00001 00005 /* Copyright © 2010 James Legg. 00006 This program is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 */ 00011 00012 #ifndef LIBTRACK_LIGHTING_H_ 00013 #define LIBTRACK_LIGHTING_H_ 00014 00015 #include <istream> 00016 #include <ostream> 00017 #include <vector> 00018 00019 namespace Track 00020 { 00021 00025 struct LightSettings 00026 { 00027 LightSettings(); 00028 LightSettings(std::istream & in); 00032 float position[4]; 00034 float colour[4]; 00035 bool operator == (const LightSettings & other) const; 00036 }; 00037 00039 std::ostream & operator<<(std::ostream & destination, const LightSettings & light_settings); 00040 00044 struct FogSettings 00045 { 00046 FogSettings(); 00047 FogSettings(std::istream & in); 00049 float colour[4]; 00054 float density; 00056 bool enabled; 00057 bool operator != (const FogSettings & other) const; 00058 }; 00059 00061 std::ostream & operator<<(std::ostream & destination, const FogSettings & fog_settings); 00062 00065 class Lighting 00066 { 00067 public: 00068 // Initalise to sensible defaults. 00069 Lighting(); 00070 00072 Lighting(std::istream & in); 00073 00078 void prepare_render() const; 00079 00083 void initalise() const; 00084 00087 void set_lights(const std::vector<LightSettings> & lights); 00090 const std::vector<LightSettings> & get_lights() const; 00091 00094 void set_ambient(float colour[4]); 00097 const float * get_ambient_light() const; 00098 00101 void set_fog(const FogSettings & fog); 00104 const FogSettings & get_fog() const; 00105 00106 bool operator!=(const Lighting & other) const; 00107 private: 00108 std::vector<LightSettings> m_lights; 00109 FogSettings m_fog; 00110 float m_ambient_light[4]; 00111 }; 00112 00113 std::ostream & operator<<(std::ostream & destination, const Lighting & lighting); 00114 00115 } // Track namespace 00116 00117 #endif // LIBTRACK_LIGHTING_H_
Generated at Mon Sep 6 00:41:11 2010 by Doxygen version 1.4.7 for Racer version svn335.