Files
XCEngine/new_editor/app/Rendering/Viewport/SceneViewportResourcePaths.h

50 lines
1.3 KiB
C++

#pragma once
#include <XCEngine/Core/Containers/String.h>
#include <filesystem>
namespace XCEngine::UI::Editor::App {
namespace Internal {
inline ::XCEngine::Containers::String NormalizeSceneViewportResourcePath(
const std::filesystem::path& path) {
return ::XCEngine::Containers::String(
path.lexically_normal().generic_string().c_str());
}
inline std::filesystem::path GetSceneViewportResourceRepoRootPath() {
#ifdef XCUIEDITOR_REPO_ROOT
return std::filesystem::path(XCUIEDITOR_REPO_ROOT);
#else
return std::filesystem::path(__FILE__)
.parent_path()
.parent_path()
.parent_path()
.parent_path()
.parent_path();
#endif
}
inline ::XCEngine::Containers::String BuildSceneViewportEditorResourcePath(
const std::filesystem::path& relativePath) {
return NormalizeSceneViewportResourcePath(
GetSceneViewportResourceRepoRootPath() /
"editor" /
"resources" /
relativePath);
}
} // namespace Internal
inline ::XCEngine::Containers::String GetSceneViewportInfiniteGridShaderPath() {
return Internal::BuildSceneViewportEditorResourcePath(
std::filesystem::path("shaders") /
"scene-viewport" /
"infinite-grid" /
"infinite-grid.shader");
}
} // namespace XCEngine::UI::Editor::App