diff --git a/src/light.h b/src/light.h index 6911293..cf4c445 100644 --- a/src/light.h +++ b/src/light.h @@ -5,7 +5,6 @@ #include #include #include -#include class FrameBuffer; class Shader; @@ -13,7 +12,7 @@ class Scene; class Texture; class Camera; -class Light : public Serializable +class Light { public: enum LightType { @@ -48,7 +47,7 @@ public: virtual unsigned int getFlags() = 0; protected: - P_VEC3(m_color) + glm::vec3 m_color; }; class AmbientLight : public Light @@ -57,7 +56,6 @@ class AmbientLight : public Light Texture* reflect; static Texture* brdfLUT; public: - SERIALIZABLE(AmbientLight, CAST(m_color)) AmbientLight(Texture* ambientTex = nullptr, Texture* reflectTex = nullptr) : ambient(ambientTex), reflect(reflectTex) {} virtual LightType getType() { return AMBIENT; } @@ -73,12 +71,6 @@ public: class DirectionnalLight : public Light { 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)); @@ -97,12 +89,12 @@ public: void updateShadowMap(Scene* scene); private: - P_VEC3(m_direction) - - P_VEC3(m_center) - - P_BOOL(m_shadowCaster) - P_INT(m_shadowMapResolution) + glm::vec3 m_direction; + + glm::vec3 m_center; + + bool m_shadowCaster; + int m_shadowMapResolution; FrameBuffer* m_shadowMap; std::vector m_viewMatrices; std::vector m_projectionMatrices; @@ -114,12 +106,6 @@ private: class PointLight : public Light { 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)); glm::vec3 getPos() { return m_position; } @@ -141,11 +127,11 @@ public: private: void updateTransform(); - P_VEC3(m_position) - P_FLOAT(m_range) - - P_BOOL(m_shadowCaster) - P_INT(m_shadowMapResolution) + glm::vec3 m_position; + float m_range; + + bool m_shadowCaster; + int m_shadowMapResolution; FrameBuffer* m_shadowMap; std::vector m_shadowTransforms; diff --git a/src/mesh.cpp b/src/mesh.cpp index c2199ae..0056e3e 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -6,8 +6,6 @@ #include "material.h" #include "buffer.h" -INIT_SERIALIZABLE(Mesh) - const char* const Mesh::flagStr[Mesh::NB_FLAGS] = { "INDEXED", diff --git a/src/mesh.h b/src/mesh.h index be2d85f..be24532 100644 --- a/src/mesh.h +++ b/src/mesh.h @@ -7,13 +7,11 @@ #include #include -#include - class Buffer; class Material; class Shader; -struct Mesh : public Serializable +struct Mesh { public: @@ -65,8 +63,8 @@ public: /*************************************************************/ // 3D public data - P_VECTOR_VEC3(m_positions3D) - P_VECTOR_VEC3(m_normals) + std::vector m_positions3D; + std::vector m_normals; typedef struct { @@ -75,34 +73,19 @@ public: } Tangents; std::vector m_tangents; - + // 2D public data - P_VECTOR_VEC2(m_positions2D) + std::vector m_positions2D; // public data common to 2D and 3D - P_VECTOR_VEC2(m_texCoords) - P_VECTOR_VEC3(m_instances_offsets) - P_VECTOR_UINT(m_indices) + std::vector m_texCoords; + std::vector m_instances_offsets; + std::vector m_indices; /*************************************************************/ /* 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. */ @@ -253,17 +236,17 @@ public: unsigned int updateFlags(); protected: - P_STRING(m_name) + std::string m_name; Material* m_material; - P_BOOL(m_isDoubleSided) - P_BOOL(m_isBillboard) - P_BOOL(m_isWireframe) - P_BOOL(m_isShadowCaster) - P_FLOAT(m_depth) + bool m_isDoubleSided; + bool m_isBillboard; + bool m_isWireframe; + bool m_isShadowCaster; + float m_depth; unsigned int m_flags; - P_UINT(m_primitive_type) + unsigned int m_primitive_type; std::vector buffers;