Added onSceneLoaded delegate
This commit is contained in:
@@ -142,6 +142,8 @@ namespace Nuake {
|
||||
Window::Get()->SetTitlebarHitTestCallback([&](Window& window, int x, int y, bool& hit) {
|
||||
hit = m_TitleBarHovered;
|
||||
});
|
||||
|
||||
Engine::OnSceneLoaded.AddRaw(this, &EditorInterface::OnSceneLoaded);
|
||||
}
|
||||
|
||||
void EditorInterface::DrawTitlebar(float& outHeight)
|
||||
@@ -2433,6 +2435,11 @@ namespace Nuake {
|
||||
window->DC.MenuBarAppending = false;
|
||||
}
|
||||
|
||||
void EditorInterface::OnSceneLoaded(Ref<Scene> scene)
|
||||
{
|
||||
Logger::Log("On Scene loaded");
|
||||
}
|
||||
|
||||
bool isLoadingProject = false;
|
||||
bool isLoadingProjectQueue = false;
|
||||
bool EditorInterface::isCreatingNewProject = false;
|
||||
|
||||
@@ -102,6 +102,8 @@ namespace Nuake
|
||||
bool BeginMenubar(const ImRect& barRectangle);
|
||||
void EndMenubar();
|
||||
|
||||
void OnSceneLoaded(Ref<Scene> scene);
|
||||
|
||||
void SetStatusMessage(const std::string& msg, const Color& color = Color(0.08f, 0.08f, 0.08f, 1.0f)) { m_StatusMessage = msg; m_StatusBarColor = color; }
|
||||
void DrawViewport();
|
||||
void DrawStatusBar();
|
||||
|
||||
@@ -46,6 +46,8 @@ namespace Nuake
|
||||
Timestep Engine::timeStep = 0.f;
|
||||
float Engine::timeScale = 1.0f;
|
||||
|
||||
MulticastDelegate<Ref<Scene>> Engine::OnSceneLoaded;
|
||||
|
||||
void Engine::Init()
|
||||
{
|
||||
//Window::Get()->OnWindowSetScene().AddStatic(&Engine::OnWindowSetScene);
|
||||
@@ -64,7 +66,7 @@ namespace Nuake
|
||||
currentWindow = Window::Get();
|
||||
|
||||
Input::Init();
|
||||
//Renderer2D::Init();
|
||||
|
||||
Logger::Log("Engine initialized");
|
||||
|
||||
RegisterCoreTypes::RegisterCoreComponents();
|
||||
@@ -250,7 +252,13 @@ namespace Nuake
|
||||
|
||||
bool Engine::SetCurrentScene(Ref<Scene> scene)
|
||||
{
|
||||
return currentWindow->SetScene(scene);
|
||||
bool result = currentWindow->SetScene(scene);
|
||||
if (result)
|
||||
{
|
||||
OnSceneLoaded.Broadcast(scene);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Engine::QueueSceneSwitch(const std::string& scenePath)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "src/Core/Core.h"
|
||||
#include "src/Core/Logger.h"
|
||||
#include "src/Window.h"
|
||||
#include "src/Core/MulticastDelegate.h"
|
||||
|
||||
// Welcome to the Nuake source code.
|
||||
namespace Nuake
|
||||
@@ -85,6 +86,9 @@ namespace Nuake
|
||||
static Timestep timeStep;
|
||||
static float timeScale;
|
||||
|
||||
public:
|
||||
static MulticastDelegate<Ref<Scene>> OnSceneLoaded;
|
||||
|
||||
private:
|
||||
static void GenerateManifest();
|
||||
};
|
||||
|
||||
@@ -274,10 +274,14 @@ void SceneRenderPipeline::Render(PassRenderContext& ctx)
|
||||
{
|
||||
{ GBufferAlbedo, GBufferDepth, GBufferNormal, GBufferMaterial }, // GBuffer
|
||||
{ ShadingOutput }, // Shading
|
||||
{ TonemappedOutput }
|
||||
{ TonemappedOutput }, // Tonemap
|
||||
};
|
||||
|
||||
GBufferPipeline.Execute(ctx, pipelineInputs);
|
||||
|
||||
// Debug drawing
|
||||
// Get delegate
|
||||
|
||||
}
|
||||
|
||||
Ref<VulkanImage> SceneRenderPipeline::ResizeImage(Ref<VulkanImage> image, const Vector2& size)
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "src/Rendering/Vulkan/Pipeline/RenderPipeline.h"
|
||||
#include "src/Rendering/Vulkan/VkResources.h"
|
||||
|
||||
#include "src/Core/MulticastDelegate.h"
|
||||
|
||||
namespace Nuake
|
||||
{
|
||||
struct GBufferConstant
|
||||
@@ -95,6 +97,9 @@ namespace Nuake
|
||||
|
||||
static RenderPipeline GBufferPipeline;
|
||||
|
||||
// Delegates
|
||||
MulticastDelegate<> DebugDrawDelegate;
|
||||
|
||||
public:
|
||||
SceneRenderPipeline();
|
||||
~SceneRenderPipeline() = default;
|
||||
@@ -103,6 +108,8 @@ namespace Nuake
|
||||
void Render(PassRenderContext& ctx);
|
||||
Ref<VulkanImage> GetOutput() { return TonemappedOutput; }
|
||||
|
||||
MulticastDelegate<>& OnDebugDraw() { return DebugDrawDelegate; }
|
||||
|
||||
private:
|
||||
Ref<VulkanImage> ResizeImage(Ref<VulkanImage> image, const Vector2& size);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user