| 2991 | } |
| 2992 | |
| 2993 | void Renderer::DrawHorizonAndSkyForReflections(RenderView& renderView) |
| 2994 | { |
| 2995 | _context->ClearRenderTargetView(_skyboxRenderTarget.RenderTargetView[0].Get(), Colors::Black); |
| 2996 | _context->ClearDepthStencilView(_skyboxRenderTarget.DepthStencilView[0].Get(), D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0); |
| 2997 | _context->OMSetRenderTargets(1, _skyboxRenderTarget.RenderTargetView[0].GetAddressOf(), _skyboxRenderTarget.DepthStencilView[0].Get()); |
| 2998 | |
| 2999 | D3D11_VIEWPORT viewport; |
| 3000 | viewport.TopLeftX = 0; |
| 3001 | viewport.TopLeftY = 0; |
| 3002 | viewport.Width = ROOM_AMBIENT_MAP_SIZE; |
| 3003 | viewport.Height = ROOM_AMBIENT_MAP_SIZE; |
| 3004 | viewport.MinDepth = 0; |
| 3005 | viewport.MaxDepth = 1; |
| 3006 | |
| 3007 | _context->RSSetViewports(1, &viewport); |
| 3008 | |
| 3009 | D3D11_RECT rects[1]; |
| 3010 | rects[0].left = 0; |
| 3011 | rects[0].right = ROOM_AMBIENT_MAP_SIZE; |
| 3012 | rects[0].top = 0; |
| 3013 | rects[0].bottom = ROOM_AMBIENT_MAP_SIZE; |
| 3014 | |
| 3015 | _context->RSSetScissorRects(1, rects); |
| 3016 | |
| 3017 | SetBlendMode(BlendMode::Opaque); |
| 3018 | SetCullMode(CullMode::CounterClockwise); |
| 3019 | |
| 3020 | auto view = RenderView(_gameCamera.Camera.WorldPosition, Vector3::UnitX, Vector3::UnitY, ROOM_AMBIENT_MAP_SIZE, ROOM_AMBIENT_MAP_SIZE, 0, 32, DEFAULT_FAR_VIEW, PI / 2.0f); |
| 3021 | |
| 3022 | CCameraMatrixBuffer cameraConstantBuffer; |
| 3023 | cameraConstantBuffer.DualParaboloidView = Matrix::CreateLookAt(_gameCamera.Camera.WorldPosition, _gameCamera.Camera.WorldPosition + Vector3(0, -1024, 0), Vector3::UnitX); |
| 3024 | cameraConstantBuffer.Hemisphere = -1; |
| 3025 | cameraConstantBuffer.Frame = GlobalCounter; |
| 3026 | cameraConstantBuffer.InterpolatedFrame = (float)GlobalCounter + GetInterpolationFactor(); |
| 3027 | cameraConstantBuffer.RefreshRate = _refreshRate; |
| 3028 | view.FillConstantBuffer(cameraConstantBuffer); |
| 3029 | UpdateConstantBuffer(cameraConstantBuffer, _cbCameraMatrices); |
| 3030 | |
| 3031 | DrawHorizonAndSky(_skyboxRenderTarget.DepthStencilView[0].Get(), view, true); |
| 3032 | |
| 3033 | _context->ClearRenderTargetView(_skyboxRenderTarget.RenderTargetView[1].Get(), Colors::Black); |
| 3034 | _context->ClearDepthStencilView(_skyboxRenderTarget.DepthStencilView[1].Get(), D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0); |
| 3035 | _context->OMSetRenderTargets(1, _skyboxRenderTarget.RenderTargetView[1].GetAddressOf(), _skyboxRenderTarget.DepthStencilView[1].Get()); |
| 3036 | |
| 3037 | SetCullMode(CullMode::Clockwise); |
| 3038 | |
| 3039 | cameraConstantBuffer.Hemisphere = 1; |
| 3040 | UpdateConstantBuffer(cameraConstantBuffer, _cbCameraMatrices); |
| 3041 | |
| 3042 | DrawHorizonAndSky(_skyboxRenderTarget.DepthStencilView[1].Get(), view, true); |
| 3043 | |
| 3044 | SetCullMode(CullMode::CounterClockwise); |
| 3045 | } |
| 3046 | |
| 3047 | void Renderer::DrawHorizonAndSky(ID3D11DepthStencilView* depthStencilView, RenderView& renderView, bool reflectionPass) |
| 3048 | { |
nothing calls this directly
no test coverage detected