CSEngine
Loading...
Searching...
No Matches
CSE::CameraMgr Class Reference
Inheritance diagram for CSE::CameraMgr:
CSE::SContainerList< CameraComponent * > CSE::CoreBase CSE::SIContainer< S, T, M >

Public Member Functions

void Init () override
 
void DeleteCameraComponent (CameraComponent *object)
 
const float * GetProjectionRatio () const
 
void SetProjectionRatio (float ratio)
 
CameraComponentGetCurrentCamera () const
 
void ChangeCurrentCamera (CameraComponent *camera)
 
GLProgramHandleGetSkyboxProgram () const
 
- Public Member Functions inherited from CSE::SContainerList< CameraComponent * >
void Register (CameraComponent * object) override
 
void Remove (CameraComponent * object) override
 
CameraComponentGet (int index) const override
 
std::list< CameraComponent * > GetAll () const override
 
int GetID (CameraComponent * object) const override
 
int GetSize () const override
 
- Public Member Functions inherited from CSE::SIContainer< S, T, M >
virtual void Register (T object)=0
 
virtual void Remove (T object)=0
 
virtual T Get (M index) const =0
 
virtual M GetID (T object) const =0
 
- Public Member Functions inherited from CSE::CoreBase
virtual void Update (float elapsedTime)
 

Additional Inherited Members

- Protected Attributes inherited from CSE::SContainerList< CameraComponent * >
std::list< CameraComponent * > m_objects
 
int m_size
 

Detailed Description

Definition at line 11 of file CameraMgr.h.

Member Function Documentation

◆ ChangeCurrentCamera()

void CameraMgr::ChangeCurrentCamera ( CameraComponent camera)

Definition at line 62 of file CameraMgr.cpp.

62 {
63
64 m_currentCamera = camera;
65
66}

◆ DeleteCameraComponent()

void CameraMgr::DeleteCameraComponent ( CameraComponent object)

Definition at line 22 of file CameraMgr.cpp.

22 {
23 if (object == nullptr) return;
24
25 auto iGameObj = std::find(m_objects.begin(), m_objects.end(), object);
26
27 if (iGameObj != m_objects.end()) {
28 m_size--;
29 m_objects.erase(iGameObj);
30 object->GetGameObject()->DeleteComponent(object);
31 //MemoryMgr::getInstance()->ReleaseObject(object);
32 }
33}

◆ GetCurrentCamera()

CameraComponent * CameraMgr::GetCurrentCamera ( ) const

Definition at line 54 of file CameraMgr.cpp.

54 {
55 if (m_currentCamera == nullptr && m_size > 0)
56 return m_objects.front();
57
58 return m_currentCamera;
59}

◆ GetProjectionRatio()

const float * CameraMgr::GetProjectionRatio ( ) const

Definition at line 36 of file CameraMgr.cpp.

36 {
37 return &m_projectionRatio;
38}

◆ GetSkyboxProgram()

GLProgramHandle * CameraMgr::GetSkyboxProgram ( ) const

Definition at line 68 of file CameraMgr.cpp.

68 {
69 return m_skyboxProgram;
70}

◆ Init()

void CameraMgr::Init ( )
overridevirtual

Implements CSE::CoreBase.

Definition at line 15 of file CameraMgr.cpp.

15 {
16 std::string cubemap_vert = CSE::AssetMgr::LoadAssetFile(CSE::AssetsPath() + "Shader/PBR/IBL/cubemap.vert");
17 std::string cubemap_frag = CSE::AssetMgr::LoadAssetFile(CSE::AssetsPath() + "Shader/PBR/IBL/cubemap.frag");
18
19 m_skyboxProgram = ShaderUtil::CreateProgramHandle(cubemap_vert.c_str(), cubemap_frag.c_str());
20}
static GLProgramHandle * CreateProgramHandle(const GLchar *vertexSource, const GLchar *fragmentSource, GLProgramHandle *handle=nullptr)
Creates a program handle.

◆ SetProjectionRatio()

void CameraMgr::SetProjectionRatio ( float  ratio)

Definition at line 41 of file CameraMgr.cpp.

41 {
42 m_projectionRatio = ratio;
43
44 for (auto camera : m_objects) {
45
46 if (camera == nullptr) continue;
47
48 camera->SetProjectionMatrix();
49
50 }
51}

The documentation for this class was generated from the following files: