31e3d15ab1
Starting the setup for builtin types for rendering. This will allow the engine to be easier to use for beginners while still offering great modularity and functionality. The builtin namespace is intended to simplify mesh loading and rendering. It should eventually offer pre-made shaders to simplify the rendering of the builtin types. Possibly in the future, it could have partially setup scenes/application to simplify scene/application building
60 lines
1.2 KiB
C++
60 lines
1.2 KiB
C++
#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;
|
|
};
|
|
}
|
|
} |