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;
27 Loader(Lighting &, Collection &);
30 virtual void init_actions();
32 void ambient(float, float, float);
33 void fog_color(float, float, float);
34 void fog_density(float);
35 void fog_half_distance(float);
36 void light(const std::string &);
44 mutable unsigned generation;
46 AttachedLight(const Light *l): light(l), generation(0) { }
52 std::vector<AttachedLight> lights;
53 mutable ProgramData shdata;
58 /** Sets the ambient lighting color. Affects all surfaces in the scene. */
59 void set_ambient(const Color &);
61 const Color &get_ambient() const { return ambient; }
63 /** Sets the fog color, which is blended into distant surfaces. */
64 void set_fog_color(const Color &);
66 /** Sets the density of the fog. Zero means no fog. */
67 void set_fog_density(float);
69 /** Sets the density of the fog so that the blending factor at the given
71 void set_fog_half_distance(float);
73 /** Attaches a light source. If the light was already attached, does
75 void attach(const Light &);
77 /** Detaches a light source. If the light was not attached, does nothing. */
78 void detach(const Light &);
80 int find_light_index(const Light &) const;
82 const ProgramData &get_shader_data() const;
84 void set_debug_name(const std::string &);