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

Method InitRenderPass

trinity/Tr2ReflectionProbe.cpp:99–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97
98
99void Tr2ReflectionProbe::InitRenderPass( Tr2RenderContext& renderContext )
100{
101 if( !m_lockPosition )
102 {
103 m_position = Tr2Renderer::GetViewPosition();
104 }
105
106 renderContext.m_esm.PushViewport();
107 Tr2Renderer::PushViewTransform();
108 Tr2Renderer::PushProjection();
109 renderContext.m_esm.PushRenderTarget();
110 renderContext.m_esm.PushDepthStencilBuffer();
111
112 renderContext.m_esm.SetViewport( m_intermediateSize, m_intermediateSize, 0, 0, 0, 1 );
113
114 // Square projection matrix, with near and far clip planes from the current projection
115 Matrix newProjection = IdentityMatrix();
116 const Matrix& currentProjection = Tr2Renderer::GetProjectionTransform();
117 newProjection.m[2][2] = currentProjection.m[2][2];
118 newProjection.m[2][3] = -1.0f;
119 newProjection.m[3][2] = currentProjection.m[3][2];
120 newProjection.m[3][3] = 0.0f;
121
122 Tr2Renderer::SetProjectionTransform( newProjection );
123
124 // We need to invert cull-mode because of the left-handed coordinates of the cube rendertarget
125 m_prevCullInversion = renderContext.m_esm.IsCullModeInverted();
126 renderContext.m_esm.SetInvertedCullMode( true );
127
128#if !TRINITY_PLATFORM_SUPPORTS_RENDER_PASS_HINTS
129 {
130 GPU_REGION( renderContext, "Reflection Depth Clear" );
131
132 for( int i = GetStartFace(); i < GetEndFace(); i++ )
133 {
134 renderContext.SetRenderTarget( *m_renderTargets[i], 0 );
135 renderContext.m_esm.SetDepthStencilBuffer( m_stencilMaps[i] );
136 CR( renderContext.Clear( CLEARFLAGS_ZBUFFER | CLEARFLAGS_TARGET, 0, 0, 0 ) );
137 }
138 }
139#endif
140}
141
142Tr2TextureAL Tr2ReflectionProbe::GetDepthBuffer( unsigned face )
143{

Callers 1

RenderReflectionPassMethod · 0.80

Calls 11

GetViewPositionFunction · 0.85
GetProjectionTransformFunction · 0.85
PushViewportMethod · 0.80
IsCullModeInvertedMethod · 0.80
SetInvertedCullModeMethod · 0.80
SetDepthStencilBufferMethod · 0.80
PushRenderTargetMethod · 0.45
SetViewportMethod · 0.45
SetRenderTargetMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected