Move scene viewport shaders into editor resources
This commit is contained in:
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