Better Transform component and edit gui

This commit is contained in:
Simon Lübeß
2022-04-09 12:35:36 +02:00
parent c7fde476e8
commit af37154071
18 changed files with 341 additions and 208 deletions
@@ -10,7 +10,7 @@ namespace GlitchyEditor.EditWindows
{
class SceneViewportWindow : EditorWindow
{
public OldCamera _camera;
//public OldCamera _camera;
public const String s_WindowTitle = "Scene";
@@ -38,6 +38,8 @@ namespace GlitchyEditor.EditWindows
private ImGui.Vec2 oldViewportSize;
private bool viewPortChanged;
public Entity CameraEntity { get; set; }
protected override void InternalShow()
{
ImGui.PushStyleVar(.WindowPadding, ImGui.Vec2(1, 1));
@@ -87,8 +89,11 @@ namespace GlitchyEditor.EditWindows
topLeft.y += cntMin.y;
ImGuizmo.SetRect(topLeft.x, topLeft.y, viewportSize.x, viewportSize.y);
var view = _camera.View;
var projection = _camera.Projection;
var cameraTransformCmp = CameraEntity.GetComponent<TransformComponent>();
var view = cameraTransformCmp.WorldTransform.Invert();
var cameraCmp = CameraEntity.GetComponent<CameraComponent>();
var projection = cameraCmp.Camera.Projection;
Matrix mat = .Identity;
ImGuizmo.DrawGrid((.)&view, (.)&projection, (.)&mat, 10);