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

@@ -1,12 +1,12 @@
#ifndef EDITOR_HPP
#define EDITOR_HPP
#include <X11/X.h>
#include <open_engine.hpp>
#include "open_engine/fastgltf.hpp"
#include "open_engine/logging.hpp"
#include "open_engine/ref_scope.hpp"
#include "open_engine/renderer/model3d.hpp"
#include "open_engine/renderer/renderer3d.hpp"
#include "open_engine/scene/components.hpp"
#include "panels/content_browser.hpp"
@@ -135,11 +135,16 @@ namespace OpenEngine {
// ============================================================
Entity cube3 = scene->CreateEntity("glb");
Entity cube4 = scene->CreateEntity("glb2");
cube3.AddComponent<TransformComponent>();
cube4.AddComponent<TransformComponent>();
Ref<Mesh> test = TestGLTF();
Ref<Model3D> model = Model3D::Create("./assets/models/cubes.glb");
Ref<Model3D> model2 = Model3D::Create("./assets/models/cube_legs.glb");
Ref<Model3D> monkey = Model3D::Create("./assets/models/monkey.glb");
cube3.AddComponent<MeshComponent>(CreateMesh(test->vertices, test->indices, (uint32_t)cube3));
cube3.AddComponent<ModelComponent>(model);
cube4.AddComponent<ModelComponent>(monkey);
/*
auto view = scene->GetRegistry().view<TagComponent>();

View File

@@ -22,6 +22,7 @@ namespace OpenEngine {
void SphereShapeOnImGuiRender(entt::registry& registry, entt::entity entity);
void BoxShapeOnImGuiRender(entt::registry& registry, entt::entity entity);
void PlaneShapeOnImGuiRender(entt::registry& registry, entt::entity entity);
void ModelOnImGuiRender(entt::registry& registry, entt::entity entity);
}
#endif // EDITOR_COMPONENT_HPP