35 void CSetOfTexturedTriangles::render_texturedobj()
const 37 #if MRPT_HAS_OPENGL_GLUT 44 float ax, ay, az, bx,
by,
bz;
47 for (it = m_triangles.begin(); it != m_triangles.end(); ++it)
51 ax = it->m_v2.m_x - it->m_v1.m_x;
52 ay = it->m_v2.m_y - it->m_v1.m_y;
53 az = it->m_v2.m_z - it->m_v1.m_z;
55 bx = it->m_v3.m_x - it->m_v1.m_x;
56 by = it->m_v3.m_y - it->m_v1.m_y;
57 bz = it->m_v3.m_z - it->m_v1.m_z;
61 glTexCoord2d(
float(it->m_v1.m_u)/r_width,
float(it->m_v1.m_v)/r_height);
glVertex3f(it->m_v1.m_x, it->m_v1.m_y, it->m_v1.m_z);
62 glTexCoord2d(
float(it->m_v2.m_u)/r_width,
float(it->m_v2.m_v)/r_height);
glVertex3f(it->m_v2.m_x, it->m_v2.m_y, it->m_v2.m_z);
63 glTexCoord2d(
float(it->m_v3.m_u)/r_width,
float(it->m_v3.m_v)/r_height);
glVertex3f(it->m_v3.m_x, it->m_v3.m_y, it->m_v3.m_z);
84 writeToStreamRender(out);
85 writeToStreamTexturedObject(out);
92 m_triangles[i].writeToStream(out);
108 readFromStreamRender(
in);
111 readFromStreamTexturedObject(
in);
115 in >> CTexturedObject::m_textureImage;
116 in >> CTexturedObject::m_enableTransparency;
117 if (CTexturedObject::m_enableTransparency)
119 in >> CTexturedObject::m_textureImageAlpha;
120 assignImage( CTexturedObject::m_textureImage, CTexturedObject::m_textureImageAlpha );
123 assignImage( CTexturedObject::m_textureImage );
128 m_triangles.resize(
n);
131 m_triangles[i].readFromStream(
in);
137 CRenderizableDisplayList::notifyChange();
143 throw std::runtime_error(
"TODO: TraceRay not implemented in CSetOfTexturedTriangles");
148 bb_min =
mrpt::math::TPoint3D(std::numeric_limits<double>::max(),std::numeric_limits<double>::max(), std::numeric_limits<double>::max());
149 bb_max =
mrpt::math::TPoint3D(-std::numeric_limits<double>::max(),-std::numeric_limits<double>::max(),-std::numeric_limits<double>::max());
151 for (
size_t i=0;i<m_triangles.size();i++)
169 m_pose.composePoint(bb_min, bb_min);
170 m_pose.composePoint(bb_max, bb_max);
174 CSetOfTexturedTriangles::TVertex::TVertex( ) :
175 m_x(0.0), m_y(0.0), m_z(0.0), m_u(0), m_v(0)
179 m_x(
x), m_y(
y), m_z(
z), m_u(u), m_v(
v)
183 out << m_x << m_y << m_z << m_u << m_v;
186 in >> m_x >> m_y >> m_z >> m_u >> m_v;
193 m_v1(
v1), m_v2(
v2), m_v3(
v3)
197 m_v1.writeToStream(out); m_v2.writeToStream(out); m_v3.writeToStream(out);
200 m_v1.readFromStream(
in); m_v2.readFromStream(
in); m_v3.readFromStream(
in);
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
void readFromStream(mrpt::utils::CStream &in)
TVertex()
Default constructor.
bool BASE_IMPEXP traceRay(const std::vector< TPolygonWithPlane > &vec, const mrpt::poses::CPose3D &pose, double &dist)
Fast ray tracing method using polygons' properties.
GLAPI void GLAPIENTRY glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
const Scalar * const_iterator
double z
X,Y,Z coordinates.
void writeToStream(mrpt::utils::CStream &out) const
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
GLAPI void GLAPIENTRY glShadeModel(GLenum mode)
void readFromStream(mrpt::utils::CStream &in)
void writeToStream(mrpt::utils::CStream &out) const
A renderizable object suitable for rendering with OpenGL's display lists.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
This base provides a set of functions for maths stuff.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
GLfloat GLfloat GLfloat GLfloat v3
GLAPI void GLAPIENTRY glBegin(GLenum mode)
void keep_max(T &var, const K test_val)
If the second argument is above the first one, set the first argument to this higher value...
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
TTriangle()
Default constructor.
void keep_min(T &var, const K test_val)
If the second argument is below the first one, set the first argument to this lower value...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
The namespace for 3D scene representation and rendering.
GLAPI void GLAPIENTRY glEnd(void)
GLAPI void GLAPIENTRY glTexCoord2d(GLdouble s, GLdouble t)
GLfloat GLfloat GLfloat v2
unsigned __int32 uint32_t
A set of textured triangles.