| 989 | } |
| 990 | |
| 991 | void DecalManager::prepRenderImage( SceneRenderState* state ) |
| 992 | { |
| 993 | PROFILE_SCOPE( DecalManager_RenderDecals ); |
| 994 | |
| 995 | if ( !smDecalsOn || !mData ) |
| 996 | return; |
| 997 | |
| 998 | // Decals only render in the diffuse pass! |
| 999 | // We technically could render them into reflections but prefer to save |
| 1000 | // the performance. This would also break the DecalInstance::mLastAlpha |
| 1001 | // optimization. |
| 1002 | if ( !state->isDiffusePass() ) |
| 1003 | return; |
| 1004 | |
| 1005 | PROFILE_START( DecalManager_RenderDecals_SphereTreeCull ); |
| 1006 | |
| 1007 | const Frustum& rootFrustum = state->getCameraFrustum(); |
| 1008 | |
| 1009 | // Populate vector of decal instances to be rendered with all |
| 1010 | // decals from visible decal spheres. |
| 1011 | |
| 1012 | SceneManager* sceneManager = state->getSceneManager(); |
| 1013 | SceneZoneSpaceManager* zoneManager = sceneManager->getZoneManager(); |
| 1014 | AssertFatal( zoneManager, "DecalManager::prepRenderImage - No zone manager!" ); |
| 1015 | const Vector<DecalSphere*> &grid = mData->getSphereList(); |
| 1016 | const bool haveOnlyOutdoorZone = ( zoneManager->getNumActiveZones() == 1 ); |
| 1017 | |
| 1018 | mDecalQueue.clear(); |
| 1019 | for ( U32 i = 0; i < grid.size(); i++ ) |
| 1020 | { |
| 1021 | DecalSphere* decalSphere = grid[i]; |
| 1022 | const SphereF& worldSphere = decalSphere->mWorldSphere; |
| 1023 | |
| 1024 | // See if this decal sphere can be culled. |
| 1025 | |
| 1026 | const SceneCullingState& cullingState = state->getCullingState(); |
| 1027 | if( haveOnlyOutdoorZone ) |
| 1028 | { |
| 1029 | U32 outdoorZone = SceneZoneSpaceManager::RootZoneId; |
| 1030 | if( cullingState.isCulled( worldSphere, &outdoorZone, 1 ) ) |
| 1031 | continue; |
| 1032 | } |
| 1033 | else |
| 1034 | { |
| 1035 | // Update the zoning state of the sphere, if we need to. |
| 1036 | |
| 1037 | if( decalSphere->mZones.size() == 0 ) |
| 1038 | decalSphere->updateZoning( zoneManager ); |
| 1039 | |
| 1040 | // Skip the sphere if it is not visible in any of its zones. |
| 1041 | |
| 1042 | if( cullingState.isCulled( worldSphere, decalSphere->mZones.address(), decalSphere->mZones.size() ) ) |
| 1043 | continue; |
| 1044 | } |
| 1045 | |
| 1046 | // TODO: If each sphere stored its largest decal instance we |
| 1047 | // could do an LOD step on it here and skip adding any of the |
| 1048 | // decals in the sphere. |
nothing calls this directly
no test coverage detected