MRPT
2.0.4
|
Rendering state related to the projection and model-view matrices.
Used to store matrices that will be sent to shaders.
The homogeneous coordinates of a rendered point comes from:
p = p_matrix * mv_matrix * [x y z 1.0]'
Definition at line 25 of file TRenderMatrices.h.
#include <mrpt/opengl/TRenderMatrices.h>
Public Member Functions | |
TRenderMatrices ()=default | |
void | computeProjectionMatrix (float zmin, float zmax) |
Uses is_projective , vw,vh, etc. More... | |
void | computeOrthoProjectionMatrix (float left, float right, float bottom, float top, float znear, float zfar) |
Especial case for custom parameters of Orthographic projection. More... | |
void | applyLookAt () |
Updates the current p_matrix such that it "looks at" pointing, with up vector "up". More... | |
void | projectPoint (float x, float y, float z, float &proj_u, float &proj_v, float &proj_z_depth) const |
Computes the normalized coordinates (range=[0,1]) on the current rendering viewport of a point with local coordinates (wrt to the current model matrix) of (x,y,z). More... | |
void | projectPointPixels (float x, float y, float z, float &proj_u_px, float &proj_v_px, float &proj_depth) const |
Projects a point from global world coordinates into (u,v) pixel coordinates. More... | |
Public Attributes | |
mrpt::math::TPoint3D | eye = {0, 0, 0} |
The camera is here. More... | |
mrpt::math::TPoint3D | pointing = {0, 0, 0} |
The camera points to here. More... | |
mrpt::math::TPoint3D | up = {0, 0, 0} |
Up vector of the camera. More... | |
size_t | viewport_width = 640 |
In pixels. More... | |
size_t | viewport_height = 480 |
double | FOV = 30.0f |
Vertical FOV in degrees. More... | |
double | azimuth = .0 |
Camera elev & azimuth, in radians. More... | |
double | elev = .0 |
double | eyeDistance = 1.0f |
bool | is_projective = true |
true: projective, false: ortho More... | |
mrpt::math::CMatrixFloat44 | p_matrix |
Projection matrix, computed by renderNormalScene() from all the parameters above. More... | |
mrpt::math::CMatrixFloat44 | mv_matrix |
Model-view matrix. More... | |
mrpt::math::CMatrixFloat44 | pmv_matrix |
Result of p_matrix * mv_matrix. More... | |
|
default |
void TRenderMatrices::applyLookAt | ( | ) |
Updates the current p_matrix such that it "looks at" pointing, with up vector "up".
Replacement for deprecated OpenGL gluLookAt().
Definition at line 84 of file TRenderMatrices.cpp.
References mrpt::math::CMatrixFixed< T, ROWS, COLS >::asEigen(), ASSERT_, mrpt::math::crossProduct3D(), mrpt::d2f(), eye, p_matrix, pointing, mrpt::math::UNINITIALIZED_MATRIX, and up.
void TRenderMatrices::computeOrthoProjectionMatrix | ( | float | left, |
float | right, | ||
float | bottom, | ||
float | top, | ||
float | znear, | ||
float | zfar | ||
) |
Especial case for custom parameters of Orthographic projection.
Replacement for obsolete: glOrtho()
Definition at line 19 of file TRenderMatrices.cpp.
References ASSERT_ABOVE_, p_matrix, and mrpt::math::MatrixBase< Scalar, Derived >::setIdentity().
Referenced by computeProjectionMatrix(), and TEST().
void TRenderMatrices::computeProjectionMatrix | ( | float | zmin, |
float | zmax | ||
) |
Uses is_projective , vw,vh, etc.
and computes p_matrix. Replacement for obsolete: gluPerspective() and glOrtho()
Definition at line 35 of file TRenderMatrices.cpp.
References ASSERT_ABOVE_, ASSERT_ABOVEEQ_, computeOrthoProjectionMatrix(), mrpt::DEG2RAD(), eyeDistance, FOV, is_projective, p_matrix, mrpt::math::MatrixVectorBase< Scalar, Derived >::setZero(), viewport_height, and viewport_width.
Referenced by TEST().
void TRenderMatrices::projectPoint | ( | float | x, |
float | y, | ||
float | z, | ||
float & | proj_u, | ||
float & | proj_v, | ||
float & | proj_z_depth | ||
) | const |
Computes the normalized coordinates (range=[0,1]) on the current rendering viewport of a point with local coordinates (wrt to the current model matrix) of (x,y,z).
The output proj_z_depth is the real distance from the eye to the point.
Definition at line 138 of file TRenderMatrices.cpp.
References mrpt::math::CMatrixFixed< T, ROWS, COLS >::asEigen(), and pmv_matrix.
Referenced by projectPointPixels().
void TRenderMatrices::projectPointPixels | ( | float | x, |
float | y, | ||
float | z, | ||
float & | proj_u_px, | ||
float & | proj_v_px, | ||
float & | proj_depth | ||
) | const |
Projects a point from global world coordinates into (u,v) pixel coordinates.
Definition at line 150 of file TRenderMatrices.cpp.
References projectPoint(), viewport_height, and viewport_width.
Referenced by mrpt::opengl::COctreePointRenderer< CPointCloudColoured >::octree_recursive_render().
double mrpt::opengl::TRenderMatrices::azimuth = .0 |
Camera elev & azimuth, in radians.
Definition at line 43 of file TRenderMatrices.h.
Referenced by mrpt::opengl::COpenGLViewport::get3DRayForPixelCoord().
double mrpt::opengl::TRenderMatrices::elev = .0 |
Definition at line 43 of file TRenderMatrices.h.
Referenced by mrpt::opengl::COpenGLViewport::get3DRayForPixelCoord().
mrpt::math::TPoint3D mrpt::opengl::TRenderMatrices::eye = {0, 0, 0} |
The camera is here.
Definition at line 30 of file TRenderMatrices.h.
Referenced by applyLookAt(), and mrpt::opengl::COpenGLViewport::get3DRayForPixelCoord().
double mrpt::opengl::TRenderMatrices::eyeDistance = 1.0f |
Definition at line 44 of file TRenderMatrices.h.
Referenced by computeProjectionMatrix(), and mrpt::opengl::COpenGLViewport::get3DRayForPixelCoord().
double mrpt::opengl::TRenderMatrices::FOV = 30.0f |
Vertical FOV in degrees.
Definition at line 41 of file TRenderMatrices.h.
Referenced by computeProjectionMatrix(), mrpt::opengl::COpenGLViewport::get3DRayForPixelCoord(), and TEST().
bool mrpt::opengl::TRenderMatrices::is_projective = true |
true: projective, false: ortho
Definition at line 46 of file TRenderMatrices.h.
Referenced by computeProjectionMatrix(), mrpt::opengl::COpenGLViewport::get3DRayForPixelCoord(), mrpt::opengl::COpenGLViewport::renderNormalSceneMode(), mrpt::opengl::COpenGLViewport::renderTextMessages(), and TEST().
mrpt::math::CMatrixFloat44 mrpt::opengl::TRenderMatrices::mv_matrix |
Model-view matrix.
Definition at line 53 of file TRenderMatrices.h.
Referenced by mrpt::opengl::enqueForRendering(), mrpt::opengl::processRenderQueue(), mrpt::opengl::COpenGLViewport::renderTextMessages(), and mrpt::opengl::COpenGLViewport::renderViewportBorder().
mrpt::math::CMatrixFloat44 mrpt::opengl::TRenderMatrices::p_matrix |
Projection matrix, computed by renderNormalScene() from all the parameters above.
Used in shaders.
Definition at line 50 of file TRenderMatrices.h.
Referenced by applyLookAt(), computeOrthoProjectionMatrix(), computeProjectionMatrix(), mrpt::opengl::processRenderQueue(), mrpt::opengl::COpenGLViewport::renderTextMessages(), and TEST().
mrpt::math::CMatrixFloat44 mrpt::opengl::TRenderMatrices::pmv_matrix |
Result of p_matrix * mv_matrix.
Used in shaders. Updated by renderSetOfObjects()
Definition at line 58 of file TRenderMatrices.h.
Referenced by mrpt::opengl::processRenderQueue(), projectPoint(), and mrpt::opengl::CText::render().
mrpt::math::TPoint3D mrpt::opengl::TRenderMatrices::pointing = {0, 0, 0} |
The camera points to here.
Definition at line 33 of file TRenderMatrices.h.
Referenced by applyLookAt().
mrpt::math::TPoint3D mrpt::opengl::TRenderMatrices::up = {0, 0, 0} |
Up vector of the camera.
Definition at line 36 of file TRenderMatrices.h.
Referenced by applyLookAt().
size_t mrpt::opengl::TRenderMatrices::viewport_height = 480 |
Definition at line 39 of file TRenderMatrices.h.
Referenced by computeProjectionMatrix(), mrpt::opengl::COpenGLViewport::get3DRayForPixelCoord(), mrpt::opengl::COctreePointRenderer< CPointCloudColoured >::octree_recursive_render(), projectPointPixels(), mrpt::opengl::CText::render(), mrpt::opengl::COpenGLViewport::render(), mrpt::opengl::COpenGLViewport::renderTextMessages(), and TEST().
size_t mrpt::opengl::TRenderMatrices::viewport_width = 640 |
In pixels.
This may be smaller than the total render window.
Definition at line 39 of file TRenderMatrices.h.
Referenced by computeProjectionMatrix(), mrpt::opengl::COpenGLViewport::get3DRayForPixelCoord(), mrpt::opengl::COctreePointRenderer< CPointCloudColoured >::octree_recursive_render(), projectPointPixels(), mrpt::opengl::CText::render(), mrpt::opengl::COpenGLViewport::render(), mrpt::opengl::COpenGLViewport::renderTextMessages(), and TEST().
Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020 |