2
3
4
5
9#include "Render/FrameInfo.h"
10#include "World/World/World.h"
33 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ 0, 3.0f });
34 float columeWidth = ImGuiH::GetLineItemSize().x * 6.5f;
39 ImGuiH::DrawPropertyItem(
"FOV", columeWidth,
nullptr, [&](){
40 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
41 if(ImGui::DragFloat(
"##", &m_Camera->GetPerspectiveParam().fov, 0.1f, 1.0f, 179.0f,
"%.2f", ImGuiSliderFlags_AlwaysClamp))
43 FrameInfo::Get().m_World->Mark(World::FrushStableFrame);
45 ImGui::PopItemWidth();
47 if (ImGuiH::DrawResetIcon(m_Camera->GetPerspectiveParam().fov != 45.0f))
49 m_Camera->GetPerspectiveParam().fov = 45.0f;
50 FrameInfo::Get().m_World->Mark(World::FrushStableFrame);
58 ImGuiH::DrawPropertyItem(
"Near Plane", columeWidth,
nullptr, [&]() {
59 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
60 if (ImGui::DragFloat(
"##", &m_Camera->GetPerspectiveParam().nearPlane, 0.1f, 0.01f, 1000.0f,
"%.3f", ImGuiSliderFlags_AlwaysClamp))
62 FrameInfo::Get().m_World->Mark(World::FrushStableFrame);
64 ImGui::PopItemWidth();
66 if (ImGuiH::DrawResetIcon(m_Camera->GetPerspectiveParam().nearPlane != 0.01f))
68 m_Camera->GetPerspectiveParam().nearPlane = 0.01f;
69 FrameInfo::Get().m_World->Mark(World::FrushStableFrame);
77 ImGuiH::DrawPropertyItem(
"AspectRatio", columeWidth,
nullptr, [&]() {
78 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
79 float aspectRatio = m_Camera->GetPerspectiveParam().aspectRatio;
80 ImGui::DragFloat(
"##", &aspectRatio, 10.0f, 0.0f, 100.0f,
"%.3f", ImGuiSliderFlags_AlwaysClamp);
81 ImGui::PopItemWidth();
83 ImGuiH::DrawResetIcon(m_Camera->GetPerspectiveParam().aspectRatio != 1.777f);
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
virtual void DrawThis() override
This interface defines how to draw this component to property panel.
virtual void OnDeSerialize() override
This interface defines how to deserialize.
bool m_IsActive
True if the camera is primary.
CameraComponent(bool isActive=false)
Constructor Function. Init class variable. Usually call it.
virtual void OnSerialize() override
This interface defines how to serialize.
CameraComponent Class. This class defines the specific behaves of CameraComponent.