diff --git a/engine/asset/include/asset.hpp b/engine/asset/include/asset.hpp index 854e8a5..e77a6fd 100644 --- a/engine/asset/include/asset.hpp +++ b/engine/asset/include/asset.hpp @@ -11,28 +11,28 @@ namespace std { template <> - struct hash { - std::size_t operator()(const file::Path& k) const { + struct hash { + std::size_t operator()(const prism::Path& k) const { return (std::hash()(k.string())); } }; } template -std::unique_ptr load_asset(const file::Path p); +std::unique_ptr load_asset(const prism::Path p); template -bool can_load_asset(const file::Path p); +bool can_load_asset(const prism::Path p); template -using AssetStore = std::unordered_map>; +using AssetStore = std::unordered_map>; template class AssetPool : public AssetStore... { public: template AssetPtr add() { - const auto p = file::Path(); + const auto p = prism::Path(); auto reference_block = get_reference_block(p); AssetStore::try_emplace(p, std::make_unique()); @@ -41,7 +41,7 @@ public: } template - AssetPtr get(const file::Path path) { + AssetPtr get(const prism::Path path) { return fetch(path, get_reference_block(path)); } @@ -58,14 +58,14 @@ public: } template - AssetPtr fetch(const file::Path path, ReferenceBlock* reference_block) { + AssetPtr fetch(const prism::Path path, ReferenceBlock* reference_block) { if(!AssetStore::count(path)) AssetStore::try_emplace(path, load_asset(path)); return AssetPtr(AssetStore::at(path).get(), reference_block); } - std::tuple load_asset_generic(const file::Path path) { + std::tuple load_asset_generic(const prism::Path path) { Asset* asset = nullptr; ReferenceBlock* block = nullptr; @@ -88,10 +88,10 @@ public: } } - std::unordered_map> reference_blocks; + std::unordered_map> reference_blocks; private: - ReferenceBlock* get_reference_block(const file::Path path) { + ReferenceBlock* get_reference_block(const prism::Path path) { if(!reference_blocks.count(path)) reference_blocks.try_emplace(path, std::make_unique()); @@ -99,7 +99,7 @@ private: } template - void load_asset_generic(const file::Path path, Asset*& at, ReferenceBlock*& block) { + void load_asset_generic(const prism::Path path, Asset*& at, ReferenceBlock*& block) { if(can_load_asset(path)) { if(!AssetStore::count(path)) AssetStore::try_emplace(path, load_asset(path)); @@ -110,7 +110,7 @@ private: } template - void delete_asset(const file::Path path) { + void delete_asset(const prism::Path path) { auto iter = AssetStore::find(path); if(iter != AssetStore::end()) { auto& [_, asset] = *iter; @@ -126,14 +126,14 @@ using AssetManager = AssetPool; inline std::unique_ptr assetm; -std::unique_ptr load_mesh(const file::Path path); -std::unique_ptr load_material(const file::Path path); -std::unique_ptr load_texture(const file::Path path); +std::unique_ptr load_mesh(const prism::Path path); +std::unique_ptr load_material(const prism::Path path); +std::unique_ptr load_texture(const prism::Path path); -void save_material(Material* material, const file::Path path); +void save_material(Material* material, const prism::Path path); template -std::unique_ptr load_asset(const file::Path path) { +std::unique_ptr load_asset(const prism::Path path) { if constexpr (std::is_same_v) { return load_mesh(path); } else if constexpr(std::is_same_v) { @@ -144,7 +144,7 @@ std::unique_ptr load_asset(const file::Path path) { } template -bool can_load_asset(const file::Path path) { +bool can_load_asset(const prism::Path path) { if constexpr(std::is_same_v) { return path.extension() == ".model"; } else if constexpr(std::is_same_v) { diff --git a/engine/asset/src/asset.cpp b/engine/asset/src/asset.cpp index 3619fc9..43842db 100644 --- a/engine/asset/src/asset.cpp +++ b/engine/asset/src/asset.cpp @@ -15,10 +15,10 @@ #include "physics.hpp" #include "imgui_backend.hpp" -std::unique_ptr load_mesh(const file::Path path) { +std::unique_ptr load_mesh(const prism::Path path) { Expects(!path.empty()); - auto file = file::open(path, true); + auto file = prism::open_file(path, true); if(!file.has_value()) { prism::log::error(System::Renderer, "Failed to load mesh from {}!", path); return nullptr; @@ -185,10 +185,10 @@ std::unique_ptr load_mesh(const file::Path path) { return mesh; } -std::unique_ptr load_texture(const file::Path path) { +std::unique_ptr load_texture(const prism::Path path) { Expects(!path.empty()); - auto file = file::open(path, true); + auto file = prism::open_file(path, true); if(!file.has_value()) { prism::log::error(System::Renderer, "Failed to load texture from {}!", path); return nullptr; @@ -242,10 +242,10 @@ std::unique_ptr load_texture(const file::Path path) { return texture; } -std::unique_ptr load_material(const file::Path path) { +std::unique_ptr load_material(const prism::Path path) { Expects(!path.empty()); - auto file = file::open(path); + auto file = prism::open_file(path); if(!file.has_value()) { prism::log::error(System::Core, "Failed to load material from {}!", path); return {}; @@ -287,7 +287,7 @@ std::unique_ptr load_material(const file::Path path) { p.float_value = property["float_value"]; if(!property["asset_value"].get().empty()) { - p.value_tex = assetm->get(file::app_domain / property["asset_value"].get()); + p.value_tex = assetm->get(prism::app_domain / property["asset_value"].get()); } } } @@ -331,7 +331,7 @@ std::unique_ptr load_material(const file::Path path) { return mat; } -void save_material(Material* material, const file::Path path) { +void save_material(Material* material, const prism::Path path) { Expects(material != nullptr); Expects(!path.empty()); diff --git a/engine/audio/include/audio.hpp b/engine/audio/include/audio.hpp index 11fae57..2ee64b2 100755 --- a/engine/audio/include/audio.hpp +++ b/engine/audio/include/audio.hpp @@ -8,5 +8,5 @@ namespace audio { void initialize(); - void play_file(const file::Path path, const float gain = 1.0f); + void play_file(const prism::Path path, const float gain = 1.0f); } diff --git a/engine/audio/src/audio.cpp b/engine/audio/src/audio.cpp index cd7c5de..b74927b 100755 --- a/engine/audio/src/audio.cpp +++ b/engine/audio/src/audio.cpp @@ -77,8 +77,8 @@ void audio::initialize() { Pa_StartStream(stream); } -void audio::play_file(const file::Path path, const float gain) { - auto audio_file = file::open(path); +void audio::play_file(const prism::Path path, const float gain) { + auto audio_file = prism::open_file(path); if(audio_file == std::nullopt) return; diff --git a/engine/core/include/engine.hpp b/engine/core/include/engine.hpp index e90e1b9..7b03b94 100755 --- a/engine/core/include/engine.hpp +++ b/engine/core/include/engine.hpp @@ -134,7 +134,7 @@ namespace prism { @param path The scene file path. @return Returns a instance of the scene is successful, and nullptr on failure. */ - Scene* load_scene(const file::Path& path); + Scene* load_scene(const prism::Path& path); /** Save the current scene to disk. @param path The absolute file path. @@ -145,7 +145,7 @@ namespace prism { @param path The screen file path. @return Returns a instance of the screen if successful, and nullptr on failure. */ - ui::Screen* load_screen(const file::Path& path); + ui::Screen* load_screen(const prism::Path& path); /** Set the current screen. @param screen The screen object to set as current. Can be null. @@ -162,7 +162,7 @@ namespace prism { @param path The prefab file path. @param override_name If not empty, the root object's new name. Defaulted to a empty string. */ - Object add_prefab(Scene& scene, const file::Path& path, std::string_view override_name = ""); + Object add_prefab(Scene& scene, const prism::Path& path, std::string_view override_name = ""); /** Save a tree of objects as a prefab to disk. @param root The parent object to save as a prefab. @@ -180,12 +180,12 @@ namespace prism { @param path The animation file path. @return An animation. */ - Animation load_animation(const file::Path& path); + Animation load_animation(const prism::Path& path); /** Load a cutscene from disk. This changes the current cutscene. @param path The cutscene file path. */ - void load_cutscene(const file::Path& path); + void load_cutscene(const prism::Path& path); /** Saves the current cutscene to disk. @param path The absolute file path. diff --git a/engine/core/include/screen.hpp b/engine/core/include/screen.hpp index 3bf21fd..09ff1be 100755 --- a/engine/core/include/screen.hpp +++ b/engine/core/include/screen.hpp @@ -15,7 +15,7 @@ namespace ui { class Screen { public: Screen() {} - Screen(const file::Path path); + Screen(const prism::Path path); void process_event(const std::string& type, std::string data = ""); diff --git a/engine/core/src/debug.cpp b/engine/core/src/debug.cpp index d21bdec..94b7a15 100644 --- a/engine/core/src/debug.cpp +++ b/engine/core/src/debug.cpp @@ -169,7 +169,7 @@ void draw_shader_editor() { if(ImGui::Button("Select Path")) { platform::open_dialog(false, [](std::string path) { // open_dialog() can't select folders yet, so use this as a workaround - options.shader_source_path = file::Path(path).parent_path().string(); + options.shader_source_path = prism::Path(path).parent_path().string(); }); } } else { @@ -186,13 +186,13 @@ void draw_shader_editor() { if(!selected_shader.empty()) { if(loaded_shader_string.empty()) { - file::Path base_shader_path = options.shader_source_path; + prism::Path base_shader_path = options.shader_source_path; shader_compiler.set_include_path(base_shader_path.string()); - file::Path shader_path = file::Path(selected_shader); + prism::Path shader_path = prism::Path(selected_shader); - auto file = file::open(base_shader_path / shader_path.replace_extension(shader_path.extension().string() + ".glsl")); + auto file = prism::open_file(base_shader_path / shader_path.replace_extension(shader_path.extension().string() + ".glsl")); loaded_shader_string = file->read_as_string(); } diff --git a/engine/core/src/engine.cpp b/engine/core/src/engine.cpp index a03daa7..faa3697 100755 --- a/engine/core/src/engine.cpp +++ b/engine/core/src/engine.cpp @@ -63,7 +63,7 @@ prism::app* engine::get_app() const { void engine::load_localization(const std::string_view path) { Expects(!path.empty()); - auto file = file::open(file::app_domain / path); + auto file = prism::open_file(prism::app_domain / path); if(file.has_value()) { nlohmann::json j; file->read_as_stream() >> j; @@ -131,10 +131,10 @@ void engine::create_empty_scene() { current_scene = scenes.back().get(); } -Scene* engine::load_scene(const file::Path& path) { +Scene* engine::load_scene(const prism::Path& path) { Expects(!path.empty()); - auto file = file::open(path); + auto file = prism::open_file(path); if(!file.has_value()) { prism::log::error(System::Core, "Failed to load scene from {}!", path); return nullptr; @@ -149,7 +149,7 @@ Scene* engine::load_scene(const file::Path& path) { for(auto& obj : j["objects"]) { if(obj.contains("prefabPath")) { - Object o = add_prefab(*scene, file::app_domain / obj["prefabPath"].get()); + Object o = add_prefab(*scene, prism::app_domain / obj["prefabPath"].get()); scene->get(o).name = obj["name"]; @@ -191,7 +191,7 @@ void engine::save_scene(const std::string_view path) { out << j; } -ui::Screen* engine::load_screen(const file::Path& path) { +ui::Screen* engine::load_screen(const prism::Path& path) { Expects(!path.empty()); return new ui::Screen(path); @@ -224,10 +224,10 @@ AnimationChannel engine::load_animation(nlohmann::json a) { return animation; } -Animation engine::load_animation(const file::Path& path) { +Animation engine::load_animation(const prism::Path& path) { Expects(!path.empty()); - auto file = file::open(path, true); + auto file = prism::open_file(path, true); if(!file.has_value()) { prism::log::error(System::Core, "Failed to load animation from {}!", path); return {}; @@ -282,12 +282,12 @@ Animation engine::load_animation(const file::Path& path) { return anim; } -void engine::load_cutscene(const file::Path& path) { +void engine::load_cutscene(const prism::Path& path) { Expects(!path.empty()); cutscene = std::make_unique(); - auto file = file::open(path); + auto file = prism::open_file(path); if(!file.has_value()) { prism::log::error(System::Core, "Failed to load cutscene from {}!", path); return; @@ -316,7 +316,7 @@ void engine::load_cutscene(const file::Path& path) { anim.target = obj; } } else { - load_scene(file::root_path(path) / s["scene"].get()); + load_scene(prism::root_path(path) / s["scene"].get()); if(get_scene() == nullptr) create_empty_scene(); @@ -359,10 +359,10 @@ void engine::save_cutscene(const std::string_view path) { out << j; } -Object engine::add_prefab(Scene& scene, const file::Path& path, const std::string_view override_name) { +Object engine::add_prefab(Scene& scene, const prism::Path& path, const std::string_view override_name) { Expects(!path.empty()); - auto file = file::open(path); + auto file = prism::open_file(path); if(!file.has_value()) { prism::log::error(System::Core, "Failed to load prefab from {}!", path); return NullObject; diff --git a/engine/core/src/file.cpp b/engine/core/src/file.cpp index 0fcb88e..145410d 100755 --- a/engine/core/src/file.cpp +++ b/engine/core/src/file.cpp @@ -6,7 +6,7 @@ #include "log.hpp" #include "assertions.hpp" -file::Path file::root_path(const Path path) { +prism::Path prism::root_path(const Path path) { auto p = path; while(p.parent_path() != p && p.parent_path() != "/") { p = p.parent_path(); @@ -15,7 +15,7 @@ file::Path file::root_path(const Path path) { return p; } -std::optional file::open(const file::Path path, const bool binary_mode) { +std::optional prism::open_file(const prism::Path path, const bool binary_mode) { Expects(!path.empty()); auto str = get_file_path(path).string(); @@ -25,30 +25,30 @@ std::optional file::open(const file::Path path, const bool binary_mo return {}; } - return file::File(file); + return prism::file(file); } -file::Path file::get_file_path(const file::Path path) { +prism::Path prism::get_file_path(const prism::Path& path) { auto fixed_path = path; auto root = root_path(path); if(root == app_domain) { - fixed_path = domain_data[static_cast(Domain::App)] / path.lexically_relative(root_path(path)); + fixed_path = domain_data[static_cast(domain::app)] / path.lexically_relative(root_path(path)); } else if(root == internal_domain) { - fixed_path = domain_data[static_cast(Domain::Internal)] / path.lexically_relative(root_path(path)); + fixed_path = domain_data[static_cast(domain::internal)] / path.lexically_relative(root_path(path)); } return fixed_path; } -file::Path file::get_domain_path(const Domain domain) { +prism::Path prism::get_domain_path(const domain domain) { return domain_data[static_cast(domain)]; } -file::Path parent_domain(const file::Path path) { +prism::Path parent_domain(const prism::Path& path) { return path; } -file::Path file::get_relative_path(const Domain domain, const Path path) { +prism::Path prism::get_relative_path(const domain domain, const Path path) { // unimplemented return path; } diff --git a/engine/core/src/scene.cpp b/engine/core/src/scene.cpp index 11eb7be..748ff56 100755 --- a/engine/core/src/scene.cpp +++ b/engine/core/src/scene.cpp @@ -19,10 +19,10 @@ void load_transform_component(nlohmann::json j, Transform& t) { void load_renderable_component(nlohmann::json j, Renderable& t) { if(j.contains("path")) - t.mesh = assetm->get(file::app_domain / j["path"].get()); + t.mesh = assetm->get(prism::app_domain / j["path"].get()); for(auto& material : j["materials"]) - t.materials.push_back(assetm->get(file::app_domain / material.get())); + t.materials.push_back(assetm->get(prism::app_domain / material.get())); } void load_camera_component(nlohmann::json j, Camera& camera) { diff --git a/engine/core/src/screen.cpp b/engine/core/src/screen.cpp index b5516b6..13c2006 100755 --- a/engine/core/src/screen.cpp +++ b/engine/core/src/screen.cpp @@ -94,8 +94,8 @@ UIElement* ui::Screen::find_element(const std::string& id) { return foundElement; } -ui::Screen::Screen(const file::Path path) { - auto file = file::open(path); +ui::Screen::Screen(const prism::Path path) { + auto file = prism::open_file(path); if(!file.has_value()) { prism::log::error(System::Core, "Failed to load UI from {}!", path); return; diff --git a/engine/gfx/vulkan/src/gfx_vulkan.cpp b/engine/gfx/vulkan/src/gfx_vulkan.cpp index 1e35674..b784a21 100755 --- a/engine/gfx/vulkan/src/gfx_vulkan.cpp +++ b/engine/gfx/vulkan/src/gfx_vulkan.cpp @@ -754,7 +754,7 @@ GFXPipeline* GFXVulkan::create_graphics_pipeline(const GFXGraphicsPipelineCreate vertex_module = createShaderModule(vertex_shader_vector.data(), vertex_shader_vector.size() * sizeof(uint32_t)); } else { - auto vertex_shader = file::open(file::internal_domain / (info.shaders.vertex_src.as_path().string()), true); + auto vertex_shader = prism::open_file(prism::internal_domain / (info.shaders.vertex_src.as_path().string()), true); vertex_shader->read_all(); vertex_module = createShaderModule(vertex_shader->cast_data(), vertex_shader->size()); @@ -781,7 +781,7 @@ GFXPipeline* GFXVulkan::create_graphics_pipeline(const GFXGraphicsPipelineCreate fragment_module = createShaderModule(fragment_shader_vector.data(), fragment_shader_vector.size() * sizeof(uint32_t)); } else { - auto fragment_shader = file::open(file::internal_domain / (info.shaders.fragment_src.as_path().string()), true); + auto fragment_shader = prism::open_file(prism::internal_domain / (info.shaders.fragment_src.as_path().string()), true); fragment_shader->read_all(); fragment_module = createShaderModule(fragment_shader->cast_data(), fragment_shader->size()); @@ -1035,7 +1035,7 @@ GFXPipeline* GFXVulkan::create_compute_pipeline(const GFXComputePipelineCreateIn compute_module = createShaderModule(shader_vector.data(), shader_vector.size() * sizeof(uint32_t)); } else { - auto shader = file::open(file::internal_domain / (info.compute_src.as_path().string()), true); + auto shader = prism::open_file(prism::internal_domain / (info.compute_src.as_path().string()), true); shader->read_all(); compute_module = createShaderModule(shader->cast_data(), shader->size()); diff --git a/engine/platform/include/file.hpp b/engine/platform/include/file.hpp index 5a59aa7..3f6df79 100755 --- a/engine/platform/include/file.hpp +++ b/engine/platform/include/file.hpp @@ -11,24 +11,24 @@ #include "file_utils.hpp" #include "path.hpp" -namespace file { - enum class Domain { - System, - Internal, - App +namespace prism { + enum class domain { + system, + internal, + app }; /// Represents a file handle. The file may or may not be fully loaded in memory. - class File { + class file { public: - File(FILE* handle) : handle(handle) {} + explicit file(FILE* handle) : handle(handle) {} - File(File&& f) noexcept : + file(file&& f) noexcept : mem(std::move(f.mem)), handle(std::exchange(f.handle, nullptr)), data(std::move(f.data)) {} - ~File() { + ~file() { if(handle != nullptr) fclose(handle); } @@ -57,7 +57,7 @@ namespace file { /// Loads the entire file into memory, accessible via cast_data() void read_all() { fseek(handle, 0L, SEEK_END); - const size_t _size = static_cast(ftell(handle)); + const auto _size = static_cast(ftell(handle)); rewind(handle); data.resize(_size); @@ -71,7 +71,7 @@ namespace file { } /// If the file is loaded in memory, return the size of the file. - size_t size() const { + [[nodiscard]] size_t size() const { return data.size(); } @@ -110,11 +110,11 @@ namespace file { @param mode The access mode. @param path The absolute file path. */ - void set_domain_path(const Domain domain, const Path path); - Path get_domain_path(const Domain domain); + void set_domain_path(domain domain, Path path); + Path get_domain_path(domain domain); /// Converts an absolute path to a domain relative path. - Path get_relative_path(const Domain domain, const Path path); + Path get_relative_path(domain domain, Path path); /// Returns the path to a writeable directory. Path get_writeable_directory(); @@ -126,10 +126,10 @@ namespace file { @param binary_mode Whether or not to open the file as binary or ASCII. Defaults to false. @return An optional with a value if the file was loaded correctly, otherwise it's empty. */ - std::optional open(const Path path, const bool binary_mode = false); + std::optional open_file(Path path, bool binary_mode = false); - Path root_path(const Path path); - Path get_file_path(const Path path); + Path root_path(Path path); + Path get_file_path(const Path& path); inline Path internal_domain = "/internal", app_domain = "/app"; } diff --git a/engine/renderer/include/imguipass.hpp b/engine/renderer/include/imguipass.hpp index e32032c..2b265a5 100755 --- a/engine/renderer/include/imguipass.hpp +++ b/engine/renderer/include/imguipass.hpp @@ -24,7 +24,7 @@ private: void create_font_texture(); void update_buffers(RenderTarget& target, const ImDrawData& draw_data); - std::unique_ptr font_file; + std::unique_ptr font_file; GFXPipeline* pipeline = nullptr; GFXTexture* font_texture = nullptr; diff --git a/engine/renderer/src/dofpass.cpp b/engine/renderer/src/dofpass.cpp index 6826cc2..79291a8 100755 --- a/engine/renderer/src/dofpass.cpp +++ b/engine/renderer/src/dofpass.cpp @@ -9,7 +9,7 @@ AssetPtr aperture_texture; DoFPass::DoFPass(GFX* gfx, prism::renderer* renderer) : renderer(renderer) { - aperture_texture = assetm->get(file::app_domain / "textures/aperture.png"); + aperture_texture = assetm->get(prism::app_domain / "textures/aperture.png"); GFXRenderPassCreateInfo renderPassInfo = {}; renderPassInfo.label = "Depth of Field"; @@ -28,9 +28,9 @@ DoFPass::DoFPass(GFX* gfx, prism::renderer* renderer) : renderer(renderer) { height_constant.value = extent.height; GFXGraphicsPipelineCreateInfo create_info = {}; - create_info.shaders.vertex_src = ShaderSource(file::Path("dof.vert")); + create_info.shaders.vertex_src = ShaderSource(prism::Path("dof.vert")); create_info.shaders.vertex_constants = {width_constant, height_constant}; - create_info.shaders.fragment_src = ShaderSource(file::Path("dof.frag")); + create_info.shaders.fragment_src = ShaderSource(prism::Path("dof.frag")); create_info.shader_input.bindings = { {0, GFXBindingType::StorageImage}, diff --git a/engine/renderer/src/imguipass.cpp b/engine/renderer/src/imguipass.cpp index 0c9d589..3f768f2 100755 --- a/engine/renderer/src/imguipass.cpp +++ b/engine/renderer/src/imguipass.cpp @@ -23,8 +23,8 @@ void ImGuiPass::create_render_target_resources(RenderTarget& target) { if(pipeline == nullptr) { GFXGraphicsPipelineCreateInfo createInfo; createInfo.label = "ImGui"; - createInfo.shaders.vertex_src = ShaderSource(file::Path("imgui.vert")); - createInfo.shaders.fragment_src = ShaderSource(file::Path("imgui.frag")); + createInfo.shaders.vertex_src = ShaderSource(prism::Path("imgui.vert")); + createInfo.shaders.fragment_src = ShaderSource(prism::Path("imgui.frag")); GFXVertexInput vertexInput = {}; vertexInput.stride = sizeof(ImDrawVert); @@ -153,9 +153,9 @@ void ImGuiPass::load_font(const std::string_view filename) { ImGuiIO& io = ImGui::GetIO(); if(io.Fonts->Fonts.empty()) { - auto file = file::open(file::app_domain / filename); + auto file = prism::open_file(prism::app_domain / filename); if(file != std::nullopt) { - font_file = std::make_unique(std::move(file.value())); + font_file = std::make_unique(std::move(file.value())); font_file->read_all(); diff --git a/engine/renderer/src/materialcompiler.cpp b/engine/renderer/src/materialcompiler.cpp index 6f2a0f4..ee19a87 100755 --- a/engine/renderer/src/materialcompiler.cpp +++ b/engine/renderer/src/materialcompiler.cpp @@ -11,7 +11,7 @@ #include "renderer.hpp" ShaderSource get_shader(std::string filename, bool skinned, bool cubemap) { - auto shader_file = file::open(file::internal_domain / filename); + auto shader_file = prism::open_file(prism::internal_domain / filename); if(!shader_file.has_value()) { prism::log::error(System::Renderer, "Failed to open shader file {}!", filename); return {}; diff --git a/engine/renderer/src/renderer.cpp b/engine/renderer/src/renderer.cpp index 865d60e..7fc6f59 100755 --- a/engine/renderer/src/renderer.cpp +++ b/engine/renderer/src/renderer.cpp @@ -91,7 +91,7 @@ struct SkyPushConstant { renderer::renderer(GFX* gfx, const bool enable_imgui) : gfx(gfx) { Expects(gfx != nullptr); - shader_compiler.set_include_path(file::get_domain_path(file::Domain::Internal).string()); + shader_compiler.set_include_path(prism::get_domain_path(prism::domain::internal).string()); create_dummy_texture(); create_histogram_resources(); @@ -144,8 +144,8 @@ void renderer::resize_render_target(RenderTarget& target, const prism::Extent ex GFXGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.label = "Text"; - pipelineInfo.shaders.vertex_src = ShaderSource(file::Path("text.vert")); - pipelineInfo.shaders.fragment_src = ShaderSource(file::Path("text.frag")); + pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("text.vert")); + pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("text.frag")); pipelineInfo.rasterization.primitive_type = GFXPrimitiveType::TriangleStrip; @@ -222,7 +222,7 @@ void renderer::update_screen() { if(current_screen != nullptr) { for(auto& element : current_screen->elements) { if(!element.background.image.empty()) - element.background.texture = assetm->get(file::app_domain / element.background.image); + element.background.texture = assetm->get(prism::app_domain / element.background.image); } } } @@ -718,8 +718,8 @@ void renderer::create_mesh_pipeline(Material& material) const { GFXGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.label = "Mesh"; - pipelineInfo.shaders.vertex_src = ShaderSource(file::Path("mesh.vert")); - pipelineInfo.shaders.fragment_src = ShaderSource(file::Path("mesh.frag")); + pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("mesh.vert")); + pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("mesh.frag")); pipelineInfo.shaders.vertex_constants = {materials_constant, lights_constant, spot_lights_constant, probes_constant}; pipelineInfo.shaders.fragment_constants = {materials_constant, lights_constant, spot_lights_constant, probes_constant}; @@ -814,8 +814,8 @@ void renderer::create_render_target_resources(RenderTarget& target) { GFXGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.label = "Post"; - pipelineInfo.shaders.vertex_src = ShaderSource(file::Path("post.vert")); - pipelineInfo.shaders.fragment_src = ShaderSource(file::Path("post.frag")); + pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("post.vert")); + pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("post.frag")); pipelineInfo.shader_input.bindings = { {4, GFXBindingType::PushConstant}, @@ -841,8 +841,8 @@ void renderer::create_post_pipelines() { GFXGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.label = "Post"; - pipelineInfo.shaders.vertex_src = ShaderSource(file::Path("post.vert")); - pipelineInfo.shaders.fragment_src = ShaderSource(file::Path("post.frag")); + pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("post.vert")); + pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("post.frag")); pipelineInfo.shader_input.bindings = { {4, GFXBindingType::PushConstant}, @@ -862,7 +862,7 @@ void renderer::create_post_pipelines() { } void renderer::create_font_texture() { - auto file = file::open(file::app_domain / "font.fp", true); + auto file = prism::open_file(prism::app_domain / "font.fp", true); if(file == std::nullopt) { prism::log::error(System::Renderer, "Failed to load font file!"); return; @@ -920,8 +920,8 @@ void renderer::create_ui_pipelines() { GFXGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.label = "UI"; - pipelineInfo.shaders.vertex_src = ShaderSource(file::Path("ui.vert")); - pipelineInfo.shaders.fragment_src = ShaderSource(file::Path("ui.frag")); + pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("ui.vert")); + pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("ui.frag")); pipelineInfo.rasterization.primitive_type = GFXPrimitiveType::TriangleStrip; @@ -959,8 +959,8 @@ void renderer::generate_brdf() { GFXGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.label = "BRDF"; - pipelineInfo.shaders.vertex_src = ShaderSource(file::Path("brdf.vert")); - pipelineInfo.shaders.fragment_src = ShaderSource(file::Path("brdf.frag")); + pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("brdf.vert")); + pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("brdf.frag")); pipelineInfo.render_pass = brdf_render_pass; @@ -1006,7 +1006,7 @@ void renderer::generate_brdf() { void renderer::create_histogram_resources() { GFXComputePipelineCreateInfo create_info = {}; - create_info.compute_src = ShaderSource(file::Path("histogram.comp")); + create_info.compute_src = ShaderSource(prism::Path("histogram.comp")); create_info.workgroup_size_x = 16; create_info.workgroup_size_y = 16; @@ -1022,7 +1022,7 @@ void renderer::create_histogram_resources() { histogram_pipeline = gfx->create_compute_pipeline(create_info); - create_info.compute_src = ShaderSource(file::Path("histogram-average.comp")); + create_info.compute_src = ShaderSource(prism::Path("histogram-average.comp")); create_info.workgroup_size_x = 256; create_info.workgroup_size_y = 1; @@ -1055,15 +1055,15 @@ ShaderSource renderer::register_shader(const std::string_view shader_file) { } } - file::Path base_shader_path = get_shader_source_directory(); + prism::Path base_shader_path = get_shader_source_directory(); // if shader editor system is not initialized, use prebuilt shaders if(base_shader_path.empty()) - return ShaderSource(file::Path(shader_file)); + return ShaderSource(prism::Path(shader_file)); shader_compiler.set_include_path(base_shader_path.string()); - file::Path shader_path = file::Path(shader_file); + prism::Path shader_path = prism::Path(shader_file); ShaderStage stage = ShaderStage::Vertex; if(shader_path.extension() == ".vert") @@ -1072,7 +1072,7 @@ ShaderSource renderer::register_shader(const std::string_view shader_file) { stage = ShaderStage::Fragment; if(found_shader_source.empty()) { - auto file = file::open(base_shader_path / shader_path.replace_extension(shader_path.extension().string() + ".glsl")); + auto file = prism::open_file(base_shader_path / shader_path.replace_extension(shader_path.extension().string() + ".glsl")); return shader_compiler.compile(ShaderLanguage::GLSL, stage, ShaderSource(file->read_as_string()), gfx->accepted_shader_language()).value(); } else { diff --git a/engine/renderer/src/scenecapture.cpp b/engine/renderer/src/scenecapture.cpp index 87f94f0..355e09f 100755 --- a/engine/renderer/src/scenecapture.cpp +++ b/engine/renderer/src/scenecapture.cpp @@ -68,7 +68,7 @@ const std::array sceneTransforms = { inline AssetPtr cubeMesh; SceneCapture::SceneCapture(GFX* gfx) { - cubeMesh = assetm->get(file::app_domain / "models/cube.model"); + cubeMesh = assetm->get(prism::app_domain / "models/cube.model"); // render pass GFXRenderPassCreateInfo renderPassInfo = {}; @@ -407,8 +407,8 @@ void SceneCapture::createSkyResources() { pipelineInfo.label = "Sky Scene Capture"; pipelineInfo.render_pass = renderPass; - pipelineInfo.shaders.vertex_src = ShaderSource(file::Path("sky.vert")); - pipelineInfo.shaders.fragment_src = ShaderSource(file::Path("sky.frag")); + pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("sky.vert")); + pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("sky.frag")); pipelineInfo.shader_input.bindings = { {1, GFXBindingType::PushConstant} @@ -451,8 +451,8 @@ void SceneCapture::createIrradianceResources() { GFXGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.label = "Irradiance Convolution"; - pipelineInfo.shaders.vertex_src = ShaderSource(file::Path("irradiance.vert")); - pipelineInfo.shaders.fragment_src = ShaderSource(file::Path("irradiance.frag")); + pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("irradiance.vert")); + pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("irradiance.frag")); GFXVertexInput input; input.stride = sizeof(Vector3); @@ -503,8 +503,8 @@ void SceneCapture::createPrefilterResources() { GFXGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.label = "Prefilter"; - pipelineInfo.shaders.vertex_src = ShaderSource(file::Path("filter.vert")); - pipelineInfo.shaders.fragment_src = ShaderSource(file::Path("filter.frag")); + pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("filter.vert")); + pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("filter.frag")); pipelineInfo.shaders.fragment_constants = {size_constant}; diff --git a/engine/renderer/src/shadowpass.cpp b/engine/renderer/src/shadowpass.cpp index d2c39ec..0c1e02a 100755 --- a/engine/renderer/src/shadowpass.cpp +++ b/engine/renderer/src/shadowpass.cpp @@ -320,7 +320,7 @@ void ShadowPass::create_pipelines() { GFXGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.shaders.vertex_constants = {point_light_max_constant}; - pipelineInfo.shaders.vertex_src = ShaderSource(file::Path("shadow.vert")); + pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("shadow.vert")); pipelineInfo.shaders.fragment_constants = { point_light_max_constant }; @@ -364,7 +364,7 @@ void ShadowPass::create_pipelines() { { pipelineInfo.label = "Point Shadow"; - pipelineInfo.shaders.fragment_src = ShaderSource(file::Path("omnishadow.frag")); + pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("omnishadow.frag")); auto [static_pipeline, skinned_pipeline] = material_compiler.create_pipeline_permutations(pipelineInfo, true); diff --git a/engine/renderer/src/smaapass.cpp b/engine/renderer/src/smaapass.cpp index d912e36..5aa8bd6 100755 --- a/engine/renderer/src/smaapass.cpp +++ b/engine/renderer/src/smaapass.cpp @@ -137,8 +137,8 @@ void SMAAPass::create_pipelines() { GFXGraphicsPipelineCreateInfo createInfo = {}; createInfo.label = "SMAA Edge"; - createInfo.shaders.vertex_src = ShaderSource(file::Path("edge.vert")); - createInfo.shaders.fragment_src = ShaderSource(file::Path("edge.frag")); + createInfo.shaders.vertex_src = ShaderSource(prism::Path("edge.vert")); + createInfo.shaders.fragment_src = ShaderSource(prism::Path("edge.frag")); createInfo.render_pass = render_pass; @@ -155,8 +155,8 @@ void SMAAPass::create_pipelines() { edge_pipeline = gfx->create_graphics_pipeline(createInfo); createInfo.label = "SMAA Blend"; - createInfo.shaders.vertex_src = ShaderSource(file::Path("blend.vert")); - createInfo.shaders.fragment_src = ShaderSource(file::Path("blend.frag")); + createInfo.shaders.vertex_src = ShaderSource(prism::Path("blend.vert")); + createInfo.shaders.fragment_src = ShaderSource(prism::Path("blend.frag")); createInfo.shader_input.bindings.push_back({3, GFXBindingType::Texture}); blend_pipeline = gfx->create_graphics_pipeline(createInfo); diff --git a/engine/shadercompiler/include/shadercompiler.hpp b/engine/shadercompiler/include/shadercompiler.hpp index 90d71f3..23fe502 100755 --- a/engine/shadercompiler/include/shadercompiler.hpp +++ b/engine/shadercompiler/include/shadercompiler.hpp @@ -43,13 +43,13 @@ public: ShaderSource(const ShaderSource& rhs) : source (rhs.source) {} explicit ShaderSource(const std::string& source_string) : source(source_string) {} explicit ShaderSource(const std::vector& source_bytecode) : source(source_bytecode) {} - explicit ShaderSource(const file::Path& shader_path) : source(shader_path) {} + explicit ShaderSource(const prism::Path& shader_path) : source(shader_path) {} - std::variant> source; + std::variant> source; /// Returns a view of the shader source as a path. - [[nodiscard]] file::Path as_path() const { - return std::get(source); + [[nodiscard]] prism::Path as_path() const { + return std::get(source); } /// Returns a view of the shader source as plaintext. @@ -67,7 +67,7 @@ public: } [[nodiscard]] bool is_path() const { - return std::holds_alternative(source); + return std::holds_alternative(source); } [[nodiscard]] bool is_string() const { diff --git a/engine/shadercompiler/src/includer.hpp b/engine/shadercompiler/src/includer.hpp index 52b03d2..d2a625e 100755 --- a/engine/shadercompiler/src/includer.hpp +++ b/engine/shadercompiler/src/includer.hpp @@ -134,7 +134,7 @@ protected: // If no path markers, return current working directory. // Otherwise, strip file name and return path leading up to it. virtual std::string getDirectory(const std::string) const { - //return file::get_domain_path(file::Domain::Internal).string(); + //return file::get_domain_path(file::domain::Internal).string(); return ""; } }; diff --git a/engine/utility/include/file_utils.hpp b/engine/utility/include/file_utils.hpp index 7483f56..4fa704f 100644 --- a/engine/utility/include/file_utils.hpp +++ b/engine/utility/include/file_utils.hpp @@ -3,12 +3,12 @@ #include #include -namespace file { +namespace prism { using Path = std::filesystem::path; } namespace prism::log { - inline void internal_format(std::string& msg, const file::Path& arg) { + inline void internal_format(std::string& msg, const prism::Path& arg) { auto pos = msg.find_first_of("{}"); msg.replace(pos, 2, arg.string()); } diff --git a/engine/utility/include/path.hpp b/engine/utility/include/path.hpp index 9443d18..c5e5a6f 100755 --- a/engine/utility/include/path.hpp +++ b/engine/utility/include/path.hpp @@ -2,6 +2,6 @@ #include -namespace file { +namespace prism { using Path = std::filesystem::path; } diff --git a/example/src/example.cpp b/example/src/example.cpp index 58bf690..efe5543 100644 --- a/example/src/example.cpp +++ b/example/src/example.cpp @@ -6,8 +6,8 @@ #include "scene.hpp" void app_main(prism::engine* engine) { - file::set_domain_path(file::Domain::App, "data"); - file::set_domain_path(file::Domain::Internal, "{resource_dir}/shaders"); + prism::set_domain_path(prism::domain::app, "data"); + prism::set_domain_path(prism::domain::internal, "{resource_dir}/shaders"); platform::open_window("Example", {-1, -1, 1280, 720}, WindowFlags::Resizable); } diff --git a/platforms/sdl/file.cpp b/platforms/sdl/file.cpp index 0221fa6..a8369d5 100644 --- a/platforms/sdl/file.cpp +++ b/platforms/sdl/file.cpp @@ -2,10 +2,10 @@ #include "string_utils.hpp" -void file::set_domain_path(const file::Domain domain, const file::Path path) { +void prism::set_domain_path(const prism::domain domain, const prism::Path path) { domain_data[(int)domain] = replace_substring(path.string(), "{resource_dir}/", ""); } -file::Path file::get_writeable_directory() { +prism::Path prism::get_writeable_directory() { return "~"; } diff --git a/tools/common/include/commoneditor.hpp b/tools/common/include/commoneditor.hpp index 4eae663..1ac0e8c 100755 --- a/tools/common/include/commoneditor.hpp +++ b/tools/common/include/commoneditor.hpp @@ -188,7 +188,7 @@ public: } } - GFXTexture* get_asset_thumbnail(const file::Path path) { + GFXTexture* get_asset_thumbnail(const prism::Path path) { if(asset_thumbnails.count(path.string())) { return asset_thumbnails[path.string()]; } else { @@ -272,7 +272,7 @@ public: current_asset_type = get_asset_type(); open_asset_popup = true; on_asset_select = [&asset, this](auto p) { - asset = assetm->get(file::app_domain / p); + asset = assetm->get(prism::app_domain / p); has_asset_edit_changed = true; }; } @@ -360,7 +360,7 @@ inline void editPath(const char* label, std::string& path, bool editable = true, if(ImGui::Button("...")) { platform::open_dialog(false, [&path, &on_selected](std::string p) { - path = file::get_relative_path(file::Domain::App, p).string(); + path = prism::get_relative_path(prism::domain::app, p).string(); if(on_selected != nullptr) on_selected(); diff --git a/tools/common/src/commoneditor.cpp b/tools/common/src/commoneditor.cpp index fee3959..8cf2867 100755 --- a/tools/common/src/commoneditor.cpp +++ b/tools/common/src/commoneditor.cpp @@ -49,15 +49,15 @@ const std::map imToPl = { CommonEditor::CommonEditor(std::string id) : id(id) { #ifdef PLATFORM_MACOS - file::set_domain_path(file::Domain::App, "../../../data"); + file::set_domain_path(file::domain::App, "../../../data"); #else - file::set_domain_path(file::Domain::App, "data"); + prism::set_domain_path(prism::domain::app, "data"); #endif - file::set_domain_path(file::Domain::Internal, "{resource_dir}/shaders"); + prism::set_domain_path(prism::domain::internal, "{resource_dir}/shaders"); ImGuiIO& io = ImGui::GetIO(); - iniFileName = (file::get_writeable_directory() / "imgui.ini").string(); + iniFileName = (prism::get_writeable_directory() / "imgui.ini").string(); io.IniFilename = iniFileName.c_str(); @@ -260,7 +260,7 @@ void CommonEditor::begin_frame() { int column = 0; for(auto& [p, a_type] : asset_files) { if(current_asset_type == a_type) { - if(ImGui::ImageButton(get_asset_thumbnail(file::app_domain / p), ImVec2(64, 64))) { + if(ImGui::ImageButton(get_asset_thumbnail(prism::app_domain / p), ImVec2(64, 64))) { on_asset_select(p); ImGui::CloseCurrentPopup(); } @@ -465,7 +465,7 @@ void editUI(UI& ui) { ImGui::InputText("Path", &ui.ui_path); if(ImGui::Button("Reload")) { - ui.screen = engine->load_screen(file::app_domain / ui.ui_path); + ui.screen = engine->load_screen(prism::app_domain / ui.ui_path); engine->get_renderer()->init_screen(ui.screen); ui.screen->extent.width = ui.width; ui.screen->extent.height = ui.height; @@ -723,8 +723,8 @@ void CommonEditor::set_undo_stack(UndoStack *stack) { current_stack = stack; } -bool mesh_readable(const file::Path path) { - auto file = file::open(path); +bool mesh_readable(const prism::Path path) { + auto file = prism::open_file(path); if(!file.has_value()) { prism::log::error(System::Renderer, "Failed to load mesh from {}!", path); return false; @@ -736,8 +736,8 @@ bool mesh_readable(const file::Path path) { return version == 5 || version == 6; } -bool material_readable(const file::Path path) { - auto file = file::open(path); +bool material_readable(const prism::Path path) { + auto file = prism::open_file(path); if(!file.has_value()) { prism::log::error(System::Core, "Failed to load material from {}!", path); return false; @@ -783,8 +783,8 @@ void CommonEditor::drawAssets() { for(auto& [p, type] : asset_files) { ImGui::PushID(&p); - if(ImGui::ImageButton(get_asset_thumbnail(file::app_domain / p), ImVec2(64, 64))) - asset_selected(file::app_domain / p, type); + if(ImGui::ImageButton(get_asset_thumbnail(prism::app_domain / p), ImVec2(64, 64))) + asset_selected(prism::app_domain / p, type); if(ImGui::BeginPopupContextItem()) { ImGui::TextDisabled("%s", p.string().c_str()); @@ -792,7 +792,7 @@ void CommonEditor::drawAssets() { ImGui::Separator(); if(ImGui::Button("Regenerate thumbnail")) { - asset_thumbnails.erase(asset_thumbnails.find((file::app_domain / p).string())); + asset_thumbnails.erase(asset_thumbnails.find((prism::app_domain / p).string())); } ImGui::EndPopup(); @@ -814,8 +814,8 @@ GFXTexture* CommonEditor::get_material_preview(Material& material) { Scene scene; auto sphere = scene.add_object(); - scene.add(sphere).mesh = assetm->get(file::app_domain / "models" / "sphere.model"); - scene.get(sphere).materials.push_back(assetm->get(file::app_domain / material.path)); // we throw away our material handle here :-( + scene.add(sphere).mesh = assetm->get(prism::app_domain / "models" / "sphere.model"); + scene.get(sphere).materials.push_back(assetm->get(prism::app_domain / material.path)); // we throw away our material handle here :-( scene.get(sphere).rotation = euler_to_quat(Vector3(radians(90.0f), 0, 0)); @@ -826,7 +826,7 @@ GFXTexture* CommonEditor::get_mesh_preview(Mesh& mesh) { Scene scene; auto mesh_obj = scene.add_object(); - scene.add(mesh_obj).mesh = assetm->get(file::app_domain / mesh.path); + scene.add(mesh_obj).mesh = assetm->get(prism::app_domain / mesh.path); float biggest_component = 0.0f; for(const auto& part : scene.get(mesh_obj).mesh->parts) { @@ -840,7 +840,7 @@ GFXTexture* CommonEditor::get_mesh_preview(Mesh& mesh) { find_biggest_component(part.aabb.min); find_biggest_component(part.aabb.max); - scene.get(mesh_obj).materials.push_back(assetm->get(file::app_domain / "materials" / "Material.material")); + scene.get(mesh_obj).materials.push_back(assetm->get(prism::app_domain / "materials" / "Material.material")); } return generate_common_preview(scene, Vector3(biggest_component * 2.0f)); @@ -1045,7 +1045,7 @@ void CommonEditor::drawConsole() { } void CommonEditor::load_options() { - std::ifstream i(file::get_writeable_directory() / (id + "options.json")); + std::ifstream i(prism::get_writeable_directory() / (id + "options.json")); if (i.is_open()) { nlohmann::json j; i >> j; @@ -1077,12 +1077,12 @@ void CommonEditor::save_options() { j["height"] = height; j["files"] = lastOpenedFiles; - std::ofstream out(file::get_writeable_directory() / (id + "options.json")); + std::ofstream out(prism::get_writeable_directory() / (id + "options.json")); out << j; } void CommonEditor::load_thumbnail_cache() { - auto thumbnail_cache = file::open("./thumbnail-cache"); + auto thumbnail_cache = prism::open_file("./thumbnail-cache"); if(thumbnail_cache != std::nullopt) { int size; thumbnail_cache->read(&size); diff --git a/tools/common/src/debugpass.cpp b/tools/common/src/debugpass.cpp index 454c90a..88a4273 100755 --- a/tools/common/src/debugpass.cpp +++ b/tools/common/src/debugpass.cpp @@ -21,8 +21,8 @@ void DebugPass::initialize() { { GFXGraphicsPipelineCreateInfo createInfo; - createInfo.shaders.vertex_src = ShaderSource(file::Path("debug.vert")); - createInfo.shaders.fragment_src = ShaderSource(file::Path("debug.frag")); + createInfo.shaders.vertex_src = ShaderSource(prism::Path("debug.vert")); + createInfo.shaders.fragment_src = ShaderSource(prism::Path("debug.frag")); GFXVertexInput vertexInput = {}; vertexInput.stride = sizeof(Vector3); @@ -47,14 +47,14 @@ void DebugPass::initialize() { primitive_pipeline = engine->get_gfx()->create_graphics_pipeline(createInfo); - cubeMesh = assetm->get(file::app_domain / "models/cube.model"); - sphereMesh = assetm->get(file::app_domain / "models/sphere.model"); + cubeMesh = assetm->get(prism::app_domain / "models/cube.model"); + sphereMesh = assetm->get(prism::app_domain / "models/sphere.model"); createInfo.rasterization.polygon_type = GFXPolygonType::Fill; arrow_pipeline = engine->get_gfx()->create_graphics_pipeline(createInfo); - arrowMesh = assetm->get(file::app_domain / "models/arrow.model"); + arrowMesh = assetm->get(prism::app_domain / "models/arrow.model"); } { @@ -69,8 +69,8 @@ void DebugPass::initialize() { // pipeline GFXGraphicsPipelineCreateInfo pipelineInfo = {}; - pipelineInfo.shaders.vertex_src = ShaderSource(file::Path("color.vert")); - pipelineInfo.shaders.fragment_src = ShaderSource(file::Path("color.frag")); + pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("color.vert")); + pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("color.frag")); GFXVertexInput input; input.stride = sizeof(Vector3); @@ -110,8 +110,8 @@ void DebugPass::initialize() { GFXGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.label = "Sobel"; - pipelineInfo.shaders.vertex_src = ShaderSource(file::Path("color.vert")); - pipelineInfo.shaders.fragment_src = ShaderSource(file::Path("color.frag")); + pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("color.vert")); + pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("color.frag")); GFXVertexInput input; input.stride = sizeof(Vector3); @@ -142,8 +142,8 @@ void DebugPass::initialize() { GFXGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.label = "Billboard"; - pipelineInfo.shaders.vertex_src = ShaderSource(file::Path("billboard.vert")); - pipelineInfo.shaders.fragment_src = ShaderSource(file::Path("billboard.frag")); + pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("billboard.vert")); + pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("billboard.frag")); pipelineInfo.shader_input.bindings = { {1, GFXBindingType::PushConstant}, @@ -163,10 +163,10 @@ void DebugPass::initialize() { billboard_pipeline = engine->get_gfx()->create_graphics_pipeline(pipelineInfo); - pointTexture = assetm->get(file::app_domain / "textures/point.png"); - spotTexture = assetm->get(file::app_domain / "textures/spot.png"); - sunTexture = assetm->get(file::app_domain / "textures/sun.png"); - probeTexture = assetm->get(file::app_domain / "textures/probe.png"); + pointTexture = assetm->get(prism::app_domain / "textures/point.png"); + spotTexture = assetm->get(prism::app_domain / "textures/spot.png"); + sunTexture = assetm->get(prism::app_domain / "textures/sun.png"); + probeTexture = assetm->get(prism::app_domain / "textures/probe.png"); } } diff --git a/tools/editor/include/prismeditor.hpp b/tools/editor/include/prismeditor.hpp index 1aa10b9..2d77711 100755 --- a/tools/editor/include/prismeditor.hpp +++ b/tools/editor/include/prismeditor.hpp @@ -61,7 +61,7 @@ public: void asset_selected(std::filesystem::path path, AssetType type) override; private: - void open_asset(const file::Path path); + void open_asset(const prism::Path path); void setup_editor(Editor* editor); }; diff --git a/tools/editor/src/materialeditor.cpp b/tools/editor/src/materialeditor.cpp index 35c3f34..c0f633d 100755 --- a/tools/editor/src/materialeditor.cpp +++ b/tools/editor/src/materialeditor.cpp @@ -137,7 +137,7 @@ void MaterialEditor::draw(CommonEditor* editor) { save_material(*material, path); }); } else { - save_material(*material, file::get_file_path(path)); + save_material(*material, prism::get_file_path(path)); } } diff --git a/tools/editor/src/prismeditor.cpp b/tools/editor/src/prismeditor.cpp index d825785..cccfa36 100755 --- a/tools/editor/src/prismeditor.cpp +++ b/tools/editor/src/prismeditor.cpp @@ -81,7 +81,7 @@ void prepPrefabScene() { scene->get(plane).position = Vector3(0, -1, 0); scene->get(plane).scale = Vector3(50); - scene->add(plane).mesh = assetm->get(file::app_domain / "models/plane.model"); + scene->add(plane).mesh = assetm->get(prism::app_domain / "models/plane.model"); prepThreePointLighting(); } @@ -96,8 +96,8 @@ Renderable* prepMaterialScene() { scene->get(plane).position = Vector3(0, -1, 0); scene->get(plane).scale = Vector3(50); - scene->add(plane).mesh = assetm->get(file::app_domain / "models/plane.model"); - scene->get(plane).materials.push_back(assetm->get(file::app_domain / "materials/Material.material")); + scene->add(plane).mesh = assetm->get(prism::app_domain / "models/plane.model"); + scene->get(plane).materials.push_back(assetm->get(prism::app_domain / "materials/Material.material")); auto sphere = scene->add_object(); scene->get(sphere).name = "sphere"; @@ -105,7 +105,7 @@ Renderable* prepMaterialScene() { scene->get(sphere).rotation = euler_to_quat(Vector3(radians(90.0f), 0, 0)); - scene->add(sphere).mesh = assetm->get(file::app_domain / "models/sphere.model"); + scene->add(sphere).mesh = assetm->get(prism::app_domain / "models/sphere.model"); prepThreePointLighting(); @@ -125,7 +125,7 @@ void PrismEditor::setup_editor(Editor* editor) { } -void PrismEditor::open_asset(const file::Path path) { +void PrismEditor::open_asset(const prism::Path path) { if(path.extension() == ".prefab") { PrefabEditor* editor = new PrefabEditor(); editor->path = path.string();