37 using ScalarType = Scalar;
41 enum class ProjectionMode { ORTHO, PERSPECTIVE };
92 void reset() { *
this = {}; }
94 PointType& center() {
return mCenter; }
96 const PointType& center()
const {
return mCenter; }
98 PointType& eye() {
return mEye; }
100 const PointType& eye()
const {
return mEye; }
102 PointType& up() {
return mUp; }
104 const PointType& up()
const {
return mUp; }
106 Scalar& fieldOfView() {
return mFovDeg; }
108 const Scalar& fieldOfView()
const {
return mFovDeg; }
110 void setFieldOfViewAdaptingEyeDistance(
const Scalar& fovDeg)
113 PointType targetToEye = (
mEye -
mCenter).normalized();
116 std::tan((fovDeg / 2.0) / 180.0 * M_PI));
127 Scalar& aspectRatio() {
return mAspect; }
129 const Scalar& aspectRatio()
const {
return mAspect; }
131 Scalar& nearPlane() {
return mNear; }
133 const Scalar& nearPlane()
const {
return mNear; }
135 Scalar& farPlane() {
return mFar; }
137 const Scalar& farPlane()
const {
return mFar; }
139 MatrixType viewMatrix()
const
144 MatrixType projectionMatrix()
const
147 case ProjectionMode::ORTHO: {
150 return orthoProjectionMatrix<MatrixType>(
153 case ProjectionMode::PERSPECTIVE: {