Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Codable.hpp
1#pragma once
2
3#include "system/Config.hpp"
4#include "graphics/GPUTypes.hpp"
5#include "Common.hpp"
6
7class Texture;
8
12class Codable {
13public:
20 static bool decodeBool(const KeyValues & param, unsigned int position = 0);
21
26 static std::string encode(bool b);
27
34 static glm::vec2 decodeVec2(const KeyValues & param, unsigned int position = 0);
35
40 static std::vector<std::string> encode(const glm::vec2 & v);
41
48 static glm::vec3 decodeVec3(const KeyValues & param, unsigned int position = 0);
49
54 static std::vector<std::string> encode(const glm::vec3 & v);
55
62 static glm::vec4 decodeVec4(const KeyValues & param, unsigned int position = 0);
63
68 static std::vector<std::string> encode(const glm::vec4 & v);
69
79 static glm::mat4 decodeTransformation(const std::vector<KeyValues> & params);
80
85 static std::vector<KeyValues> encode(const glm::mat4 & transfo);
86
95 static std::pair<std::string, Layout> decodeTexture(const KeyValues & param);
96
101 static KeyValues encode(const Texture * texture);
102
110 static std::vector<KeyValues> decode(const std::string & codableFile);
111
118 static std::string encode(const std::vector<KeyValues> & params);
119
124 static std::string encode(const KeyValues & params);
125
129 static void unknown(const KeyValues & params);
130
131private:
132
134 enum class Prefix : uint {
135 ROOT,
136 LIST,
137 NONE
138 };
139
146 static std::string encode(const std::vector<KeyValues> & params, Prefix prefix, uint level);
147
148};
Provides helpers for serialization/deserialization of basic types.
Definition: Codable.hpp:12
static glm::vec2 decodeVec2(const KeyValues &param, unsigned int position=0)
Definition: Codable.cpp:63
static std::pair< std::string, Layout > decodeTexture(const KeyValues &param)
Definition: Codable.cpp:143
Prefix
Prefix type/.
Definition: Codable.hpp:134
@ LIST
"-" prefix.
@ NONE
No prefix.
@ ROOT
"*" prefix.
static std::string encode(bool b)
Definition: Codable.cpp:24
static glm::vec3 decodeVec3(const KeyValues &param, unsigned int position=0)
Definition: Codable.cpp:28
static void unknown(const KeyValues &params)
Definition: Codable.cpp:320
static bool decodeBool(const KeyValues &param, unsigned int position=0)
Definition: Codable.cpp:9
static std::vector< KeyValues > decode(const std::string &codableFile)
Definition: Codable.cpp:185
static glm::mat4 decodeTransformation(const std::vector< KeyValues > &params)
Definition: Codable.cpp:79
static glm::vec4 decodeVec4(const KeyValues &param, unsigned int position=0)
Definition: Codable.cpp:45
Represents a texture containing one or more images, stored on the CPU and/or GPU.
Definition: Texture.hpp:12
Represent a key-values tuple.
Definition: Config.hpp:9