-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEditorOutlinePass.cpp
More file actions
51 lines (45 loc) · 1.45 KB
/
Copy pathEditorOutlinePass.cpp
File metadata and controls
51 lines (45 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "EditorOutlinePass.h"
#include "Core/GarbageCollection.h"
#include "Render/RenderTexture.h"
#include "Render/CommandBuffer.h"
namespace sh::editor
{
EditorOutlinePass::EditorOutlinePass() :
ScriptableRenderPass(core::Name("EditorOutline"), render::RenderQueue::BeforeOpaque)
{
}
EditorOutlinePass::~EditorOutlinePass()
{
}
SH_EDITOR_API void EditorOutlinePass::SetOutTexture(render::RenderTexture& tex)
{
rd.target = &tex;
rd.renderViewers.resize(1);
}
SH_EDITOR_API void EditorOutlinePass::Configure(const render::RenderData& renderData)
{
renderTextures.clear();
renderTextures[rd.target] = render::ResourceUsage::ColorAttachment;
if (renderData.drawables != nullptr)
{
SetImageUsages(*renderData.drawables);
renderBatches = CreateRenderBatch(*renderData.drawables);
}
}
SH_EDITOR_API void EditorOutlinePass::Record(render::CommandBuffer& cmd, const render::IRenderContext& ctx, const render::RenderData& renderData)
{
if (renderData.renderViewers.empty())
return;
rd.renderViewers[0] = renderData.renderViewers.front();
rd.drawables = renderData.drawables;
cmd.SetRenderData(rd, true, true, true, true);
cmd.SetViewport(0, 0, rd.target->GetSize().x, rd.target->GetSize().y);
cmd.SetScissor(0, 0, rd.target->GetSize().x, rd.target->GetSize().y);
if (rd.drawables == nullptr)
return;
for (const RenderBatch& batch : renderBatches)
{
cmd.DrawMeshBatch(batch.drawables, passName);
}
}
}//namespace