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

Method RenderReflectionPass

trinity/Eve/EveSpaceScene.cpp:1759–1990  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1757}
1758
1759void EveSpaceScene::RenderReflectionPass( Tr2GpuResourcePool& gpuResourcePool, Tr2RenderContext& renderContext )
1760{
1761 if( !HasReflectionProbe() || !m_display )
1762 {
1763 return;
1764 }
1765
1766 CCP_STATS_ZONE( __FUNCTION__ );
1767
1768 // set the current reflection
1769 GPU_REGION( renderContext, "Reflection" );
1770
1771 // lower the reflection intensity for the objects rendered into the reflection
1772 // (so the reflections in the reflections don't get brighter and brighter)
1773 // we cap it at 0.8 for no good reason, just felt like a good number to cap the reflection intensity in the reflections
1774 auto tmp = m_currentReflectionIntensity;
1775 if( m_currentReflectionIntensity != 0.0f )
1776 {
1777 m_currentReflectionIntensity = min( 0.8f, 1.0f / ( m_currentReflectionIntensity * m_currentReflectionIntensity ) );
1778 }
1779
1780 {
1781 // Override DepthMap in the variable store
1782 ITr2TextureProvider* bkDepthMapTexVar = nullptr;
1783 CTr2TextureReference faceDepthBuffer;
1784 if( m_depthMapVar.GetType() == TRIVARIABLE_TEXTURE_RES )
1785 {
1786 m_depthMapVar.GetValue( bkDepthMapTexVar );
1787 if( bkDepthMapTexVar )
1788 {
1789 bkDepthMapTexVar->Lock();
1790 }
1791
1792 m_depthMapVar = &faceDepthBuffer;
1793 }
1794 ON_BLOCK_EXIT( [&] {
1795 if( m_depthMapVar.GetType() == TRIVARIABLE_TEXTURE_RES )
1796 {
1797 m_depthMapVar = bkDepthMapTexVar;
1798 if( bkDepthMapTexVar )
1799 {
1800 bkDepthMapTexVar->Unlock();
1801 }
1802 }
1803 UpdateVariableStore();
1804 } );
1805
1806 auto bkProjection = m_projection;
1807 ON_BLOCK_EXIT( [&] { m_projection = bkProjection; } );
1808 auto bkJitter = m_jitterMatrix;
1809 m_jitterMatrix = IdentityMatrix();
1810 ON_BLOCK_EXIT( [&] { m_jitterMatrix = bkJitter; } );
1811
1812 // we change the frustum during reflection updates/renderings
1813 // we need the old one for resetting
1814 auto normalFrustum = m_updateContext.GetFrustum();
1815
1816

Callers 1

ExecuteMethod · 0.80

Calls 15

GetProjectionTransformFunction · 0.85
to_stringFunction · 0.85
PopulatePerFramePSDataFunction · 0.85
PopulatePerFrameVSDataFunction · 0.85
GetViewTransformFunction · 0.85
SetViewTransformFunction · 0.85
GetViewPositionFunction · 0.85
GetFrustumMethod · 0.80
InitRenderPassMethod · 0.80
GetStartFaceMethod · 0.80
GetEndFaceMethod · 0.80

Tested by

no test coverage detected