| 2047 | } |
| 2048 | |
| 2049 | void Renderer::RenderSimpleSceneToParaboloid(RenderTarget2D* renderTarget, Vector3 position, int hemisphere) |
| 2050 | { |
| 2051 | // TODO: Update the horizon draw code here once paraboloids are required. TrainWreck Feb 2, 2025. |
| 2052 | |
| 2053 | #ifdef PARABOLOID |
| 2054 | // Reset GPU state |
| 2055 | SetBlendMode(BlendMode::Opaque); |
| 2056 | SetCullMode(CullMode::CounterClockwise); |
| 2057 | |
| 2058 | _shaders.Bind(Shader::RoomAmbient); |
| 2059 | |
| 2060 | // Bind and clear render target |
| 2061 | _context->ClearRenderTargetView(renderTarget->RenderTargetView.Get(), Colors::Black); |
| 2062 | _context->ClearDepthStencilView(renderTarget->DepthStencilView.Get(), D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0); |
| 2063 | _context->OMSetRenderTargets(1, renderTarget->RenderTargetView.GetAddressOf(), renderTarget->DepthStencilView.Get()); |
| 2064 | |
| 2065 | D3D11_VIEWPORT viewport; |
| 2066 | viewport.TopLeftX = 0; |
| 2067 | viewport.TopLeftY = 0; |
| 2068 | viewport.Width = ROOM_AMBIENT_MAP_SIZE; |
| 2069 | viewport.Height = ROOM_AMBIENT_MAP_SIZE; |
| 2070 | viewport.MinDepth = 0; |
| 2071 | viewport.MaxDepth = 1; |
| 2072 | |
| 2073 | _context->RSSetViewports(1, &viewport); |
| 2074 | |
| 2075 | D3D11_RECT rects[1]; |
| 2076 | rects[0].left = 0; |
| 2077 | rects[0].right = ROOM_AMBIENT_MAP_SIZE; |
| 2078 | rects[0].top = 0; |
| 2079 | rects[0].bottom = ROOM_AMBIENT_MAP_SIZE; |
| 2080 | |
| 2081 | _context->RSSetScissorRects(1, rects); |
| 2082 | |
| 2083 | // Opaque geometry |
| 2084 | SetBlendMode(BlendMode::Opaque); |
| 2085 | |
| 2086 | if (hemisphere == -1) |
| 2087 | { |
| 2088 | SetCullMode(CullMode::CounterClockwise); |
| 2089 | } |
| 2090 | else |
| 2091 | { |
| 2092 | SetCullMode(CullMode::Clockwise); |
| 2093 | } |
| 2094 | |
| 2095 | auto view = RenderView(&Camera, 0, PI / 2.0f, 32, DEFAULT_FAR_VIEW, ROOM_AMBIENT_MAP_SIZE, ROOM_AMBIENT_MAP_SIZE); |
| 2096 | |
| 2097 | CCameraMatrixBuffer cameraConstantBuffer; |
| 2098 | cameraConstantBuffer.DualParaboloidView = Matrix::CreateLookAt(position, position + Vector3(0, 0, 1024), -Vector3::UnitY); |
| 2099 | cameraConstantBuffer.Hemisphere = hemisphere; |
| 2100 | view.FillConstantBuffer(cameraConstantBuffer); |
| 2101 | _cbCameraMatrices.UpdateData(cameraConstantBuffer, _context.Get()); |
| 2102 | |
| 2103 | // Draw horizon and sky. |
| 2104 | auto* levelPtr = g_GameFlow->GetLevel(CurrentLevel); |
| 2105 | |
| 2106 | if (levelPtr->GetHorizonEnabled(0) || levelPtr->GetHorizonEnabled(1)) |
nothing calls this directly
no test coverage detected