MRPT
1.9.9
|
A triangle (float coordinates) with RGBA colors (u8) and UV (texture coordinates) for each vertex.
Note that not all the fields must be filled in, it depends on the consumer of the structure.
The structure is memory packed to 1-byte, to ensure it can be used in GPU memory vertex arrays without unexpected paddings.
Definition at line 35 of file TTriangle.h.
#include <mrpt/opengl/TTriangle.h>
Classes | |
struct | Vertex |
Public Member Functions | |
TTriangle ()=default | |
TTriangle (const mrpt::math::TPolygon3D &p) | |
TTriangle (const mrpt::math::TPoint3Df &p1, const mrpt::math::TPoint3Df &p2, const mrpt::math::TPoint3Df &p3) | |
Constructor from 3 points (default normals are computed) More... | |
TTriangle (const mrpt::math::TPoint3Df &p1, const mrpt::math::TPoint3Df &p2, const mrpt::math::TPoint3Df &p3, const mrpt::math::TVector3Df &n1, const mrpt::math::TVector3Df &n2, const mrpt::math::TVector3Df &n3) | |
Constructor from 3 points and its 3 normals. More... | |
const float & | x (size_t i) const |
const float & | y (size_t i) const |
const float & | z (size_t i) const |
const uint8_t & | r (size_t i) const |
const uint8_t & | g (size_t i) const |
const uint8_t & | b (size_t i) const |
const uint8_t & | a (size_t i) const |
const float & | u (size_t i) const |
const float & | v (size_t i) const |
float & | x (size_t i) |
float & | y (size_t i) |
float & | z (size_t i) |
uint8_t & | r (size_t i) |
uint8_t & | g (size_t i) |
uint8_t & | b (size_t i) |
uint8_t & | a (size_t i) |
float & | u (size_t i) |
float & | v (size_t i) |
mrpt::math::TPoint3Df & | vertex (size_t i) |
const mrpt::math::TPoint3Df & | vertex (size_t i) const |
void | setColor (const mrpt::img::TColor &c) |
Sets the color of all vertices. More... | |
void | setColor (const mrpt::img::TColorf &c) |
void | computeNormals () |
Compute the three normals from the cross-product of "v01 x v02". More... | |
void | readFrom (mrpt::serialization::CArchive &i) |
void | writeTo (mrpt::serialization::CArchive &o) const |
Public Attributes | |
std::array< Vertex, 3 > | vertices |
|
default |
|
inlineexplicit |
Definition at line 53 of file TTriangle.h.
References ASSERT_EQUAL_, computeNormals(), and vertices.
|
inlineexplicit |
Constructor from 3 points (default normals are computed)
Definition at line 65 of file TTriangle.h.
References computeNormals(), and vertices.
|
inlineexplicit |
Constructor from 3 points and its 3 normals.
Definition at line 75 of file TTriangle.h.
References vertices.
|
inline |
Definition at line 96 of file TTriangle.h.
References vertices.
Referenced by mrpt::maps::CRandomFieldGridMap2D::getAs3DObject(), mrpt::opengl::CMesh::onUpdateBuffers_Wireframe(), mrpt::opengl::stock_objects::RobotPioneer(), and mrpt::opengl::CMesh::updateTriangles().
|
inline |
Definition at line 105 of file TTriangle.h.
References vertices.
|
inline |
Definition at line 95 of file TTriangle.h.
References vertices.
Referenced by mrpt::opengl::CMesh::onUpdateBuffers_Wireframe(), mrpt::opengl::stock_objects::RobotPioneer(), and mrpt::opengl::CMesh::updateTriangles().
|
inline |
Definition at line 104 of file TTriangle.h.
References vertices.
void TTriangle::computeNormals | ( | ) |
Compute the three normals from the cross-product of "v01 x v02".
Note that using this default normals will not lead to interpolated lighting in the fragment shaders, since all vertex are equal; a derived class should use custom, more accurate normals to enable soft lighting.
Definition at line 21 of file TTriangle.cpp.
References v(), vertices, x(), y(), and z().
Referenced by mrpt::opengl::CAngularObservationMesh::addTriangle(), mrpt::opengl::CColorBar::onUpdateBuffers_all(), mrpt::opengl::stock_objects::RobotPioneer(), and TTriangle().
|
inline |
Definition at line 94 of file TTriangle.h.
References vertices.
Referenced by mrpt::opengl::CMesh::onUpdateBuffers_Wireframe(), mrpt::opengl::stock_objects::RobotPioneer(), and mrpt::opengl::CMesh::updateTriangles().
|
inline |
Definition at line 103 of file TTriangle.h.
References vertices.
|
inline |
Definition at line 93 of file TTriangle.h.
References vertices.
Referenced by mrpt::opengl::CMesh::onUpdateBuffers_Wireframe(), mrpt::opengl::stock_objects::RobotPioneer(), and mrpt::opengl::CMesh::updateTriangles().
|
inline |
Definition at line 102 of file TTriangle.h.
References vertices.
void TTriangle::readFrom | ( | mrpt::serialization::CArchive & | i | ) |
Definition at line 43 of file TTriangle.cpp.
References vertices.
|
inline |
Sets the color of all vertices.
Definition at line 116 of file TTriangle.h.
References mrpt::img::TColor::A, mrpt::img::TColor::B, mrpt::img::TColor::G, mrpt::img::TColor::R, and vertices.
Referenced by mrpt::opengl::CAngularObservationMesh::addTriangle(), mrpt::opengl::stock_objects::RobotPioneer(), and setColor().
|
inline |
Definition at line 126 of file TTriangle.h.
References mrpt::img::TColorf::A, mrpt::img::TColorf::B, mrpt::f2u8(), mrpt::img::TColorf::G, mrpt::img::TColorf::R, and setColor().
|
inline |
Definition at line 97 of file TTriangle.h.
References vertices.
|
inline |
Definition at line 106 of file TTriangle.h.
References vertices.
|
inline |
Definition at line 98 of file TTriangle.h.
References vertices.
Referenced by computeNormals().
|
inline |
Definition at line 107 of file TTriangle.h.
References vertices.
|
inline |
Definition at line 109 of file TTriangle.h.
References vertices.
Referenced by createPolygonFromTriangle(), and mrpt::opengl::stock_objects::RobotPioneer().
|
inline |
Definition at line 110 of file TTriangle.h.
References vertices.
void TTriangle::writeTo | ( | mrpt::serialization::CArchive & | o | ) | const |
Definition at line 35 of file TTriangle.cpp.
References vertices.
|
inline |
Definition at line 90 of file TTriangle.h.
References vertices.
Referenced by computeNormals(), mrpt::maps::CRandomFieldGridMap2D::getAs3DObject(), mrpt::opengl::CMesh::onUpdateBuffers_Wireframe(), mrpt::opengl::CSetOfTriangles::updatePolygons(), and mrpt::opengl::CMesh::updateTriangles().
|
inline |
Definition at line 99 of file TTriangle.h.
References vertices.
|
inline |
Definition at line 91 of file TTriangle.h.
References vertices.
Referenced by computeNormals(), mrpt::maps::CRandomFieldGridMap2D::getAs3DObject(), mrpt::opengl::CMesh::onUpdateBuffers_Wireframe(), mrpt::opengl::CSetOfTriangles::updatePolygons(), and mrpt::opengl::CMesh::updateTriangles().
|
inline |
Definition at line 100 of file TTriangle.h.
References vertices.
|
inline |
Definition at line 92 of file TTriangle.h.
References vertices.
Referenced by computeNormals(), mrpt::maps::CRandomFieldGridMap2D::getAs3DObject(), mrpt::opengl::CMesh::onUpdateBuffers_Wireframe(), mrpt::opengl::CSetOfTriangles::updatePolygons(), and mrpt::opengl::CMesh::updateTriangles().
|
inline |
Definition at line 101 of file TTriangle.h.
References vertices.
std::array<Vertex, 3> mrpt::opengl::TTriangle::vertices |
Definition at line 88 of file TTriangle.h.
Referenced by a(), mrpt::opengl::CAngularObservationMesh::addTriangle(), b(), computeNormals(), createFromTriangle(), g(), mrpt::maps::CRandomFieldGridMap2D::getAs3DObject(), mrpt::opengl::CColorBar::onUpdateBuffers_all(), mrpt::opengl::CTexturedPlane::onUpdateBuffers_TexturedTriangles(), mrpt::opengl::CMesh::onUpdateBuffers_TexturedTriangles(), mrpt::opengl::COctoMapVoxels::onUpdateBuffers_Triangles(), r(), readFrom(), setColor(), TTriangle(), u(), v(), vertex(), writeTo(), x(), y(), and z().
Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020 |