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

Method render

Engine/source/lighting/shadowMap/shadowMapPass.cpp:128–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128void ShadowMapPass::render( SceneManager *sceneManager,
129 const SceneRenderState *diffuseState,
130 U32 objectMask )
131{
132 PROFILE_SCOPE( ShadowMapPass_Render );
133
134 // Prep some shadow rendering stats.
135 smActiveShadowMaps = 0;
136 smUpdatedShadowMaps = 0;
137 smNearShadowMaps = 0;
138 GFXDeviceStatistics stats;
139 stats.start( GFX->getDeviceStatistics() );
140
141 // NOTE: The lights were already registered by SceneManager.
142
143 // Update mLights
144 mLights.clear();
145 mLightManager->getAllUnsortedLights( &mLights );
146 mActiveLights = mLights.size();
147
148 // Use the per-frame incremented time for
149 // priority updates and to track when the
150 // shadow was last updated.
151 const U32 currTime = Sim::getCurrentTime();
152
153 // First do a loop thru the lights setting up the shadow
154 // info array for this pass.
155 Vector<LightShadowMap*> shadowMaps;
156 shadowMaps.reserve( mActiveLights );
157 for ( U32 i = 0; i < mActiveLights; i++ )
158 {
159 ShadowMapParams *params = mLights[i]->getExtended<ShadowMapParams>();
160
161 // Before we do anything... skip lights without shadows.
162 if ( !mLights[i]->getCastShadows() || smDisableShadows )
163 continue;
164
165 // --- Static Shadow Map ---
166 LightShadowMap *lsm = params->getOrCreateShadowMap();
167
168 // First check the visiblity query... if it wasn't
169 // visible skip it.
170 if(params->getOcclusionQuery()->getStatus(true) == GFXOcclusionQuery::Occluded)
171 continue;
172
173 // Any shadow that is visible is counted as being
174 // active regardless if we update it or not.
175 ++smActiveShadowMaps;
176
177 // Do a priority update for this shadow.
178 lsm->updatePriority(diffuseState, currTime);
179
180 shadowMaps.push_back(lsm);
181 }
182
183 // Now sort the shadow info by priority.
184 // andrewmac: tempoarily disabled until I find a better solution.
185 //shadowMaps.sort( LightShadowMap::cmpPriority );

Callers 1

_onPreRenderMethod · 0.45

Calls 15

mPowFunction · 0.85
getDeviceStatisticsMethod · 0.80
getAllUnsortedLightsMethod · 0.80
getCastShadowsMethod · 0.80
getOrCreateShadowMapMethod · 0.80
updatePriorityMethod · 0.80
setLightShadowMapMethod · 0.80
getCurrentTimeFunction · 0.50
startMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected