Move scene viewport shaders into editor resources
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "Passes/SceneViewportGridPass.h"
|
||||
|
||||
#include "Viewport/SceneViewportShaderPaths.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
|
||||
@@ -32,6 +34,10 @@ private:
|
||||
|
||||
} // namespace
|
||||
|
||||
SceneViewportGridPassRenderer::SceneViewportGridPassRenderer()
|
||||
: m_gridPass(GetSceneViewportInfiniteGridShaderPath()) {
|
||||
}
|
||||
|
||||
void SceneViewportGridPassRenderer::Shutdown() {
|
||||
m_gridPass.Shutdown();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Editor {
|
||||
|
||||
class SceneViewportGridPassRenderer {
|
||||
public:
|
||||
SceneViewportGridPassRenderer();
|
||||
~SceneViewportGridPassRenderer() = default;
|
||||
|
||||
void Shutdown();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "Passes/SceneViewportSelectionOutlinePass.h"
|
||||
|
||||
#include "Viewport/SceneViewportShaderPaths.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
|
||||
@@ -40,6 +42,10 @@ private:
|
||||
|
||||
} // namespace
|
||||
|
||||
SceneViewportSelectionOutlinePassRenderer::SceneViewportSelectionOutlinePassRenderer()
|
||||
: m_outlinePass(GetSceneViewportObjectIdOutlineShaderPath()) {
|
||||
}
|
||||
|
||||
void SceneViewportSelectionOutlinePassRenderer::Shutdown() {
|
||||
m_outlinePass.Shutdown();
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Editor {
|
||||
|
||||
class SceneViewportSelectionOutlinePassRenderer {
|
||||
public:
|
||||
SceneViewportSelectionOutlinePassRenderer();
|
||||
~SceneViewportSelectionOutlinePassRenderer() = default;
|
||||
|
||||
void Shutdown();
|
||||
|
||||
47
editor/src/Viewport/SceneViewportShaderPaths.h
Normal file
47
editor/src/Viewport/SceneViewportShaderPaths.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEngine/Core/Containers/String.h>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
|
||||
namespace Detail {
|
||||
|
||||
inline Containers::String NormalizeSceneViewportShaderPath(const std::filesystem::path& path) {
|
||||
return Containers::String(path.lexically_normal().generic_string().c_str());
|
||||
}
|
||||
|
||||
inline std::filesystem::path GetSceneViewportShaderRepoRootPath() {
|
||||
#ifdef XCENGINE_EDITOR_REPO_ROOT
|
||||
return std::filesystem::path(XCENGINE_EDITOR_REPO_ROOT);
|
||||
#else
|
||||
return std::filesystem::path(__FILE__).parent_path().parent_path().parent_path();
|
||||
#endif
|
||||
}
|
||||
|
||||
inline Containers::String BuildSceneViewportShaderPath(const std::filesystem::path& relativePath) {
|
||||
return NormalizeSceneViewportShaderPath(
|
||||
GetSceneViewportShaderRepoRootPath() /
|
||||
"editor" /
|
||||
"resources" /
|
||||
"shaders" /
|
||||
"scene-viewport" /
|
||||
relativePath);
|
||||
}
|
||||
|
||||
} // namespace Detail
|
||||
|
||||
inline Containers::String GetSceneViewportInfiniteGridShaderPath() {
|
||||
return Detail::BuildSceneViewportShaderPath(
|
||||
std::filesystem::path("infinite-grid") / "infinite-grid.shader");
|
||||
}
|
||||
|
||||
inline Containers::String GetSceneViewportObjectIdOutlineShaderPath() {
|
||||
return Detail::BuildSceneViewportShaderPath(
|
||||
std::filesystem::path("object-id-outline") / "object-id-outline.shader");
|
||||
}
|
||||
|
||||
} // namespace Editor
|
||||
} // namespace XCEngine
|
||||
Reference in New Issue
Block a user