Visualization Library 2.0.0-b3

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-2017, 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 t = - (R + dot(O,N) - dot(C,N)) / dot(N,V);
160  VL_CHECK(t>=0)
161  if (t > max_t)
162  max_t = t;
163  }
164  real dist = max_t;
165  mat4 m = mat4::getLookAt(center+dir*dist*bias,center,up);
166  setViewMatrix(m);
167 }
168 //-----------------------------------------------------------------------------
170 {
171  // build modelview matrix
172  mat4 viewproj = projectionMatrix() * viewMatrix();
173  // frustum plane extraction
174  mFrustum.planes().resize(6);
175  extractPlanes( &mFrustum.planes()[0], viewproj );
176 }
177 //-----------------------------------------------------------------------------
178 void Camera::setProjectionFrustum(real left, real right, real bottom, real top, real near, real far)
179 {
180  // see http://www.opengl.org/resources/faq/technical/transformations.htm
181  setFOV( 2.0f*atan((top-bottom)*0.5f/near) );
182  setNearPlane(near);
183  setFarPlane(far);
184  setProjectionMatrix(mat4::getFrustum(left, right, bottom, top, near, far), PMT_PerspectiveProjectionFrustum);
185 }
186 //-----------------------------------------------------------------------------
187 void Camera::setProjectionPerspective(real fov, real near, real far)
188 {
189  setFOV(fov);
190  setNearPlane(near);
191  setFarPlane(far);
193 }
194 //-----------------------------------------------------------------------------
196 {
198 }
199 //-----------------------------------------------------------------------------
201 {
202  mLeft = 0;
203  mRight = (real)mViewport->width();
204  mBottom = 0;
205  mTop = (real)mViewport->height();
206  mFOV = -1;
208 }
209 //-----------------------------------------------------------------------------
210 void Camera::setProjectionOrtho(real left, real right, real bottom, real top, real znear, real zfar)
211 {
212  mLeft = left;
213  mRight = right;
214  mBottom = bottom;
215  mTop = top;
216  mFOV = -1;
217  mNearPlane = znear;
218  mFarPlane = zfar;
220 }
221 //-----------------------------------------------------------------------------
222 void Camera::setProjectionOrtho(real offset)
223 {
224  mLeft = offset;
225  mRight = viewport()->width() + offset;
226  mBottom = offset;
227  mTop = viewport()->height() + offset;
228  mFOV = -1;
229  mNearPlane = -1;
230  mFarPlane = +1;
232 }
233 //-----------------------------------------------------------------------------
234 void Camera::setViewMatrixLookAt( const vec3& eye, const vec3& at, const vec3& up)
235 {
236  // note: this sets both the local matrix and the view matrix
237  setViewMatrix( mat4::getLookAt(eye, at, up) );
238 }
239 //-----------------------------------------------------------------------------
240 void Camera::getViewMatrixAsLookAt( vec3& eye, vec3& at, vec3& up, vec3& right) const
241 {
242  mModelingMatrix.getAsLookAtModeling(eye, at, up, right);
243 }
244 //-----------------------------------------------------------------------------
245 bool Camera::project(const vec4& in, vec4& out) const
246 {
247  out = mProjectionMatrix * mViewMatrix * in;
248 
249  if (out.w() == 0.0f)
250  return false;
251 
252  out.x() /= out.w();
253  out.y() /= out.w();
254  out.z() /= out.w();
255 
256  // map to range 0-1
257  out.x() = out.x() * 0.5f + 0.5f;
258  out.y() = out.y() * 0.5f + 0.5f;
259  out.z() = out.z() * 0.5f + 0.5f;
260 
261  // map to viewport
262  out.x() = out.x() * mViewport->width() + mViewport->x();
263  out.y() = out.y() * mViewport->height() + mViewport->y();
264  return true;
265 }
266 //-----------------------------------------------------------------------------
267 bool Camera::unproject(const vec3& win, vec4& out) const
268 {
269  vec4 v;
270  v.x() = win.x();
271  v.y() = win.y();
272  v.z() = win.z();
273  v.w() = 1.0;
274 
275  // map from viewport to 0-1
276  v.x() = (v.x() - mViewport->x()) / mViewport->width();
277  v.y() = (v.y() - mViewport->y()) / mViewport->height();
278 
279  // map to range -1 to 1
280  v.x() = v.x() * 2.0f - 1.0f;
281  v.y() = v.y() * 2.0f - 1.0f;
282  v.z() = v.z() * 2.0f - 1.0f;
283 
284  real det=0;
285  mat4 inverse = (mProjectionMatrix * mViewMatrix).getInverse(&det);
286  if (!det)
287  return false;
288 
289  v = inverse * v;
290  if (v.w() == 0.0)
291  return false;
292 
293  out = v / v.w();
294  return true;
295 }
296 //-----------------------------------------------------------------------------
297 bool Camera::unproject(std::vector<vec3>& win) const
298 {
299  real det=0;
300  mat4 inverse = (mProjectionMatrix * mViewMatrix).getInverse(&det);
301  if (!det)
302  return false;
303 
304  bool ok = true;
305  for(unsigned i=0; i<win.size(); ++i)
306  {
307  vec4 v;
308  v = vec4( win[i], 1.0 );
309 
310  // map from viewport to 0-1
311  v.x() = (v.x() - mViewport->x()) / mViewport->width();
312  v.y() = (v.y() - mViewport->y()) / mViewport->height();
313 
314  // map to range -1 to 1
315  v.x() = v.x() * 2.0f - 1.0f;
316  v.y() = v.y() * 2.0f - 1.0f;
317  v.z() = v.z() * 2.0f - 1.0f;
318 
319  v = inverse * v;
320  if (v.w() == 0.0)
321  {
322  ok = false;
323  continue;
324  }
325 
326  v = v / v.w();
327  win[i] = v.xyz();
328  }
329  return ok;
330 }
331 //-----------------------------------------------------------------------------
332 Ray Camera::computeRay(int winx, int winy)
333 {
334  vl::vec4 out;
335  if (!unproject( vl::vec3((real)winx,(real)winy,0), out ))
336  return Ray();
337  else
338  {
339  vl::Ray ray;
340  ray.setOrigin(out.xyz());
341  ray.setDirection( (out.xyz() - modelingMatrix().getT()).normalize() );
342  return ray;
343  }
344 }
345 //-----------------------------------------------------------------------------
347 {
348  /*
349  n3
350  D-----C
351  | |
352  n4| O |n2
353  | |
354  A-----B
355  n1
356  */
357  // compute the frustum passing through the adjacent pixels
358  vl::vec4 A1,B1,C1,D1;
359  vl::vec4 A2,B2,C2,D2;
360  unproject( vl::vec3((real)winx-1,(real)winy-1,0), A1 );
361  unproject( vl::vec3((real)winx+1,(real)winy-1,0), B1 );
362  unproject( vl::vec3((real)winx+1,(real)winy+1,0), C1 );
363  unproject( vl::vec3((real)winx-1,(real)winy+1,0), D1 );
364  unproject( vl::vec3((real)winx-1,(real)winy-1,0.1f), A2 );
365  unproject( vl::vec3((real)winx+1,(real)winy-1,0.1f), B2 );
366  unproject( vl::vec3((real)winx+1,(real)winy+1,0.1f), C2 );
367  unproject( vl::vec3((real)winx-1,(real)winy+1,0.1f), D2 );
368 
369  vec3 n1 = -cross(A2.xyz()-A1.xyz(),B1.xyz()-A1.xyz());
370  vec3 n2 = -cross(B2.xyz()-B1.xyz(),C1.xyz()-B1.xyz());
371  vec3 n3 = -cross(C2.xyz()-C1.xyz(),D1.xyz()-C1.xyz());
372  vec3 n4 = -cross(D2.xyz()-D1.xyz(),A1.xyz()-D1.xyz());
374  frustum.planes().push_back( Plane( A1.xyz(), n1 ) );
375  frustum.planes().push_back( Plane( B1.xyz(), n2 ) );
376  frustum.planes().push_back( Plane( C1.xyz(), n3 ) );
377  frustum.planes().push_back( Plane( D1.xyz(), n4 ) );
378  return frustum;
379 }
380 //-----------------------------------------------------------------------------
EProjectionMatrixType projectionMatrixType() const
The Camera&#39;s projection matrix type.
Definition: Camera.hpp:178
void setNearPlane(real nearplane)
The near clipping plane.
Definition: Camera.hpp:100
const T_Scalar & z() const
Definition: Vector4.hpp:103
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:161
const T_Scalar & e(int i, int j) const
Definition: Matrix4.hpp:660
const T_Scalar & x() const
Definition: Vector4.hpp:101
real mLeft
Definition: Camera.hpp:280
Vector3< T_Scalar > getZ() const
Definition: Matrix4.hpp:126
Projection matrix generated by mat4::getPerspective() or similar.
mat4 mViewMatrix
Definition: Camera.hpp:273
real mTop
Definition: Camera.hpp:280
static Matrix4 getPerspective(float fovy, float aspect_ratio, float znear, float zfar)
Definition: Matrix4.hpp:825
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:276
Ray computeRay(int viewp_x, int viewp_y)
Computes the ray passing through the point <viewp_x,viewp_y>.
Definition: Camera.cpp:332
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:91
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:240
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:282
void setProjectionPerspective()
Builds a perspective projection matrix for the Camera based on the Camera&#39;s and Viewport&#39;s settings...
Definition: Camera.cpp:195
mat4 mProjectionMatrix
Definition: Camera.hpp:275
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:346
void setFarPlane(real farplane)
The far clipping plane.
Definition: Camera.hpp:107
Vector3< T_Scalar > xyz() const
Definition: Vector4.hpp:131
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:870
real left() const
&#39;left&#39; parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
Definition: Camera.hpp:113
real nearPlane() const
The near clipping plane.
Definition: Camera.hpp:103
fvec3 cross(const fvec3 &v1, const fvec3 &v2)
Definition: Vector3.hpp:277
void applyViewMatrix() const
Loads the GL_MODELVIEW matrix with the Camera&#39;s view matrix.
Definition: Camera.cpp:88
EProjectionMatrixType mProjectionType
Definition: Camera.hpp:283
Viewport * viewport()
The viewport bound to a camera.
Definition: Camera.hpp:141
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:267
Frustum mFrustum
Definition: Camera.hpp:277
float dot(float a, float b)
Definition: glsl_math.hpp:1111
real mBottom
Definition: Camera.hpp:280
const Frustum & frustum() const
The view frustum of the camera used to perform frustum culling.
Definition: Camera.hpp:132
bool project(const vec4 &in_world, vec4 &out_viewp) const
Projects a vector from world coordinates to viewport coordinates.
Definition: Camera.cpp:245
void computeFrustumPlanes()
Computes the Camera&#39;s frustum planes in world space.
Definition: Camera.cpp:169
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:281
static void bug(const String &message)
Use this function to provide information about programming errors: wrong parameter initialization...
Definition: Log.cpp:174
int height() const
Definition: Viewport.hpp:71
real fov() const
The field of view of the camera.
Definition: Camera.hpp:96
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:125
Projection matrix generated by mat4::getOrtho() or similar.
float max(float a, float b)
Definition: Vector2.hpp:311
const mat4 & modelingMatrix() const
Returns the Camera&#39;s modelingMatrix() (inverse of the view matrix).
Definition: Camera.hpp:169
real mRight
Definition: Camera.hpp:280
const T_Scalar & y() const
Definition: Vector3.hpp:90
Implements the viewport and clearing settings associated to a Camera.
Definition: Viewport.hpp:51
real farPlane() const
The far clipping plane.
Definition: Camera.hpp:110
real bottom() const
&#39;bottom&#39; parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
Definition: Camera.hpp:121
const T_Scalar & y() const
Definition: Vector4.hpp:102
void setProjectionMatrix(const mat4 &mat, EProjectionMatrixType proj_type)
The Camera&#39;s projection matrix.
Definition: Camera.hpp:172
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:234
void setViewMatrix(const mat4 &mat)
Sets the Camera&#39;s view matrix (inverse of the modeling matrix).
Definition: Camera.hpp:157
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:274
void setDirection(const vec3 &dir)
Definition: Ray.hpp:46
Vector3< T_Scalar > getT() const
Definition: Matrix4.hpp:131
static Matrix4 getFrustum(float pleft, float pright, float pbottom, float ptop, float pnear, float pfar)
Definition: Matrix4.hpp:847
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:178
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:802
T_Scalar * ptr()
Definition: Matrix4.hpp:340
void setProjectionOrtho()
Builds an orthographic projection matrix for the Camera based on the Camera&#39;s near/far planes and its...
Definition: Camera.cpp:200
const mat4 & projectionMatrix() const
The Camera&#39;s projection matrix.
Definition: Camera.hpp:175
const T_Scalar & x() const
Definition: Vector3.hpp:89
real right() const
&#39;right&#39; parameter as passed to the last setProjectionFrustum() or setProjectionOrtho*() ...
Definition: Camera.hpp:117
void setFOV(real fov)
The field of view of the camera.
Definition: Camera.hpp:93
real aspectRatio() const
Returns the aspect ratio computed as viewport()->width()/viewport()->height().
Definition: Camera.hpp:83
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:296
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:783
#define VL_CHECK(expr)
Definition: checks.hpp:73
real mFOV
Definition: Camera.hpp:279
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:104