MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / _onPreRender

Method _onPreRender

Engine/source/lighting/basic/basicLightManager.cpp:257–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255}
256
257void BasicLightManager::_onPreRender( SceneManager *sceneManger, const SceneRenderState *state )
258{
259 // Update all our shadow plugins here!
260 Vector<BasicSceneObjectLightingPlugin*> *pluginInsts = BasicSceneObjectLightingPlugin::getPluginInstances();
261
262 Vector<BasicSceneObjectLightingPlugin*>::const_iterator pluginIter = (*pluginInsts).begin();
263 for ( ; pluginIter != (*pluginInsts).end(); pluginIter++ )
264 {
265 BasicSceneObjectLightingPlugin *plugin = *pluginIter;
266 plugin->updateShadow( (SceneRenderState*)state );
267 }
268
269 U32 pluginCount = (*pluginInsts).size();
270
271 // Sort them by the score.
272 dQsort( (*pluginInsts).address(), pluginCount, sizeof(BasicSceneObjectLightingPlugin*), comparePluginScores );
273
274 mTimer->getElapsedMs();
275 mTimer->reset();
276 U32 numUpdated = 0;
277 U32 targetMs = 5;
278
279 S32 updateMs = 0;
280
281 pluginIter = (*pluginInsts).begin();
282 for ( ; pluginIter != (*pluginInsts).end(); pluginIter++ )
283 {
284 BasicSceneObjectLightingPlugin *plugin = *pluginIter;
285
286 // If we run out of update time then stop.
287 updateMs = mTimer->getElapsedMs();
288 if ( updateMs >= targetMs )
289 break;
290
291 // NOTE! Fix this all up to past const SceneRenderState!
292 plugin->renderShadow( (SceneRenderState*)state );
293 numUpdated++;
294 }
295
296 smShadowsUpdated = numUpdated;
297 smActiveShadowPlugins = pluginCount;
298 smElapsedUpdateMs = updateMs;
299}
300
301BasicLightManager::LightingShaderConstants::LightingShaderConstants()
302 : mInit( false ),

Callers

nothing calls this directly

Calls 9

dQsortFunction · 0.85
updateShadowMethod · 0.80
renderShadowMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
addressMethod · 0.45
getElapsedMsMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected