mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-06 13:11:53 +00:00
Better Transform component and edit gui
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user