| 469 | } |
| 470 | |
| 471 | void DrawSceneOntoScreen() |
| 472 | { |
| 473 | #if !ENABLE_CBUFFER_RANGE |
| 474 | |
| 475 | // Update model transformation with standard projection |
| 476 | Settings settings; |
| 477 | UpdateSettingsForScreen(settings); |
| 478 | commands->UpdateBuffer(*constantBuffer, 0, &settings, sizeof(settings)); |
| 479 | |
| 480 | #endif // /ENABLE_CBUFFER_RANGE |
| 481 | |
| 482 | // Generate MIP-maps again after texture has been written by the render-target |
| 483 | commands->GenerateMips(*renderTargetTex); |
| 484 | |
| 485 | // Begin render pass for swap-chain |
| 486 | commands->BeginRenderPass(*swapChain); |
| 487 | { |
| 488 | // Clear color and depth buffers of active framebuffer (i.e. the screen) |
| 489 | commands->Clear(LLGL::ClearFlags::ColorDepth, backgroundColor); |
| 490 | |
| 491 | // Binds graphics pipeline for swap-chain |
| 492 | commands->SetPipelineState(*pipelines[1]); |
| 493 | |
| 494 | // Set viewport to fullscreen. |
| 495 | // Note: this must be done AFTER the respective graphics pipeline has been set, |
| 496 | // since the previous pipeline has no dynamic viewport! |
| 497 | commands->SetViewport(swapChain->GetResolution()); |
| 498 | |
| 499 | #if ENABLE_RESOURCE_HEAP |
| 500 | if (resourceHeap) |
| 501 | { |
| 502 | // Set graphics pipeline resources |
| 503 | commands->SetResourceHeap(*resourceHeap, 1); |
| 504 | } |
| 505 | else |
| 506 | #endif // /ENABLE_RESOURCE_HEAP |
| 507 | { |
| 508 | // Set previous resources again since we invalidated them via SetPipelineState() |
| 509 | commands->SetResource(0, *constantBuffer); |
| 510 | commands->SetResource(1, *samplerState); |
| 511 | |
| 512 | // Set render-target texture |
| 513 | commands->SetResource(2, *renderTargetTex); |
| 514 | #if ENABLE_CUSTOM_MULTISAMPLING |
| 515 | commands->SetResource(3, *renderTargetTexMS); |
| 516 | #endif |
| 517 | } |
| 518 | |
| 519 | // Draw scene |
| 520 | commands->DrawIndexed(36, 0); |
| 521 | } |
| 522 | commands->EndRenderPass(); |
| 523 | } |
| 524 | |
| 525 | #if ENABLE_CBUFFER_RANGE |
| 526 |
no test coverage detected