X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmaterials%2Flight.h;h=4532d0d42c4035c2442fbcaf2e1eea414ce6c164;hb=3ac3a51c623271da815c8ee60c484445871753bf;hp=e94f3c5aca8b333c5a73f6c31082cd2d0afa34a3;hpb=7aaec9a70b8d7733429bec043f8e33e02956f266;p=libs%2Fgl.git diff --git a/source/materials/light.h b/source/materials/light.h index e94f3c5a..4532d0d4 100644 --- a/source/materials/light.h +++ b/source/materials/light.h @@ -21,7 +21,7 @@ is not 180 degrees, it's a spotlight. Otherwise it's an omnidirectional point light. Lights are usually grouped with a Lighting object, which can be used in a -Pipeline::Pass. +Sequence::Step. Lights do not cast shadows by themselves. See ShadowMap for that. */ @@ -35,23 +35,23 @@ public: private: void attenuation(float, float, float); - void diffuse(float, float, float); + void color(float, float, float); void position(float, float, float, float); - void specular(float, float, float); void spot_direction(float, float, float); void spot_exponent(float); void spot_cutoff(float); }; private: - Color diffuse; - Color specular; + 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(); @@ -60,16 +60,21 @@ private: void update_matrix(); public: - /** Sets the diffuse (direction-independent) color of the Light. Provided - to shaders with the name light_sources[i].diffuse. */ - void set_diffuse(const Color &c); + /** Sets the color of the Light. Provided + to shaders as light_sources[i].color. */ + void set_color(const Color &); - /** Sets the specular (direction-dependent) color of the Light. Provided to - shaders with the name light_sources[i].specular. */ - void set_specular(const Color &c); + /** Sets a multiplier on how much light actually reaches the target. Used + when modeling an atmosphere. */ + void set_transmittance(const Color &); - const Color &get_diffuse() const { return diffuse; } - const Color &get_specular() const { return specular; } + const Color &get_color() const { return color; } + const Color &get_transmittance() const { return transmittance; } + + 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; } /** Sets the postion and orientation of the Light from a matrix. Negative Z axis is used as the spot direction, other axes are ignored. */ @@ -103,9 +108,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