MCPcopy Create free account
hub / github.com/carbonengine/trinity / RenderDepthPass

Method RenderDepthPass

trinity/Eve/EveSpaceScene.cpp:2194–2349  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------- Description: Render opaque objects to populate a readable depth stencil. --------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2192// Render opaque objects to populate a readable depth stencil.
2193// --------------------------------------------------------------------------------------
2194void EveSpaceScene::RenderDepthPass( const Tr2TextureAL& depthMap, const Tr2TextureAL& normalMap, const Tr2TextureAL& customStencil, Tr2RenderContext& renderContext, const BlueSharedString& techniqueName )
2195{
2196 CCP_STATS_ZONE( __FUNCTION__ );
2197
2198 if( !m_display )
2199 {
2200 return;
2201 }
2202
2203 renderContext.m_esm.BeginManagedRendering();
2204
2205 { // Update mesh morphs
2206 auto& meshMorphs = m_componentRegistry->GetComponents<ITr2MeshMorph>();
2207 if( meshMorphs.size() > 0 )
2208 {
2209 bool cleanUpMorphTasks = true;
2210 for( auto& meshMorph : meshMorphs )
2211 {
2212 if( !meshMorph->UpdateMeshMorphs( renderContext ) )
2213 {
2214 cleanUpMorphTasks = false;
2215 }
2216 }
2217 if( cleanUpMorphTasks )
2218 {
2219 m_componentRegistry->Clear<ITr2MeshMorph>();
2220 }
2221 }
2222 }
2223
2224 // Render to depth map
2225 {
2226 renderContext.AddGpuMarker( __FUNCTION__ );
2227 GPU_REGION( renderContext, "Depth Pass" );
2228
2229 renderContext.m_esm.SetRenderTarget( 1, customStencil );
2230
2231 Tr2EffectStateManager::RenderingMode renderingMode;
2232 if( normalMap.IsValid() )
2233 {
2234 renderContext.m_esm.PushRenderTarget();
2235 renderContext.m_esm.SetRenderTarget( 0, normalMap );
2236 if( customStencil.IsValid() )
2237 {
2238 renderContext.RenderPassHint( { Tr2LoadAction::CLEAR, Tr2StoreAction::STORE }, { Tr2LoadAction::CLEAR, Tr2StoreAction::STORE }, { Tr2LoadAction::CLEAR, Tr2StoreAction::STORE } );
2239 renderContext.Clear( CLEARFLAGS_TARGET, 0, 0, 0, 1 );
2240 }
2241 else
2242 {
2243 renderContext.RenderPassHint( { Tr2LoadAction::CLEAR, Tr2StoreAction::STORE }, { Tr2LoadAction::CLEAR, Tr2StoreAction::STORE } );
2244 }
2245 renderContext.Clear( CLEARFLAGS_TARGET | CLEARFLAGS_ZBUFFER, 0, 0, 0 );
2246 renderingMode = Tr2EffectStateManager::RM_OPAQUE;
2247 }
2248 else
2249 {
2250#if TRINITY_PLATFORM == TRINITY_METAL
2251 renderContext.m_esm.PushRenderTarget();

Callers 1

ExecuteMethod · 0.80

Calls 15

LengthFunction · 0.85
BeginManagedRenderingMethod · 0.80
sizeMethod · 0.80
UpdateMeshMorphsMethod · 0.80
ApplyStandardStatesMethod · 0.80
RenderBatchesMethod · 0.80
GetZOnlyRenderablesMethod · 0.80
emptyMethod · 0.80
EndManagedRenderingMethod · 0.80
GetTranslationCurveMethod · 0.80
SetSunAngleMethod · 0.80
SetPlanetsMethod · 0.80

Tested by

no test coverage detected