| 145 | } |
| 146 | |
| 147 | void 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 | |
| 177 | void Tr2ReflectionProbe::EndRenderPass( Tr2RenderContext& renderContext ) |
| 178 | { |
no test coverage detected