56 for (
size_t i = 0; i < 3; i++)
60 pp.r = pp.g = pp.b = 0xff;
90 const float&
x(
size_t i)
const {
return vertices[i].xyzrgba.pt.x; }
91 const float&
y(
size_t i)
const {
return vertices[i].xyzrgba.pt.y; }
92 const float&
z(
size_t i)
const {
return vertices[i].xyzrgba.pt.z; }
93 const uint8_t&
r(
size_t i)
const {
return vertices[i].xyzrgba.r; }
94 const uint8_t&
g(
size_t i)
const {
return vertices[i].xyzrgba.g; }
95 const uint8_t&
b(
size_t i)
const {
return vertices[i].xyzrgba.b; }
96 const uint8_t&
a(
size_t i)
const {
return vertices[i].xyzrgba.a; }
97 const float&
u(
size_t i)
const {
return vertices[i].uv.x; }
98 const float&
v(
size_t i)
const {
return vertices[i].uv.y; }
99 float&
x(
size_t i) {
return vertices[i].xyzrgba.pt.x; }
118 for (
size_t i = 0; i < 3; i++)
mrpt::math::TPoint3Df & vertex(size_t i)
const uint8_t & b(size_t i) const
const mrpt::math::TPoint3Df & vertex(size_t i) const
const uint8_t & r(size_t i) const
const float & x(size_t i) const
void readFrom(mrpt::serialization::CArchive &i)
A triangle (float coordinates) with RGBA colors (u8) and UV (texture coordinates) for each vertex...
const uint8_t & g(size_t i) const
mrpt::math::TVector2Df uv
texture coordinates (0,0)-(1,1)
TTriangle(const mrpt::math::TPoint3Df &p1, const mrpt::math::TPoint3Df &p2, const mrpt::math::TPoint3Df &p3)
Constructor from 3 points (default normals are computed)
const uint8_t & a(size_t i) const
std::array< Vertex, 3 > vertices
const float & u(size_t i) const
mrpt::math::TVector3Df normal
Must not be normalized.
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.
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure.
TTriangle(const mrpt::math::TPolygon3D &p)
XYZ point (float) + RGBA(u8)
Base template for TPoint2D and TPoint2Df.
void setColor(const mrpt::img::TColor &c)
Sets the color of all vertices.
uint8_t f2u8(const float f)
converts a float [0,1] into an uint8_t [0,255] (without checking for out of bounds) ...
const float & y(size_t i) const
Virtual base class for "archives": classes abstracting I/O streams.
mrpt::math::TPointXYZfRGBAu8 xyzrgba
const float & z(size_t i) const
An RGBA color - floats in the range [0,1].
void setColor(const mrpt::img::TColorf &c)
The namespace for 3D scene representation and rendering.
void computeNormals()
Compute the three normals from the cross-product of "v01 x v02".
const float & v(size_t i) const
3D polygon, inheriting from std::vector<TPoint3D>
void writeTo(mrpt::serialization::CArchive &o) const
void setColor(const mrpt::img::TColor &c)