21 #ifndef __TRIANGULARMESH_HH 22 #define __TRIANGULARMESH_HH 1 36 # ifdef miamesh_EXPORTS 37 # define EXPORT_MESH __declspec(dllexport) 39 # define EXPORT_MESH __declspec(dllimport) 43 # define EXPORT_MESH __attribute__((visibility("default"))) 71 typedef std::shared_ptr<CTriangleMesh>
Pointer;
81 typedef std::vector<T3DVector<unsigned int> > CTrianglefield;
82 typedef std::vector<C3DFVector> CVertexfield;
83 typedef std::vector<C3DFVector> CNormalfield;
84 typedef std::vector<C3DFVector> CColorfield;
85 typedef std::vector<float> CScalefield;
87 typedef std::shared_ptr<CTrianglefield > PTrianglefield;
88 typedef std::shared_ptr<CVertexfield > PVertexfield;
89 typedef std::shared_ptr<CNormalfield > PNormalfield;
90 typedef std::shared_ptr<CColorfield > PColorfield;
91 typedef std::shared_ptr<CScalefield > PScalefield;
93 typedef CTrianglefield::value_type triangle_type;
94 typedef CVertexfield::value_type vertex_type;
95 typedef CNormalfield::value_type normal_type;
96 typedef CColorfield::value_type color_type;
97 typedef CScalefield::value_type scale_type;
99 typedef CVertexfield::const_iterator const_vertex_iterator;
100 typedef CVertexfield::iterator vertex_iterator;
102 typedef CTrianglefield::const_iterator const_triangle_iterator;
103 typedef CTrianglefield::iterator triangle_iterator;
105 typedef CNormalfield::const_iterator const_normal_iterator;
106 typedef CNormalfield::iterator normal_iterator;
108 typedef CScalefield::const_iterator const_scale_iterator;
109 typedef CScalefield::iterator scale_iterator;
111 typedef CColorfield::const_iterator const_color_iterator;
112 typedef CColorfield::iterator color_iterator;
139 PVertexfield vertices,
140 PNormalfield normals,
148 CTriangleMesh(PTrianglefield triangles, PVertexfield vertices);
152 CTriangleMesh *clone() const __attribute__((warn_unused_result));
164 static const
std::
string get_type_description();
169 int get_available_data() const;
174 const
void *get_vertex_pointer()const;
179 const
void *get_normal_pointer()const;
185 const
void *get_triangle_pointer()const;
190 const
void *get_color_pointer()const;
196 unsigned int triangle_size()const;
201 unsigned int vertices_size()const;
206 const triangle_type& triangle_at(
unsigned int i)const;
211 const vertex_type& vertex_at(
unsigned int i)const;
216 const normal_type& normal_at(
unsigned int i)const;
221 const scale_type& scale_at(
unsigned int i)const;
227 const color_type& color_at(
unsigned int i)const;
230 const CVertexfield& get_vertices() const;
231 const CTrianglefield& get_triangles() const;
234 const_triangle_iterator triangles_begin() const;
235 triangle_iterator triangles_begin();
236 const_triangle_iterator triangles_end() const;
237 triangle_iterator triangles_end();
239 const_vertex_iterator vertices_begin()const;
240 const_vertex_iterator vertices_end()const;
241 vertex_iterator vertices_begin();
242 vertex_iterator vertices_end();
244 const_normal_iterator normals_begin()const;
245 const_normal_iterator normals_end()const;
246 normal_iterator normals_begin();
247 normal_iterator normals_end();
249 const_scale_iterator scale_begin()const;
250 const_scale_iterator scale_end()const;
251 scale_iterator scale_begin();
252 scale_iterator scale_end();
254 const_color_iterator color_begin()const;
255 const_color_iterator color_end()const;
256 color_iterator color_begin();
257 color_iterator color_end();
261 const
std::
string& get_sourceformat()
const {
262 return m_sourceformat;
267 m_sourceformat = fmt;
275 void evaluate_normals();
278 std::string m_sourceformat;
279 struct CTriangleMeshData * data;
296 template <
class Deformation>
307 CTriangleMesh::scale_iterator sb = mesh->scale_begin();
308 CTriangleMesh::scale_iterator se = mesh->scale_end();
310 CTriangleMesh::const_vertex_iterator vb = cmesh.vertices_begin();
311 CTriangleMesh::const_normal_iterator nb = cmesh.normals_begin();
314 *sb++ =
dot(*nb++, deform.apply(*vb++));
327 template <
class Deformation>
355 #endif // __TRIANGULARMESH_HH
the singleton that a plug-in handler really is
PTriangleMesh EXPORT_MESH get_sub_mesh(const CTriangleMesh &mesh, const std::vector< unsigned > &triangle_indices)
EData
these are some flags to indicate, which data is actually available
void set_sourceformat(const std::string &fmt)
The templatex basis class of all IO plug-ins.
#define EXPORT_MESH
define visibility for proper export
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
THandlerSingleton< TIOPluginHandler< CMeshIOPlugin > > CMeshIOPluginHandler
Plug-in handler for triangulat mesh IO.
helper class to derive from for data that can be loaded and stored to a disk.
A class to deine a triangle mesh with some attributes.
double EXPORT_GSL dot(const gsl_vector *lhs, const gsl_vector *rhs)
CTriangleMesh::Pointer PTriangleMesh
Pointer type of the CTriangle mesh class.
void colorize_mesh(CTriangleMesh *mesh, const Deformation &deform)
static const char * data_descr
TIOPlugin< CTriangleMesh > CMeshIOPlugin
IO plugin for triangular meshes.
std::shared_ptr< CTriangleMesh > Pointer
int get_available_data() const
The generic base for all plug-ins.
#define NS_MIA_END
conveniance define to end the mia namespace