Showing the changes to libraries/render-utils/src/RenderForwardTask.cpp (1 of 2 files). Show all
Unified · Split
| @@ -30,6 +30,9 @@ · 29 unmodified lines | |||
| 30 | using namespace render; | 30 | using namespace render; |
| 31 | 31 | ||
| 32 | RenderForwardTask::RenderForwardTask(RenderFetchCullSortTask::Output items) { | 32 | RenderForwardTask::RenderForwardTask(RenderFetchCullSortTask::Output items) { |
| 33 | // Prepare the ShapePipelines | ||
| 34 | ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>(); | ||
| 35 | |||
| 33 | // Extract opaques / transparents / lights / overlays | 36 | // Extract opaques / transparents / lights / overlays |
| 34 | const auto opaques = items[0]; | 37 | const auto opaques = items[0]; |
| 35 | const auto transparents = items[1]; | 38 | const auto transparents = items[1]; |
| @@ -40,6 +43,7 @@ RenderForwardTask::RenderForwardTask(RenderFetchCullSortTask::Output items) { · 4 unmodified lines | |||
| 40 | 43 | ||
| 41 | const auto framebuffer = addJob<PrepareFramebuffer>("PrepareFramebuffer"); | 44 | const auto framebuffer = addJob<PrepareFramebuffer>("PrepareFramebuffer"); |
| 42 | 45 | ||
| 46 | addJob<Draw>("DrawOpaques", opaques, shapePlumber); | ||
| 43 | addJob<DrawBackground>("DrawBackground", background); | 47 | addJob<DrawBackground>("DrawBackground", background); |
| 44 | 48 | ||
| 45 | // bounds do not draw on stencil buffer, so they must come last | 49 | // bounds do not draw on stencil buffer, so they must come last |
| @@ -90,6 +94,28 @@ void PrepareFramebuffer::run(const SceneContextPointer& sceneContext, const Rend · 44 unmodified lines | |||
| 90 | framebuffer = _framebuffer; | 94 | framebuffer = _framebuffer; |
| 91 | } | 95 | } |
| 92 | 96 | ||
| 97 | void Draw::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, | ||
| 98 | const Inputs& items) { | ||
| 99 | RenderArgs* args = renderContext->args; | ||
| 100 | |||
| 101 | gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { | ||
| 102 | args->_batch = &batch; | ||
| 103 | |||
| 104 | // Setup projection | ||
| 105 | glm::mat4 projMat; | ||
| 106 | Transform viewMat; | ||
| 107 | args->getViewFrustum().evalProjectionMatrix(projMat); | ||
| 108 | args->getViewFrustum().evalViewTransform(viewMat); | ||
| 109 | batch.setProjectionTransform(projMat); | ||
| 110 | batch.setViewTransform(viewMat); | ||
| 111 | batch.setModelTransform(Transform()); | ||
| 112 | |||
| 113 | // Render items | ||
| 114 | renderStateSortShapes(sceneContext, renderContext, _shapePlumber, items, -1); | ||
| 115 | }); | ||
| 116 | args->_batch = nullptr; | ||
| 117 | } | ||
| 118 | |||
| 93 | void DrawBackground::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, | 119 | void DrawBackground::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, |
| 94 | const Inputs& background) { | 120 | const Inputs& background) { |
| 95 | RenderArgs* args = renderContext->args; | 121 | RenderArgs* args = renderContext->args; |