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

Method PopulatePerFramePSData

trinity/Interior/Tr2InteriorScene.cpp:1273–1316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1271}
1272
1273void Tr2InteriorScene::PopulatePerFramePSData( Tr2PerFramePSData& data, Tr2RenderContext& renderContext )
1274{
1275 memset( &data, 0, sizeof( Tr2PerFramePSData ) );
1276
1277 // column_major for shaders
1278 data.ViewProjectionMat = XMMatrixTranspose(
1279 XMMatrixMultiply(
1280 Tr2Renderer::GetViewTransform(),
1281 Tr2Renderer::GetProjectionTransform() ) );
1282 // attention: need the transposed, but shader also needs column_major, so it is transpose(transpose(m)) == m
1283 data.ViewInverseTransposeMat = Tr2Renderer::GetInverseViewTransform();
1284
1285 unsigned int width = renderContext.m_esm.GetRenderTargetWidth();
1286 unsigned int height = renderContext.m_esm.GetRenderTargetHeight();
1287
1288 data.viewPort.x = float( renderContext.m_esm.GetViewport().width ) / float( width );
1289 data.viewPort.y = float( renderContext.m_esm.GetViewport().height ) / float( height );
1290 data.viewPort.z = float( renderContext.m_esm.GetViewport().x ) / float( width ) + 0.5f / float( width );
1291 data.viewPort.w = float( renderContext.m_esm.GetViewport().y ) / float( height ) + 0.5f / float( height );
1292
1293 XMVECTOR det;
1294 data.ViewProjInverse = XMMatrixTranspose(
1295 XMMatrixInverse( &det, XMMatrixMultiply( Tr2Renderer::GetViewTransform(), Tr2Renderer::GetProjectionTransform() ) ) );
1296
1297 // sun
1298 GetSunDiffuseColorHandle()->GetValue( data.sunDiffuseColor );
1299 GetSunSpecularColorHandle()->GetValue( data.sunSpecularColor );
1300 GetAmbientColorHandle()->GetValue( data.sceneAmbientColor );
1301
1302 Vector3 vec;
1303 GetSunDirWorldHandle()->GetValue( vec );
1304 data.sunDirWorld.x = vec.x;
1305 data.sunDirWorld.y = vec.y;
1306 data.sunDirWorld.z = vec.z;
1307 data.cullDirection = 1.0f;
1308 data.shScale = 0;
1309 data.shadowCount = (float)m_shadowCount;
1310 data.invShadowSize = 1.0f / m_shadowSize;
1311
1312 data.sceneFogColor = m_fogColor;
1313 data.maxFogAmount = m_maxFogAmount;
1314 data.maxFogDistance = m_maxFogDistance;
1315 data.minFogDistance = m_minFogDistance;
1316}
1317
1318ITriRenderBatchAccumulator* Tr2InteriorScene::GetOpaquePickingBatchAccumulator( void )
1319{

Callers

nothing calls this directly

Calls 10

GetViewTransformFunction · 0.85
GetProjectionTransformFunction · 0.85
GetSunDiffuseColorHandleFunction · 0.85
GetAmbientColorHandleFunction · 0.85
GetSunDirWorldHandleFunction · 0.85
GetRenderTargetWidthMethod · 0.80
GetRenderTargetHeightMethod · 0.80
GetViewportMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected