X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmaterials%2Flight.h;h=05a05aa90040a65bbf1017a070fdc9ab85cb75c0;hb=5008778dbb1840bf7c6d479800d2b932f8386fb2;hp=d097d04ae435157ebb1c4ddd18cc2bd5857d37d0;hpb=615f1717f32064a7adb2b848e8646c2c3cf11f61;p=libs%2Fgl.git diff --git a/source/materials/light.h b/source/materials/light.h index d097d04a..05a05aa9 100644 --- a/source/materials/light.h +++ b/source/materials/light.h @@ -1,15 +1,15 @@ #ifndef MSP_GL_LIGHT_H_ #define MSP_GL_LIGHT_H_ -#include #include +#include #include "color.h" #include "placeable.h" +#include "vector.h" namespace Msp { namespace GL { -class Matrix; class ProgramData; /** @@ -44,12 +44,14 @@ public: private: Color color; + Color transmittance; Vector4 position; Vector3 spot_dir; Vector3 direction; float spot_exp; Geometry::Angle spot_cutoff; float attenuation[3]; + unsigned generation; public: Light(); @@ -62,12 +64,12 @@ public: to shaders as light_sources[i].color. */ void set_color(const Color &); - const Color &get_color() const { return color; } + /** Sets a multiplier on how much light actually reaches the target. Used + when modeling an atmosphere. */ + void set_transmittance(const Color &); - DEPRECATED void set_diffuse(const Color &c) { set_color(c); } - DEPRECATED void set_specular(const Color &) { } - DEPRECATED const Color &get_diffuse() const { return color; } - DEPRECATED const Color &get_specular() const { return color; } + const Color &get_color() const { return color; } + const Color &get_transmittance() const { return transmittance; } /** Sets the postion and orientation of the Light from a matrix. Negative Z axis is used as the spot direction, other axes are ignored. */ @@ -101,9 +103,11 @@ public: void set_attenuation(float, float, float); const float *get_attenuation() const { return attenuation; } - /** Updates a ProgramData object with the uniforms for the Light. A view - matrix and light source index must be passed in. */ - void update_shader_data(ProgramData &, const Matrix &, unsigned) const; + unsigned get_generation() const { return generation; } + + /** Updates a ProgramData object with the uniforms for the Light. A light + source index must be passed in. Primarily used by Lighting. */ + void update_shader_data(ProgramData &, unsigned) const; }; } // namespace GL