19 enum class ProjType { ORTHOGRAPHIC, PERSPECTIVE };
21 Camera( Scalar height = 1_ra, Scalar width = 1_ra );
29 inline Core::Transform getFrame()
const;
32 inline void setFrame(
const Core::Transform& frame );
35 inline Core::Vector3 getPosition()
const;
38 inline void setPosition(
const Core::Vector3& position );
41 inline Core::Vector3 getDirection()
const;
45 void setDirection(
const Core::Vector3& direction );
48 inline Core::Vector3 getUpVector()
const;
52 inline void setUpVector(
const Core::Vector3& upVector );
54 inline Core::Vector3 getRightVector()
const;
65 Core::Ray getRayFromScreen(
const Core::Vector2& pix )
const;
68 Core::Vector3 projectToScreen(
const Core::Vector3& p )
const;
71 Core::Vector3 projectToNDC(
const Core::Vector3& p )
const;
76 Core::Vector3 unProjectFromScreen(
const Core::Vector2& pix )
const;
82 Core::Vector3 unProjectFromScreen(
const Core::Vector3& pix )
const;
85 Core::Vector3 unProjectFromNDC(
const Core::Vector3& pix )
const;
92 inline ProjType getType()
const;
95 inline void setType(
const ProjType& projectionType );
98 inline Scalar getZoomFactor()
const;
101 inline void setZoomFactor(
const Scalar& zoomFactor );
105 inline Scalar getFOV()
const;
115 inline void setFOV( Scalar fov );
117 inline Scalar getMinZNear()
const;
118 inline Scalar getMinZRange()
const;
121 inline Core::Matrix4 getProjMatrix()
const;
122 inline Core::Matrix4 getViewMatrix()
const;
125 void updateProjMatrix();
129 inline void setProjMatrix( Core::Matrix4 projMatrix );
132 inline Scalar getZNear()
const;
135 inline void setZNear( Scalar zNear );
138 inline Scalar getZFar()
const;
141 inline void setZFar( Scalar zFar );
144 inline Scalar getWidth()
const;
147 inline Scalar getHeight()
const;
150 inline Scalar getAspect()
const;
153 inline void setXYmag( Scalar xmag, Scalar ymag );
159 void setViewport( Scalar width, Scalar height );
161 void applyTransform(
const Core::Transform& T );
164 void fitZRange(
const Core::Aabb& aabb );
166 const Scalar m_minZNear { 0.01_ra };
167 const Scalar m_minZRange { 0.01_ra };
178 static Core::Matrix4 perspective( Scalar a, Scalar y, Scalar n, Scalar f );
192 static Core::Matrix4 frustum( Scalar l, Scalar r, Scalar b, Scalar t, Scalar n, Scalar f );
205 static Core::Matrix4 ortho( Scalar l, Scalar r, Scalar b, Scalar t, Scalar n, Scalar f );
210 Core::Transform m_frame { Core::Transform::Identity() };
212 Core::Matrix4 m_projMatrix { Core::Matrix4::Identity() };
214 Scalar m_width { 1_ra };
215 Scalar m_height { 1_ra };
219 ProjType m_projType { ProjType::PERSPECTIVE };
220 Scalar m_zoomFactor { 1_ra };
221 Scalar m_zNear { 0.1_ra };
222 Scalar m_zFar { 1000_ra };
226 Scalar m_fov { Core::Math::PiDiv4 };
231 Scalar m_xmag { 1_ra };
232 Scalar m_ymag { 1_ra };