History

Added multiple selections but still only first linked to outline

Olivier Prat committed 9 years ago

Commit e42699c1 parent 8d793136 files · +55 −20Browse files

Showing the changes to libraries/render-utils/src/RenderDeferredTask.cpp (1 of 6 files). Show all

Unified · Split

libraries/render-utils/src/RenderDeferredTask.cpp+30−13
@@ -44,6 +44,7 @@ · 43 unmodified lines
4444
4545 #include <gpu/StandardShaderLib.h>
4646
47+#include <sstream>
4748
4849 using namespace render;
4950 extern void initOverlay3DPipelines(render::ShapePlumber& plumber, bool depthTest = false);
@@ -57,6 +58,18 @@ void RenderDeferredTask::configure(const Config& config) · 7 unmodified lines
5758 {
5859 }
5960
61+const render::Varying RenderDeferredTask::addSelectItemJobs(JobModel& task, const char* selectionName,
62+ const render::Varying& metas,
63+ const render::Varying& opaques,
64+ const render::Varying& transparents) {
65+ const auto selectMetaInput = SelectItems::Inputs(metas, Varying()).asVarying();
66+ const auto selectedMetas = task.addJob<SelectItems>("MetaSelection", selectMetaInput, selectionName);
67+ const auto selectMetaAndOpaqueInput = SelectItems::Inputs(opaques, selectedMetas).asVarying();
68+ const auto selectedMetasAndOpaques = task.addJob<SelectItems>("OpaqueSelection", selectMetaAndOpaqueInput, selectionName);
69+ const auto selectItemInput = SelectItems::Inputs(transparents, selectedMetasAndOpaques).asVarying();
70+ return task.addJob<SelectItems>("TransparentSelection", selectItemInput, selectionName);
71+}
72+
6073 void RenderDeferredTask::build(JobModel& task, const render::Varying& input, render::Varying& output) {
6174 const auto& items = input.get<Input>();
6275 auto fadeEffect = DependencyManager::get<FadeEffect>();
@@ -94,15 +107,6 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 31 unmodified lines
94107 // draw a stencil mask in hidden regions of the framebuffer.
95108 task.addJob<PrepareStencil>("PrepareStencil", primaryFramebuffer);
96109
97− // Select items that need to be outlined
98− const auto selectionName = "contextOverlayHighlightList";
99− const auto selectMetaInput = SelectItems::Inputs(metas, Varying()).asVarying();
100− const auto selectedMetas = task.addJob<SelectItems>("PassTestMetaSelection", selectMetaInput, selectionName);
101− const auto selectMetaAndOpaqueInput = SelectItems::Inputs(opaques, selectedMetas).asVarying();
102− const auto selectedMetasAndOpaques = task.addJob<SelectItems>("PassTestOpaqueSelection", selectMetaAndOpaqueInput, selectionName);
103− const auto selectItemInput = SelectItems::Inputs(transparents, selectedMetasAndOpaques).asVarying();
104− const auto selectedItems = task.addJob<SelectItems>("PassTestTransparentSelection", selectItemInput, selectionName);
105−
106110 // Render opaque objects in DeferredBuffer
107111 const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel).asVarying();
108112 task.addJob<DrawStateSortDeferred>("DrawOpaqueDeferred", opaqueInputs, shapePlumber);
@@ -172,9 +176,22 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 63 unmodified lines
172176 const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer).asVarying();
173177 task.addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs);
174178
179+ // Select items that need to be outlined
180+ const auto selectionBaseName = "contextOverlayHighlightList";
181+ const auto selectedItems = addSelectItemJobs(task, selectionBaseName, metas, opaques, transparents);
182+ DrawOutlineTask::Groups outlineGroups;
183+ outlineGroups[0] = selectedItems;
184+ for (auto i = 1; i < DrawOutlineTask::MAX_GROUP_COUNT; i++) {
185+ std::ostringstream selectionName;
186+ selectionName << selectionBaseName;
187+ selectionName << i;
188+ outlineGroups[i] = addSelectItemJobs(task, selectionName.str().c_str(), metas, opaques, transparents);
189+ }
175190 const auto outlineRangeTimer = task.addJob<BeginGPURangeTimer>("BeginOutlineRangeTimer", "Outline");
176− const auto outlineInputs = DrawOutlineTask::Inputs(selectedItems, deferredFramebuffer, primaryFramebuffer, deferredFrameTransform).asVarying();
191+
192+ const auto outlineInputs = DrawOutlineTask::Inputs(outlineGroups, deferredFramebuffer, primaryFramebuffer, deferredFrameTransform).asVarying();
177193 task.addJob<DrawOutlineTask>("DrawOutline", outlineInputs);
194+
178195 task.addJob<EndGPURangeTimer>("EndOutlineRangeTimer", outlineRangeTimer);
179196
180197 { // DEbug the bounds of the rendered items, still look at the zbuffer
@@ -184,6 +201,9 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 3 unmodified lines
184201
185202 task.addJob<DrawBounds>("DrawLightBounds", lights);
186203 task.addJob<DrawBounds>("DrawZones", zones);
204+
205+ // Render.getConfig("RenderMainView.DrawSelectionBounds").enabled = true
206+ task.addJob<DrawBounds>("DrawSelectionBounds", selectedItems);
187207 }
188208
189209 // Layered Overlays
@@ -230,9 +250,6 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren · 40 unmodified lines
230250 }
231251
232252 task.addJob<DebugZoneLighting>("DrawZoneStack", deferredFrameTransform);
233−
234− // Render.getConfig("RenderMainView.DrawSelectionBounds").enabled = true
235− task.addJob<DrawBounds>("DrawSelectionBounds", selectedItems);
236253 }
237254
238255 // AA job to be revisited

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t