36 enum Enum { ORTHO, PERSPECTIVE };
79 void reset() { *
this = {}; }
81 PointType& center() {
return mCenter; }
83 const PointType& center()
const {
return mCenter; }
85 PointType& eye() {
return mEye; }
87 const PointType& eye()
const {
return mEye; }
89 PointType& up() {
return mUp; }
91 const PointType& up()
const {
return mUp; }
93 Scalar& fieldOfView() {
return mFovDeg; }
95 const Scalar& fieldOfView()
const {
return mFovDeg; }
97 void setFieldOfViewAdaptingEyeDistance(
const Scalar& fov)
100 PointType targetToEye = (
mEye -
mCenter).normalized();
102 std::tan((fov / 2.0) / 180.0 * M_PI));
107 ProjectionMode::Enum projectionMode()
const {
return mProjectionMode; }
113 Scalar& aspectRatio() {
return mAspect; }
115 const Scalar& aspectRatio()
const {
return mAspect; }
117 Scalar& nearPlane() {
return mNear; }
119 const Scalar& nearPlane()
const {
return mNear; }
121 Scalar& farPlane() {
return mFar; }
123 const Scalar& farPlane()
const {
return mFar; }
125 MatrixType viewMatrix()
const
130 MatrixType projMatrix()
const
133 case ProjectionMode::ORTHO: {
136 return orthoProjectionMatrix<MatrixType>(
139 case ProjectionMode::PERSPECTIVE: {
140 return projectionMatrix<MatrixType>(