adding plane shape and universal guizmo (this is the wrong branch)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef EDITOR_HPP
|
||||
#define EDITOR_HPP
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <open_engine.hpp>
|
||||
|
||||
#include "open_engine/renderer/renderer3d.hpp"
|
||||
@@ -285,6 +286,10 @@ 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,6 +21,7 @@ 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,4 +283,16 @@ 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,3 +1,4 @@
|
||||
#include "open_engine/scene/components.hpp"
|
||||
#include "open_engine/scene/entity.hpp"
|
||||
#include "editor_component.hpp"
|
||||
|
||||
@@ -26,6 +27,7 @@ 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 = {};
|
||||
@@ -74,6 +76,11 @@ 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)
|
||||
|
||||
Reference in New Issue
Block a user