add debug camera information
This commit is contained in:
parent
833ac5e6f0
commit
752cd6218a
|
|
@ -7,5 +7,8 @@ namespace NzEditor
|
|||
{
|
||||
public:
|
||||
MainWindow(Nz::EditorBaseApplication* app);
|
||||
|
||||
protected:
|
||||
virtual void OnRenderImgui() override;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
#include <NazaraEditor/Editor/UI/MainWindow.hpp>
|
||||
#include <NazaraEditor/Editor/Application.hpp>
|
||||
|
||||
#include <NazaraEditor/Core/Components/CameraComponent.hpp>
|
||||
|
||||
namespace NzEditor
|
||||
{
|
||||
|
|
@ -6,4 +9,23 @@ namespace NzEditor
|
|||
: Nz::EditorMainWindow(app, "LOC_EDITOR_WINDOW_MAIN_TITLE", { "General", "Tools", "Plugins" })
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::OnRenderImgui()
|
||||
{
|
||||
Nz::EditorMainWindow::OnRenderImgui();
|
||||
|
||||
auto flags = ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoDecoration;
|
||||
if (ImGui::Begin("MainWindow", nullptr, flags))
|
||||
{
|
||||
auto cam = GetApplication()->GetMainCamera();
|
||||
auto& camcomponent = cam.get<Nz::EditorCameraComponent>();
|
||||
auto& transform = cam.get<Nz::NodeComponent>();
|
||||
|
||||
auto desiredRotation = camcomponent.GetOrientation();
|
||||
auto rotation = transform.GetRotation().ToEulerAngles();
|
||||
ImGui::Text("Camera position: %.2f %.2f %.2f", transform.GetPosition().x, transform.GetPosition().y, transform.GetPosition().z);
|
||||
ImGui::Text("Camera rotation: %.2f %.2f %.2f", rotation.roll.value, rotation.pitch.value, rotation.yaw.value);
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue