MRPT  2.0.4
CSetOfTexturedTriangles.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
12 
13 namespace mrpt::opengl
14 {
15 /** A set of textured triangles.
16  * This class can be used to draw any solid, arbitrarily complex object with
17  * textures.
18  * \sa opengl::COpenGLScene
19  * \ingroup mrpt_opengl_grp
20  */
22 {
24 
25  public:
28 
29  CSetOfTexturedTriangles() = default;
30  virtual ~CSetOfTexturedTriangles() override = default;
31 
32  void onUpdateBuffers_TexturedTriangles() override;
33 
34  /** Evaluates the bounding box of this object (including possible children)
35  * in the coordinate frame of the object parent. */
36  void getBoundingBox(
38  mrpt::math::TPoint3D& bb_max) const override;
39 
41  {
42  m_triangles.clear();
44  }
45  size_t getTrianglesCount() const { return m_triangles.size(); }
46  const TTriangle& getTriangle(size_t idx) const
47  {
48  ASSERT_BELOW_(idx, m_triangles.size());
49  return m_triangles[idx];
50  }
51  void getTriangle(size_t idx, TTriangle& t) const
52  {
53  ASSERT_BELOW_(idx, m_triangles.size());
54  t = m_triangles[idx];
56  }
57  void insertTriangle(const TTriangle& t)
58  {
59  m_triangles.push_back(t);
61  }
62 
63  bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const override;
64 };
65 
66 } // namespace mrpt::opengl
void getTriangle(size_t idx, TTriangle &t) const
const TTriangle & getTriangle(size_t idx) const
#define ASSERT_BELOW_(__A, __B)
Definition: exceptions.h:149
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration.
A triangle (float coordinates) with RGBA colors (u8) and UV (texture coordinates) for each vertex...
Definition: TTriangle.h:35
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Simulation of ray-trace, given a pose.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const override
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:13
const auto bb_max
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
const auto bb_min
virtual ~CSetOfTexturedTriangles() override=default
void onUpdateBuffers_TexturedTriangles() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
std::vector< mrpt::opengl::TTriangle > m_triangles
List of triangles.
Renderizable generic renderer for objects using the triangles-with-a-texture shader.



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