33 PERSPECTIVE = 1, ORTHO = 2, CUBE = 3
40 void Exterminate()
override;
44 void Tick(
float elapsedTime)
override;
48 void CopyReference(
SComponent* src, std::map<SGameObject*, SGameObject*> lists_obj,
49 std::map<SComponent*, SComponent*> lists_comp)
override;
51 void SetValue(std::string name_str, Arguments value)
override;
53 std::string PrintValue()
const override;
55 mat4 GetCameraMatrix()
const;
57 vec3 GetCameraPosition()
const;
59 mat4 GetProjectionMatrix()
const {
60 if (!m_isProjectionInited) {
61 SetProjectionMatrix();
63 return m_projectionMatrix;
68 void SetTargetVector(
const vec3& target);
72 void SetUp(
const vec3& up);
74 void SetCameraType(CAMERATYPE type);
76 void SetPerspectiveFov(
float fov);
78 void SetZDepthRange(
float near,
float far);
80 void SetPerspective(
float fov,
float near,
float far);
82 void SetOrtho(
float left,
float right,
float top,
float bottom);
86 void SetProjectionMatrix()
const;
92 BackgroundType GetBackgroundType()
override;
94 void RenderBackground()
const override;
96 void SetBackgroundSkybox(
STexture* skyboxTexture =
nullptr);
98 void SetBackgroundColor(
vec3&& color);
100 void SetBackgroundType(BackgroundType type);
103 struct BackgroundMapStruct {
105 unsigned short mapId = 0;
106 unsigned short viewId = 0;
107 unsigned short projectionId = 0;
111 void SetCameraMatrix();
119 mutable mat4 m_cameraMatrix;
120 mutable mat4 m_projectionMatrix;
124 CAMERATYPE m_type = PERSPECTIVE;
125 mutable bool m_isProjectionInited =
false;
132 float m_oLeft = -1.f;
133 float m_oRight = 1.f;
134 float m_oBottom = -1.f;
141 BackgroundType m_backgroundType = SOLID;
142 vec3 m_backgroundColor =
vec3(0.4f, 0.4f, 0.4f);
143 BackgroundMapStruct* m_backgroundMap =
nullptr;