Visualization Library 2.1.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Camera.cpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2020, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #include <vlGraphics/Camera.hpp>
33 #include <vlGraphics/OpenGL.hpp>
34 #include <vlCore/AABB.hpp>
35 #include <vlCore/Log.hpp>
36 #include <vlCore/Say.hpp>
37 
38 #undef near
39 #undef far
40 
41 using namespace vl;
42 
43 //-----------------------------------------------------------------------------
44 // Camera
45 //-----------------------------------------------------------------------------
47 {
48  VL_DEBUG_SET_OBJECT_NAME()
49  mFrustum.planes().resize(6);
50  mFOV = 60.0;
51  mNearPlane = (real)0.05;
52  mFarPlane = (real)10000.0;
53  mLeft = mRight = mTop = mBottom = -1;
54  mViewport = new Viewport;
55 
58 }
59 //-----------------------------------------------------------------------------
60 void Camera::applyModelViewMatrix(const mat4& model_matrix) const
61 {
62  /* some OpenGL drivers (ATI) require this instead of the more general (and mathematically correct) viewMatrix() */
63  mat4 viewm = viewMatrix();
64  viewm.e(3,0) = 0.0;
65  viewm.e(3,1) = 0.0;
66  viewm.e(3,2) = 0.0;
67  viewm.e(3,3) = 1.0;
68 
69  glMatrixMode(GL_MODELVIEW);
70 #if 0
71  VL_glLoadMatrix( viewm.ptr() );
72  VL_glMultMatrix( matrix.ptr() );
73 #elif 0
74  viewm = viewm * matrix;
75  VL_glLoadMatrix( viewm.ptr() );
76 #else
77  VL_glLoadMatrix( (viewm * model_matrix).ptr() );
78 #endif
79 }
80 //-----------------------------------------------------------------------------
82 {
83  // projection matrix
84  glMatrixMode( GL_PROJECTION );
85  VL_glLoadMatrix( projectionMatrix().ptr() );
86 }
87 //-----------------------------------------------------------------------------
89 {
90  /* some OpenGL drivers (ATI) require this instead of the more general (and mathematically correct) viewMatrix() */
91  mat4 viewm = viewMatrix();
92  viewm.e(3,0) = 0.0;
93  viewm.e(3,1) = 0.0;
94  viewm.e(3,2) = 0.0;
95  viewm.e(3,3) = 1.0;
96  glMatrixMode(GL_MODELVIEW);
97  VL_glLoadMatrix( viewm.ptr() );
98 }
99 //-----------------------------------------------------------------------------
100 void Camera::computeNearFarOptimizedProjMatrix(const Sphere& scene_bounding_sphere)
101 {
102  // near/far clipping planes optimization
103  if (!scene_bounding_sphere.isNull())
104  {
105  // transform the sphere in camera coordinates
106  Sphere camera_sphere;
107  scene_bounding_sphere.transformed(camera_sphere, viewMatrix());
108 
109  // visible objects are in the negative z, but we need a positive distance for the near and far clipping planes
110  mNearPlane = -(camera_sphere.center().z() + camera_sphere.radius());
111  mFarPlane = -(camera_sphere.center().z() - camera_sphere.radius());
112 
113  // clamp to positive epsilon: can't let near and far clipping planes go behind the camera!
114  real epsilon = camera_sphere.radius() / 1000.0f;
115  mFarPlane = max(mFarPlane, epsilon * 2); // alway more than the near
116  mNearPlane = max(mNearPlane, epsilon * 1);
117 
118  switch(projectionMatrixType())
119  {
121  break;
123  break;
124 
125  // we cannot do this: if we change the near plane we have to recompute also left, right, bottom and top!
126  // case PMT_PerspectiveProjectionFrustum: setProjectionFrustum(mLeft, mRight, mBottom, mTop, mNearPlane, mFarPlane);
127  // break;
128 
129  default:
130  Log::bug("Camera::computeNearFarOptimizedProjMatrix() called on unsupported projection type.\n");
131  }
132  }
133 }
134 //-----------------------------------------------------------------------------
135 void Camera::adjustView(const AABB& aabb, const vec3& dir, const vec3& up, real bias)
136 {
137  VL_CHECK(bias >= 0)
138  VL_CHECK(!aabb.isNull())
139  if (bias < 0)
140  vl::Log::bug("Camera::adjustView(): 'bias' must be >= 0.\n");
141 
142  vec3 center = aabb.center();
143 
144  Sphere sphere(aabb);
145  const vec3& C = modelingMatrix().getT();
146  const vec3& V = -modelingMatrix().getZ();
147  const real R = sphere.radius();
148 
149  // extract the frustum planes based on the current view and projection matrices
150  mat4 viewproj = projectionMatrix() * viewMatrix();
151  Frustum frustum; frustum.planes().resize(6);
152  extractPlanes( &frustum.planes()[0], viewproj );
153  // iterate over left/right/top/bottom clipping planes. the planes are in world coords.
154  real max_t = 0;
155  for(int i=0; i<4; ++i)
156  {
157  const vec3& O = frustum.plane(i).origin() * frustum.plane(i).normal();
158  const vec3& N = frustum.plane(i).normal();
159  real dot_n_v = dot(N,V);
160  // if this triggers adjust your parameters so it doesn't happen
161  VL_CHECK(dot_n_v);
162  real t = - (R + dot(O,N) - dot(C,N)) / dot_n_v;
163  VL_CHECK(t>=0)
164  if (t > max_t)
165  max_t = t;
166  }
167  real dist = max_t;
168  mat4 m = mat4::getLookAt(center+dir*dist*bias,center,up);
169  setViewMatrix(m);
170 }
171 //-----------------------------------------------------------------------------
173 {
174  // build modelview matrix
175  mat4 viewproj = projectionMatrix() * viewMatrix();
176  // frustum plane extraction
177  mFrustum.planes().resize(6);
178  extractPlanes( &mFrustum.planes()[0], viewproj );
179 }
180 //-----------------------------------------------------------------------------
181 void Camera::setProjectionFrustum(real left, real right, real bottom, real top, real near, real far)
182 {
183  // see http://www.opengl.org/resources/faq/technical/transformations.htm
184  setFOV( 2.0f*atan((top-bottom)*0.5f/near) );
185  setNearPlane(near);
186  setFarPlane(far);
187  setProjectionMatrix(mat4::getFrustum(left, right, bottom, top, near, far), PMT_PerspectiveProjectionFrustum);
188 }
189 //-----------------------------------------------------------------------------
190 void Camera::setProjectionPerspective(real fov, real near, real far)
191 {
192  setFOV(fov);
193  setNearPlane(near);
194  setFarPlane(far);
196 }
197 //-----------------------------------------------------------------------------
199 {
201 }
202 //-----------------------------------------------------------------------------
204 {
205  mLeft = 0;
206  mRight = (real)mViewport->width();
207  mBottom = 0;
208  mTop = (real)mViewport->height();
209  mFOV = -1;
211 }
212 //-----------------------------------------------------------------------------
213 void Camera::setProjectionOrtho(real left, real right, real bottom, real top, real znear, real zfar)
214 {
215  mLeft = left;
216  mRight = right;
217  mBottom = bottom;
218  mTop = top;
219  mFOV = -1;
220  mNearPlane = znear;
221  mFarPlane = zfar;
223 }
224 //-----------------------------------------------------------------------------
225 void Camera::setProjectionOrtho(real offset)
226 {
227  mLeft = offset;
228  mRight = viewport()->width() + offset;
229  mBottom = offset;
230  mTop = viewport()->height() + offset;
231  mFOV = -1;
232  mNearPlane = -1;
233  mFarPlane = +1;
235 }
236 //-----------------------------------------------------------------------------
237 void Camera::setViewMatrixLookAt( const vec3& eye, const vec3& at, const vec3& up)
238 {
239  // note: this sets both the local matrix and the view matrix
240  setViewMatrix( mat4::getLookAt(eye, at, up) );
241 }
242 //-----------------------------------------------------------------------------
243 void Camera::getViewMatrixAsLookAt( vec3& eye, vec3& at, vec3& up, vec3& right) const
244 {
245  mModelingMatrix.getAsLookAtModeling(eye, at, up, right);
246 }
247 //-----------------------------------------------------------------------------
248 bool Camera::project(const vec4& in, vec4& out) const
249 {
250  out = mProjectionMatrix * mViewMatrix * in;
251 
252  if (out.w() == 0.0f)
253  return false;
254 
255  out.x() /= out.w();
256  out.y() /= out.w();
257  out.z() /= out.w();
258 
259  // map to range 0-1
260  out.x() = out.x() * 0.5f + 0.5f;
261  out.y() = out.y() * 0.5f + 0.5f;
262  out.z() = out.z() * 0.5f + 0.5f;
263 
264  // map to viewport
265  out.x() = out.x() * mViewport->width() + mViewport->x();
266  out.y() = out.y() * mViewport->height() + mViewport->y();
267  return true;
268 }
269 //-----------------------------------------------------------------------------
270 bool Camera::unproject(const vec3& win, vec4& out) const
271 {
272  vec4 v;
273  v.x() = win.x();
274  v.y() = win.y();
275  v.z() = win.z();
276  v.w() = 1.0;
277 
278  // map from viewport to 0-1
279  v.x() = (v.x() - mViewport->x()) / mViewport->width();
280  v.y() = (v.y() - mViewport->y()) / mViewport->height();
281 
282  // map to range -1 to 1
283  v.x() = v.x() * 2.0f - 1.0f;
284  v.y() = v.y() * 2.0f - 1.0f;
285  v.z() = v.z() * 2.0f - 1.0f;
286 
287  real det=0;
288  mat4 inverse = (mProjectionMatrix * mViewMatrix).getInverse(&det);
289  if (!det)
290  return false;
291 
292  v = inverse * v;
293  if (v.w() == 0.0)
294  return false;
295 
296  out = v / v.w();
297  return true;
298 }
299 //-----------------------------------------------------------------------------
300 bool Camera::unproject(std::vector<vec3>& win) const
301 {
302  real det=0;
303  mat4 inverse = (mProjectionMatrix * mViewMatrix).getInverse(&det);
304  if (!det)
305  return false;
306 
307  bool ok = true;
308  for(unsigned i=0; i<win.size(); ++i)
309  {
310  vec4 v;
311  v = vec4( win[i], 1.0 );
312 
313  // map from viewport to 0-1
314  v.x() = (v.x() - mViewport->x()) / mViewport->width();
315  v.y() = (v.y() - mViewport->y()) / mViewport->height();
316 
317  // map to range -1 to 1
318  v.x() = v.x() * 2.0f - 1.0f;
319  v.y() = v.y() * 2.0f - 1.0f;
320  v.z() = v.z() * 2.0f - 1.0f;
321 
322  v = inverse * v;
323  if (v.w() == 0.0)
324  {
325  ok = false;
326  continue;
327  }
328 
329  v = v / v.w();
330  win[i] = v.xyz();
331  }
332  return ok;
333 }
334 //-----------------------------------------------------------------------------
335 Ray Camera::computeRay(int winx, int winy)
336 {
337  vl::vec4 out;
338  if (!unproject( vl::vec3((real)winx,(real)winy,0), out ))
339  return Ray();
340  else
341  {
342  vl::Ray ray;
343  ray.setOrigin(out.xyz());
344  ray.setDirection( (out.xyz() - modelingMatrix().getT()).normalize() );
345  return ray;
346  }
347 }
348 //-----------------------------------------------------------------------------
350 {
351  /*
352  n3
353  D-----C
354  | |
355  n4| O |n2
356  | |
357  A-----B
358  n1
359  */
360  // compute the frustum passing through the adjacent pixels
361  vl::vec4 A1,B1,C1,D1;
362  vl::vec4 A2,B2,C2,D2;
363  unproject( vl::vec3((real)winx-1,(real)winy-1,0), A1 );
364  unproject( vl::vec3((real)winx+1,(real)winy-1,0), B1 );
365  unproject( vl::vec3((real)winx+1,(real)winy+1,0), C1 );
366  unproject( vl::vec3((real)winx-1,(real)winy+1,0), D1 );
367  unproject( vl::vec3((real)winx-1,(real)winy-1,0.1f), A2 );
368  unproject( vl::vec3((real)winx+1,(real)winy-1,0.1f), B2 );
369  unproject( vl::vec3((real)winx+1,(real)winy+1,0.1f), C2 );
370  unproject( vl::vec3((real)winx-1,(real)winy+1,0.1f), D2 );
371 
372  vec3 n1 = -cross(A2.xyz()-A1.xyz(),B1.xyz()-A1.xyz());
373  vec3 n2 = -cross(B2.xyz()-B1.xyz(),C1.xyz()-B1.xyz());
374  vec3 n3 = -cross(C2.xyz()-C1.xyz(),D1.xyz()-C1.xyz());
375  vec3 n4 = -cross(D2.xyz()-D1.xyz(),A1.xyz()-D1.xyz());
377  frustum.planes().push_back( Plane( A1.xyz(), n1 ) );
378  frustum.planes().push_back( Plane( B1.xyz(), n2 ) );
379  frustum.planes().push_back( Plane( C1.xyz(), n3 ) );
380  frustum.planes().push_back( Plane( D1.xyz(), n4 ) );
381  return frustum;
382 }
383 //-----------------------------------------------------------------------------
EProjectionMatrixType projectionMatrixType() const
The Camera&#39;s projection matrix type.
Definition: Camera.hpp:177
void setNearPlane(real nearplane)
The near clipping plane.
Definition: Camera.hpp:99
const T_Scalar & z() const
Definition: Vector4.hpp:104
VLCORE_EXPORT void extractPlanes(Plane *planes, const mat4 &modelviewproj)
Extracts the 6 frustum planes for the given model-view-projection matrix.
Definition: math_utils.cpp:82
const mat4 & viewMatrix() const
Returns the Camera&#39;s view matrix (inverse of the modeling matrix).
Definition: Camera.hpp:160
const T_Scalar & e(int i, int j) const
Definition: Matrix4.hpp:665
const T_Scalar & x() const
Definition: Vector4.hpp:102
real mLeft
Definition: Camera.hpp:279
Vector3< T_Scalar > getZ() const
Definition: Matrix4.hpp:131
Projection matrix generated by mat4::getPerspective() or similar.
mat4 mViewMatrix
Definition: Camera.hpp:272
real mTop
Definition: Camera.hpp:279
static Matrix4 getPerspective(float fovy, float aspect_ratio, float znear, float zfar)
Definition: Matrix4.hpp:830
The Ray class defines a ray as an origin and direction using real precision.
Definition: Ray.hpp:41
The Plane class defines a plane using a normal and an origin.
Definition: Plane.hpp:49
bool isNull() const
Returns true if the AABB is null.
Definition: AABB.hpp:60
ref< Viewport > mViewport
Definition: Camera.hpp:275
Ray computeRay(int viewp_x, int viewp_y)
Computes the ray passing through the point <viewp_x,viewp_y>.
Definition: Camera.cpp:335
A set of planes defining a frustum used for culling purposes (frustum culling).
Definition: Frustum.hpp:49
const T_Scalar & z() const
Definition: Vector3.hpp:92
std::vector< Plane > & planes()
Definition: Frustum.hpp:54
void getViewMatrixAsLookAt(vec3 &eye, vec3 &at, vec3 &up, vec3 &right) const
Returns the look-at parameters of the modelview transform.
Definition: Camera.cpp:243
void adjustView(const AABB &aabb, const vec3 &dir, const vec3 &up, real bias=1.0f)
Adjusts the camera position so that the given aabb can be properly viewed.
Definition: Camera.cpp:135
real mFarPlane
Definition: Camera.hpp:281
void setProjectionPerspective()
Builds a perspective projection matrix for the Camera based on the Camera&#39;s and Viewport&#39;s settings...
Definition: Camera.cpp:198
mat4 mProjectionMatrix
Definition: Camera.hpp:274
const vec3 & center() const
Returns the center of the sphere.
Definition: Sphere.hpp:68
Frustum computeRayFrustum(int viewp_x, int viewp_y)
Computes a 1 pixel wide frustum suitable to cull objects during ray intersection detection.
Definition: Camera.cpp:349
void setFarPlane(real farplane)
The far clipping plane.
Definition: Camera.hpp:106
Vector3< T_Scalar > xyz() const
Definition: Vector4.hpp:132
const Plane & plane(unsigned i) const
Definition: Frustum.hpp:58
real origin() const
Definition: Plane.hpp:76
vec3 center() const
Returns the center of the AABB.
Definition: AABB.cpp:184
static Matrix4 getOrtho(float pleft, float pright, float pbottom, float ptop, float pnear, float pfar)
Definition: Matrix4.hpp:875
real left() const
&#39;left&#39; parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
Definition: Camera.hpp:112
real nearPlane() const
The near clipping plane.
Definition: Camera.hpp:102
fvec3 cross(const fvec3 &v1, const fvec3 &v2)
Definition: Vector3.hpp:278
void applyViewMatrix() const
Loads the GL_MODELVIEW matrix with the Camera&#39;s view matrix.
Definition: Camera.cpp:88
EProjectionMatrixType mProjectionType
Definition: Camera.hpp:282
Viewport * viewport()
The viewport bound to a camera.
Definition: Camera.hpp:140
Visualization Library main namespace.
Projection matrix generated by mat4::getFrustum() or similar.
real radius() const
Returns the radius of the sphere.
Definition: Sphere.hpp:74
bool unproject(const vec3 &in_viewp, vec4 &out_world) const
Unprojects a vector from viewport coordinates to world coordinates.
Definition: Camera.cpp:270
Frustum mFrustum
Definition: Camera.hpp:276
float dot(float a, float b)
Definition: glsl_math.hpp:1111
real mBottom
Definition: Camera.hpp:279
const Frustum & frustum() const
The view frustum of the camera used to perform frustum culling.
Definition: Camera.hpp:131
bool project(const vec4 &in_world, vec4 &out_viewp) const
Projects a vector from world coordinates to viewport coordinates.
Definition: Camera.cpp:248
void computeFrustumPlanes()
Computes the Camera&#39;s frustum planes in world space.
Definition: Camera.cpp:172
void computeNearFarOptimizedProjMatrix(const Sphere &scene_bounding_sphere)
The near and far clipping planes are adjusted to fit the provided scene_bounding_sphere.
Definition: Camera.cpp:100
real mNearPlane
Definition: Camera.hpp:280
static void bug(const String &message)
Use this function to provide information about programming errors: wrong parameter initialization...
Definition: Log.cpp:175
int height() const
Definition: Viewport.hpp:71
real fov() const
The field of view of the camera.
Definition: Camera.hpp:95
int width() const
Definition: Viewport.hpp:69
The AABB class implements an axis-aligned bounding box using vl::real precision.
Definition: AABB.hpp:44
real top() const
&#39;top&#39; parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
Definition: Camera.hpp:124
Projection matrix generated by mat4::getOrtho() or similar.
float max(float a, float b)
Definition: Vector2.hpp:312
const mat4 & modelingMatrix() const
Returns the Camera&#39;s modelingMatrix() (inverse of the view matrix).
Definition: Camera.hpp:168
real mRight
Definition: Camera.hpp:279
const T_Scalar & y() const
Definition: Vector3.hpp:91
Implements the viewport and clearing settings associated to a Camera.
Definition: Viewport.hpp:51
real farPlane() const
The far clipping plane.
Definition: Camera.hpp:109
real bottom() const
&#39;bottom&#39; parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
Definition: Camera.hpp:120
const T_Scalar & y() const
Definition: Vector4.hpp:103
void setProjectionMatrix(const mat4 &mat, EProjectionMatrixType proj_type)
The Camera&#39;s projection matrix.
Definition: Camera.hpp:171
T atan(T a)
Definition: glsl_math.hpp:277
void setOrigin(const vec3 &orig)
Definition: Ray.hpp:47
void setViewMatrixLookAt(const vec3 &eye, const vec3 &at, const vec3 &up)
Setup the modelview transform of the camera based on look-at parameters.
Definition: Camera.cpp:237
void setViewMatrix(const mat4 &mat)
Sets the Camera&#39;s view matrix (inverse of the modeling matrix).
Definition: Camera.hpp:156
The Sphere class defines a sphere using a center and a radius using vl::real precision.
Definition: Sphere.hpp:43
void applyProjMatrix() const
Loads the GL_PROJECTION matrix with the Camera&#39;s projection matrix.
Definition: Camera.cpp:81
mat4 mModelingMatrix
Definition: Camera.hpp:273
void setDirection(const vec3 &dir)
Definition: Ray.hpp:46
Vector3< T_Scalar > getT() const
Definition: Matrix4.hpp:136
static Matrix4 getFrustum(float pleft, float pright, float pbottom, float ptop, float pnear, float pfar)
Definition: Matrix4.hpp:852
const vec3 & normal() const
Definition: Plane.hpp:74
void setProjectionFrustum(real left, real right, real bottom, real top, real znear, real zfar)
Produces a perspective projection matrix.
Definition: Camera.cpp:181
void applyModelViewMatrix(const mat4 &model_matrix) const
Loads the GL_MODELVIEW matrix with the Camera&#39;s view matrix multiplied by the specified model matrix...
Definition: Camera.cpp:60
void getAsLookAtModeling(Vector3< T_Scalar > &eye, Vector3< T_Scalar > &at, Vector3< T_Scalar > &up, Vector3< T_Scalar > &right) const
Definition: Matrix4.hpp:807
T_Scalar * ptr()
Definition: Matrix4.hpp:345
void setProjectionOrtho()
Builds an orthographic projection matrix for the Camera based on the Camera&#39;s near/far planes and its...
Definition: Camera.cpp:203
const mat4 & projectionMatrix() const
The Camera&#39;s projection matrix.
Definition: Camera.hpp:174
const T_Scalar & x() const
Definition: Vector3.hpp:90
real right() const
&#39;right&#39; parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
Definition: Camera.hpp:116
void setFOV(real fov)
The field of view of the camera.
Definition: Camera.hpp:92
real aspectRatio() const
Returns the aspect ratio computed as viewport()->width()/viewport()->height().
Definition: Camera.hpp:82
void transformed(Sphere &out, const mat4 &mat) const
Returns a sphere that contains the original sphere transformed by the given matrix.
Definition: Sphere.hpp:157
fvec4 vec4
Defined as: &#39;typedef fvec4 vec4&#39;. See also VL_PIPELINE_PRECISION.
Definition: Vector4.hpp:297
bool isNull() const
Returns true if the sphere is null, ie, if radius is < 0.
Definition: Sphere.hpp:59
static Matrix4 getLookAt(const Vector3< float > &eye, const Vector3< float > &at, const Vector3< float > &up)
Definition: Matrix4.hpp:788
#define VL_CHECK(expr)
Definition: checks.hpp:73
real mFOV
Definition: Camera.hpp:278
Camera()
Constructs a perspective projecting camera with FOV = 60.0, Near Plane = 0.05, Far Plane = 10000...
Definition: Camera.cpp:46
T normalize(T)
Definition: glsl_math.hpp:1128
const T_Scalar & w() const
Definition: Vector4.hpp:105