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 <string>
#include <vector>
#include <SparrowSerializer/serializable.h>
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)
glm::vec3 m_direction;
P_VEC3(m_center)
glm::vec3 m_center;
P_BOOL(m_shadowCaster)
P_INT(m_shadowMapResolution)
bool m_shadowCaster;
int m_shadowMapResolution;
FrameBuffer* m_shadowMap;
std::vector<glm::mat4> m_viewMatrices;
std::vector<glm::mat4> 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)
glm::vec3 m_position;
float m_range;
P_BOOL(m_shadowCaster)
P_INT(m_shadowMapResolution)
bool m_shadowCaster;
int m_shadowMapResolution;
FrameBuffer* m_shadowMap;
std::vector<glm::mat4> m_shadowTransforms;

View File

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

View File

@ -7,13 +7,11 @@
#include <glm/vec3.hpp>
#include <glm/vec2.hpp>
#include <SparrowSerializer/serializable.h>
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<glm::vec3> m_positions3D;
std::vector<glm::vec3> m_normals;
typedef struct
{
@ -77,32 +75,17 @@ public:
std::vector<Tangents> m_tangents;
// 2D public data
P_VECTOR_VEC2(m_positions2D)
std::vector<glm::vec2> 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<glm::vec2> m_texCoords;
std::vector<glm::vec3> m_instances_offsets;
std::vector<unsigned int> 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<Buffer*> buffers;