| 415 | } |
| 416 | |
| 417 | void DrawSceneIntoTexture() |
| 418 | { |
| 419 | #ifndef ENABLE_CBUFFER_RANGE |
| 420 | |
| 421 | // Update constant buffer with current settings |
| 422 | Settings settings; |
| 423 | UpdateSettingsForTexture(settings); |
| 424 | commands->UpdateBuffer(*constantBuffer, 0, &settings, sizeof(settings)); |
| 425 | |
| 426 | #endif // /ENABLE_CBUFFER_RANGE |
| 427 | |
| 428 | // Begin render pass for render target |
| 429 | commands->BeginRenderPass(*renderTarget); |
| 430 | { |
| 431 | // Clear color and depth buffers of active framebuffer (i.e. the render target) |
| 432 | commands->SetClearColor({ 0.2f, 0.7f, 0.1f }); |
| 433 | commands->Clear(LLGL::ClearFlags::ColorDepth); |
| 434 | |
| 435 | // Bind graphics pipeline for render target |
| 436 | commands->SetPipelineState(*pipelines[0]); |
| 437 | |
| 438 | // Set common buffers and sampler states |
| 439 | commands->SetIndexBuffer(*indexBuffer); |
| 440 | commands->SetVertexBuffer(*vertexBuffer); |
| 441 | |
| 442 | if (resourceHeap) |
| 443 | { |
| 444 | // Set graphics pipeline resources |
| 445 | commands->SetResourceHeap(*resourceHeap, 0); |
| 446 | } |
| 447 | else |
| 448 | { |
| 449 | // Set resource directly |
| 450 | commands->SetResource(*constantBuffer, 3, LLGL::BindFlags::ConstantBuffer, shaderStages); |
| 451 | commands->SetResource(*colorMap, 2, LLGL::BindFlags::Sampled, shaderStages); |
| 452 | commands->SetResource(*samplerState, 1, 0, shaderStages); |
| 453 | } |
| 454 | |
| 455 | // Draw scene |
| 456 | commands->DrawIndexed(36, 0); |
| 457 | } |
| 458 | commands->EndRenderPass(); |
| 459 | } |
| 460 | |
| 461 | void DrawSceneOntoScreen() |
| 462 | { |
no test coverage detected