58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <XCEngine/Components/Component.h>
|
|
#include <XCEngine/Core/Math/Color.h>
|
|
|
|
namespace XCEngine {
|
|
namespace Components {
|
|
|
|
enum class CameraProjectionType {
|
|
Perspective = 0,
|
|
Orthographic
|
|
};
|
|
|
|
class CameraComponent : public Component {
|
|
public:
|
|
std::string GetName() const override { return "Camera"; }
|
|
|
|
CameraProjectionType GetProjectionType() const { return m_projectionType; }
|
|
void SetProjectionType(CameraProjectionType type) { m_projectionType = type; }
|
|
|
|
float GetFieldOfView() const { return m_fieldOfView; }
|
|
void SetFieldOfView(float value);
|
|
|
|
float GetOrthographicSize() const { return m_orthographicSize; }
|
|
void SetOrthographicSize(float value);
|
|
|
|
float GetNearClipPlane() const { return m_nearClipPlane; }
|
|
void SetNearClipPlane(float value);
|
|
|
|
float GetFarClipPlane() const { return m_farClipPlane; }
|
|
void SetFarClipPlane(float value);
|
|
|
|
float GetDepth() const { return m_depth; }
|
|
void SetDepth(float value) { m_depth = value; }
|
|
|
|
bool IsPrimary() const { return m_primary; }
|
|
void SetPrimary(bool value) { m_primary = value; }
|
|
|
|
const Math::Color& GetClearColor() const { return m_clearColor; }
|
|
void SetClearColor(const Math::Color& value) { m_clearColor = value; }
|
|
|
|
void Serialize(std::ostream& os) const override;
|
|
void Deserialize(std::istream& is) override;
|
|
|
|
private:
|
|
CameraProjectionType m_projectionType = CameraProjectionType::Perspective;
|
|
float m_fieldOfView = 60.0f;
|
|
float m_orthographicSize = 5.0f;
|
|
float m_nearClipPlane = 0.1f;
|
|
float m_farClipPlane = 1000.0f;
|
|
float m_depth = 0.0f;
|
|
bool m_primary = true;
|
|
Math::Color m_clearColor = Math::Color(0.192f, 0.302f, 0.475f, 1.0f);
|
|
};
|
|
|
|
} // namespace Components
|
|
} // namespace XCEngine
|