991b52b233
Builtin general structure created. Added a builtin::BasicScene class for quick general testing of the engine on different systems. The builtin::BasicScene class greatly reduces the amount of code needed to be handled by the developer by offering a pre-made way to handle it. It even includes pre-made shaders!
72 lines
1.5 KiB
C++
72 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <glm/glm.hpp>
|
|
#include "Renderable.h"
|
|
|
|
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 BasicVertex : public Positioned
|
|
{
|
|
void set_position(const Position& position) override { this->position = position; }
|
|
|
|
Position position;
|
|
};
|
|
|
|
typedef Index BasicIndex;
|
|
|
|
typedef Renderable<BasicVertex, BasicIndex> BasicRenderable;
|
|
|
|
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;
|
|
};
|
|
}
|
|
} |