14 #ifndef SRC_DEFAULT_SHADER_H_
15 #define SRC_DEFAULT_SHADER_H_
153 std::vector<LightProperties> lights_;
161 void update_light_arrays();
Represents a 4-component (R,G,B,A) color, stored internally in a float array to be compatable with Op...
Small data structure to hold per-light properties.
Small data structure to hold properties of the material to be lit.
Color diffuse_reflectance
Color specular_reflectance
Color ambient_reflectance
Texture2D surface_texture
A simple GLSL shader for textured per-fragment Phong shading with multiple light sources.
void UseProgram(const Matrix4 &model, const Matrix4 &view, const Matrix4 &projection, const MaterialProperties &material)
Only needed if you do not want to draw a Mesh. This does all of the same setup for drawing that the D...
static const unsigned int MAX_LIGHTS
If changed, this needs to also be changed in the glsl shader code.
void StopProgram()
Only needed if you do not want to draw a Mesh. Call this after UseProgram() and after drawing your ge...
void SetLight(int i, LightProperties light)
Changes the properties for a light that was already added.
void Init()
This loads vertex and fragment shaders from files, compiles them, and links them. So,...
void Draw(const Matrix4 &model, const Matrix4 &view, const Matrix4 &projection, Mesh *mesh, const MaterialProperties &material)
This starts the shader and sets its uniform variables based upon the current set of lights,...
LightProperties light(int i)
DefaultShader(bool add_default_light=true)
The constructor defaults to adding a single white light to the scene at (10,10,10)....
void AddLight(LightProperties light)
Multiple lights are supported, this adds one to the end of the list. Up to MAX_LIGHTS can be added.
A 4x4 transformation matrix stored internally as an array of floats in column-major order so as to be...
A triangle mesh data structure that can be rendered with a ShaderProgram like DefaultShader.
A 3D Point with floating point coordinates, used for storing vertices and all sorts of other 3D graph...
A wrapper around GLSL shader programs.
A wrapper around a 2D texture that supports loading images from files or setting texture color data d...
Namespace for the MinGfx Toolkit.