diff --git a/Editor/src/ComponentsPanel/CameraPanel.h b/Editor/src/ComponentsPanel/CameraPanel.h new file mode 100644 index 00000000..d07831bb --- /dev/null +++ b/Editor/src/ComponentsPanel/CameraPanel.h @@ -0,0 +1,48 @@ +#pragma once +#include "ComponentPanel.h" +#include +#include + +class CameraPanel : ComponentPanel { + +public: + CameraPanel() {} + + void Draw(Nuake::Entity entity) override + { + if (!entity.HasComponent()) + return; + + auto& component = entity.GetComponent(); + BeginComponentTable(CAMERA, Nuake::CameraComponent); + { + { + ImGui::Text("FOV"); + ImGui::TableNextColumn(); + + ImGui::DragFloat("##Fov", &component.CameraInstance->Fov, 0.1f, 0.1f, 360.0f); + ImGui::TableNextColumn(); + ComponentTableReset(component.CameraInstance->Fov, 88.0f); + } + ImGui::TableNextColumn(); + { + ImGui::Text("Exposure"); + ImGui::TableNextColumn(); + + ImGui::DragFloat("##Exposure", &component.CameraInstance->Exposure, 0.1f, 0.1f, 10.0f); + ImGui::TableNextColumn(); + ComponentTableReset(component.CameraInstance->Fov, 1.0f); + } + ImGui::TableNextColumn(); + { + ImGui::Text("Gamma"); + ImGui::TableNextColumn(); + + ImGui::DragFloat("##Gamma", &component.CameraInstance->Gamma, 0.1f, 0.1f, 10.0f); + ImGui::TableNextColumn(); + ComponentTableReset(component.CameraInstance->Fov, 2.2f); + } + } + EndComponentTable(); + } +}; \ No newline at end of file diff --git a/Editor/src/Windows/EditorSelectionPanel.cpp b/Editor/src/Windows/EditorSelectionPanel.cpp index 8bba9773..0400f5bf 100644 --- a/Editor/src/Windows/EditorSelectionPanel.cpp +++ b/Editor/src/Windows/EditorSelectionPanel.cpp @@ -13,6 +13,7 @@ EditorSelectionPanel::EditorSelectionPanel() mLightPanel = LightPanel(); mScriptPanel = ScriptPanel(); mQuakeMapPanel = QuakeMapPanel(); + mCameraPanel = CameraPanel(); } void EditorSelectionPanel::ResolveFile(Ref file) @@ -94,6 +95,7 @@ void EditorSelectionPanel::DrawEntity(Nuake::Entity entity) mScriptPanel.Draw(entity); mMeshPanel.Draw(entity); mQuakeMapPanel.Draw(entity); + mCameraPanel.Draw(entity); /* if (Selection.Entity.HasComponent()) { diff --git a/Editor/src/Windows/EditorSelectionPanel.h b/Editor/src/Windows/EditorSelectionPanel.h index 82faf812..97ff1d4e 100644 --- a/Editor/src/Windows/EditorSelectionPanel.h +++ b/Editor/src/Windows/EditorSelectionPanel.h @@ -8,6 +8,8 @@ #include "../ComponentsPanel/ScriptPanel.h" #include "../ComponentsPanel/MeshPanel.h" #include "../ComponentsPanel/QuakeMapPanel.h" +#include "../ComponentsPanel/CameraPanel.h" + #include "../Actions/EditorSelection.h" #include @@ -18,6 +20,7 @@ private: ScriptPanel mScriptPanel; MeshPanel mMeshPanel; QuakeMapPanel mQuakeMapPanel; + CameraPanel mCameraPanel; Ref currentFile; Ref selectedResource; diff --git a/Nuake/Engine.cpp b/Nuake/Engine.cpp index 2ed011cf..63e2fed9 100644 --- a/Nuake/Engine.cpp +++ b/Nuake/Engine.cpp @@ -48,7 +48,8 @@ namespace Nuake m_LastFrameTime = m_Time; // Dont update if no scene is loaded. - if (CurrentWindow->GetScene()) { + if (CurrentWindow->GetScene()) + { CurrentWindow->Update(timestep); // Play mode update all the entities, Editor does not. diff --git a/Nuake/src/Rendering/Camera.h b/Nuake/src/Rendering/Camera.h index da072462..c15cd665 100644 --- a/Nuake/src/Rendering/Camera.h +++ b/Nuake/src/Rendering/Camera.h @@ -27,7 +27,6 @@ namespace Nuake Vector3 Right = Vector3(1, 0, 0); Matrix4 m_Perspective; - public: float AspectRatio = 16.0f / 9.0f;