mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Added Camera component panel
This commit is contained in:
48
Editor/src/ComponentsPanel/CameraPanel.h
Normal file
48
Editor/src/ComponentsPanel/CameraPanel.h
Normal 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();
|
||||
}
|
||||
};
|
||||
@@ -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>())
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace Nuake
|
||||
Vector3 Right = Vector3(1, 0, 0);
|
||||
Matrix4 m_Perspective;
|
||||
|
||||
|
||||
public:
|
||||
float AspectRatio = 16.0f / 9.0f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user