9 m_CurrentCameraComponent->m_ProjectionMatrix = glm::ortho(left, right, bottom, top,
static_cast<float>(-depth), 0.0f);
10 m_CurrentCameraComponent->m_ViewProjectionMatrix = m_CurrentCameraComponent->m_ProjectionMatrix;
11 m_CurrentCameraComponent->m_InitialCameraMinBound = { left, bottom };
12 m_CurrentCameraComponent->m_InitialCameraMaxBound = { right, top };
13 m_CurrentCameraComponent->m_CameraSize = { std::abs(right - left), std::abs(top - bottom) };
17 CORI_CORE_INFO_TAGGED({
Logger::Tags::Graphics::Self,
Logger::Tags::Graphics::Camera },
"Created orthographic camera with properties - (left: {}, right: {}, bottom: {}, top: {}, depth: {})", left, right, bottom, top, depth);
53 glm::mat4 view = glm::translate(glm::mat4(1.0f), glm::vec3(m_CurrentCameraComponent->m_CameraSize / 2.0f, 0.0f)) *
54 glm::rotate(glm::mat4(1.0f), glm::radians(m_CurrentCameraComponent->m_CameraRotation), glm::vec3(0.0f, 0.0f, 1.0f)) *
55 glm::scale(glm::mat4(1.0f), glm::vec3(m_CurrentCameraComponent->m_CameraScale, 1.0f)) *
56 glm::translate(glm::mat4(1.0f), glm::vec3(-(m_CurrentCameraComponent->m_CameraSize / 2.0f + m_CurrentCameraComponent->m_CameraPosition), 0.0f));
58 m_CurrentCameraComponent->m_ViewProjectionMatrix = m_CurrentCameraComponent->m_ProjectionMatrix * view;
60 glm::mat3 translation;
61 translation[0] = glm::vec3(view[0].x, view[0].y, view[0].w);
62 translation[1] = glm::vec3(view[1].x, view[1].y, view[1].w);
63 translation[2] = glm::vec3(view[3].x, view[3].y, view[3].w);
64 translation = glm::inverse(translation) * glm::translate(glm::mat3(1.0f), glm::vec2(m_CurrentCameraComponent->m_CameraSize / 2.0f));
66 m_CurrentCameraComponent->m_CameraBounds =
Utility::CalculateAABB(translation, m_CurrentCameraComponent->m_CameraSize / 2.0f);
void CreateOrthoCamera(const float left, float right, const float bottom, const float top, const uint8_t depth=50)
Creates or recreate an orthographic camera.