Added ortho cam getters

This commit is contained in:
NaifBanana 2024-11-22 01:17:28 -06:00
parent 94785e586c
commit 785de6f1f6
2 changed files with 38 additions and 13 deletions

View File

@ -156,18 +156,29 @@ OrthographicCamera::OrthographicCamera(
_proj = glm::ortho(_leftPlane, _rightPlane, _bottomPlane, _topPlane, _nearPlane, _farPlane);
}
float OrthographicCamera::getLeftPlane() const { return _leftPlane; }
float OrthographicCamera::getRightPlane() const { return _rightPlane; }
float OrthographicCamera::getBottomPlane() const { return _bottomPlane; }
float OrthographicCamera::getTopPlane() const { return _topPlane; }
float OrthographicCamera::getNearPlane() const { return _nearPlane; }
float OrthographicCamera::getFarPlane() const { return _farPlane; }
// PerspectiveCamera class
/* PerspectiveCamera::PerspectiveCamera(
const Vec3& pos,
const Vec3& tar,
const Vec3& up,
float left,
float right,
float bottom,
float top,
float near,
float far
) : Camera(pos, tar, up), _leftPlane(left), _rightPlane(right), _bottomPlane(bottom), _topPlane(top), _nearPlane(near), _farPlane(far) {
_proj = glm::ortho(_leftPlane, _rightPlane, _bottomPlane, _topPlane, _nearPlane, _farPlane);
} */
PerspectiveCamera::PerspectiveCamera(
const Vec3& pos=Vec3(1.0f, 0.0f, 0.0f),
const Vec3& tar=Vec3(0.0f, 0.0f, 0.0f),
const Vec3& up =Vec3(0.0f, 1.0f, 0.0f),
float fov = 45.0f,
float aspectRatio = 1.0f,
float near = -1.0f,
float far = 1.0f
) : Camera(pos, tar, up), _fov(fov), _ratio(aspectRatio), _nearPlane(near), _farPlane(far) {
_proj = glm::perspective(glm::radians(_fov), _ratio, _nearPlane, _farPlane);
}
}

View File

@ -90,6 +90,20 @@ public:
float far = 1.0f
);
float getLeftPlane() const;
float getRightPlane() const;
float getBottomPlane() const;
float getTopPlane() const;
float getNearPlane() const;
float getFarPlane() const;
void setLeftPlane(float);
void setRightPlane(float);
void setBottomPlane(float);
void setTopPlane(float);
void setNearPlane(float);
void setFarPlane(float);
private:
float _leftPlane, _rightPlane, _topPlane, _bottomPlane, _nearPlane, _farPlane;