charcoal/OpenGLEngine/BuiltinTypes.h

103 lines
1.9 KiB
C
Raw Normal View History

2018-09-14 22:09:43 +00:00
#pragma once
#include <glm/glm.hpp>
#include "Renderable.h"
#include "PoseableBatch.h"
#include "VertexFragmentShaderProgram.h"
2018-09-16 00:43:29 +00:00
#include "TextureRenderable.h"
2018-09-14 22:09:43 +00:00
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;
};
2018-09-14 22:09:43 +00:00
// Generic Vertices
struct PVertex
{
void set_position(const Position& position) { this->position = position; }
Position position;
};
struct PNMVertex
2018-09-14 22:09:43 +00:00
{
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; }
2018-09-14 22:09:43 +00:00
Position position;
Normal normal;
Material material;
2018-09-14 22:09:43 +00:00
};
struct PTVertex
{
void set_position(const Position& position) { this->position = position; }
void set_uv(const UV& uv) { this->uv = uv; }
Position position;
UV uv;
2018-09-14 22:09:43 +00:00
};
}
}