mirror of
https://github.com/antopilo/Nuake.git
synced 2026-01-06 06:09:52 +03:00
Compare commits
4 Commits
994a5843cf
...
0243ef83cb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0243ef83cb | ||
|
|
e232d06ed3 | ||
|
|
ff50932aa4 | ||
|
|
c065f12801 |
161
Data/Shaders/Vulkan/gizmo.frag
Normal file
161
Data/Shaders/Vulkan/gizmo.frag
Normal file
@@ -0,0 +1,161 @@
|
||||
// Transforms
|
||||
struct ModelData
|
||||
{
|
||||
float4x4 model;
|
||||
};
|
||||
[[vk::binding(0, 0)]]
|
||||
StructuredBuffer<ModelData> model : register(t1);
|
||||
|
||||
// Vertex
|
||||
struct Vertex
|
||||
{
|
||||
float3 position;
|
||||
float uv_x;
|
||||
float3 normal;
|
||||
float uv_y;
|
||||
float3 tangent;
|
||||
float3 bitangent;
|
||||
};
|
||||
|
||||
[[vk::binding(0, 1)]]
|
||||
StructuredBuffer<Vertex> vertexBuffer : register(t2);
|
||||
|
||||
// Samplers
|
||||
[[vk::binding(0, 2)]]
|
||||
SamplerState mySampler : register(s0);
|
||||
|
||||
// Materials
|
||||
struct Material
|
||||
{
|
||||
bool hasAlbedo;
|
||||
float3 albedo;
|
||||
bool hasNormal;
|
||||
bool hasMetalness;
|
||||
bool hasRoughness;
|
||||
bool hasAO;
|
||||
float metalnessValue;
|
||||
float roughnessValue;
|
||||
float aoValue;
|
||||
int albedoTextureId;
|
||||
int normalTextureId;
|
||||
int metalnessTextureId;
|
||||
int roughnessTextureId;
|
||||
int aoTextureId;
|
||||
};
|
||||
[[vk::binding(0, 3)]]
|
||||
StructuredBuffer<Material> material;
|
||||
|
||||
// Textures
|
||||
[[vk::binding(0, 4)]]
|
||||
Texture2D textures[];
|
||||
|
||||
// Lights
|
||||
struct Light
|
||||
{
|
||||
float3 position;
|
||||
int type;
|
||||
float4 color;
|
||||
float3 direction;
|
||||
float outerConeAngle;
|
||||
float innerConeAngle;
|
||||
bool castShadow;
|
||||
int shadowMapTextureId[4];
|
||||
int transformId[4];
|
||||
};
|
||||
|
||||
[[vk::binding(0, 5)]]
|
||||
StructuredBuffer<Light> lights;
|
||||
|
||||
// Cameras
|
||||
struct CameraView {
|
||||
float4x4 View;
|
||||
float4x4 Projection;
|
||||
float4x4 ViewProjection;
|
||||
float4x4 InverseView;
|
||||
float4x4 InverseProjection;
|
||||
float3 Position;
|
||||
float Near;
|
||||
float Far;
|
||||
};
|
||||
[[vk::binding(0, 6)]]
|
||||
StructuredBuffer<CameraView> cameras;
|
||||
|
||||
struct PSInput {
|
||||
float4 Position : SV_Position;
|
||||
float2 UV : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct PSOutput {
|
||||
float4 oColor0 : SV_TARGET;
|
||||
};
|
||||
|
||||
struct OutlinePushConstant
|
||||
{
|
||||
float4 Color;
|
||||
float Thickness;
|
||||
int SourceTextureID;
|
||||
int EntityIDTextureID;
|
||||
int DepthTextureID;
|
||||
float SelectedEntity;
|
||||
};
|
||||
|
||||
[[vk::push_constant]]
|
||||
OutlinePushConstant pushConstants;
|
||||
|
||||
PSOutput main(PSInput input)
|
||||
{
|
||||
PSOutput output;
|
||||
|
||||
float4 outlineColor = pushConstants.Color;
|
||||
float target = pushConstants.SelectedEntity;
|
||||
float radius = pushConstants.Thickness;
|
||||
float2 uv = input.UV;
|
||||
|
||||
int entityIDTextureID = pushConstants.EntityIDTextureID;
|
||||
float hasHit = 0.0f;
|
||||
|
||||
float sampleValue = textures[entityIDTextureID].Sample(mySampler, uv).r;
|
||||
|
||||
if(abs(sampleValue - target) < 0.0001)
|
||||
{
|
||||
output.oColor0 = outlineColor;
|
||||
output.oColor0.a = 1.0;
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 fragColor = float4(0, 0, 0, 0);
|
||||
const float TAU = 6.28318530;
|
||||
const float steps = 32.0;
|
||||
for(float i = 0.0f; i < TAU; i += TAU / steps)
|
||||
{
|
||||
float2 uvOffset = float2(sin(i), cos(i)) * radius;
|
||||
|
||||
float2 sampleUV = uv + uvOffset;
|
||||
sampleUV.x = clamp(sampleUV.x, 0.0, 0.999);
|
||||
sampleUV.y = clamp(sampleUV.y, 0.0, 0.999);
|
||||
|
||||
int sampleValue = (int)textures[entityIDTextureID].Sample(mySampler, sampleUV).r;
|
||||
if(sampleValue == target)
|
||||
{
|
||||
hasHit = 1.0f;
|
||||
}
|
||||
|
||||
float alpha = smoothstep(0.5, 0.9, int(sampleValue != target) * hasHit * 10.0f);
|
||||
float4 outputColor = float4(
|
||||
lerp(fragColor.r, outlineColor.r, alpha),
|
||||
lerp(fragColor.g, outlineColor.g, alpha),
|
||||
lerp(fragColor.b, outlineColor.b, alpha),
|
||||
lerp(fragColor.a, outlineColor.a, alpha)
|
||||
);
|
||||
|
||||
fragColor = outputColor;
|
||||
}
|
||||
|
||||
if(fragColor.a > 0.1)
|
||||
{
|
||||
fragColor.a = 1.0f;
|
||||
}
|
||||
|
||||
output.oColor0 = fragColor;
|
||||
return output;
|
||||
}
|
||||
112
Data/Shaders/Vulkan/gizmo.vert
Normal file
112
Data/Shaders/Vulkan/gizmo.vert
Normal file
@@ -0,0 +1,112 @@
|
||||
// Transforms
|
||||
struct ModelData
|
||||
{
|
||||
float4x4 model;
|
||||
};
|
||||
[[vk::binding(0, 0)]]
|
||||
StructuredBuffer<ModelData> model : register(t1);
|
||||
|
||||
// Vertex
|
||||
struct Vertex
|
||||
{
|
||||
float3 position;
|
||||
float uv_x;
|
||||
float3 normal;
|
||||
float uv_y;
|
||||
float3 tangent;
|
||||
float3 bitangent;
|
||||
};
|
||||
|
||||
[[vk::binding(0, 1)]]
|
||||
StructuredBuffer<Vertex> vertexBuffer : register(t2);
|
||||
|
||||
// Samplers
|
||||
[[vk::binding(0, 2)]]
|
||||
SamplerState mySampler : register(s0);
|
||||
|
||||
// Materials
|
||||
struct Material
|
||||
{
|
||||
bool hasAlbedo;
|
||||
float3 albedo;
|
||||
bool hasNormal;
|
||||
bool hasMetalness;
|
||||
bool hasRoughness;
|
||||
bool hasAO;
|
||||
float metalnessValue;
|
||||
float roughnessValue;
|
||||
float aoValue;
|
||||
int albedoTextureId;
|
||||
int normalTextureId;
|
||||
int metalnessTextureId;
|
||||
int roughnessTextureId;
|
||||
int aoTextureId;
|
||||
};
|
||||
[[vk::binding(0, 3)]]
|
||||
StructuredBuffer<Material> material;
|
||||
|
||||
// Textures
|
||||
[[vk::binding(0, 4)]]
|
||||
Texture2D textures[];
|
||||
|
||||
// Lights
|
||||
struct Light
|
||||
{
|
||||
float3 position;
|
||||
int type;
|
||||
float4 color;
|
||||
float3 direction;
|
||||
float outerConeAngle;
|
||||
float innerConeAngle;
|
||||
bool castShadow;
|
||||
int shadowMapTextureId[4];
|
||||
int transformId[4];
|
||||
};
|
||||
|
||||
[[vk::binding(0, 5)]]
|
||||
StructuredBuffer<Light> lights;
|
||||
|
||||
// Cameras
|
||||
struct CameraView {
|
||||
float4x4 View;
|
||||
float4x4 Projection;
|
||||
float4x4 ViewProjection;
|
||||
float4x4 InverseView;
|
||||
float4x4 InverseProjection;
|
||||
float3 Position;
|
||||
float Near;
|
||||
float Far;
|
||||
};
|
||||
[[vk::binding(0, 6)]]
|
||||
StructuredBuffer<CameraView> cameras;
|
||||
|
||||
struct OutlinePushConstant
|
||||
{
|
||||
float4 Color;
|
||||
float Thickness;
|
||||
int SourceTextureID;
|
||||
int EntityIDTextureID;
|
||||
int DepthTextureID;
|
||||
float SelectedEntity;
|
||||
};
|
||||
|
||||
[[vk::push_constant]]
|
||||
OutlinePushConstant pushConstants;
|
||||
|
||||
// Outputs
|
||||
struct VSOutput {
|
||||
float4 Position : SV_Position;
|
||||
float2 UV : TEXCOORD0;
|
||||
};
|
||||
|
||||
// Main vertex shader
|
||||
VSOutput main(uint vertexIndex : SV_VertexID)
|
||||
{
|
||||
VSOutput output;
|
||||
|
||||
Vertex v = vertexBuffer[vertexIndex];
|
||||
output.UV = float2(v.uv_x, v.uv_y);
|
||||
output.Position = float4(v.position, 1.0f);
|
||||
|
||||
return output;
|
||||
}
|
||||
@@ -2529,7 +2529,6 @@ namespace Nuake {
|
||||
|
||||
void EditorInterface::OnSceneLoaded(Ref<Scene> scene)
|
||||
{
|
||||
Window::Get()->SetDecorated(true);
|
||||
VkRenderer::Get().SceneRenderer->sceneRenderPipeline->OnDebugDraw().AddRaw(this, &EditorInterface::OnDebugDraw);
|
||||
}
|
||||
|
||||
@@ -2562,7 +2561,7 @@ namespace Nuake {
|
||||
auto project = Engine::GetProject();
|
||||
if (project)
|
||||
{
|
||||
auto sceneToLoad = project->DefaultScene;
|
||||
auto& sceneToLoad = project->DefaultScene;
|
||||
if (!sceneToLoad)
|
||||
{
|
||||
sceneToLoad = CreateRef<Scene>();
|
||||
@@ -2573,6 +2572,7 @@ namespace Nuake {
|
||||
isLoadingProjectQueue = false;
|
||||
|
||||
auto window = Window::Get();
|
||||
window->SetDecorated(true);
|
||||
window->ShowTitleBar(false);
|
||||
window->SetSize({ 1600, 900 });
|
||||
window->Center();
|
||||
@@ -2581,7 +2581,6 @@ namespace Nuake {
|
||||
else
|
||||
{
|
||||
isLoadingProjectQueue = false;
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -2839,22 +2838,22 @@ namespace Nuake {
|
||||
sceneEditor->Draw();
|
||||
}
|
||||
|
||||
ImGuiDockNode* node = (ImGuiDockNode*)GImGui->DockContext.Nodes.GetVoidPtr(ImGui::GetID("SceneEditorDockSpace"));
|
||||
if (node)
|
||||
{
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 32);
|
||||
if (ImGui::DockNodeBeginAmendTabBar(node))
|
||||
{
|
||||
ImGui::SetNextItemWidth(48);
|
||||
if (ImGui::BeginTabItem("##logoPadding", 0, ImGuiTabItemFlags_Leading))
|
||||
{
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
ImGui::DockNodeEndAmendTabBar();
|
||||
}
|
||||
}
|
||||
|
||||
//ImGuiDockNode* node = (ImGuiDockNode*)GImGui->DockContext.Nodes.GetVoidPtr(ImGui::GetID("SceneEditorDockSpace"));
|
||||
//if (node)
|
||||
//{
|
||||
// ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 32);
|
||||
// if (ImGui::DockNodeBeginAmendTabBar(node))
|
||||
// {
|
||||
// ImGui::SetNextItemWidth(48);
|
||||
// if (ImGui::BeginTabItem("##logoPadding", 0, ImGuiTabItemFlags_Leading))
|
||||
// {
|
||||
//
|
||||
// ImGui::EndTabItem();
|
||||
// }
|
||||
// ImGui::DockNodeEndAmendTabBar();
|
||||
// }
|
||||
//}
|
||||
//
|
||||
ImGui::End();
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
using namespace Nuake;
|
||||
|
||||
std::set<std::string> SceneEditorWindow::previouslyCreatedEditors = std::set<std::string>();
|
||||
|
||||
SceneEditorWindow::SceneEditorWindow(Ref<Scene> inScene) :
|
||||
editorContext(inScene, inScene->Path),
|
||||
layoutInitialized(false)
|
||||
@@ -22,6 +24,16 @@ SceneEditorWindow::SceneEditorWindow(Ref<Scene> inScene) :
|
||||
RegisterWidget<LoggerWidget>();
|
||||
RegisterWidget<ViewportWidget>();
|
||||
RegisterWidget<FileBrowserWidget>();
|
||||
|
||||
imguiId = editorContext.GetScene()->Path.empty() ? "New Scene" : editorContext.GetScene()->Path;
|
||||
|
||||
// This is to prevent initializing the dockspace twice, because imgui keeps a cache of the dockspace
|
||||
if (previouslyCreatedEditors.find(imguiId) != previouslyCreatedEditors.end())
|
||||
{
|
||||
layoutInitialized = true;
|
||||
}
|
||||
|
||||
previouslyCreatedEditors.insert(imguiId);
|
||||
}
|
||||
|
||||
void SceneEditorWindow::Save()
|
||||
@@ -39,13 +51,8 @@ void SceneEditorWindow::Update(float ts)
|
||||
|
||||
void SceneEditorWindow::Draw()
|
||||
{
|
||||
std::string sceneName = editorContext.GetScene()->Path.empty() ? "New Scene" : editorContext.GetScene()->Path;
|
||||
|
||||
ImGuiID editorDockspaceId = ImGui::GetID("SceneEditorDockSpace");
|
||||
if (!layoutInitialized)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// This is to prevent other windows of other scene editors to dock
|
||||
ImGuiWindowClass windowClass;
|
||||
windowClass.ClassId = ImHashStr("SceneEditor");
|
||||
@@ -54,15 +61,15 @@ void SceneEditorWindow::Draw()
|
||||
ImGui::SetNextWindowDockID(ImGui::GetID("SceneEditorDockSpace"));
|
||||
ImGui::SetNextWindowSizeConstraints({1280, 720}, { FLT_MAX, FLT_MAX });
|
||||
bool shouldStayOpen = true;
|
||||
std::string windowName = std::string(ICON_FA_WINDOW_MAXIMIZE + std::string(" ") + sceneName);
|
||||
std::string windowName = std::string(ICON_FA_WINDOW_MAXIMIZE + std::string(" ") + imguiId);
|
||||
|
||||
if (ImGui::Begin(windowName.c_str(), &shouldStayOpen))
|
||||
{
|
||||
this->isFocused = true;
|
||||
|
||||
ImGuiWindowClass localSceneEditorClass;
|
||||
localSceneEditorClass.ClassId = ImHashStr(sceneName.c_str());
|
||||
std::string dockspaceName = std::string("Dockspace##" + sceneName);
|
||||
localSceneEditorClass.ClassId = ImHashStr(imguiId.c_str());
|
||||
std::string dockspaceName = std::string("Dockspace##" + imguiId);
|
||||
|
||||
ImGuiID dockspaceId = ImGui::GetID(dockspaceName.c_str());
|
||||
ImGui::DockSpace(dockspaceId, ImGui::GetContentRegionAvail(), ImGuiDockNodeFlags_None, &localSceneEditorClass);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "Widgets/IEditorWidget.h"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <concepts>
|
||||
@@ -31,6 +32,10 @@ private:
|
||||
bool isFocused;
|
||||
std::vector<Scope<IEditorWidget>> widgets;
|
||||
|
||||
// This is because imgui keeps cache of previously created dockspace, so we can reuse it.
|
||||
std::string imguiId;
|
||||
static std::set<std::string> previouslyCreatedEditors;
|
||||
|
||||
public:
|
||||
SceneEditorWindow(Ref<Nuake::Scene> scene);
|
||||
~SceneEditorWindow() = default;
|
||||
|
||||
@@ -14,10 +14,6 @@ using namespace Nuake;
|
||||
|
||||
ViewportWidget::ViewportWidget(EditorContext& context) : IEditorWidget(context)
|
||||
{
|
||||
const Vector2& defaultSize = { 1280, 720 };
|
||||
const UUID viewId = editorContext.GetScene()->m_EditorCamera->ID;
|
||||
auto& vkRenderer = Nuake::VkRenderer::Get();
|
||||
|
||||
OnSceneChanged(context.GetScene());
|
||||
}
|
||||
|
||||
@@ -32,8 +28,8 @@ void ViewportWidget::Update(float ts)
|
||||
|
||||
if (!Engine::IsPlayMode())
|
||||
{
|
||||
Ref<EditorCamera> editorCam = editorContext.GetScene()->m_EditorCamera;
|
||||
editorCam->Update(ts, isHoveringViewport);
|
||||
EditorCamera& editorCam = reinterpret_cast<EditorCamera&>(*editorContext.GetScene()->GetCurrentCamera().get());
|
||||
editorCam.Update(ts, isHoveringViewport);
|
||||
}
|
||||
|
||||
const Vector2 viewportSize = sceneViewport->GetViewportSize();
|
||||
|
||||
@@ -378,7 +378,6 @@ namespace Nuake
|
||||
currentProject = project;
|
||||
|
||||
// TODO(antopilo) only generate manifest in editor context
|
||||
|
||||
FileSystem::SetRootDirectory(FileSystem::GetParentPath(project->FullPath));
|
||||
GenerateManifest();
|
||||
|
||||
|
||||
@@ -339,6 +339,8 @@ void RenderPipeline::Execute(PassRenderContext& ctx, PipelineAttachments& inputs
|
||||
return;
|
||||
}
|
||||
|
||||
assert(std::size(RenderPasses) == std::size(inputs) && "Did you forget to an input?");
|
||||
|
||||
int passIndex = 0;
|
||||
for (auto& pass : RenderPasses)
|
||||
{
|
||||
|
||||
@@ -106,9 +106,12 @@ SceneRenderPipeline::SceneRenderPipeline()
|
||||
GBufferEntityID = CreateRef<VulkanImage>(ImageFormat::R32F, defaultSize);
|
||||
GBufferEntityID->SetDebugName("GBufferEntityID");
|
||||
|
||||
OutlineOutput =CreateRef<VulkanImage>(ImageFormat::RGBA8, defaultSize);
|
||||
OutlineOutput = CreateRef<VulkanImage>(ImageFormat::RGBA8, defaultSize);
|
||||
OutlineOutput->SetDebugName("OutlineOutput");
|
||||
|
||||
GizmoOutput = CreateRef<VulkanImage>(ImageFormat::RGBA8, defaultSize);
|
||||
GizmoOutput->SetDebugName("GizmoOutput");
|
||||
|
||||
// Setup bloom targets
|
||||
BloomOutput = CreateRef<VulkanImage>(ImageFormat::RGBA16F, defaultSize);
|
||||
BloomThreshold = CreateRef<VulkanImage>(ImageFormat::RGBA16F, defaultSize);
|
||||
@@ -274,6 +277,30 @@ SceneRenderPipeline::SceneRenderPipeline()
|
||||
cmd.DrawIndexed(6);
|
||||
});
|
||||
|
||||
auto& gizmoPass = GBufferPipeline.AddPass("Gizmo");
|
||||
gizmoPass.SetShaders(shaderMgr.GetShader("gizmo_vert"), shaderMgr.GetShader("gizmo_frag"));
|
||||
gizmoPass.AddAttachment("GizmoOutput", GizmoOutput->GetFormat());
|
||||
gizmoPass.AddInput("Depth");
|
||||
gizmoPass.SetPreRender([&](PassRenderContext& ctx) {
|
||||
Cmd& cmd = ctx.commandBuffer;
|
||||
auto& layout = ctx.renderPass->PipelineLayout;
|
||||
auto& res = GPUResources::Get();
|
||||
|
||||
// Bindless
|
||||
cmd.BindDescriptorSet(layout, res.ModelDescriptor, 0);
|
||||
cmd.BindDescriptorSet(layout, res.SamplerDescriptor, 2);
|
||||
cmd.BindDescriptorSet(layout, res.MaterialDescriptor, 3);
|
||||
cmd.BindDescriptorSet(layout, res.TexturesDescriptor, 4);
|
||||
cmd.BindDescriptorSet(layout, res.LightsDescriptor, 5);
|
||||
cmd.BindDescriptorSet(layout, res.CamerasDescriptor, 6);
|
||||
});
|
||||
gizmoPass.SetRender([&](PassRenderContext& ctx)
|
||||
{
|
||||
auto& cmd = ctx.commandBuffer;
|
||||
DebugCmd debugCmd = DebugCmd(cmd);
|
||||
OnDebugDraw().Broadcast(debugCmd);
|
||||
});
|
||||
|
||||
auto& outlinePass = GBufferPipeline.AddPass("Outline");
|
||||
outlinePass.SetShaders(shaderMgr.GetShader("outline_vert"), shaderMgr.GetShader("outline_frag"));
|
||||
outlinePass.SetPushConstant<OutlineConstant>(outlineConstant);
|
||||
@@ -343,6 +370,7 @@ void SceneRenderPipeline::Render(PassRenderContext& ctx)
|
||||
{ GBufferAlbedo, GBufferDepth, GBufferNormal, GBufferMaterial, GBufferEntityID }, // GBuffer
|
||||
{ ShadingOutput }, // Shading
|
||||
{ TonemappedOutput }, // Tonemap
|
||||
{ OutlineOutput },
|
||||
{ OutlineOutput }
|
||||
};
|
||||
|
||||
|
||||
@@ -90,6 +90,8 @@ namespace Nuake
|
||||
// Attachments Shading
|
||||
Ref<VulkanImage> ShadingOutput;
|
||||
|
||||
Ref<VulkanImage> GizmoOutput;
|
||||
|
||||
Ref<VulkanImage> TonemappedOutput;
|
||||
|
||||
Ref<VulkanImage> OutlineOutput;
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#pragma once
|
||||
#include "Nuake/Core/Core.h"
|
||||
#include "Nuake/Core/Maths.h"
|
||||
#include "Nuake/Core/MulticastDelegate.h"
|
||||
#include "Nuake/Resource/UUID.h"
|
||||
|
||||
|
||||
namespace Nuake
|
||||
{
|
||||
class VulkanImage;
|
||||
class DebugCmd;
|
||||
|
||||
class Viewport
|
||||
{
|
||||
@@ -17,6 +19,7 @@ namespace Nuake
|
||||
|
||||
UUID viewId;
|
||||
Ref<VulkanImage> renderTarget;
|
||||
MulticastDelegate<DebugCmd&> debugDrawDelegate;
|
||||
|
||||
int selectedEntityID;
|
||||
public:
|
||||
@@ -45,5 +48,15 @@ namespace Nuake
|
||||
|
||||
Ref<VulkanImage> GetRenderTarget() const { return renderTarget; }
|
||||
bool Resize();
|
||||
|
||||
void OnDebugDraw(DebugCmd& debugCmd)
|
||||
{
|
||||
debugDrawDelegate.Broadcast(debugCmd);
|
||||
}
|
||||
|
||||
MulticastDelegate<DebugCmd&>& GetOnDebugDraw()
|
||||
{
|
||||
return debugDrawDelegate;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "SceneViewport.h"
|
||||
#include "Nuake/Rendering/Vertex.h"
|
||||
#include "VulkanSceneRenderer.h"
|
||||
#include "SceneRenderPipeline.h"
|
||||
|
||||
#include "DescriptorLayoutBuilder.h"
|
||||
|
||||
@@ -466,6 +467,9 @@ void VkRenderer::RegisterSceneViewport(const Ref<Scene>& scene, const UUID& view
|
||||
Ref<VkSceneRenderer> sceneRenderer = CreateRef<VkSceneRenderer>();
|
||||
sceneRenderer->Init();
|
||||
|
||||
// Register the viewport to the onDebugDraw event for custom drawing
|
||||
sceneRenderer->sceneRenderPipeline->OnDebugDraw().AddRaw(Viewports[viewportId].get(), &Viewport::OnDebugDraw);
|
||||
|
||||
SceneRenderers[viewportId] = std::move(sceneRenderer);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ void VkSceneRenderer::LoadShaders()
|
||||
shaderMgr.AddShader("tonemap_vert", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/tonemap.vert"));
|
||||
shaderMgr.AddShader("outline_frag", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/outline.frag"));
|
||||
shaderMgr.AddShader("outline_vert", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/outline.vert"));
|
||||
shaderMgr.AddShader("gizmo_frag", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/gizmo.frag"));
|
||||
shaderMgr.AddShader("gizmo_vert", shaderCompiler.CompileShader("Resources/Shaders/Vulkan/gizmo.vert"));
|
||||
}
|
||||
|
||||
void VkSceneRenderer::PrepareScenes(const std::vector<Ref<Scene>>& scenes, RenderContext inContext)
|
||||
|
||||
Reference in New Issue
Block a user