34 PERSPECTIVE = 1, ORTHO = 2, CUBE = 3
41 void Exterminate()
override;
45 void Tick(
float elapsedTime)
override;
49 void CopyReference(
SComponent* src, std::map<SGameObject*, SGameObject*> lists_obj,
50 std::map<SComponent*, SComponent*> lists_comp)
override;
52 void SetValue(std::string name_str, Arguments value)
override;
54 std::string PrintValue()
const override;
56 mat4 GetCameraMatrix()
const;
58 vec3 GetCameraPosition()
const;
60 mat4 GetProjectionMatrix()
const {
61 if (!m_isProjectionInited) {
62 SetProjectionMatrix();
64 return m_projectionMatrix;
69 void SetTargetVector(
const vec3& target);
73 void SetUp(
const vec3& up);
75 void SetCameraType(CAMERATYPE type);
77 void SetPerspectiveFov(
float fov);
79 void SetZDepthRange(
float near,
float far);
81 void SetPerspective(
float fov,
float near,
float far);
83 void SetOrtho(
float left,
float right,
float top,
float bottom);
87 void SetProjectionMatrix()
const;
93 BackgroundType GetBackgroundType()
override;
95 void RenderBackground()
const override;
97 void SetBackgroundSkybox(
STexture* skyboxTexture =
nullptr);
99 void SetBackgroundColor(
vec3&& color);
101 void SetBackgroundType(BackgroundType type);
104 struct BackgroundMapStruct {
106 unsigned short mapId = 0;
107 unsigned short viewId = 0;
108 unsigned short projectionId = 0;
112 void SetCameraMatrix();
120 mutable mat4 m_cameraMatrix;
121 mutable mat4 m_projectionMatrix;
125 CAMERATYPE m_type = PERSPECTIVE;
126 mutable bool m_isProjectionInited =
false;
133 float m_oLeft = -1.f;
134 float m_oRight = 1.f;
135 float m_oBottom = -1.f;
142 BackgroundType m_backgroundType = SOLID;
143 vec3 m_backgroundColor =
vec3(0.4f, 0.4f, 0.4f);
144 BackgroundMapStruct* m_backgroundMap =
nullptr;