| 465 | } |
| 466 | |
| 467 | bool SceneLighting::light(BitSet32 flags) |
| 468 | { |
| 469 | if(!mSceneManager) |
| 470 | return(false); |
| 471 | |
| 472 | mStartTime = Platform::getRealMilliseconds(); |
| 473 | |
| 474 | // Register static lights |
| 475 | if (!LIGHTMGR) |
| 476 | return false; // This world doesn't need lighting. |
| 477 | |
| 478 | LIGHTMGR->registerGlobalLights(NULL,true); |
| 479 | |
| 480 | // Notify each system factory that we are beginning to light |
| 481 | for(SceneLightingInterface** sitr = mLightingInterfaces->mAvailableSystemInterfaces.begin(); sitr != mLightingInterfaces->mAvailableSystemInterfaces.end(); sitr++) |
| 482 | { |
| 483 | SceneLightingInterface* si = (*sitr); |
| 484 | si->processLightingBegin(); |
| 485 | } |
| 486 | |
| 487 | // grab all the lights |
| 488 | mLights.clear(); |
| 489 | LIGHTMGR->getAllUnsortedLights(&mLights); |
| 490 | LIGHTMGR->unregisterAllLights(); |
| 491 | |
| 492 | if(!mLights.size()) |
| 493 | return(false); |
| 494 | |
| 495 | // get all the objects and create proxy's for them |
| 496 | SimpleQueryList objects; |
| 497 | gClientContainer.findObjects(mLightingInterfaces->mAvailableObjectTypes, &SimpleQueryList::insertionCallback, &objects); |
| 498 | |
| 499 | for(SceneObject ** itr = objects.mList.begin(); itr != objects.mList.end(); itr++) |
| 500 | { |
| 501 | ObjectProxy * proxy = NULL; |
| 502 | SceneObject* obj = *itr; |
| 503 | if (!obj) |
| 504 | continue; |
| 505 | |
| 506 | // Create the right chunk for the system |
| 507 | for(SceneLightingInterface** sitr = mLightingInterfaces->mAvailableSystemInterfaces.begin(); |
| 508 | sitr != mLightingInterfaces->mAvailableSystemInterfaces.end() && proxy == NULL; sitr++) |
| 509 | { |
| 510 | SceneLightingInterface* si = (*sitr); |
| 511 | proxy = si->createObjectProxy(obj, &mSceneObjects); |
| 512 | } |
| 513 | |
| 514 | if (proxy) |
| 515 | { |
| 516 | if(!proxy->calcValidation()) |
| 517 | { |
| 518 | Con::errorf(ConsoleLogEntry::General, "Failed to calculate validation info for object. Skipped."); |
| 519 | delete proxy; |
| 520 | continue; |
| 521 | } |
| 522 | |
| 523 | if(!proxy->loadResources()) |
| 524 | { |
nothing calls this directly
no test coverage detected