32 #ifndef Camera_INCLUDE_ONCE 33 #define Camera_INCLUDE_ONCE 65 void computeNearFarOptimizedProjMatrix(
const Sphere& scene_bounding_sphere);
70 void computeFrustumPlanes();
73 void applyModelViewMatrix(
const mat4& model_matrix)
const;
76 void applyViewMatrix()
const;
79 void applyProjMatrix()
const;
86 return (real)viewport()->width()/viewport()->height();
93 void setFOV(real fov) { mFOV = fov; }
96 real
fov()
const {
return mFOV; }
113 real
left()
const {
return mLeft; }
117 real
right()
const {
return mRight; }
125 real
top()
const {
return mTop; }
182 void setProjectionPerspective();
186 void setProjectionPerspective(real fov, real near, real far);
198 void setProjectionFrustum(real left, real right, real bottom, real top, real znear, real zfar);
206 void setProjectionOrtho(real left, real right, real bottom, real top, real znear, real zfar);
214 void setProjectionOrtho();
224 void setProjectionOrtho(real offset);
230 void setViewMatrixLookAt(
const vec3& eye,
const vec3& at,
const vec3& up);
237 void getViewMatrixAsLookAt(
vec3& eye,
vec3& at,
vec3& up,
vec3& right)
const;
240 bool project(
const vec4& in_world,
vec4& out_viewp)
const;
248 bool unproject(
const vec3& in_viewp,
vec4& out_world)
const;
251 bool unproject(std::vector<vec3>& points)
const;
260 Ray computeRay(
int viewp_x,
int viewp_y);
263 Frustum computeRayFrustum(
int viewp_x,
int viewp_y);
270 void adjustView(
const AABB& aabb,
const vec3& dir,
const vec3& up, real bias=1.0f);
280 real mLeft, mRight, mBottom,
mTop;
EProjectionMatrixType projectionMatrixType() const
The Camera's projection matrix type.
void setNearPlane(real nearplane)
The near clipping plane.
const mat4 & viewMatrix() const
Returns the Camera's view matrix (inverse of the modeling matrix).
void setViewport(Viewport *viewport)
The viewport bound to a camera.
const Transform * boundTransform() const
Returns the Transform bound to a camera.
The Ray class defines a ray as an origin and direction using real precision.
ref< Viewport > mViewport
A set of planes defining a frustum used for culling purposes (frustum culling).
const Viewport * viewport() const
The viewport bound to a camera.
void setFarPlane(real farplane)
The far clipping plane.
ref< Transform > mBoundTransform
real left() const
'left' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
real nearPlane() const
The near clipping plane.
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
EProjectionMatrixType mProjectionType
Viewport * viewport()
The viewport bound to a camera.
Visualization Library main namespace.
const Frustum & frustum() const
The view frustum of the camera used to perform frustum culling.
T_Scalar getInverse(Matrix4 &dest) const
real fov() const
The field of view of the camera.
The AABB class implements an axis-aligned bounding box using vl::real precision.
real top() const
'top' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
The base class for all the reference counted objects.
const mat4 & modelingMatrix() const
Returns the Camera's modelingMatrix() (inverse of the view matrix).
Frustum & frustum()
The view frustum of the camera used to perform frustum culling.
Implements the viewport and clearing settings associated to a Camera.
real farPlane() const
The far clipping plane.
real bottom() const
'bottom' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
void setProjectionMatrix(const mat4 &mat, EProjectionMatrixType proj_type)
The Camera's projection matrix.
void setModelingMatrix(const mat4 &mat)
Sets the Camera's modelingMatrix() (inverse of the view matrix).
void setViewMatrix(const mat4 &mat)
Sets the Camera's view matrix (inverse of the modeling matrix).
The Sphere class defines a sphere using a center and a radius using vl::real precision.
#define VLGRAPHICS_EXPORT
void setFrustum(const Frustum &frustum)
The view frustum of the camera used to perform frustum culling.
void bindTransform(Transform *transform)
Bind the camera to a Transform.
const mat4 & projectionMatrix() const
The Camera's projection matrix.
Transform * boundTransform()
Returns the Transform bound to a camera.
The ref<> class is used to reference-count an Object.
real right() const
'right' parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
void setFOV(real fov)
The field of view of the camera.
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
real aspectRatio() const
Returns the aspect ratio computed as viewport()->width()/viewport()->height().