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