Added Camera component panel

This commit is contained in:
Antoine Pilote
2023-03-01 22:03:12 -05:00
parent f5c5497122
commit 344e2fb0c8
5 changed files with 55 additions and 2 deletions

View File

@@ -0,0 +1,48 @@
#pragma once
#include "ComponentPanel.h"
#include <src/Scene/Components/CameraComponent.h>
#include <src/Core/FileSystem.h>
class CameraPanel : ComponentPanel {
public:
CameraPanel() {}
void Draw(Nuake::Entity entity) override
{
if (!entity.HasComponent<Nuake::CameraComponent>())
return;
auto& component = entity.GetComponent<Nuake::CameraComponent>();
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();
}
};

View File

@@ -13,6 +13,7 @@ EditorSelectionPanel::EditorSelectionPanel()
mLightPanel = LightPanel();
mScriptPanel = ScriptPanel();
mQuakeMapPanel = QuakeMapPanel();
mCameraPanel = CameraPanel();
}
void EditorSelectionPanel::ResolveFile(Ref<Nuake::File> 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<MeshComponent>())
{

View File

@@ -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 <src/Resource/Project.h>
@@ -18,6 +20,7 @@ private:
ScriptPanel mScriptPanel;
MeshPanel mMeshPanel;
QuakeMapPanel mQuakeMapPanel;
CameraPanel mCameraPanel;
Ref<Nuake::File> currentFile;
Ref<Nuake::Resource> selectedResource;

View File

@@ -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.

View File

@@ -27,7 +27,6 @@ namespace Nuake
Vector3 Right = Vector3(1, 0, 0);
Matrix4 m_Perspective;
public:
float AspectRatio = 16.0f / 9.0f;