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

Method StartRenderFace

trinity/Tr2ReflectionProbe.cpp:147–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void Tr2ReflectionProbe::StartRenderFace( unsigned face, Tr2RenderContext& renderContext )
148{
149 renderContext.RenderPassHint( { Tr2LoadAction::CLEAR, Tr2StoreAction::STORE, 0 }, { Tr2LoadAction::CLEAR, Tr2StoreAction::DONT_CARE, 0.F } );
150
151 renderContext.m_esm.SetRenderTarget( 0, *m_renderTargets[face] );
152 renderContext.m_esm.SetDepthStencilBuffer( m_stencilMaps[face] );
153
154 static const Vector3 faceDirections[] = {
155 Vector3( 0, 1, 0 ), Vector3( 1, 0, 0 ), //+X
156 Vector3( 0, 1, 0 ),
157 Vector3( -1, 0, 0 ), //-X
158 Vector3( 0, 0, -1 ),
159 Vector3( 0, 1, 0 ), //+Y
160 Vector3( 0, 0, 1 ),
161 Vector3( 0, -1, 0 ), //-Y
162 Vector3( 0, 1, 0 ),
163 Vector3( 0, 0, 1 ), //+Z
164 Vector3( 0, 1, 0 ),
165 Vector3( 0, 0, -1 ), //-Z
166 };
167
168 // We need to invert the X-axis because of the left-handed coordinates of the cube rendertarget
169 static const Matrix xInverter = Matrix(
170 -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 );
171
172 const Vector3& up = faceDirections[face * 2];
173 const Vector3& at = faceDirections[face * 2 + 1];
174 Tr2Renderer::SetViewTransform( LookAtMatrix( m_position, m_position + at, up ) * xInverter );
175}
176
177void Tr2ReflectionProbe::EndRenderPass( Tr2RenderContext& renderContext )
178{

Callers 1

RenderReflectionPassMethod · 0.80

Calls 6

SetViewTransformFunction · 0.85
SetDepthStencilBufferMethod · 0.80
Vector3Class · 0.70
MatrixClass · 0.70
RenderPassHintMethod · 0.45
SetRenderTargetMethod · 0.45

Tested by

no test coverage detected