MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / registerGlobalLights

Method registerGlobalLights

Engine/source/lighting/lightManager.cpp:201–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201void LightManager::registerGlobalLights( const Frustum *frustum, bool staticLighting, bool enableZoneLightCulling)
202{
203 PROFILE_SCOPE( LightManager_RegisterGlobalLights );
204
205 // TODO: We need to work this out...
206 //
207 // 1. Why do we register and unregister lights on every
208 // render when they don't often change... shouldn't we
209 // just register once and keep them?
210 //
211 // 2. If we do culling of lights should this happen as part
212 // of registration or somewhere else?
213 //
214
215 // Grab the lights to process.
216 Vector<SceneObject*> activeLights;
217 const U32 lightMask = LightObjectType;
218
219 if ( staticLighting || !frustum )
220 {
221 // We're processing static lighting or want all the lights
222 // in the container registerd... so no culling.
223 getSceneManager()->getContainer()->findObjectList( lightMask, &activeLights );
224 }
225 else
226 {
227 // Cull the lights using the frustum.
228 getSceneManager()->getContainer()->findObjectList(*frustum, lightMask, &activeLights);
229 /*
230 for (U32 i = 0; i < activeLights.size(); ++i)
231 {
232 for (U32 i = 0; i < activeLights.size(); ++i)
233 {
234 if (!getSceneManager()->mRenderedObjectsList.contains(activeLights[i]))
235 {
236 activeLights.erase(i);
237 --i;
238 }
239 }
240 }
241 */
242 // Store the culling position for sun placement
243 // later... see setSpecialLight.
244 mCullPos = frustum->getPosition();
245
246 // HACK: Make sure the control object always gets
247 // processed as lights mounted to it don't change
248 // the shape bounds and can often get culled.
249
250 GameConnection *conn = GameConnection::getConnectionToServer();
251 if (conn->getControlObject())
252 {
253 GameBase *conObject = conn->getControlObject();
254 activeLights.push_back_unique(conObject);
255 }
256 }
257
258 // Let the lights register themselves.

Callers 4

updateFaceMethod · 0.80
updateReflectionMethod · 0.80
renderSceneMethod · 0.80
lightMethod · 0.80

Calls 7

findObjectListMethod · 0.80
push_back_uniqueMethod · 0.80
getContainerMethod · 0.45
getPositionMethod · 0.45
getControlObjectMethod · 0.45
sizeMethod · 0.45
submitLightsMethod · 0.45

Tested by

no test coverage detected