117 lines
2.3 KiB
C++
117 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include <glm/glm.hpp>
|
|
#include "Renderable.h"
|
|
#include "PoseableBatch.h"
|
|
#include "VertexFragmentShaderProgram.h"
|
|
#include "TextureRenderable.h"
|
|
|
|
namespace charcoal
|
|
{
|
|
namespace builtin
|
|
{
|
|
using namespace glm;
|
|
|
|
typedef vec3 Position;
|
|
typedef vec3 Normal;
|
|
typedef vec4 ColorRGBA;
|
|
typedef vec3 ColorRGB;
|
|
typedef vec2 UV;
|
|
|
|
typedef unsigned int Index;
|
|
|
|
// Shader Data Types
|
|
|
|
struct Light
|
|
{
|
|
typedef vec3 Power;
|
|
typedef vec3 Fade;
|
|
|
|
Light(
|
|
const Position& position,
|
|
const Power& power,
|
|
const ColorRGB& ambient,
|
|
const ColorRGB& diffuse,
|
|
const ColorRGB& specular,
|
|
const Fade& fade
|
|
)
|
|
: position(position),
|
|
power(power),
|
|
ambient(ambient),
|
|
diffuse(diffuse),
|
|
specular(specular),
|
|
fade(fade)
|
|
{}
|
|
|
|
Position position;
|
|
Power power;
|
|
ColorRGB ambient;
|
|
ColorRGB diffuse;
|
|
ColorRGB specular;
|
|
Fade fade;
|
|
};
|
|
|
|
struct Material
|
|
{
|
|
Material(
|
|
float ambient = 1.0f,
|
|
float diffuse = 1.0f,
|
|
float specular = 0.0f,
|
|
float specular_exponent = 1.0f
|
|
)
|
|
: ambient(ambient),
|
|
diffuse(diffuse),
|
|
specular(specular),
|
|
specular_exponent(specular_exponent)
|
|
{}
|
|
|
|
float ambient;
|
|
float diffuse;
|
|
float specular;
|
|
float specular_exponent;
|
|
};
|
|
|
|
// Generic Vertices
|
|
|
|
struct PVertex
|
|
{
|
|
void set_position(const Position& position) { this->position = position; }
|
|
|
|
Position position;
|
|
};
|
|
|
|
struct PNMVertex
|
|
{
|
|
void set_position(const Position& position) { this->position = position; }
|
|
void set_normal(const Normal& normal) { this->normal = normal; }
|
|
void set_material(const Material& material) { this->material = material; }
|
|
|
|
Position position;
|
|
Normal normal;
|
|
Material material;
|
|
};
|
|
|
|
struct PTVertex
|
|
{
|
|
void set_position(const Position& position) { this->position = position; }
|
|
void set_uv(const UV& uv) { this->uv = uv; }
|
|
|
|
Position position;
|
|
UV uv;
|
|
};
|
|
|
|
// typedefs for builtin types
|
|
|
|
typedef PVertex BasicVertex;
|
|
typedef Index BasicIndex;
|
|
typedef Renderable<BasicVertex, BasicIndex> BasicRenderable;
|
|
|
|
typedef PNMVertex LitVertex;
|
|
typedef Index LitIndex;
|
|
typedef Renderable<LitVertex, LitIndex> LitRenderable;
|
|
|
|
typedef PTVertex TexturedVertex;
|
|
typedef Index TexturedIndex;
|
|
typedef TextureRenderable<TexturedVertex, TexturedIndex> TexturedRenderable;
|
|
}
|
|
} |