| 9 | #include "TriViewport.h" |
| 10 | |
| 11 | void SetupScreenQuad( Tr2ScreenVertex quad[4], |
| 12 | const Vector2& tlTexCoord, |
| 13 | const Vector2& brTexCoord, |
| 14 | const Vector2& tlVertexCoord, |
| 15 | const Vector2& brVertexCoord ) |
| 16 | { |
| 17 | const TriViewport& viewport = Tr2Renderer::GetViewport(); |
| 18 | |
| 19 | Vector2 tlScreen( tlVertexCoord[0] * 2.0f - 1.0f, -( tlVertexCoord[1] * 2.0f - 1.0f ) ); |
| 20 | Vector2 brScreen( brVertexCoord[0] * 2.0f - 1.0f, -( brVertexCoord[1] * 2.0f - 1.0f ) ); |
| 21 | const float z = 1.0f; |
| 22 | const float w = 1.0f; |
| 23 | |
| 24 | int edge1 = 1; |
| 25 | int edge2 = 2; |
| 26 | |
| 27 | USE_MAIN_THREAD_RENDER_CONTEXT(); //TODO! pass it in so we look at actual current cull mode |
| 28 | if( !renderContext.m_esm.IsCullModeInverted() ) |
| 29 | { |
| 30 | // Flip the interior edge direction in the quad which produces a correctly |
| 31 | // oriented strip of two triangles |
| 32 | edge1 = 2; |
| 33 | edge2 = 1; |
| 34 | } |
| 35 | |
| 36 | // Top Left |
| 37 | quad[0].p = Vector4( tlScreen.x, tlScreen.y, z, w ); |
| 38 | quad[0].t = tlTexCoord; |
| 39 | |
| 40 | // Top right |
| 41 | quad[edge1].p = Vector4( brScreen.x, tlScreen.y, z, w ); |
| 42 | quad[edge1].t = Vector2( brTexCoord.x, tlTexCoord.y ); |
| 43 | |
| 44 | // Bottom left |
| 45 | quad[edge2].p = Vector4( tlScreen.x, brScreen.y, z, w ); |
| 46 | quad[edge2].t = Vector2( tlTexCoord.x, brTexCoord.y ); |
| 47 | |
| 48 | // Bottom right |
| 49 | quad[3].p = Vector4( brScreen.x, brScreen.y, z, w ); |
| 50 | quad[3].t = brTexCoord; |
| 51 | } |
| 52 | |
| 53 | void SetupScreenQuadInCameraSpace( Tr2ScreenVertex quad[4], int width, int height ) |
| 54 | { |
no test coverage detected