3#include "../Util/GLProgramHandle.h"
4#include "../Util/Render/ShaderUtil.h"
5#include "../Util/AssetsDef.h"
9CameraMgr::CameraMgr() =
default;
12CameraMgr::~CameraMgr() =
default;
15void CameraMgr::Init() {
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");
23 if (
object ==
nullptr)
return;
25 auto iGameObj = std::find(m_objects.begin(), m_objects.end(),
object);
27 if (iGameObj != m_objects.end()) {
29 m_objects.erase(iGameObj);
30 object->GetGameObject()->DeleteComponent(
object);
36const float* CameraMgr::GetProjectionRatio()
const {
37 return &m_projectionRatio;
41void CameraMgr::SetProjectionRatio(
float ratio) {
42 m_projectionRatio = ratio;
44 for (
auto camera : m_objects) {
46 if (camera ==
nullptr)
continue;
48 camera->SetProjectionMatrix();
55 if (m_currentCamera ==
nullptr && m_size > 0)
56 return m_objects.front();
58 return m_currentCamera;
64 m_currentCamera = camera;
69 return m_skyboxProgram;
static GLProgramHandle * CreateProgramHandle(const GLchar *vertexSource, const GLchar *fragmentSource, GLProgramHandle *handle=nullptr)
Creates a program handle.