charcoal/OpenGLEngine/MeshTypes.h

60 lines
1.2 KiB
C
Raw Normal View History

#pragma once
#include <glm/glm.hpp>
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
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;
};
}
}