Compare commits
3 Commits
jolt
...
1eda916f3e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1eda916f3e | ||
|
|
7da00008e0 | ||
|
|
f26ee2bca8 |
@@ -1,7 +1,6 @@
|
||||
#ifndef EDITOR_HPP
|
||||
#define EDITOR_HPP
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <open_engine.hpp>
|
||||
|
||||
#include "open_engine/renderer/renderer3d.hpp"
|
||||
@@ -286,10 +285,6 @@ namespace OpenEngine {
|
||||
guizmo_operation = ImGuizmo::OPERATION::SCALE;
|
||||
break;
|
||||
}
|
||||
case KeyCode::T: {
|
||||
guizmo_operation = ImGuizmo::OPERATION::UNIVERSAL;
|
||||
break;
|
||||
}
|
||||
case KeyCode::Delete: {
|
||||
scene->MarkEntityForDeletion(selected_entity);
|
||||
scene_hierarchy.ClearSelection();
|
||||
|
||||
@@ -21,7 +21,6 @@ namespace OpenEngine {
|
||||
void BodyOnImGuiRender(entt::registry& registry, entt::entity entity);
|
||||
void SphereShapeOnImGuiRender(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
|
||||
|
||||
@@ -283,16 +283,4 @@ namespace OpenEngine {
|
||||
"%.2f",
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include "open_engine/scene/components.hpp"
|
||||
#include "open_engine/scene/entity.hpp"
|
||||
#include "editor_component.hpp"
|
||||
|
||||
@@ -27,7 +26,6 @@ namespace OpenEngine {
|
||||
RegisterDrawer<PhysicsBodyComponent>("Physics Body", &BodyOnImGuiRender);
|
||||
RegisterDrawer<SphereShapeComponent>("Sphere Shape", &SphereShapeOnImGuiRender);
|
||||
RegisterDrawer<BoxShapeComponent>("Box Shape", &BoxShapeOnImGuiRender);
|
||||
RegisterDrawer<PlaneShapeComponent>("Plane Shape", &PlaneShapeOnImGuiRender);
|
||||
|
||||
scene = context;
|
||||
selected_context = {};
|
||||
@@ -76,11 +74,6 @@ namespace OpenEngine {
|
||||
selected_context.AddComponent<BoxShapeComponent>();
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
if (!selected_context.HasComponent<PlaneShapeComponent>())
|
||||
if (ImGui::MenuItem("Plane shape")) {
|
||||
selected_context.AddComponent<PlaneShapeComponent>();
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
|
||||
void EntityPopup(Ref<Scene>& scene)
|
||||
|
||||
26
imgui.ini
26
imgui.ini
@@ -1,6 +1,6 @@
|
||||
[Window][WindowOverViewport_11111111]
|
||||
Pos=0,24
|
||||
Size=2560,1371
|
||||
Size=1272,1363
|
||||
Collapsed=0
|
||||
|
||||
[Window][Debug##Default]
|
||||
@@ -10,31 +10,31 @@ Collapsed=0
|
||||
|
||||
[Window][Statistics]
|
||||
Pos=0,24
|
||||
Size=224,439
|
||||
Size=224,437
|
||||
Collapsed=0
|
||||
DockId=0x00000003,0
|
||||
|
||||
[Window][Properties]
|
||||
Pos=2110,24
|
||||
Size=450,810
|
||||
Pos=822,24
|
||||
Size=450,805
|
||||
Collapsed=0
|
||||
DockId=0x00000007,0
|
||||
|
||||
[Window][Viewport]
|
||||
Pos=226,61
|
||||
Size=1882,964
|
||||
Size=594,956
|
||||
Collapsed=0
|
||||
DockId=0x00000012,0
|
||||
|
||||
[Window][Dear ImGui Demo]
|
||||
Pos=2110,836
|
||||
Size=450,559
|
||||
Pos=822,831
|
||||
Size=450,556
|
||||
Collapsed=0
|
||||
DockId=0x00000008,0
|
||||
|
||||
[Window][Scene]
|
||||
Pos=0,465
|
||||
Size=224,930
|
||||
Pos=0,463
|
||||
Size=224,924
|
||||
Collapsed=0
|
||||
DockId=0x00000004,0
|
||||
|
||||
@@ -143,8 +143,8 @@ Collapsed=0
|
||||
DockId=0x00000012,1
|
||||
|
||||
[Window][Assets]
|
||||
Pos=226,1027
|
||||
Size=1882,368
|
||||
Pos=226,1019
|
||||
Size=594,368
|
||||
Collapsed=0
|
||||
DockId=0x0000000C,0
|
||||
|
||||
@@ -156,12 +156,12 @@ DockId=0x0000000F,0
|
||||
|
||||
[Window][##play_state_bar]
|
||||
Pos=226,24
|
||||
Size=1882,35
|
||||
Size=594,35
|
||||
Collapsed=0
|
||||
DockId=0x00000011,0
|
||||
|
||||
[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=0x00000001 Parent=0x00000005 SizeRef=224,1386 Split=Y Selected=0xE601B12F
|
||||
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=255,417 Selected=0x553E127E
|
||||
|
||||
@@ -153,11 +153,6 @@ namespace OpenEngine {
|
||||
{
|
||||
float radius = 1.0f;
|
||||
};
|
||||
|
||||
struct PlaneShapeComponent
|
||||
{
|
||||
float extent = 1.0f;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // COMPONENTS_HPP
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <core/time.hpp>
|
||||
|
||||
#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/SphereShape.h>
|
||||
#include <Jolt/Physics/EActivation.h>
|
||||
@@ -35,13 +34,8 @@ namespace OpenEngine {
|
||||
auto& c = reg.get<SphereShapeComponent>(e);
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -358,9 +352,4 @@ namespace OpenEngine {
|
||||
void Scene::OnComponentAdded<IDComponent>(Entity entity, IDComponent& component)
|
||||
{
|
||||
}
|
||||
|
||||
template<>
|
||||
void Scene::OnComponentAdded<PlaneShapeComponent>(Entity entity, PlaneShapeComponent& component)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,16 +214,6 @@ namespace OpenEngine {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -376,13 +366,6 @@ namespace OpenEngine {
|
||||
|
||||
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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user