Rename Path -> path
This commit is contained in:
parent
01966c1d81
commit
fa65e99094
26 changed files with 110 additions and 112 deletions
|
@ -11,28 +11,28 @@
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
template <>
|
template <>
|
||||||
struct hash<prism::Path> {
|
struct hash<prism::path> {
|
||||||
std::size_t operator()(const prism::Path& k) const {
|
std::size_t operator()(const prism::path& k) const {
|
||||||
return (std::hash<std::string>()(k.string()));
|
return (std::hash<std::string>()(k.string()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
std::unique_ptr<T> load_asset(const prism::Path p);
|
std::unique_ptr<T> load_asset(const prism::path p);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool can_load_asset(const prism::Path p);
|
bool can_load_asset(const prism::path p);
|
||||||
|
|
||||||
template<class AssetType>
|
template<class AssetType>
|
||||||
using AssetStore = std::unordered_map<prism::Path, std::unique_ptr<AssetType>>;
|
using AssetStore = std::unordered_map<prism::path, std::unique_ptr<AssetType>>;
|
||||||
|
|
||||||
template<class... Assets>
|
template<class... Assets>
|
||||||
class AssetPool : public AssetStore<Assets>... {
|
class AssetPool : public AssetStore<Assets>... {
|
||||||
public:
|
public:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
AssetPtr<T> add() {
|
AssetPtr<T> add() {
|
||||||
const auto p = prism::Path();
|
const auto p = prism::path();
|
||||||
auto reference_block = get_reference_block(p);
|
auto reference_block = get_reference_block(p);
|
||||||
|
|
||||||
AssetStore<T>::try_emplace(p, std::make_unique<T>());
|
AssetStore<T>::try_emplace(p, std::make_unique<T>());
|
||||||
|
@ -41,7 +41,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
AssetPtr<T> get(const prism::Path path) {
|
AssetPtr<T> get(const prism::path path) {
|
||||||
return fetch<T>(path, get_reference_block(path));
|
return fetch<T>(path, get_reference_block(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,14 +58,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
AssetPtr<T> fetch(const prism::Path path, ReferenceBlock* reference_block) {
|
AssetPtr<T> fetch(const prism::path path, ReferenceBlock* reference_block) {
|
||||||
if(!AssetStore<T>::count(path))
|
if(!AssetStore<T>::count(path))
|
||||||
AssetStore<T>::try_emplace(path, load_asset<T>(path));
|
AssetStore<T>::try_emplace(path, load_asset<T>(path));
|
||||||
|
|
||||||
return AssetPtr<T>(AssetStore<T>::at(path).get(), reference_block);
|
return AssetPtr<T>(AssetStore<T>::at(path).get(), reference_block);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<Asset*, ReferenceBlock*> load_asset_generic(const prism::Path path) {
|
std::tuple<Asset*, ReferenceBlock*> load_asset_generic(const prism::path path) {
|
||||||
Asset* asset = nullptr;
|
Asset* asset = nullptr;
|
||||||
ReferenceBlock* block = nullptr;
|
ReferenceBlock* block = nullptr;
|
||||||
|
|
||||||
|
@ -88,10 +88,10 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unordered_map<prism::Path, std::unique_ptr<ReferenceBlock>> reference_blocks;
|
std::unordered_map<prism::path, std::unique_ptr<ReferenceBlock>> reference_blocks;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ReferenceBlock* get_reference_block(const prism::Path path) {
|
ReferenceBlock* get_reference_block(const prism::path path) {
|
||||||
if(!reference_blocks.count(path))
|
if(!reference_blocks.count(path))
|
||||||
reference_blocks.try_emplace(path, std::make_unique<ReferenceBlock>());
|
reference_blocks.try_emplace(path, std::make_unique<ReferenceBlock>());
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void load_asset_generic(const prism::Path path, Asset*& at, ReferenceBlock*& block) {
|
void load_asset_generic(const prism::path path, Asset*& at, ReferenceBlock*& block) {
|
||||||
if(can_load_asset<T>(path)) {
|
if(can_load_asset<T>(path)) {
|
||||||
if(!AssetStore<T>::count(path))
|
if(!AssetStore<T>::count(path))
|
||||||
AssetStore<T>::try_emplace(path, load_asset<T>(path));
|
AssetStore<T>::try_emplace(path, load_asset<T>(path));
|
||||||
|
@ -110,7 +110,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void delete_asset(const prism::Path path) {
|
void delete_asset(const prism::path path) {
|
||||||
auto iter = AssetStore<T>::find(path);
|
auto iter = AssetStore<T>::find(path);
|
||||||
if(iter != AssetStore<T>::end()) {
|
if(iter != AssetStore<T>::end()) {
|
||||||
auto& [_, asset] = *iter;
|
auto& [_, asset] = *iter;
|
||||||
|
@ -126,14 +126,14 @@ using AssetManager = AssetPool<Mesh, Material, Texture>;
|
||||||
|
|
||||||
inline std::unique_ptr<AssetManager> assetm;
|
inline std::unique_ptr<AssetManager> assetm;
|
||||||
|
|
||||||
std::unique_ptr<Mesh> load_mesh(const prism::Path path);
|
std::unique_ptr<Mesh> load_mesh(const prism::path path);
|
||||||
std::unique_ptr<Material> load_material(const prism::Path path);
|
std::unique_ptr<Material> load_material(const prism::path path);
|
||||||
std::unique_ptr<Texture> load_texture(const prism::Path path);
|
std::unique_ptr<Texture> load_texture(const prism::path path);
|
||||||
|
|
||||||
void save_material(Material* material, const prism::Path path);
|
void save_material(Material* material, const prism::path path);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
std::unique_ptr<T> load_asset(const prism::Path path) {
|
std::unique_ptr<T> load_asset(const prism::path path) {
|
||||||
if constexpr (std::is_same_v<T, Mesh>) {
|
if constexpr (std::is_same_v<T, Mesh>) {
|
||||||
return load_mesh(path);
|
return load_mesh(path);
|
||||||
} else if constexpr(std::is_same_v<T, Material>) {
|
} else if constexpr(std::is_same_v<T, Material>) {
|
||||||
|
@ -144,7 +144,7 @@ std::unique_ptr<T> load_asset(const prism::Path path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool can_load_asset(const prism::Path path) {
|
bool can_load_asset(const prism::path path) {
|
||||||
if constexpr(std::is_same_v<T, Mesh>) {
|
if constexpr(std::is_same_v<T, Mesh>) {
|
||||||
return path.extension() == ".model";
|
return path.extension() == ".model";
|
||||||
} else if constexpr(std::is_same_v<T, Material>) {
|
} else if constexpr(std::is_same_v<T, Material>) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "physics.hpp"
|
#include "physics.hpp"
|
||||||
#include "imgui_backend.hpp"
|
#include "imgui_backend.hpp"
|
||||||
|
|
||||||
std::unique_ptr<Mesh> load_mesh(const prism::Path path) {
|
std::unique_ptr<Mesh> load_mesh(const prism::path path) {
|
||||||
Expects(!path.empty());
|
Expects(!path.empty());
|
||||||
|
|
||||||
auto file = prism::open_file(path, true);
|
auto file = prism::open_file(path, true);
|
||||||
|
@ -185,7 +185,7 @@ std::unique_ptr<Mesh> load_mesh(const prism::Path path) {
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Texture> load_texture(const prism::Path path) {
|
std::unique_ptr<Texture> load_texture(const prism::path path) {
|
||||||
Expects(!path.empty());
|
Expects(!path.empty());
|
||||||
|
|
||||||
auto file = prism::open_file(path, true);
|
auto file = prism::open_file(path, true);
|
||||||
|
@ -242,7 +242,7 @@ std::unique_ptr<Texture> load_texture(const prism::Path path) {
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Material> load_material(const prism::Path path) {
|
std::unique_ptr<Material> load_material(const prism::path path) {
|
||||||
Expects(!path.empty());
|
Expects(!path.empty());
|
||||||
|
|
||||||
auto file = prism::open_file(path);
|
auto file = prism::open_file(path);
|
||||||
|
@ -331,7 +331,7 @@ std::unique_ptr<Material> load_material(const prism::Path path) {
|
||||||
return mat;
|
return mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void save_material(Material* material, const prism::Path path) {
|
void save_material(Material* material, const prism::path path) {
|
||||||
Expects(material != nullptr);
|
Expects(material != nullptr);
|
||||||
Expects(!path.empty());
|
Expects(!path.empty());
|
||||||
|
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
namespace audio {
|
namespace audio {
|
||||||
void initialize();
|
void initialize();
|
||||||
|
|
||||||
void play_file(const prism::Path path, const float gain = 1.0f);
|
void play_file(const prism::path path, const float gain = 1.0f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ void audio::initialize() {
|
||||||
Pa_StartStream(stream);
|
Pa_StartStream(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio::play_file(const prism::Path path, const float gain) {
|
void audio::play_file(const prism::path path, const float gain) {
|
||||||
auto audio_file = prism::open_file(path);
|
auto audio_file = prism::open_file(path);
|
||||||
if(audio_file == std::nullopt)
|
if(audio_file == std::nullopt)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -134,7 +134,7 @@ namespace prism {
|
||||||
@param path The scene file path.
|
@param path The scene file path.
|
||||||
@return Returns a instance of the scene is successful, and nullptr on failure.
|
@return Returns a instance of the scene is successful, and nullptr on failure.
|
||||||
*/
|
*/
|
||||||
Scene* load_scene(const prism::Path& path);
|
Scene* load_scene(const prism::path& path);
|
||||||
|
|
||||||
/** Save the current scene to disk.
|
/** Save the current scene to disk.
|
||||||
@param path The absolute file path.
|
@param path The absolute file path.
|
||||||
|
@ -145,7 +145,7 @@ namespace prism {
|
||||||
@param path The screen file path.
|
@param path The screen file path.
|
||||||
@return Returns a instance of the screen if successful, and nullptr on failure.
|
@return Returns a instance of the screen if successful, and nullptr on failure.
|
||||||
*/
|
*/
|
||||||
ui::Screen* load_screen(const prism::Path& path);
|
ui::Screen* load_screen(const prism::path& path);
|
||||||
|
|
||||||
/** Set the current screen.
|
/** Set the current screen.
|
||||||
@param screen The screen object to set as current. Can be null.
|
@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 path The prefab file path.
|
||||||
@param override_name If not empty, the root object's new name. Defaulted to a empty string.
|
@param override_name If not empty, the root object's new name. Defaulted to a empty string.
|
||||||
*/
|
*/
|
||||||
Object add_prefab(Scene& scene, const prism::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.
|
/** Save a tree of objects as a prefab to disk.
|
||||||
@param root The parent object to save as a prefab.
|
@param root The parent object to save as a prefab.
|
||||||
|
@ -180,12 +180,12 @@ namespace prism {
|
||||||
@param path The animation file path.
|
@param path The animation file path.
|
||||||
@return An animation.
|
@return An animation.
|
||||||
*/
|
*/
|
||||||
Animation load_animation(const prism::Path& path);
|
Animation load_animation(const prism::path& path);
|
||||||
|
|
||||||
/** Load a cutscene from disk. This changes the current cutscene.
|
/** Load a cutscene from disk. This changes the current cutscene.
|
||||||
@param path The cutscene file path.
|
@param path The cutscene file path.
|
||||||
*/
|
*/
|
||||||
void load_cutscene(const prism::Path& path);
|
void load_cutscene(const prism::path& path);
|
||||||
|
|
||||||
/** Saves the current cutscene to disk.
|
/** Saves the current cutscene to disk.
|
||||||
@param path The absolute file path.
|
@param path The absolute file path.
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace ui {
|
||||||
class Screen {
|
class Screen {
|
||||||
public:
|
public:
|
||||||
Screen() {}
|
Screen() {}
|
||||||
Screen(const prism::Path path);
|
Screen(const prism::path path);
|
||||||
|
|
||||||
void process_event(const std::string& type, std::string data = "");
|
void process_event(const std::string& type, std::string data = "");
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ void draw_shader_editor() {
|
||||||
if(ImGui::Button("Select Path")) {
|
if(ImGui::Button("Select Path")) {
|
||||||
platform::open_dialog(false, [](std::string path) {
|
platform::open_dialog(false, [](std::string path) {
|
||||||
// open_dialog() can't select folders yet, so use this as a workaround
|
// open_dialog() can't select folders yet, so use this as a workaround
|
||||||
options.shader_source_path = prism::Path(path).parent_path().string();
|
options.shader_source_path = prism::path(path).parent_path().string();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -186,11 +186,11 @@ void draw_shader_editor() {
|
||||||
|
|
||||||
if(!selected_shader.empty()) {
|
if(!selected_shader.empty()) {
|
||||||
if(loaded_shader_string.empty()) {
|
if(loaded_shader_string.empty()) {
|
||||||
prism::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());
|
shader_compiler.set_include_path(base_shader_path.string());
|
||||||
|
|
||||||
prism::Path shader_path = prism::Path(selected_shader);
|
prism::path shader_path = prism::path(selected_shader);
|
||||||
|
|
||||||
auto file = prism::open_file(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"));
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ void engine::create_empty_scene() {
|
||||||
current_scene = scenes.back().get();
|
current_scene = scenes.back().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Scene* engine::load_scene(const prism::Path& path) {
|
Scene* engine::load_scene(const prism::path& path) {
|
||||||
Expects(!path.empty());
|
Expects(!path.empty());
|
||||||
|
|
||||||
auto file = prism::open_file(path);
|
auto file = prism::open_file(path);
|
||||||
|
@ -191,7 +191,7 @@ void engine::save_scene(const std::string_view path) {
|
||||||
out << j;
|
out << j;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui::Screen* engine::load_screen(const prism::Path& path) {
|
ui::Screen* engine::load_screen(const prism::path& path) {
|
||||||
Expects(!path.empty());
|
Expects(!path.empty());
|
||||||
|
|
||||||
return new ui::Screen(path);
|
return new ui::Screen(path);
|
||||||
|
@ -224,7 +224,7 @@ AnimationChannel engine::load_animation(nlohmann::json a) {
|
||||||
return animation;
|
return animation;
|
||||||
}
|
}
|
||||||
|
|
||||||
Animation engine::load_animation(const prism::Path& path) {
|
Animation engine::load_animation(const prism::path& path) {
|
||||||
Expects(!path.empty());
|
Expects(!path.empty());
|
||||||
|
|
||||||
auto file = prism::open_file(path, true);
|
auto file = prism::open_file(path, true);
|
||||||
|
@ -282,7 +282,7 @@ Animation engine::load_animation(const prism::Path& path) {
|
||||||
return anim;
|
return anim;
|
||||||
}
|
}
|
||||||
|
|
||||||
void engine::load_cutscene(const prism::Path& path) {
|
void engine::load_cutscene(const prism::path& path) {
|
||||||
Expects(!path.empty());
|
Expects(!path.empty());
|
||||||
|
|
||||||
cutscene = std::make_unique<Cutscene>();
|
cutscene = std::make_unique<Cutscene>();
|
||||||
|
@ -359,7 +359,7 @@ void engine::save_cutscene(const std::string_view path) {
|
||||||
out << j;
|
out << j;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object engine::add_prefab(Scene& scene, const prism::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());
|
Expects(!path.empty());
|
||||||
|
|
||||||
auto file = prism::open_file(path);
|
auto file = prism::open_file(path);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "log.hpp"
|
#include "log.hpp"
|
||||||
#include "assertions.hpp"
|
#include "assertions.hpp"
|
||||||
|
|
||||||
prism::Path prism::root_path(const Path path) {
|
prism::path prism::root_path(const path path) {
|
||||||
auto p = path;
|
auto p = path;
|
||||||
while(p.parent_path() != p && p.parent_path() != "/") {
|
while(p.parent_path() != p && p.parent_path() != "/") {
|
||||||
p = p.parent_path();
|
p = p.parent_path();
|
||||||
|
@ -15,7 +15,7 @@ prism::Path prism::root_path(const Path path) {
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<prism::file> prism::open_file(const prism::Path path, const bool binary_mode) {
|
std::optional<prism::file> prism::open_file(const prism::path path, const bool binary_mode) {
|
||||||
Expects(!path.empty());
|
Expects(!path.empty());
|
||||||
|
|
||||||
auto str = get_file_path(path).string();
|
auto str = get_file_path(path).string();
|
||||||
|
@ -28,7 +28,7 @@ std::optional<prism::file> prism::open_file(const prism::Path path, const bool b
|
||||||
return prism::file(file);
|
return prism::file(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
prism::Path prism::get_file_path(const prism::Path& path) {
|
prism::path prism::get_file_path(const prism::path& path) {
|
||||||
auto fixed_path = path;
|
auto fixed_path = path;
|
||||||
auto root = root_path(path);
|
auto root = root_path(path);
|
||||||
if(root == app_domain) {
|
if(root == app_domain) {
|
||||||
|
@ -40,15 +40,15 @@ prism::Path prism::get_file_path(const prism::Path& path) {
|
||||||
return fixed_path;
|
return fixed_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
prism::Path prism::get_domain_path(const domain domain) {
|
prism::path prism::get_domain_path(const domain domain) {
|
||||||
return domain_data[static_cast<int>(domain)];
|
return domain_data[static_cast<int>(domain)];
|
||||||
}
|
}
|
||||||
|
|
||||||
prism::Path parent_domain(const prism::Path& path) {
|
prism::path parent_domain(const prism::path& path) {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
prism::Path prism::get_relative_path(const domain domain, const Path path) {
|
prism::path prism::get_relative_path(const domain domain, const path path) {
|
||||||
// unimplemented
|
// unimplemented
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ UIElement* ui::Screen::find_element(const std::string& id) {
|
||||||
return foundElement;
|
return foundElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui::Screen::Screen(const prism::Path path) {
|
ui::Screen::Screen(const prism::path path) {
|
||||||
auto file = prism::open_file(path);
|
auto file = prism::open_file(path);
|
||||||
if(!file.has_value()) {
|
if(!file.has_value()) {
|
||||||
prism::log::error(System::Core, "Failed to load UI from {}!", path);
|
prism::log::error(System::Core, "Failed to load UI from {}!", path);
|
||||||
|
|
|
@ -110,14 +110,14 @@ namespace prism {
|
||||||
@param mode The access mode.
|
@param mode The access mode.
|
||||||
@param path The absolute file path.
|
@param path The absolute file path.
|
||||||
*/
|
*/
|
||||||
void set_domain_path(domain domain, Path path);
|
void set_domain_path(domain domain, path domain_path);
|
||||||
Path get_domain_path(domain domain);
|
path get_domain_path(domain domain);
|
||||||
|
|
||||||
/// Converts an absolute path to a domain relative path.
|
/// Converts an absolute path to a domain relative path.
|
||||||
Path get_relative_path(domain domain, Path path);
|
path get_relative_path(domain domain, path domain_relative_path);
|
||||||
|
|
||||||
/// Returns the path to a writeable directory.
|
/// Returns the path to a writeable directory.
|
||||||
Path get_writeable_directory();
|
path get_writeable_directory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Opens a file handle.
|
Opens a file handle.
|
||||||
|
@ -126,12 +126,12 @@ namespace prism {
|
||||||
@param binary_mode Whether or not to open the file as binary or ASCII. Defaults to false.
|
@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.
|
@return An optional with a value if the file was loaded correctly, otherwise it's empty.
|
||||||
*/
|
*/
|
||||||
std::optional<file> open_file(Path path, bool binary_mode = false);
|
std::optional<file> open_file(path file_path, bool binary_mode = false);
|
||||||
|
|
||||||
Path root_path(Path path);
|
path root_path(path path);
|
||||||
Path get_file_path(const Path& path);
|
path get_file_path(const path& path);
|
||||||
|
|
||||||
inline Path internal_domain = "/internal", app_domain = "/app";
|
inline path internal_domain = "/internal", app_domain = "/app";
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::array<std::string, 3> domain_data;
|
inline std::array<std::string, 3> domain_data;
|
||||||
|
|
|
@ -28,9 +28,9 @@ DoFPass::DoFPass(GFX* gfx, prism::renderer* renderer) : renderer(renderer) {
|
||||||
height_constant.value = extent.height;
|
height_constant.value = extent.height;
|
||||||
|
|
||||||
GFXGraphicsPipelineCreateInfo create_info = {};
|
GFXGraphicsPipelineCreateInfo create_info = {};
|
||||||
create_info.shaders.vertex_src = ShaderSource(prism::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.vertex_constants = {width_constant, height_constant};
|
||||||
create_info.shaders.fragment_src = ShaderSource(prism::Path("dof.frag"));
|
create_info.shaders.fragment_src = ShaderSource(prism::path("dof.frag"));
|
||||||
|
|
||||||
create_info.shader_input.bindings = {
|
create_info.shader_input.bindings = {
|
||||||
{0, GFXBindingType::StorageImage},
|
{0, GFXBindingType::StorageImage},
|
||||||
|
|
|
@ -23,8 +23,8 @@ void ImGuiPass::create_render_target_resources(RenderTarget& target) {
|
||||||
if(pipeline == nullptr) {
|
if(pipeline == nullptr) {
|
||||||
GFXGraphicsPipelineCreateInfo createInfo;
|
GFXGraphicsPipelineCreateInfo createInfo;
|
||||||
createInfo.label = "ImGui";
|
createInfo.label = "ImGui";
|
||||||
createInfo.shaders.vertex_src = ShaderSource(prism::Path("imgui.vert"));
|
createInfo.shaders.vertex_src = ShaderSource(prism::path("imgui.vert"));
|
||||||
createInfo.shaders.fragment_src = ShaderSource(prism::Path("imgui.frag"));
|
createInfo.shaders.fragment_src = ShaderSource(prism::path("imgui.frag"));
|
||||||
|
|
||||||
GFXVertexInput vertexInput = {};
|
GFXVertexInput vertexInput = {};
|
||||||
vertexInput.stride = sizeof(ImDrawVert);
|
vertexInput.stride = sizeof(ImDrawVert);
|
||||||
|
|
|
@ -144,8 +144,8 @@ void renderer::resize_render_target(RenderTarget& target, const prism::Extent ex
|
||||||
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
||||||
pipelineInfo.label = "Text";
|
pipelineInfo.label = "Text";
|
||||||
|
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("text.vert"));
|
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("text.vert"));
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("text.frag"));
|
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("text.frag"));
|
||||||
|
|
||||||
pipelineInfo.rasterization.primitive_type = GFXPrimitiveType::TriangleStrip;
|
pipelineInfo.rasterization.primitive_type = GFXPrimitiveType::TriangleStrip;
|
||||||
|
|
||||||
|
@ -718,8 +718,8 @@ void renderer::create_mesh_pipeline(Material& material) const {
|
||||||
|
|
||||||
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
||||||
pipelineInfo.label = "Mesh";
|
pipelineInfo.label = "Mesh";
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("mesh.vert"));
|
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("mesh.vert"));
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("mesh.frag"));
|
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("mesh.frag"));
|
||||||
|
|
||||||
pipelineInfo.shaders.vertex_constants = {materials_constant, lights_constant, spot_lights_constant, probes_constant};
|
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};
|
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 = {};
|
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
||||||
pipelineInfo.label = "Post";
|
pipelineInfo.label = "Post";
|
||||||
|
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("post.vert"));
|
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("post.vert"));
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("post.frag"));
|
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("post.frag"));
|
||||||
|
|
||||||
pipelineInfo.shader_input.bindings = {
|
pipelineInfo.shader_input.bindings = {
|
||||||
{4, GFXBindingType::PushConstant},
|
{4, GFXBindingType::PushConstant},
|
||||||
|
@ -841,8 +841,8 @@ void renderer::create_post_pipelines() {
|
||||||
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
||||||
pipelineInfo.label = "Post";
|
pipelineInfo.label = "Post";
|
||||||
|
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("post.vert"));
|
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("post.vert"));
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("post.frag"));
|
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("post.frag"));
|
||||||
|
|
||||||
pipelineInfo.shader_input.bindings = {
|
pipelineInfo.shader_input.bindings = {
|
||||||
{4, GFXBindingType::PushConstant},
|
{4, GFXBindingType::PushConstant},
|
||||||
|
@ -920,8 +920,8 @@ void renderer::create_ui_pipelines() {
|
||||||
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
||||||
pipelineInfo.label = "UI";
|
pipelineInfo.label = "UI";
|
||||||
|
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("ui.vert"));
|
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("ui.vert"));
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("ui.frag"));
|
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("ui.frag"));
|
||||||
|
|
||||||
pipelineInfo.rasterization.primitive_type = GFXPrimitiveType::TriangleStrip;
|
pipelineInfo.rasterization.primitive_type = GFXPrimitiveType::TriangleStrip;
|
||||||
|
|
||||||
|
@ -959,8 +959,8 @@ void renderer::generate_brdf() {
|
||||||
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
||||||
pipelineInfo.label = "BRDF";
|
pipelineInfo.label = "BRDF";
|
||||||
|
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("brdf.vert"));
|
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("brdf.vert"));
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("brdf.frag"));
|
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("brdf.frag"));
|
||||||
|
|
||||||
pipelineInfo.render_pass = brdf_render_pass;
|
pipelineInfo.render_pass = brdf_render_pass;
|
||||||
|
|
||||||
|
@ -1006,7 +1006,7 @@ void renderer::generate_brdf() {
|
||||||
|
|
||||||
void renderer::create_histogram_resources() {
|
void renderer::create_histogram_resources() {
|
||||||
GFXComputePipelineCreateInfo create_info = {};
|
GFXComputePipelineCreateInfo create_info = {};
|
||||||
create_info.compute_src = ShaderSource(prism::Path("histogram.comp"));
|
create_info.compute_src = ShaderSource(prism::path("histogram.comp"));
|
||||||
create_info.workgroup_size_x = 16;
|
create_info.workgroup_size_x = 16;
|
||||||
create_info.workgroup_size_y = 16;
|
create_info.workgroup_size_y = 16;
|
||||||
|
|
||||||
|
@ -1022,7 +1022,7 @@ void renderer::create_histogram_resources() {
|
||||||
|
|
||||||
histogram_pipeline = gfx->create_compute_pipeline(create_info);
|
histogram_pipeline = gfx->create_compute_pipeline(create_info);
|
||||||
|
|
||||||
create_info.compute_src = ShaderSource(prism::Path("histogram-average.comp"));
|
create_info.compute_src = ShaderSource(prism::path("histogram-average.comp"));
|
||||||
create_info.workgroup_size_x = 256;
|
create_info.workgroup_size_x = 256;
|
||||||
create_info.workgroup_size_y = 1;
|
create_info.workgroup_size_y = 1;
|
||||||
|
|
||||||
|
@ -1055,15 +1055,15 @@ ShaderSource renderer::register_shader(const std::string_view shader_file) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
prism::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 shader editor system is not initialized, use prebuilt shaders
|
||||||
if(base_shader_path.empty())
|
if(base_shader_path.empty())
|
||||||
return ShaderSource(prism::Path(shader_file));
|
return ShaderSource(prism::path(shader_file));
|
||||||
|
|
||||||
shader_compiler.set_include_path(base_shader_path.string());
|
shader_compiler.set_include_path(base_shader_path.string());
|
||||||
|
|
||||||
prism::Path shader_path = prism::Path(shader_file);
|
prism::path shader_path = prism::path(shader_file);
|
||||||
|
|
||||||
ShaderStage stage = ShaderStage::Vertex;
|
ShaderStage stage = ShaderStage::Vertex;
|
||||||
if(shader_path.extension() == ".vert")
|
if(shader_path.extension() == ".vert")
|
||||||
|
|
|
@ -407,8 +407,8 @@ void SceneCapture::createSkyResources() {
|
||||||
pipelineInfo.label = "Sky Scene Capture";
|
pipelineInfo.label = "Sky Scene Capture";
|
||||||
pipelineInfo.render_pass = renderPass;
|
pipelineInfo.render_pass = renderPass;
|
||||||
|
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("sky.vert"));
|
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("sky.vert"));
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("sky.frag"));
|
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("sky.frag"));
|
||||||
|
|
||||||
pipelineInfo.shader_input.bindings = {
|
pipelineInfo.shader_input.bindings = {
|
||||||
{1, GFXBindingType::PushConstant}
|
{1, GFXBindingType::PushConstant}
|
||||||
|
@ -451,8 +451,8 @@ void SceneCapture::createIrradianceResources() {
|
||||||
|
|
||||||
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
||||||
pipelineInfo.label = "Irradiance Convolution";
|
pipelineInfo.label = "Irradiance Convolution";
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("irradiance.vert"));
|
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("irradiance.vert"));
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("irradiance.frag"));
|
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("irradiance.frag"));
|
||||||
|
|
||||||
GFXVertexInput input;
|
GFXVertexInput input;
|
||||||
input.stride = sizeof(Vector3);
|
input.stride = sizeof(Vector3);
|
||||||
|
@ -503,8 +503,8 @@ void SceneCapture::createPrefilterResources() {
|
||||||
|
|
||||||
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
||||||
pipelineInfo.label = "Prefilter";
|
pipelineInfo.label = "Prefilter";
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("filter.vert"));
|
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("filter.vert"));
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("filter.frag"));
|
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("filter.frag"));
|
||||||
|
|
||||||
pipelineInfo.shaders.fragment_constants = {size_constant};
|
pipelineInfo.shaders.fragment_constants = {size_constant};
|
||||||
|
|
||||||
|
|
|
@ -320,7 +320,7 @@ void ShadowPass::create_pipelines() {
|
||||||
|
|
||||||
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
||||||
pipelineInfo.shaders.vertex_constants = {point_light_max_constant};
|
pipelineInfo.shaders.vertex_constants = {point_light_max_constant};
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("shadow.vert"));
|
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("shadow.vert"));
|
||||||
|
|
||||||
pipelineInfo.shaders.fragment_constants = { point_light_max_constant };
|
pipelineInfo.shaders.fragment_constants = { point_light_max_constant };
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ void ShadowPass::create_pipelines() {
|
||||||
{
|
{
|
||||||
pipelineInfo.label = "Point Shadow";
|
pipelineInfo.label = "Point Shadow";
|
||||||
|
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("omnishadow.frag"));
|
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("omnishadow.frag"));
|
||||||
|
|
||||||
auto [static_pipeline, skinned_pipeline] = material_compiler.create_pipeline_permutations(pipelineInfo, true);
|
auto [static_pipeline, skinned_pipeline] = material_compiler.create_pipeline_permutations(pipelineInfo, true);
|
||||||
|
|
||||||
|
|
|
@ -137,8 +137,8 @@ void SMAAPass::create_pipelines() {
|
||||||
|
|
||||||
GFXGraphicsPipelineCreateInfo createInfo = {};
|
GFXGraphicsPipelineCreateInfo createInfo = {};
|
||||||
createInfo.label = "SMAA Edge";
|
createInfo.label = "SMAA Edge";
|
||||||
createInfo.shaders.vertex_src = ShaderSource(prism::Path("edge.vert"));
|
createInfo.shaders.vertex_src = ShaderSource(prism::path("edge.vert"));
|
||||||
createInfo.shaders.fragment_src = ShaderSource(prism::Path("edge.frag"));
|
createInfo.shaders.fragment_src = ShaderSource(prism::path("edge.frag"));
|
||||||
|
|
||||||
createInfo.render_pass = render_pass;
|
createInfo.render_pass = render_pass;
|
||||||
|
|
||||||
|
@ -155,8 +155,8 @@ void SMAAPass::create_pipelines() {
|
||||||
edge_pipeline = gfx->create_graphics_pipeline(createInfo);
|
edge_pipeline = gfx->create_graphics_pipeline(createInfo);
|
||||||
|
|
||||||
createInfo.label = "SMAA Blend";
|
createInfo.label = "SMAA Blend";
|
||||||
createInfo.shaders.vertex_src = ShaderSource(prism::Path("blend.vert"));
|
createInfo.shaders.vertex_src = ShaderSource(prism::path("blend.vert"));
|
||||||
createInfo.shaders.fragment_src = ShaderSource(prism::Path("blend.frag"));
|
createInfo.shaders.fragment_src = ShaderSource(prism::path("blend.frag"));
|
||||||
createInfo.shader_input.bindings.push_back({3, GFXBindingType::Texture});
|
createInfo.shader_input.bindings.push_back({3, GFXBindingType::Texture});
|
||||||
|
|
||||||
blend_pipeline = gfx->create_graphics_pipeline(createInfo);
|
blend_pipeline = gfx->create_graphics_pipeline(createInfo);
|
||||||
|
|
|
@ -43,13 +43,13 @@ public:
|
||||||
ShaderSource(const ShaderSource& rhs) : source (rhs.source) {}
|
ShaderSource(const ShaderSource& rhs) : source (rhs.source) {}
|
||||||
explicit ShaderSource(const std::string& source_string) : source(source_string) {}
|
explicit ShaderSource(const std::string& source_string) : source(source_string) {}
|
||||||
explicit ShaderSource(const std::vector<uint32_t>& source_bytecode) : source(source_bytecode) {}
|
explicit ShaderSource(const std::vector<uint32_t>& source_bytecode) : source(source_bytecode) {}
|
||||||
explicit ShaderSource(const prism::Path& shader_path) : source(shader_path) {}
|
explicit ShaderSource(const prism::path& shader_path) : source(shader_path) {}
|
||||||
|
|
||||||
std::variant<std::monostate, prism::Path, std::string, std::vector<uint32_t>> source;
|
std::variant<std::monostate, prism::path, std::string, std::vector<uint32_t>> source;
|
||||||
|
|
||||||
/// Returns a view of the shader source as a path.
|
/// Returns a view of the shader source as a path.
|
||||||
[[nodiscard]] prism::Path as_path() const {
|
[[nodiscard]] prism::path as_path() const {
|
||||||
return std::get<prism::Path>(source);
|
return std::get<prism::path>(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a view of the shader source as plaintext.
|
/// Returns a view of the shader source as plaintext.
|
||||||
|
@ -67,7 +67,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] bool is_path() const {
|
[[nodiscard]] bool is_path() const {
|
||||||
return std::holds_alternative<prism::Path>(source);
|
return std::holds_alternative<prism::path>(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] bool is_string() const {
|
[[nodiscard]] bool is_string() const {
|
||||||
|
|
|
@ -3,12 +3,10 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
namespace prism {
|
#include "path.hpp"
|
||||||
using Path = std::filesystem::path;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace prism::log {
|
namespace prism::log {
|
||||||
inline void internal_format(std::string& msg, const prism::Path& arg) {
|
inline void internal_format(std::string& msg, const prism::path& arg) {
|
||||||
auto pos = msg.find_first_of("{}");
|
auto pos = msg.find_first_of("{}");
|
||||||
msg.replace(pos, 2, arg.string());
|
msg.replace(pos, 2, arg.string());
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
namespace prism {
|
namespace prism {
|
||||||
using Path = std::filesystem::path;
|
using path = std::filesystem::path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
#include "string_utils.hpp"
|
#include "string_utils.hpp"
|
||||||
|
|
||||||
void prism::set_domain_path(const prism::domain domain, const prism::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}/", "");
|
domain_data[(int)domain] = replace_substring(path.string(), "{resource_dir}/", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
prism::Path prism::get_writeable_directory() {
|
prism::path prism::get_writeable_directory() {
|
||||||
return "~";
|
return "~";
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GFXTexture* get_asset_thumbnail(const prism::Path path) {
|
GFXTexture* get_asset_thumbnail(const prism::path path) {
|
||||||
if(asset_thumbnails.count(path.string())) {
|
if(asset_thumbnails.count(path.string())) {
|
||||||
return asset_thumbnails[path.string()];
|
return asset_thumbnails[path.string()];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -723,7 +723,7 @@ void CommonEditor::set_undo_stack(UndoStack *stack) {
|
||||||
current_stack = stack;
|
current_stack = stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mesh_readable(const prism::Path path) {
|
bool mesh_readable(const prism::path path) {
|
||||||
auto file = prism::open_file(path);
|
auto file = prism::open_file(path);
|
||||||
if(!file.has_value()) {
|
if(!file.has_value()) {
|
||||||
prism::log::error(System::Renderer, "Failed to load mesh from {}!", path);
|
prism::log::error(System::Renderer, "Failed to load mesh from {}!", path);
|
||||||
|
@ -736,7 +736,7 @@ bool mesh_readable(const prism::Path path) {
|
||||||
return version == 5 || version == 6;
|
return version == 5 || version == 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool material_readable(const prism::Path path) {
|
bool material_readable(const prism::path path) {
|
||||||
auto file = prism::open_file(path);
|
auto file = prism::open_file(path);
|
||||||
if(!file.has_value()) {
|
if(!file.has_value()) {
|
||||||
prism::log::error(System::Core, "Failed to load material from {}!", path);
|
prism::log::error(System::Core, "Failed to load material from {}!", path);
|
||||||
|
|
|
@ -21,8 +21,8 @@ void DebugPass::initialize() {
|
||||||
|
|
||||||
{
|
{
|
||||||
GFXGraphicsPipelineCreateInfo createInfo;
|
GFXGraphicsPipelineCreateInfo createInfo;
|
||||||
createInfo.shaders.vertex_src = ShaderSource(prism::Path("debug.vert"));
|
createInfo.shaders.vertex_src = ShaderSource(prism::path("debug.vert"));
|
||||||
createInfo.shaders.fragment_src = ShaderSource(prism::Path("debug.frag"));
|
createInfo.shaders.fragment_src = ShaderSource(prism::path("debug.frag"));
|
||||||
|
|
||||||
GFXVertexInput vertexInput = {};
|
GFXVertexInput vertexInput = {};
|
||||||
vertexInput.stride = sizeof(Vector3);
|
vertexInput.stride = sizeof(Vector3);
|
||||||
|
@ -69,8 +69,8 @@ void DebugPass::initialize() {
|
||||||
// pipeline
|
// pipeline
|
||||||
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
||||||
|
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("color.vert"));
|
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("color.vert"));
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("color.frag"));
|
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("color.frag"));
|
||||||
|
|
||||||
GFXVertexInput input;
|
GFXVertexInput input;
|
||||||
input.stride = sizeof(Vector3);
|
input.stride = sizeof(Vector3);
|
||||||
|
@ -110,8 +110,8 @@ void DebugPass::initialize() {
|
||||||
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
||||||
pipelineInfo.label = "Sobel";
|
pipelineInfo.label = "Sobel";
|
||||||
|
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("color.vert"));
|
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("color.vert"));
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("color.frag"));
|
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("color.frag"));
|
||||||
|
|
||||||
GFXVertexInput input;
|
GFXVertexInput input;
|
||||||
input.stride = sizeof(Vector3);
|
input.stride = sizeof(Vector3);
|
||||||
|
@ -142,8 +142,8 @@ void DebugPass::initialize() {
|
||||||
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
GFXGraphicsPipelineCreateInfo pipelineInfo = {};
|
||||||
pipelineInfo.label = "Billboard";
|
pipelineInfo.label = "Billboard";
|
||||||
|
|
||||||
pipelineInfo.shaders.vertex_src = ShaderSource(prism::Path("billboard.vert"));
|
pipelineInfo.shaders.vertex_src = ShaderSource(prism::path("billboard.vert"));
|
||||||
pipelineInfo.shaders.fragment_src = ShaderSource(prism::Path("billboard.frag"));
|
pipelineInfo.shaders.fragment_src = ShaderSource(prism::path("billboard.frag"));
|
||||||
|
|
||||||
pipelineInfo.shader_input.bindings = {
|
pipelineInfo.shader_input.bindings = {
|
||||||
{1, GFXBindingType::PushConstant},
|
{1, GFXBindingType::PushConstant},
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
void asset_selected(std::filesystem::path path, AssetType type) override;
|
void asset_selected(std::filesystem::path path, AssetType type) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void open_asset(const prism::Path path);
|
void open_asset(const prism::path path);
|
||||||
void setup_editor(Editor* editor);
|
void setup_editor(Editor* editor);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ void PrismEditor::setup_editor(Editor* editor) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrismEditor::open_asset(const prism::Path path) {
|
void PrismEditor::open_asset(const prism::path path) {
|
||||||
if(path.extension() == ".prefab") {
|
if(path.extension() == ".prefab") {
|
||||||
PrefabEditor* editor = new PrefabEditor();
|
PrefabEditor* editor = new PrefabEditor();
|
||||||
editor->path = path.string();
|
editor->path = path.string();
|
||||||
|
|
Reference in a new issue