69 #ifndef GVXR_OPENGL_EXCEPTION_H 73 #ifndef GVXR_OUT_OF_BOUNDS_EXCEPTION_H 77 #ifndef GVXR_FBO_EXCEPTION_H 85 #ifndef GVXR_CONSTANT_VALUES_H 174 double t_x(-(right + left) / (right - left));
175 double t_y(-(top + bottom) / (top - bottom));
176 double t_z(-(farPlane + nearPlane) / (farPlane - nearPlane));
179 2.0 / (right - left),
185 2.0 / (top - bottom),
191 -2.0 / (farPlane - nearPlane),
236 double a( (right + left) / (right - left));
237 double b( (top + bottom) / (top - bottom));
238 double c(-(farPlane + nearPlane) / (farPlane - nearPlane));
239 double d(-(2.0 * farPlane * nearPlane) / (farPlane - nearPlane));
242 2.0 * nearPlane / (right - left),
248 2.0 * nearPlane / (top - bottom),
285 double f(tan(
Pi_2 - (((fovy *
Pi) / 180.0) / 2.0)));
300 (zFar + zNear) / (zNear - zFar),
305 (2.0 * zFar * zNear) / (zNear - zFar),
340 VEC3 forward(center - eye);
347 VEC3 side(forward ^ up1);
350 VEC3 u(side.normal() ^ forward);
374 matrix.translate(-eye.
getX(), -eye.
getY(), -eye.
getZ());
420 centerX, centerY, centerZ,
429 if (aTypeID ==
typeid(
unsigned int))
431 return std::string(
"r32ui");
433 else if (aTypeID ==
typeid(
int))
435 return std::string(
"r32i");
437 else if (aTypeID ==
typeid(
unsigned short))
439 return std::string(
"r16ui");
441 else if (aTypeID ==
typeid(
short))
443 return std::string(
"r16i");
445 else if (aTypeID ==
typeid(
unsigned char))
447 return std::string(
"r8ui");
449 else if (aTypeID ==
typeid(
char))
451 return std::string(
"r8i");
453 else if (aTypeID ==
typeid(
float))
455 return std::string(
"r32f");
459 throw Exception(__FILE__, __FUNCTION__, __LINE__,
460 "The data type of this image is not supported on GPU.");
469 if (aTypeID ==
typeid(
unsigned int))
471 return std::string(
"uimage3D");
473 else if (aTypeID ==
typeid(
int))
475 return std::string(
"image3D");
477 else if (aTypeID ==
typeid(
unsigned short))
479 return std::string(
"uimage3D");
481 else if (aTypeID ==
typeid(
short))
483 return std::string(
"image3D");
485 else if (aTypeID ==
typeid(
unsigned char))
487 return std::string(
"uimage3D");
489 else if (aTypeID ==
typeid(
char))
491 return std::string(
"image3D");
493 else if (aTypeID ==
typeid(
float))
495 return std::string(
"image3D");
499 throw Exception(__FILE__, __FUNCTION__, __LINE__,
500 "The data type of this image is not supported on GPU.");
509 if (aTypeID ==
typeid(
unsigned int))
511 return std::string(
"uint");
513 else if (aTypeID ==
typeid(
int))
515 return std::string(
"int");
517 else if (aTypeID ==
typeid(
unsigned short))
519 return std::string(
"uint");
521 else if (aTypeID ==
typeid(
short))
523 return std::string(
"int");
525 else if (aTypeID ==
typeid(
unsigned char))
527 return std::string(
"uint");
529 else if (aTypeID ==
typeid(
char))
531 return std::string(
"int");
533 else if (aTypeID ==
typeid(
float))
535 return std::string(
"float");
539 throw Exception(__FILE__, __FUNCTION__, __LINE__,
540 "The data type of this image is not supported on GPU.");
549 if (aTypeID ==
typeid(
unsigned int))
551 return std::string(
"uvec4");
553 else if (aTypeID ==
typeid(
int))
555 return std::string(
"vec4");
557 else if (aTypeID ==
typeid(
unsigned short))
559 return std::string(
"uvec4");
561 else if (aTypeID ==
typeid(
short))
563 return std::string(
"vec4");
565 else if (aTypeID ==
typeid(
unsigned char))
567 return std::string(
"uvec4");
569 else if (aTypeID ==
typeid(
char))
571 return std::string(
"vec4");
573 else if (aTypeID ==
typeid(
float))
575 return std::string(
"vec4");
579 throw Exception(__FILE__, __FUNCTION__, __LINE__,
580 "The data type of this image is not supported on GPU.");
589 if (aTypeID ==
typeid(
unsigned int))
593 else if (aTypeID ==
typeid(
int))
597 else if (aTypeID ==
typeid(
unsigned short))
601 else if (aTypeID ==
typeid(
short))
605 else if (aTypeID ==
typeid(
unsigned char))
609 else if (aTypeID ==
typeid(
char))
613 else if (aTypeID ==
typeid(
float))
619 throw Exception(__FILE__, __FUNCTION__, __LINE__,
620 "The data type of this image is not supported on GPU.");
void pushProjectionMatrix()
Add the current matrix to the projection matrix stack.
void loadIdentity()
Load identity matrix.
void pushModelViewMatrix()
Add the current matrix to the model/view matrix stack.
void applyModelViewMatrix()
Class to handle exceptions related to OpenGL.
void multiplyPerspectiveProjectionMatrix(double fovy, double aspect, double zNear, double zFar)
MATRIX4 buildOrthoProjectionMatrix(double left, double right, double bottom, double top, double near, double far)
Create a orthographic projection matrix.
void loadPerspectiveProjectionMatrix(double fovy, double aspect, double zNear, double zFar)
Replace the projection matrix by a perspective projection matrix.
Vec3 is a template class to handle a 3D vector.
T getX() const
Accessor on the position along the x-axis.
T getZ() const
Accessor on the position along the z-axis.
Exception is a class to handle exceptions.
Vec3 normal() const
Get the unit vector corresponding to the normed current vector.
std::string getShaderPixelType(const std::type_info &aTypeID)
Matrix4x4< RATIONAL_NUMBER > MATRIX4
Type of data used to store 4x4 matrices.
const double Pi_2
Pi divided by 2.0.
std::string getShaderRGBAPixelType(const std::type_info &aTypeID)
T getY() const
Accessor on the position along the y-axis.
std::string getShaderImageType(const std::type_info &aTypeID)
void loadIdentityModelViewMatrix()
Replace the model/view matrix by the identity matrix.
Vec3< RATIONAL_NUMBER > VEC3
Type of data used to store 3D vectors.
MATRIX4 g_current_projection_matrix
The projection matrix.
MATRIX4 buildFrustumProjectionMatrix(double left, double right, double bottom, double top, double near, double far)
Create a perspective projection matrix.
void loadOrthoProjectionMatrix(double left, double right, double bottom, double top, double near, double far)
Replace the projection matrix by a orthographic projection matrix.
void normalize()
Normalize the current vector so that its length is 1.
void multiplyOrthoProjectionMatrix(double left, double right, double bottom, double top, double nearPlane, double farPlane)
void popProjectionMatrix()
std::vector< MATRIX4 > g_p_projection_matrix_stack
The stack of projection matrix.
void loadIdentityProjectionMatrix()
Replace the projection matrix by the identity matrix.
std::vector< MATRIX4 > g_p_modelview_matrix_stack
The stack of model/view matrices.
std::string getShaderTypeID(const std::type_info &aTypeID)
MATRIX4 buildLookAtModelViewMatrix(const VEC3 &eye, const VEC3 ¢re, const VEC3 &up)
Create a modelling-viewing matrix.
void loadFrustumProjectionMatrix(double left, double right, double bottom, double top, double near, double far)
Replace the projection matrix by a perspective projection matrix.
Class to handle exceptions when accessing an array cell that is not accessible, i.e. out of bounds memory access.
MATRIX4 g_current_modelview_matrix
The model/view matrices.
MATRIX4 buildPerspectiveProjectionMatrix(double fovy, double aspect, double zNear, double zFar)
Create a perspective projection matrix.
int getShaderOpenGLType(const std::type_info &aTypeID)
Constant values, such as the Z number of different atoms, etc.
Matrix4x4 is a template class to handle a 4 by 4 matrix.
void popModelViewMatrix()
void loadLookAtModelViewMatrix(const VEC3 &eye, const VEC3 ¢re, const VEC3 &up)
Replace the modelling-viewing matrix by a viewing transformation matrix.
Class to handle exceptions related to frame buffer objects (FBOs).