1 #ifndef MSP_GL_LIGHTING_H_
2 #define MSP_GL_LIGHTING_H_
5 #include <msp/geometry/angle.h>
7 #include "programdata.h"
15 Encapsulates global lighting parameters and any number of individual light
21 class Loader: public DataFile::CollectionObjectLoader<Lighting>
24 static ActionMap shared_actions;
28 Loader(Lighting &, Collection &);
31 virtual void init_actions();
33 void ambient(float, float, float);
34 void fog_color(float, float, float);
35 void fog_density(float);
36 void fog_half_distance(float);
37 void light(const std::string &);
45 mutable unsigned generation;
47 AttachedLight(const Light *l): light(l), generation(0) { }
53 std::vector<AttachedLight> lights;
54 mutable ProgramData shdata;
59 /** Sets the ambient lighting color. Affects all surfaces in the scene. */
60 void set_ambient(const Color &);
62 const Color &get_ambient() const { return ambient; }
64 /** Sets the fog color, which is blended into distant surfaces. */
65 void set_fog_color(const Color &);
67 /** Sets the density of the fog. Zero means no fog. */
68 void set_fog_density(float);
70 /** Sets the density of the fog so that the blending factor at the given
72 void set_fog_half_distance(float);
74 /** Attaches a light source. If the light was already attached, does
76 void attach(const Light &);
78 /** Detaches a light source. If the light was not attached, does nothing. */
79 void detach(const Light &);
81 const ProgramData &get_shader_data() const;
83 void set_debug_name(const std::string &);