mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Outline working on voxels
This commit is contained in:
parent
7fb7ebca57
commit
d6d36cbd43
3 changed files with 24 additions and 10 deletions
|
@ -95,7 +95,13 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
|||
task.addJob<PrepareStencil>("PrepareStencil", primaryFramebuffer);
|
||||
|
||||
// Select items that need to be outlined
|
||||
const auto selectedMetas = task.addJob<SelectItems>("PassTestSelection", metas, "contextOverlayHighlightList");
|
||||
const auto selectionName = "contextOverlayHighlightList";
|
||||
const auto selectMetaInput = SelectItems::Inputs(metas, Varying()).asVarying();
|
||||
const auto selectedMetas = task.addJob<SelectItems>("PassTestMetaSelection", selectMetaInput, selectionName);
|
||||
const auto selectMetaAndOpaqueInput = SelectItems::Inputs(opaques, selectedMetas).asVarying();
|
||||
const auto selectedMetasAndOpaques = task.addJob<SelectItems>("PassTestOpaqueSelection", selectMetaAndOpaqueInput, selectionName);
|
||||
const auto selectItemInput = SelectItems::Inputs(transparents, selectedMetasAndOpaques).asVarying();
|
||||
const auto selectedItems = task.addJob<SelectItems>("PassTestTransparentSelection", selectItemInput, selectionName);
|
||||
|
||||
// Render opaque objects in DeferredBuffer
|
||||
const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel).asVarying();
|
||||
|
@ -167,7 +173,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
|||
task.addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs);
|
||||
|
||||
const auto outlineRangeTimer = task.addJob<BeginGPURangeTimer>("BeginOutlineRangeTimer", "Outline");
|
||||
const auto outlineInputs = DrawOutlineTask::Inputs(selectedMetas, shapePlumber, deferredFramebuffer, primaryFramebuffer, deferredFrameTransform).asVarying();
|
||||
const auto outlineInputs = DrawOutlineTask::Inputs(selectedItems, shapePlumber, deferredFramebuffer, primaryFramebuffer, deferredFrameTransform).asVarying();
|
||||
task.addJob<DrawOutlineTask>("DrawOutline", outlineInputs);
|
||||
task.addJob<EndGPURangeTimer>("EndOutlineRangeTimer", outlineRangeTimer);
|
||||
|
||||
|
@ -221,7 +227,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
|||
task.addJob<DebugZoneLighting>("DrawZoneStack", deferredFrameTransform);
|
||||
|
||||
// Render.getConfig("RenderMainView.DrawSelectionBounds").enabled = true
|
||||
task.addJob<DrawBounds>("DrawSelectionBounds", selectedMetas);
|
||||
task.addJob<DrawBounds>("DrawSelectionBounds", selectedItems);
|
||||
}
|
||||
|
||||
// AA job to be revisited
|
||||
|
|
|
@ -51,13 +51,20 @@ void SliceItems::run(const RenderContextPointer& renderContext, const ItemBounds
|
|||
|
||||
}
|
||||
|
||||
void SelectItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) {
|
||||
void SelectItems::run(const RenderContextPointer& renderContext, const Inputs& inputs, ItemBounds& outItems) {
|
||||
auto selection = renderContext->_scene->getSelection(_name);
|
||||
const auto& selectedItems = selection.getItems();
|
||||
outItems.clear();
|
||||
const auto& inItems = inputs.get0();
|
||||
const auto itemsToAppend = inputs[1];
|
||||
|
||||
if (itemsToAppend.isNull()) {
|
||||
outItems.clear();
|
||||
} else {
|
||||
outItems = itemsToAppend.get<ItemBounds>();
|
||||
}
|
||||
|
||||
if (!selectedItems.empty()) {
|
||||
outItems.reserve(selectedItems.size());
|
||||
outItems.reserve(outItems.size()+selectedItems.size());
|
||||
|
||||
for (auto src : inItems) {
|
||||
if (selection.contains(src.id)) {
|
||||
|
|
|
@ -113,22 +113,23 @@ namespace render {
|
|||
// Keep items belonging to the job selection
|
||||
class SelectItems {
|
||||
public:
|
||||
using JobModel = Job::ModelIO<SelectItems, ItemBounds, ItemBounds>;
|
||||
using Inputs = VaryingSet2<ItemBounds, ItemBounds>;
|
||||
using JobModel = Job::ModelIO<SelectItems, Inputs, ItemBounds>;
|
||||
|
||||
std::string _name;
|
||||
SelectItems(const Selection::Name& name) : _name(name) {}
|
||||
|
||||
void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems);
|
||||
void run(const RenderContextPointer& renderContext, const Inputs& inputs, ItemBounds& outItems);
|
||||
};
|
||||
|
||||
// Same as SelectItems but reorder the output to match the selection order
|
||||
class SelectSortItems {
|
||||
public:
|
||||
using JobModel = Job::ModelIO<SelectSortItems, ItemBounds, ItemBounds>;
|
||||
|
||||
|
||||
std::string _name;
|
||||
SelectSortItems(const Selection::Name& name) : _name(name) {}
|
||||
|
||||
|
||||
void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue