3 Commits

Author SHA1 Message Date
Erris
1eda916f3e Merge branch '3d' 2026-03-06 18:09:39 +01:00
Erris
7da00008e0 Merge branch '3d' 2026-03-02 21:28:20 +01:00
Erris
f26ee2bca8 Merge branch '3d' 2026-03-02 13:12:56 +01:00
8 changed files with 14 additions and 72 deletions

View File

@@ -1,7 +1,6 @@
#ifndef EDITOR_HPP #ifndef EDITOR_HPP
#define EDITOR_HPP #define EDITOR_HPP
#include <X11/X.h>
#include <open_engine.hpp> #include <open_engine.hpp>
#include "open_engine/renderer/renderer3d.hpp" #include "open_engine/renderer/renderer3d.hpp"
@@ -286,10 +285,6 @@ namespace OpenEngine {
guizmo_operation = ImGuizmo::OPERATION::SCALE; guizmo_operation = ImGuizmo::OPERATION::SCALE;
break; break;
} }
case KeyCode::T: {
guizmo_operation = ImGuizmo::OPERATION::UNIVERSAL;
break;
}
case KeyCode::Delete: { case KeyCode::Delete: {
scene->MarkEntityForDeletion(selected_entity); scene->MarkEntityForDeletion(selected_entity);
scene_hierarchy.ClearSelection(); scene_hierarchy.ClearSelection();

View File

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

View File

@@ -283,16 +283,4 @@ namespace OpenEngine {
"%.2f", "%.2f",
ImGuiSliderFlags_AlwaysClamp); ImGuiSliderFlags_AlwaysClamp);
} }
void PlaneShapeOnImGuiRender(entt::registry& registry, entt::entity entity)
{
auto& planed_comp = registry.get<PlaneShapeComponent>(entity);
ImGui::DragFloat("Size",
&planed_comp.extent,
0.1f,
0.01f, FLT_MAX,
"%.2f",
ImGuiSliderFlags_AlwaysClamp);
}
} }

View File

@@ -1,4 +1,3 @@
#include "open_engine/scene/components.hpp"
#include "open_engine/scene/entity.hpp" #include "open_engine/scene/entity.hpp"
#include "editor_component.hpp" #include "editor_component.hpp"
@@ -27,7 +26,6 @@ namespace OpenEngine {
RegisterDrawer<PhysicsBodyComponent>("Physics Body", &BodyOnImGuiRender); RegisterDrawer<PhysicsBodyComponent>("Physics Body", &BodyOnImGuiRender);
RegisterDrawer<SphereShapeComponent>("Sphere Shape", &SphereShapeOnImGuiRender); RegisterDrawer<SphereShapeComponent>("Sphere Shape", &SphereShapeOnImGuiRender);
RegisterDrawer<BoxShapeComponent>("Box Shape", &BoxShapeOnImGuiRender); RegisterDrawer<BoxShapeComponent>("Box Shape", &BoxShapeOnImGuiRender);
RegisterDrawer<PlaneShapeComponent>("Plane Shape", &PlaneShapeOnImGuiRender);
scene = context; scene = context;
selected_context = {}; selected_context = {};
@@ -76,11 +74,6 @@ namespace OpenEngine {
selected_context.AddComponent<BoxShapeComponent>(); selected_context.AddComponent<BoxShapeComponent>();
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
if (!selected_context.HasComponent<PlaneShapeComponent>())
if (ImGui::MenuItem("Plane shape")) {
selected_context.AddComponent<PlaneShapeComponent>();
ImGui::CloseCurrentPopup();
}
} }
void EntityPopup(Ref<Scene>& scene) void EntityPopup(Ref<Scene>& scene)

View File

@@ -1,6 +1,6 @@
[Window][WindowOverViewport_11111111] [Window][WindowOverViewport_11111111]
Pos=0,24 Pos=0,24
Size=2560,1371 Size=1272,1363
Collapsed=0 Collapsed=0
[Window][Debug##Default] [Window][Debug##Default]
@@ -10,31 +10,31 @@ Collapsed=0
[Window][Statistics] [Window][Statistics]
Pos=0,24 Pos=0,24
Size=224,439 Size=224,437
Collapsed=0 Collapsed=0
DockId=0x00000003,0 DockId=0x00000003,0
[Window][Properties] [Window][Properties]
Pos=2110,24 Pos=822,24
Size=450,810 Size=450,805
Collapsed=0 Collapsed=0
DockId=0x00000007,0 DockId=0x00000007,0
[Window][Viewport] [Window][Viewport]
Pos=226,61 Pos=226,61
Size=1882,964 Size=594,956
Collapsed=0 Collapsed=0
DockId=0x00000012,0 DockId=0x00000012,0
[Window][Dear ImGui Demo] [Window][Dear ImGui Demo]
Pos=2110,836 Pos=822,831
Size=450,559 Size=450,556
Collapsed=0 Collapsed=0
DockId=0x00000008,0 DockId=0x00000008,0
[Window][Scene] [Window][Scene]
Pos=0,465 Pos=0,463
Size=224,930 Size=224,924
Collapsed=0 Collapsed=0
DockId=0x00000004,0 DockId=0x00000004,0
@@ -143,8 +143,8 @@ Collapsed=0
DockId=0x00000012,1 DockId=0x00000012,1
[Window][Assets] [Window][Assets]
Pos=226,1027 Pos=226,1019
Size=1882,368 Size=594,368
Collapsed=0 Collapsed=0
DockId=0x0000000C,0 DockId=0x0000000C,0
@@ -156,12 +156,12 @@ DockId=0x0000000F,0
[Window][##play_state_bar] [Window][##play_state_bar]
Pos=226,24 Pos=226,24
Size=1882,35 Size=594,35
Collapsed=0 Collapsed=0
DockId=0x00000011,0 DockId=0x00000011,0
[Docking][Data] [Docking][Data]
DockSpace ID=0x08BD597D Window=0x1BBC0F80 Pos=0,24 Size=2560,1371 Split=X DockSpace ID=0x08BD597D Window=0x1BBC0F80 Pos=0,24 Size=1272,1363 Split=X
DockNode ID=0x00000005 Parent=0x08BD597D SizeRef=820,1386 Split=X DockNode ID=0x00000005 Parent=0x08BD597D SizeRef=820,1386 Split=X
DockNode ID=0x00000001 Parent=0x00000005 SizeRef=224,1386 Split=Y Selected=0xE601B12F DockNode ID=0x00000001 Parent=0x00000005 SizeRef=224,1386 Split=Y Selected=0xE601B12F
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=255,417 Selected=0x553E127E DockNode ID=0x00000003 Parent=0x00000001 SizeRef=255,417 Selected=0x553E127E

View File

@@ -153,11 +153,6 @@ namespace OpenEngine {
{ {
float radius = 1.0f; float radius = 1.0f;
}; };
struct PlaneShapeComponent
{
float extent = 1.0f;
};
} }
#endif // COMPONENTS_HPP #endif // COMPONENTS_HPP

View File

@@ -14,7 +14,6 @@
#include <core/time.hpp> #include <core/time.hpp>
#include <Jolt/Physics/Collision/Shape/Shape.h> #include <Jolt/Physics/Collision/Shape/Shape.h>
#include <Jolt/Physics/Collision/Shape/PlaneShape.h>
#include <Jolt/Physics/Collision/Shape/BoxShape.h> #include <Jolt/Physics/Collision/Shape/BoxShape.h>
#include <Jolt/Physics/Collision/Shape/SphereShape.h> #include <Jolt/Physics/Collision/Shape/SphereShape.h>
#include <Jolt/Physics/EActivation.h> #include <Jolt/Physics/EActivation.h>
@@ -35,13 +34,8 @@ namespace OpenEngine {
auto& c = reg.get<SphereShapeComponent>(e); auto& c = reg.get<SphereShapeComponent>(e);
return CreateRef<SphereShapeSettings>(c.radius); return CreateRef<SphereShapeSettings>(c.radius);
} }
if (reg.any_of<PlaneShapeComponent>(e)) {
auto& c = reg.get<PlaneShapeComponent>(e);
const Plane plane({ 0.0f, 1.0f, 0.0f }, 0);
return CreateRef<PlaneShapeSettings>(plane, nullptr, c.extent);
}
OE_CORE_ERROR("Entity {} has no shape component!", reg.get<TagComponent>(e).tag); OE_CORE_ERROR("Entity has no shape component!");
return nullptr; return nullptr;
}; };
@@ -358,9 +352,4 @@ namespace OpenEngine {
void Scene::OnComponentAdded<IDComponent>(Entity entity, IDComponent& component) void Scene::OnComponentAdded<IDComponent>(Entity entity, IDComponent& component)
{ {
} }
template<>
void Scene::OnComponentAdded<PlaneShapeComponent>(Entity entity, PlaneShapeComponent& component)
{
}
} }

View File

@@ -214,16 +214,6 @@ namespace OpenEngine {
out << YAML::EndMap; //SphereShapeComponent out << YAML::EndMap; //SphereShapeComponent
} }
if (entity.HasComponent<PlaneShapeComponent>()) {
out << YAML::Key << "PlaneShapeComponent";
out << YAML::BeginMap; //PlaneShapeComponent
auto& psc = entity.GetComponents<PlaneShapeComponent>();
out << YAML::Key << "Extent" << YAML::Value << psc.extent;
out << YAML::EndMap; //PlaneShapeComponent
}
out << YAML::EndMap; out << YAML::EndMap;
} }
@@ -376,13 +366,6 @@ namespace OpenEngine {
ssc.radius = sphere_shape_component["Radius"].as<float>(); ssc.radius = sphere_shape_component["Radius"].as<float>();
} }
auto plane_shape_component = entity["PlaneShapeComponent"];
if (sphere_shape_component) {
auto& psc = deserializedEntity.AddComponent<PlaneShapeComponent>();
psc.extent = plane_shape_component["Extent"].as<float>();
}
} }
} }