diff --git a/Camera.cpp b/Camera.cpp index 74df939..e690b5a 100644 --- a/Camera.cpp +++ b/Camera.cpp @@ -153,7 +153,7 @@ OrthographicCamera::OrthographicCamera( 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); + setProjection(glm::ortho(_leftPlane, _rightPlane, _bottomPlane, _topPlane, _nearPlane, _farPlane)); } float OrthographicCamera::getLeftPlane() const { return _leftPlane; } @@ -170,15 +170,15 @@ float OrthographicCamera::getFarPlane() const { return _farPlane; } // PerspectiveCamera class 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 + const Vec3& pos, + const Vec3& tar, + const Vec3& up , + float fov, + float aspectRatio, + float near, + float far ) : Camera(pos, tar, up), _fov(fov), _ratio(aspectRatio), _nearPlane(near), _farPlane(far) { - _proj = glm::perspective(glm::radians(_fov), _ratio, _nearPlane, _farPlane); + setProjection(glm::perspective(glm::radians(_fov), _ratio, _nearPlane, _farPlane)); } } \ No newline at end of file diff --git a/include/Camera.h b/include/Camera.h index 1336f28..ecada51 100644 --- a/include/Camera.h +++ b/include/Camera.h @@ -103,6 +103,7 @@ public: void setTopPlane(float); void setNearPlane(float); void setFarPlane(float); + void setOrthographicProjection(float left=-1.0, float right=1.0, float bottom=-1.0, float top=1.0, float near=-1.0, float far=1.0); private: float _leftPlane, _rightPlane, _topPlane, _bottomPlane, _nearPlane, _farPlane;