61 lines
2.1 KiB
C++
61 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include <XCEngine/Core/Containers/String.h>
|
|
|
|
#include <filesystem>
|
|
|
|
namespace XCEngine::UI::Editor::App {
|
|
|
|
struct SceneViewportShaderPaths {
|
|
::XCEngine::Containers::String infiniteGridShaderPath = {};
|
|
::XCEngine::Containers::String selectionMaskShaderPath = {};
|
|
::XCEngine::Containers::String selectionOutlineShaderPath = {};
|
|
|
|
bool IsComplete() const {
|
|
return !infiniteGridShaderPath.Empty() &&
|
|
!selectionMaskShaderPath.Empty() &&
|
|
!selectionOutlineShaderPath.Empty();
|
|
}
|
|
};
|
|
|
|
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 GetSceneViewportResourceRootPath(
|
|
const std::filesystem::path& repoRoot) {
|
|
return (repoRoot / "editor" / "resources").lexically_normal();
|
|
}
|
|
|
|
inline ::XCEngine::Containers::String BuildSceneViewportResourcePath(
|
|
const std::filesystem::path& resourceRoot,
|
|
const std::filesystem::path& relativePath) {
|
|
return NormalizeSceneViewportResourcePath(
|
|
resourceRoot / relativePath);
|
|
}
|
|
|
|
inline SceneViewportShaderPaths BuildSceneViewportShaderPaths(
|
|
const std::filesystem::path& repoRoot) {
|
|
const std::filesystem::path resourceRoot =
|
|
GetSceneViewportResourceRootPath(repoRoot);
|
|
|
|
SceneViewportShaderPaths paths = {};
|
|
paths.infiniteGridShaderPath = BuildSceneViewportResourcePath(
|
|
resourceRoot,
|
|
std::filesystem::path("shaders") / "scene-viewport" /
|
|
"infinite-grid" / "infinite-grid.shader");
|
|
paths.selectionMaskShaderPath = BuildSceneViewportResourcePath(
|
|
resourceRoot,
|
|
std::filesystem::path("shaders") / "scene-viewport" /
|
|
"selection-mask" / "selection-mask.shader");
|
|
paths.selectionOutlineShaderPath = BuildSceneViewportResourcePath(
|
|
resourceRoot,
|
|
std::filesystem::path("shaders") / "scene-viewport" /
|
|
"selection-outline" / "selection-outline.shader");
|
|
return paths;
|
|
}
|
|
|
|
} // namespace XCEngine::UI::Editor::App
|