2018-09-12 22:46:36 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <glm/glm.hpp>
|
2018-09-13 04:51:47 +00:00
|
|
|
#include "Renderable.h"
|
2018-09-12 22:46:36 +00:00
|
|
|
|
|
|
|
namespace charcoal
|
|
|
|
{
|
|
|
|
namespace builtin
|
|
|
|
{
|
|
|
|
using namespace glm;
|
|
|
|
|
|
|
|
typedef vec3 Position;
|
|
|
|
typedef vec3 Normal;
|
|
|
|
typedef vec4 Color;
|
|
|
|
typedef vec2 UV;
|
|
|
|
|
|
|
|
typedef unsigned int Index;
|
|
|
|
|
|
|
|
class Positioned
|
|
|
|
{
|
|
|
|
virtual void set_position(const Position& position) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Normaled
|
|
|
|
{
|
|
|
|
virtual void set_normal(const Normal& normal) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Colored
|
|
|
|
{
|
|
|
|
virtual void set_color(const Color& color) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Textured
|
|
|
|
{
|
|
|
|
virtual void set_uv(const UV& uv) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Simple types that implement the interfaces
|
|
|
|
|
2018-09-13 04:51:47 +00:00
|
|
|
struct BasicVertex : public Positioned
|
|
|
|
{
|
|
|
|
void set_position(const Position& position) override { this->position = position; }
|
|
|
|
|
|
|
|
Position position;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef Index BasicIndex;
|
|
|
|
|
|
|
|
typedef Renderable<BasicVertex, BasicIndex> BasicRenderable;
|
|
|
|
|
2018-09-12 22:46:36 +00:00
|
|
|
struct PNVertex : public Positioned, public Normaled
|
|
|
|
{
|
|
|
|
void set_position(const Position& position) override { this->position = position; }
|
|
|
|
void set_normal(const Normal& normal) override { this->normal = normal; }
|
|
|
|
|
|
|
|
Position position;
|
|
|
|
Normal normal;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PNTVertex : public Positioned, public Normaled, public Textured
|
|
|
|
{
|
|
|
|
void set_position(const Position& position) override { this->position = position; }
|
|
|
|
void set_normal(const Normal& normal) override { this->normal = normal; }
|
|
|
|
void set_uv(const UV& uv) override { this->uv = uv; }
|
|
|
|
|
|
|
|
Position position;
|
|
|
|
Normal normal;
|
|
|
|
UV uv;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|