9#include "Engine/Files/GeneratedAssetManifest.h"
11#ifndef GAME_FOLDER_NAME
12#error "GAME_FOLDER_NAME must be defined by CMake"
25 for (
size_t i = 0; i < N; ++i) {
26 path_[i] = literal[i];
31 [[nodiscard]]
constexpr std::string_view
view()
const {
return {
path_.data(),
length_}; }
33 [[nodiscard]] std::filesystem::path
fsPath()
const
35 return std::filesystem::path(
view());
38 [[nodiscard]] std::string
string()
const
40 return std::string(
view());
43 [[nodiscard]]
constexpr const char*
c_str()
const
48 operator std::filesystem::path()
const {
return fsPath(); }
51 [[nodiscard]]
constexpr auto operator/(
const char (&other)[M])
const
53 constexpr size_t leftChars = N - 1;
54 constexpr size_t rightChars = M - 1;
55 constexpr size_t resultChars = leftChars + 1 + rightChars;
59 for (
size_t i = 0; i <
length_; ++i) {
63 result.
path_[out++] =
'/';
65 for (
size_t i = 0; i < rightChars; ++i) {
66 result.
path_[out++] = other[i];
68 result.
path_[out] =
'\0';
73 std::filesystem::path
operator/(
const std::filesystem::path & other )
const
78 std::filesystem::path
operator/(std::string_view other)
const
97 return stream << path.
view();
103 return Assets::GeneratedAssetManifest::contains(path.
view());
137 return ConstexprPath(
"assets/" GAME_FOLDER_NAME
"/Data/geometry/" );
146 return ConstexprPath(
"assets/" GAME_FOLDER_NAME
"/Data/Audio/" );
217#define CREATE_ASSET_PATH( assetPath ) \
220 constexpr auto verifiedAssetPath = ( assetPath ); \
222 ::Engine::Core::assetExists( verifiedAssetPath ), \
223 "Asset path is not present in GeneratedAssetManifest" \
225 return verifiedAssetPath; \
234#define CREATE_MESH_ASSET_PATH( assetPath, objectName ) \
237 constexpr auto path = CREATE_ASSET_PATH( assetPath ); \
238 Asset::MeshPath meshAsset( path.fsPath(), objectName ); \
constexpr const char * c_str() const
std::filesystem::path operator/(std::string_view other) const
std::array< char, N > path_
constexpr ConstexprPath(const char(&literal)[N])
constexpr std::string_view view() const
std::string string() const
friend class ConstexprPath
constexpr auto operator/(const char(&other)[M]) const
std::filesystem::path fsPath() const
constexpr ConstexprPath()=default
std::filesystem::path operator/(const std::filesystem::path &other) const
Centralized accessors for project and asset paths.
static constexpr auto engineFonts()
Path to font assets @lsp_source_path Engine/fonts.
static constexpr auto engineTextures()
Path to engine textures @lsp_source_path Engine/textures.
static constexpr auto gameGeometry()
Path to game geometry assets @lsp_source_path AirHockey/Data/geometry.
static bool doesExrFileExist(const std::filesystem::path &path)
Checks if the specified filepath exists at the given path and if the file is an exr file.
static bool doesFileOfTypeExist(const std::filesystem::path &path, const std::string &extension)
Checks if the specified filepath exists and if the file at the path is of a file type.
static std::string getEngineRoot()
Gets the engine root directory at runtime.
static bool doesGltfFileExist(const std::filesystem::path &path)
Checks if the specified filepath exists at the given path and is a gltf file.
static constexpr auto engineGeometry()
Path to engine geometry assets @lsp_source_path Engine/geometry.
static constexpr auto gameAudio()
Path to game Audio assets @lsp_source_path AirHockey/Data/Audio.
static constexpr auto engineShaders()
Path to engine shaders @lsp_source_path Engine/shaders.
static bool doesFileExist(const std::filesystem::path &path)
Checks if a file at a filepath exists.
static constexpr auto engineSounds()
Path to engine audio files @lsp_source_path Engine/sounds.
static constexpr std::string getProjectRoot()
Gets the root location of the whole game. This is.
Manages IBL (Image-Based Lighting) resources for specular reflections.
consteval bool assetExists(const ConstexprPath< N > &path)
ConstexprPath(const char(&)[N]) -> ConstexprPath< N >
std::ostream & operator<<(std::ostream &stream, const ConstexprPath< N > &path)