Removed all uses of SparrowSerializer

This commit is contained in:
Anselme 2018-05-13 20:34:28 +02:00
parent ddf187d9f6
commit a45a26b0fd
3 changed files with 28 additions and 61 deletions

View File

@ -5,7 +5,6 @@
#include <glm/mat4x4.hpp> #include <glm/mat4x4.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
#include <SparrowSerializer/serializable.h>
class FrameBuffer; class FrameBuffer;
class Shader; class Shader;
@ -13,7 +12,7 @@ class Scene;
class Texture; class Texture;
class Camera; class Camera;
class Light : public Serializable class Light
{ {
public: public:
enum LightType { enum LightType {
@ -48,7 +47,7 @@ public:
virtual unsigned int getFlags() = 0; virtual unsigned int getFlags() = 0;
protected: protected:
P_VEC3(m_color) glm::vec3 m_color;
}; };
class AmbientLight : public Light class AmbientLight : public Light
@ -57,7 +56,6 @@ class AmbientLight : public Light
Texture* reflect; Texture* reflect;
static Texture* brdfLUT; static Texture* brdfLUT;
public: public:
SERIALIZABLE(AmbientLight, CAST(m_color))
AmbientLight(Texture* ambientTex = nullptr, Texture* reflectTex = nullptr) : ambient(ambientTex), reflect(reflectTex) {} AmbientLight(Texture* ambientTex = nullptr, Texture* reflectTex = nullptr) : ambient(ambientTex), reflect(reflectTex) {}
virtual LightType getType() { return AMBIENT; } virtual LightType getType() { return AMBIENT; }
@ -73,12 +71,6 @@ public:
class DirectionnalLight : public Light class DirectionnalLight : public Light
{ {
public: public:
SERIALIZABLE(DirectionnalLight,
CAST(m_color),
CAST(m_direction),
CAST(m_center),
CAST(m_shadowCaster),
CAST(m_shadowMapResolution))
DirectionnalLight(glm::vec3 dir = glm::vec3(0, -1, 0), glm::vec3 lightColor = glm::vec3(1)); DirectionnalLight(glm::vec3 dir = glm::vec3(0, -1, 0), glm::vec3 lightColor = glm::vec3(1));
@ -97,12 +89,12 @@ public:
void updateShadowMap(Scene* scene); void updateShadowMap(Scene* scene);
private: private:
P_VEC3(m_direction) glm::vec3 m_direction;
P_VEC3(m_center) glm::vec3 m_center;
P_BOOL(m_shadowCaster) bool m_shadowCaster;
P_INT(m_shadowMapResolution) int m_shadowMapResolution;
FrameBuffer* m_shadowMap; FrameBuffer* m_shadowMap;
std::vector<glm::mat4> m_viewMatrices; std::vector<glm::mat4> m_viewMatrices;
std::vector<glm::mat4> m_projectionMatrices; std::vector<glm::mat4> m_projectionMatrices;
@ -114,12 +106,6 @@ private:
class PointLight : public Light class PointLight : public Light
{ {
public: public:
SERIALIZABLE(PointLight,
CAST(m_color),
CAST(m_position),
CAST(m_range),
CAST(m_shadowCaster),
CAST(m_shadowMapResolution))
PointLight(glm::vec3 pos = glm::vec3(0), float attenuation = 1, glm::vec3 lightColor = glm::vec3(1)); PointLight(glm::vec3 pos = glm::vec3(0), float attenuation = 1, glm::vec3 lightColor = glm::vec3(1));
glm::vec3 getPos() { return m_position; } glm::vec3 getPos() { return m_position; }
@ -141,11 +127,11 @@ public:
private: private:
void updateTransform(); void updateTransform();
P_VEC3(m_position) glm::vec3 m_position;
P_FLOAT(m_range) float m_range;
P_BOOL(m_shadowCaster) bool m_shadowCaster;
P_INT(m_shadowMapResolution) int m_shadowMapResolution;
FrameBuffer* m_shadowMap; FrameBuffer* m_shadowMap;
std::vector<glm::mat4> m_shadowTransforms; std::vector<glm::mat4> m_shadowTransforms;

View File

@ -6,8 +6,6 @@
#include "material.h" #include "material.h"
#include "buffer.h" #include "buffer.h"
INIT_SERIALIZABLE(Mesh)
const char* const Mesh::flagStr[Mesh::NB_FLAGS] = const char* const Mesh::flagStr[Mesh::NB_FLAGS] =
{ {
"INDEXED", "INDEXED",

View File

@ -7,13 +7,11 @@
#include <glm/vec3.hpp> #include <glm/vec3.hpp>
#include <glm/vec2.hpp> #include <glm/vec2.hpp>
#include <SparrowSerializer/serializable.h>
class Buffer; class Buffer;
class Material; class Material;
class Shader; class Shader;
struct Mesh : public Serializable struct Mesh
{ {
public: public:
@ -65,8 +63,8 @@ public:
/*************************************************************/ /*************************************************************/
// 3D public data // 3D public data
P_VECTOR_VEC3(m_positions3D) std::vector<glm::vec3> m_positions3D;
P_VECTOR_VEC3(m_normals) std::vector<glm::vec3> m_normals;
typedef struct typedef struct
{ {
@ -75,34 +73,19 @@ public:
} Tangents; } Tangents;
std::vector<Tangents> m_tangents; std::vector<Tangents> m_tangents;
// 2D public data // 2D public data
P_VECTOR_VEC2(m_positions2D) std::vector<glm::vec2> m_positions2D;
// public data common to 2D and 3D // public data common to 2D and 3D
P_VECTOR_VEC2(m_texCoords) std::vector<glm::vec2> m_texCoords;
P_VECTOR_VEC3(m_instances_offsets) std::vector<glm::vec3> m_instances_offsets;
P_VECTOR_UINT(m_indices) std::vector<unsigned int> m_indices;
/*************************************************************/ /*************************************************************/
/* MAIN METHODS */ /* MAIN METHODS */
/*************************************************************/ /*************************************************************/
SERIALIZABLE(Mesh,
CAST(m_positions3D),
CAST(m_normals),
CAST(m_positions2D),
CAST(m_texCoords),
CAST(m_instances_offsets),
CAST(m_indices),
CAST(m_name),
CAST(m_isDoubleSided),
CAST(m_isBillboard),
CAST(m_isWireframe),
CAST(m_isShadowCaster),
CAST(m_depth),
CAST(m_primitive_type))
/** /**
* @brief Mesh builds an empty mesh, to be renderable, a mesh must have vertices and a material. * @brief Mesh builds an empty mesh, to be renderable, a mesh must have vertices and a material.
*/ */
@ -253,17 +236,17 @@ public:
unsigned int updateFlags(); unsigned int updateFlags();
protected: protected:
P_STRING(m_name) std::string m_name;
Material* m_material; Material* m_material;
P_BOOL(m_isDoubleSided) bool m_isDoubleSided;
P_BOOL(m_isBillboard) bool m_isBillboard;
P_BOOL(m_isWireframe) bool m_isWireframe;
P_BOOL(m_isShadowCaster) bool m_isShadowCaster;
P_FLOAT(m_depth) float m_depth;
unsigned int m_flags; unsigned int m_flags;
P_UINT(m_primitive_type) unsigned int m_primitive_type;
std::vector<Buffer*> buffers; std::vector<Buffer*> buffers;