improved model loading and added model component

This commit is contained in:
Erris
2026-03-09 16:37:30 +01:00
parent ac18bb6f00
commit a0c900166f
15 changed files with 486 additions and 146 deletions

View File

@@ -2,6 +2,7 @@
#include "open_engine/renderer/renderer3d.hpp"
#include "open_engine/scene/components.hpp"
#include <Jolt/Physics/Body/MotionType.h>
#include <cstdint>
#include <editor_component.hpp>
#include <entt/entity/fwd.hpp>
#include <glm/gtc/type_ptr.hpp>
@@ -295,4 +296,33 @@ namespace OpenEngine {
"%.2f",
ImGuiSliderFlags_AlwaysClamp);
}
void ModelOnImGuiRender(entt::registry& registry, entt::entity entity)
{
auto& model_comp = registry.get<ModelComponent>(entity);
bool opened = ImGui::TreeNodeEx(
(void*)(intptr_t)entity,
ImGuiTreeNodeFlags_None,
"Meshes",
nullptr
);
if (opened) {
unsigned int i = 0;
for (auto& mesh : model_comp.model->GetMeshes())
ImGui::Text("Mesh: %i", i++);
ImGui::PushStyleColor(ImGuiCol_ChildBg, {1, 1, 1, 1});
if (ImGui::BeginChild("Material list")) {
for (auto& mesh : model_comp.model->GetMeshes())
ImGui::Text("Material: %s", mesh.material.name.c_str());
ImGui::EndChild();
}
ImGui::PopStyleColor();
ImGui::TreePop();
}
}
}