34 using ScalarType = Scalar;
38 enum class ProjectionMode { ORTHO, PERSPECTIVE };
77 void reset() { *
this = {}; }
79 PointType& center() {
return mCenter; }
81 const PointType& center()
const {
return mCenter; }
83 PointType& eye() {
return mEye; }
85 const PointType& eye()
const {
return mEye; }
87 PointType& up() {
return mUp; }
89 const PointType& up()
const {
return mUp; }
91 Scalar& fieldOfView() {
return mFovDeg; }
93 const Scalar& fieldOfView()
const {
return mFovDeg; }
95 void setFieldOfViewAdaptingEyeDistance(
const Scalar& fov)
98 PointType targetToEye = (
mEye -
mCenter).normalized();
100 std::tan((fov / 2.0) / 180.0 * M_PI));
111 Scalar& aspectRatio() {
return mAspect; }
113 const Scalar& aspectRatio()
const {
return mAspect; }
115 Scalar& nearPlane() {
return mNear; }
117 const Scalar& nearPlane()
const {
return mNear; }
119 Scalar& farPlane() {
return mFar; }
121 const Scalar& farPlane()
const {
return mFar; }
123 MatrixType viewMatrix()
const
128 MatrixType projectionMatrix()
const
131 case ProjectionMode::ORTHO: {
134 return orthoProjectionMatrix<MatrixType>(
137 case ProjectionMode::PERSPECTIVE: {