DeferredRenderer 1.0

LightingManager.h

Go to the documentation of this file.
00001 #ifndef LIGHTINGMANAGER_H
00002 #define LIGHTINGMANAGER_H
00003 
00004 #include "PointLight.h"
00005 #include "SpotLight.h"
00006 #include "ShadowSpot.h"
00007 #include "ngl/ShaderManager.h"
00008 #include "TextureManager.h"
00009 
00010 
00018 class LightingManager{
00019 public:
00020 
00022     LightingManager();
00023 
00025     ~LightingManager(){}
00026 
00028     inline void addPointLight(PointLight &_point)
00029         {m_pointLights.push_back(_point);std::cout << m_pointLights.size() << std::endl;}
00031     inline void addSpotLight(SpotLight &_spot)
00032         {m_spotLights.push_back(_spot);}
00034     inline void addShadowSpot(ShadowSpot &_spot)
00035         {m_shadowSpots.push_back(_spot);}
00036 
00038     void addPointLight(
00039         const ngl::Vector &_centre,
00040         const float &_radius,
00041         const ngl::Vector &_intensity);
00042 
00044     void addSpotLight(
00045         const ngl::Vector &_position,
00046         const ngl::Vector &_target,
00047         const float &_distance,
00048         const float &_angle,
00049         const ngl::Vector &_col,
00050         const ngl::Vector &_up);
00051 
00053     void addShadowSpot(
00054         const ngl::Vector &_position,
00055         const ngl::Vector &_target,
00056         const float &_distance,
00057         const float &_angle,
00058         const ngl::Vector &_col,
00059         const ngl::Vector &_up);
00060 
00062     void addNamedPoint(
00063         const std::string &_name,
00064         const ngl::Vector &_centre,
00065         const float &_radius,
00066         const ngl::Vector &_intensity);
00067 
00069     void addNamedSpot(
00070         const std::string &_name,
00071         const ngl::Vector &_position,
00072         const ngl::Vector &_target,
00073         const float &_distance,
00074         const float &_angle,
00075         const ngl::Vector &_col,
00076         const ngl::Vector &_up);
00077 
00079     void addNamedShadowSpot(
00080         const std::string &_name,
00081         const ngl::Vector &_position,
00082         const ngl::Vector &_target,
00083         const float &_distance,
00084         const float &_angle,
00085         const ngl::Vector &_col,
00086         const ngl::Vector &_up);
00087 
00089     void addNamedPoint(const std::string &_name,PointLight &_point);
00091     void addNamedSpot(const std::string &_name,SpotLight &_spot);
00093     void addNamedShadowSpot(const std::string &_name,ShadowSpot &_spot);
00094 
00096     inline SpotLight& getNamedSpot(const std::string &_name)
00097         {return m_namedSpotLights[_name];}
00099     inline PointLight& getNamedPoint(const std::string &_name)
00100         {return m_namedPointLights[_name];}
00102     inline ShadowSpot& getNamedShadowSpot(const std::string &_name)
00103         {return m_namedShadowSpots[_name];}
00104 
00106     inline SpotLight& getSpot(int _index)
00107         {return m_spotLights[_index];}
00109     inline PointLight& getPoint(int _index)
00110         {return m_pointLights[_index];}
00112     inline ShadowSpot& getShadowSpot(int _index)
00113         {return m_shadowSpots[_index];}
00114 
00116     inline void setGlobalAmbient(const ngl::Vector &_colour)
00117         {m_globalAmbient = _colour;}
00118 
00122     inline void setGlobalDirectional(const ngl::Vector &_colour, const ngl::Vector &_direction)
00123         {m_globalDirectional = _colour; m_globalDirectionalVec = _direction;}
00124 
00126     inline ngl::Vector getGlobalAmbient()
00127         {return m_globalAmbient;}
00129     inline ngl::Vector getDirectionalColour()
00130         {return m_globalDirectional;}
00132     inline ngl::Vector getDirectionalVec()
00133         {return m_globalDirectionalVec;}
00134 
00138     void accumulateLights(TextureManager &_textureManager, const ngl::Vector &_camPos);
00139 
00141     void createLightGeometry();
00142 private:
00143 
00145     unsigned int m_pointLightVAO;
00146 
00148     void blendPointLights(const ngl::Vector &_camPos);
00150     void blendShadowSpots(const ngl::Vector &_camPos);
00152     void blendSpotLights(const ngl::Vector &_camPos);
00153 
00155     std::vector<PointLight> m_pointLights;
00157     std::vector<SpotLight> m_spotLights;
00159     std::vector<ShadowSpot> m_shadowSpots;
00160 
00162     std::map<std::string, PointLight> m_namedPointLights;
00164     std::map<std::string, SpotLight> m_namedSpotLights;
00166     std::map<std::string, ShadowSpot> m_namedShadowSpots;
00167 
00169     ngl::Vector m_globalAmbient;
00171     ngl::Vector m_globalDirectional;
00173     ngl::Vector m_globalDirectionalVec;
00174 };
00175 
00176 #endif // LIGHTINGMANAGER_H
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines