3d renderer

This commit is contained in:
Erris
2026-03-01 17:06:15 +01:00
parent abe8016f84
commit 90a6ea00c0
21 changed files with 365 additions and 76 deletions

View File

@@ -22,6 +22,7 @@ namespace OpenEngine {
RegisterDrawer<TransformComponent>("Transform", &TransformOnImGuiRender);
RegisterDrawer<SpriteRendererComponent>("Sprite Renderer", &SpriteOnImGuiRender);
RegisterDrawer<CameraComponent>("Camera", &CameraOnImGuiRender);
RegisterDrawer<MeshComponent>("Mesh", &MeshOnImGuiRender);
scene = context;
selected_context = {};
@@ -32,17 +33,22 @@ namespace OpenEngine {
ImGui::SeparatorText("Add");
if (!selected_context.HasComponent<TransformComponent>())
if (ImGui::MenuItem("Transform")) {
selected_context.AddComponents<TransformComponent>();
selected_context.AddComponent<TransformComponent>();
ImGui::CloseCurrentPopup();
}
if (!selected_context.HasComponent<SpriteRendererComponent>())
if (ImGui::MenuItem("Sprite")) {
selected_context.AddComponents<SpriteRendererComponent>();
selected_context.AddComponent<SpriteRendererComponent>();
ImGui::CloseCurrentPopup();
}
if (!selected_context.HasComponent<CameraComponent>())
if (ImGui::MenuItem("Camera")) {
selected_context.AddComponents<CameraComponent>();
selected_context.AddComponent<CameraComponent>();
ImGui::CloseCurrentPopup();
}
if (!selected_context.HasComponent<MeshComponent>())
if (ImGui::MenuItem("Mesh")) {
selected_context.AddComponent<MeshComponent>();
ImGui::CloseCurrentPopup();
}
}
@@ -202,6 +208,7 @@ namespace OpenEngine {
entity.GetComponents<TagComponent>();
TagOnImGuiRender(reg, entity);
std::vector<entt::id_type> component_to_delete; // 0 is null/invalid in entt usually
// Iterate through every component type entt knows about
for (auto [id, storage] : reg.storage()) {