Skip to content

Commit

Permalink
Update libgui dep
Browse files Browse the repository at this point in the history
  • Loading branch information
dvsku committed Jun 28, 2024
1 parent 7cfe878 commit 4bd6c0f
Show file tree
Hide file tree
Showing 41 changed files with 82 additions and 86 deletions.
2 changes: 1 addition & 1 deletion dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SET(FETCHCONTENT_UPDATES_DISCONNECTED ON)

FetchContent_Declare(
libgui
URL https://github.com/dvsku/libgui/archive/34d97c845decb81a94ec938c1164b1ab25356510.zip
URL https://github.com/dvsku/libgui/archive/65b5c4d51f3428bbe292b77cb5f6e4be482800a6.zip
)

FetchContent_MakeAvailable(libgui)
Expand Down
7 changes: 4 additions & 3 deletions source/devue_app/src/devue_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ using namespace devue;
using namespace devue::core;

INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, INT nCmdShow) {
dvsku::util_log::settings log_settings;
log_settings.level = dvsku::util_log::level::debug;
libutil::log::settings log_settings;
log_settings.log_to_console = false;
log_settings.level = libutil::log::level::debug;

dvsku::util_log::init(log_settings);
libutil::log::init(log_settings);

libgui::window_settings settings;
settings.width = 1360U;
Expand Down
6 changes: 3 additions & 3 deletions source/devue_app/src/dv_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ bool dv_app::prepare() {
return false;
}

dvsku::uuid checkerboard_uuid = create_checkerboard_texture();
libutil::uuid checkerboard_uuid = create_checkerboard_texture();
if (!checkerboard_uuid) {
DV_LOG_ERRO("", "Failed to create checkerboard texture.");
return false;
Expand Down Expand Up @@ -343,7 +343,7 @@ void dv_app::on_drop(int count, const char* paths[]) {
}
}

dvsku::uuid dv_app::create_checkerboard_texture() {
libutil::uuid dv_app::create_checkerboard_texture() {
plugins::devue_plugin_texture ptexture;
ptexture.width = 4;
ptexture.height = 4;
Expand All @@ -356,7 +356,7 @@ dvsku::uuid dv_app::create_checkerboard_texture() {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
};

dvsku::uuid uuid = dvsku::util_uuid::create("checkerboard");
libutil::uuid uuid = libutil::create_uuid("checkerboard");

try {
if (m_systems.texture.textures.contains(uuid))
Expand Down
2 changes: 1 addition & 1 deletion source/devue_app/src/dv_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ namespace devue {
bool m_title_bar_hit_test = false;

private:
dvsku::uuid create_checkerboard_texture();
libutil::uuid create_checkerboard_texture();
};
}
8 changes: 4 additions & 4 deletions source/devue_app/src/gui/components/dv_comp_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ using namespace devue;
dv_comp_console::dv_comp_console(dv_systems* systems, dv_components* components)
: dv_comp(systems, components)
{
dvsku::util_log::create_source("gui_console", &m_text);
libutil::log::create_stream("gui_console");
}

dv_comp_console::~dv_comp_console() {
dvsku::util_log::remove_source("gui_console");
libutil::log::remove_stream("gui_console");
}

libgui::command::state dv_comp_console::render() {
bool* visible = &m_systems->command.is_set_to_execute(dv_commands::flag_show_console);

if(ImGui::Begin("Console##Window", visible, ImGuiWindowFlags_HorizontalScrollbar)) {
auto view = m_text.view();
ImGui::TextUnformatted(view.data(), view.data() + view.length());
auto content = libutil::log::get_stream_content("gui_console");
ImGui::TextUnformatted(content.c_str());
}
ImGui::End();

Expand Down
3 changes: 0 additions & 3 deletions source/devue_app/src/gui/components/dv_comp_console.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@ namespace devue {

public:
libgui::command::state render();

private:
std::stringstream m_text;
};
}
4 changes: 2 additions & 2 deletions source/devue_app/src/gui/components/dv_comp_meshes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void dv_comp_meshes::render() {
}

void dv_comp_meshes::render_model() {
dvsku::uuid uuid = m_systems->properties.get_inspected().inspected_id;
libutil::uuid uuid = m_systems->properties.get_inspected().inspected_id;

if (!m_systems->model.models.contains(uuid)) return;
core::dv_model& model = m_systems->model.models[uuid];
Expand All @@ -70,7 +70,7 @@ void dv_comp_meshes::render_model() {
}

void dv_comp_meshes::render_scene_model() {
dvsku::uuid uuid = m_systems->properties.get_inspected().inspected_id;
libutil::uuid uuid = m_systems->properties.get_inspected().inspected_id;

if (!m_systems->scene.current_scene) return;
if (!m_systems->scene.current_scene->models.contains(uuid)) return;
Expand Down
2 changes: 1 addition & 1 deletion source/devue_app/src/gui/components/dv_comp_meshes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace devue {
void render();

private:
dvsku::uuid m_current_mesh_id = 0U;
libutil::uuid m_current_mesh_id = 0U;

private:
void render_model();
Expand Down
4 changes: 2 additions & 2 deletions source/devue_app/src/gui/components/dv_comp_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void dv_comp_properties::render() {
}

void dv_comp_properties::render_model() {
dvsku::uuid uuid = m_systems->properties.get_inspected().inspected_id;
libutil::uuid uuid = m_systems->properties.get_inspected().inspected_id;

if (!m_systems->model.models.contains(uuid)) return;
core::dv_model& model = m_systems->model.models[uuid];
Expand All @@ -41,7 +41,7 @@ void dv_comp_properties::render_model() {
}

void dv_comp_properties::render_scene_model() {
dvsku::uuid uuid = m_systems->properties.get_inspected().inspected_id;
libutil::uuid uuid = m_systems->properties.get_inspected().inspected_id;

if (!m_systems->scene.current_scene) return;
if (!m_systems->scene.current_scene->models.contains(uuid)) return;
Expand Down
2 changes: 1 addition & 1 deletion source/devue_app/src/gui/components/dv_comp_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ libgui::command::state dv_comp_texture::render() {
return libgui::command::state::repeat;
}

void dv_comp_texture::set_texture(dvsku::uuid uuid, const std::string& name) {
void dv_comp_texture::set_texture(libutil::uuid uuid, const std::string& name) {
m_texture_uuid = uuid;
m_texture_name = name;
}
6 changes: 3 additions & 3 deletions source/devue_app/src/gui/components/dv_comp_texture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ namespace devue {
public:
libgui::command::state render();

void set_texture(dvsku::uuid uuid, const std::string& name);
void set_texture(libutil::uuid uuid, const std::string& name);

private:
dvsku::uuid m_texture_uuid = 0U;
std::string m_texture_name = "";
libutil::uuid m_texture_uuid = 0U;
std::string m_texture_name = "";
};
}
2 changes: 1 addition & 1 deletion source/devue_app/src/gui/dv_components.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace devue {
dv_modal_plugins modal_plugins;
dv_modal_about modal_about;

dvsku::uuid checkerboard_uuid = 0U;
libutil::uuid checkerboard_uuid = 0U;

dv_components() = delete;
dv_components(dv_systems* systems);
Expand Down
4 changes: 2 additions & 2 deletions source/devue_app/src/gui/modals/dv_modal_plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ libgui::command::state dv_modal_plugins::render() {
for (size_t i = 0; i < plugin.supported_model_types.size(); i++) {
ss << plugin.supported_model_types[i].name << " ";
ss << "(";
ss << dvsku::util_string::replace(plugin.supported_model_types[i].extensions, ";", " ");
ss << libutil::string::replace(plugin.supported_model_types[i].extensions, ";", " ");
ss << ")";

if (i != plugin.supported_model_types.size() - 1)
Expand All @@ -60,7 +60,7 @@ libgui::command::state dv_modal_plugins::render() {
for (size_t i = 0; i < plugin.supported_texture_types.size(); i++) {
ss << plugin.supported_texture_types[i].name << " ";
ss << "(";
ss << dvsku::util_string::replace(plugin.supported_texture_types[i].extensions, ";", " ");
ss << libutil::string::replace(plugin.supported_texture_types[i].extensions, ";", " ");
ss << ")";

if (i != plugin.supported_texture_types.size() - 1)
Expand Down
6 changes: 3 additions & 3 deletions source/devue_app/src/gui/modals/dv_modal_plugins.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace devue {
libgui::command::state render();

private:
dvsku::uuid m_current_plugin_id = 0U;
std::string m_supported_model_types = "";
std::string m_supported_texture_types = "";
libutil::uuid m_current_plugin_id = 0U;
std::string m_supported_model_types = "";
std::string m_supported_texture_types = "";
};
}
2 changes: 1 addition & 1 deletion source/devue_app/src/systems/dv_sys_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const inspectable& devue::dv_sys_properties::get_inspected() {
return m_current_inspectable;
}

void dv_sys_properties::inspect(inspectable::type type, dvsku::uuid id) {
void dv_sys_properties::inspect(inspectable::type type, libutil::uuid id) {
m_current_inspectable.inspected_type = type;
m_current_inspectable.inspected_id = id;
}
4 changes: 2 additions & 2 deletions source/devue_app/src/systems/dv_sys_properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace devue {
};

inspectable::type inspected_type = inspectable::type::none;
dvsku::uuid inspected_id = 0U;
libutil::uuid inspected_id = 0U;
};

class dv_sys_properties {
Expand Down Expand Up @@ -58,6 +58,6 @@ namespace devue {
std::unordered_map<std::type_index, inspectable::type> m_supported_types;

private:
void inspect(inspectable::type type = inspectable::type::none, dvsku::uuid id = 0U);
void inspect(inspectable::type type = inspectable::type::none, libutil::uuid id = 0U);
};
}
2 changes: 1 addition & 1 deletion source/devue_core/src/exceptions/dv_exception.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace devue::core {
#define DV_THROW_EXCEPTION(fmt, ...) \
throw devue::core::dv_exception(dvsku::util_string::format(fmt, __VA_ARGS__))
throw devue::core::dv_exception(libutil::string::format(fmt, __VA_ARGS__))

class dv_exception : public std::runtime_error {
public:
Expand Down
6 changes: 3 additions & 3 deletions source/devue_core/src/models/pdo/dv_mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

namespace devue::core {
struct dv_mesh {
std::string name = "";
dvsku::uuid uuid = 0U;
dvsku::uuid material_uuid = 0U;
std::string name = "";
libutil::uuid uuid = 0U;
libutil::uuid material_uuid = 0U;

std::vector<glm::u32vec3> faces;

Expand Down
10 changes: 5 additions & 5 deletions source/devue_core/src/models/pdo/dv_model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

namespace devue::core {
struct dv_model {
dvsku::uuid uuid = 0U;
libutil::uuid uuid = 0U;

std::string name = "";
std::filesystem::path texture_dir = "";

dv_skeleton skeleton;
std::vector<dv_vertex> vertices;
std::unordered_map<dvsku::uuid, dv_mesh> meshes;
std::unordered_map<dvsku::uuid, dv_material> materials;
dv_skeleton skeleton;
std::vector<dv_vertex> vertices;
std::unordered_map<libutil::uuid, dv_mesh> meshes;
std::unordered_map<libutil::uuid, dv_material> materials;

dv_bounding_box bounding_box;

Expand Down
3 changes: 1 addition & 2 deletions source/devue_core/src/scene/dv_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
#include "glm/gtc/matrix_transform.hpp"

using namespace devue::core;
using namespace dvsku;

dv_camera::dv_camera() {
uuid = util_uuid::create();
uuid = libutil::create_uuid();

// Call transformations to apply initial values
translate(0.0f, 0.0f);
Expand Down
2 changes: 1 addition & 1 deletion source/devue_core/src/scene/dv_camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace devue::core {
class dv_camera {
public:
dvsku::uuid uuid = 0U;
libutil::uuid uuid = 0U;

float speed_translate = 0.005f;
float speed_rotate = 0.1f;
Expand Down
4 changes: 2 additions & 2 deletions source/devue_core/src/scene/dv_scene.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
namespace devue::core {
class dv_scene {
public:
dvsku::uuid uuid = 0U;
libutil::uuid uuid = 0U;

dv_camera camera;
dv_lighting lighting;
dv_scene_grid grid;
std::unordered_map<dvsku::uuid, dv_scene_model> models;
std::unordered_map<libutil::uuid, dv_scene_model> models;

dv_scene() = default;
dv_scene(const dv_scene&) = delete;
Expand Down
2 changes: 1 addition & 1 deletion source/devue_core/src/scene/dv_scene_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ dv_scene_grid::dv_scene_grid() {
mesh.faces.push_back({ 0, 1, 2 });
mesh.faces.push_back({ 2, 3, 0 });

model.meshes[dvsku::util_uuid::create("grid")] = mesh;
model.meshes[libutil::create_uuid("grid")] = mesh;
}
4 changes: 2 additions & 2 deletions source/devue_core/src/scene/lighting/dv_light.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

namespace devue::core {
struct dv_light {
dvsku::uuid uuid = 0U;
libutil::uuid uuid = 0U;

glm::vec3 color = { 1.0f, 1.0f, 1.0f };
float intensity = 1.0f;

bool is_enabled = true;

dv_light() {
uuid = dvsku::util_uuid::create();
uuid = libutil::create_uuid();
}

virtual glm::vec3 get_light_color() {
Expand Down
2 changes: 1 addition & 1 deletion source/devue_core/src/scene/model/dv_scene_material.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

namespace devue::core {
struct dv_scene_material {
dvsku::uuid diffuse_texture_uuid = 0U;
libutil::uuid diffuse_texture_uuid = 0U;
};
}
4 changes: 2 additions & 2 deletions source/devue_core/src/scene/model/dv_scene_mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace devue::core {
struct dv_scene_mesh {
std::string name = "";

dvsku::uuid mesh_uuid;
dvsku::uuid material_uuid;
libutil::uuid mesh_uuid;
libutil::uuid material_uuid;

uint32_t ibo = 0U;
uint64_t face_count = 0U;
Expand Down
4 changes: 2 additions & 2 deletions source/devue_core/src/scene/model/dv_scene_model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace devue::core {

std::string name = "";

dvsku::uuid uuid = 0U;
dvsku::uuid model_uuid = 0U;
libutil::uuid uuid = 0U;
libutil::uuid model_uuid = 0U;

uint32_t vao = 0U;
uint32_t vbo = 0U;
Expand Down
2 changes: 1 addition & 1 deletion source/devue_core/src/systems/dv_sys_material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using namespace devue::core;
dv_sys_material::dv_sys_material(dv_systems_bundle* systems)
: m_systems(systems) {}

const dv_scene_material* dv_sys_material::get_material(dvsku::uuid uuid) {
const dv_scene_material* dv_sys_material::get_material(libutil::uuid uuid) {
if (!materials.contains(uuid)) return nullptr;
return &materials[uuid].second;
}
Expand Down
4 changes: 2 additions & 2 deletions source/devue_core/src/systems/dv_sys_material.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace devue::core {

class dv_sys_material {
public:
std::unordered_map<dvsku::uuid, std::pair<uint16_t, dv_scene_material>> materials;
std::unordered_map<libutil::uuid, std::pair<uint16_t, dv_scene_material>> materials;

public:
dv_sys_material() = delete;
Expand All @@ -25,7 +25,7 @@ namespace devue::core {
dv_sys_material& operator=(dv_sys_material&&) = delete;

public:
const dv_scene_material* get_material(dvsku::uuid uuid);
const dv_scene_material* get_material(libutil::uuid uuid);

void prepare_model_materials(dv_model& model);
void release_materials(dv_scene_model& smodel);
Expand Down
Loading

0 comments on commit 4bd6c0f

Please sign in to comment.