| 255 | } |
| 256 | |
| 257 | void 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 | |
| 301 | BasicLightManager::LightingShaderConstants::LightingShaderConstants() |
| 302 | : mInit( false ), |
nothing calls this directly
no test coverage detected