Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 263 vs 264 for /trunk/Source Code/Rendering/Lighting/Headers/Light.h

Diff revisions: vs.
  @@ -71,6 +71,7 @@
71 71 vec3<F32> _lightPosition[4]; //<light's position in world space
72 72 };
73 73
74 + class Camera;
74 75 class Impostor;
75 76 class ParamHandler;
76 77 class ShadowMapInfo;
  @@ -138,14 +139,13 @@
138 139 void updateState(const bool force = false);
139 140
140 141 ///Dummy function from SceneNode;
141 - bool onDraw(const RenderStage& currentStage) { return true; }
142 + bool onDraw(SceneGraphNode* const sgn, const RenderStage& currentStage) { return true; }
142 143
143 144 ///SceneNode concrete implementations
144 145 bool unload();
145 146 bool computeBoundingBox(SceneGraphNode* const sgn);
146 - bool isInView(const BoundingBox& boundingBox, const BoundingSphere& sphere, const bool distanceCheck = true);
147 + bool isInView(const SceneRenderState& sceneRenderState, const BoundingBox& boundingBox, const BoundingSphere& sphere, const bool distanceCheck = true);
147 148 void sceneUpdate(const U64 deltaTime, SceneGraphNode* const sgn, SceneState& sceneState);
148 - virtual const mat4<F32>& getLightViewMatrix(U8 index = 0) = 0;
149 149
150 150 /*----------- Shadow Mapping-------------------*/
151 151 ///Set the function used to generate shadows for this light (usually _scenegraph->render)
  @@ -153,7 +153,7 @@
153 153 inline void setShadowMappingCallback(const DELEGATE_CBK& callback) { _callback = callback; }
154 154 void addShadowMapInfo(ShadowMapInfo* const shadowMapInfo);
155 155 bool removeShadowMapInfo();
156 - virtual void generateShadowMaps(const SceneRenderState& sceneRenderState);
156 + virtual void generateShadowMaps(SceneRenderState& sceneRenderState);
157 157 inline const mat4<F32>& getVPMatrix(U8 index) const { return _shadowProperties._lightVP[index]; }
158 158 inline const vec4<F32>& getFloatValues() const { return _shadowProperties._floatValues; }
159 159 inline const vec3<F32>& getLightPos(U8 index) const { return _shadowProperties._lightPosition[index]; }
  @@ -165,9 +165,12 @@
165 165
166 166 protected:
167 167 friend class LightManager;
168 + template<typename T>
169 + friend class ImplResourceLoader;
170 + bool load(const std::string& name);
168 171
169 172 ///When the SceneGraph calls the light's render function, we draw the impostor if needed
170 - virtual void render(SceneGraphNode* const sgn);
173 + virtual void render(SceneGraphNode* const sgn, const SceneRenderState& sceneRenderState);
171 174 void postLoad(SceneGraphNode* const sgn);
172 175 ///Set light type
173 176 ///@param type Directional/Spot/Omni (see LightType enum)
  @@ -177,6 +180,8 @@
177 180 void setLightMode(const LightMode& mode);
178 181 ///Called when the rendering resolution changes
179 182 void updateResolution(I32 newWidth, I32 newHeight);
183 + ///Get a ref to the shadow camera used by this light
184 + Camera* const shadowCamera() const {return _shadowCamera;}
180 185
181 186 private:
182 187 ///Enum to char* translation for vector properties
  @@ -202,6 +207,7 @@
202 207 Impostor* _impostor; ///< Used for debug rendering -Ionut
203 208 SceneGraphNode* _lightSGN;
204 209 SceneGraphNode* _impostorSGN;
210 + Camera* _shadowCamera;
205 211 DELEGATE_CBK _callback;
206 212 F32 _score;
207 213 bool _dirty;