This is a high level mesh class. More...
Public Member Functions | |
virtual Dtk_ErrorStatus | _Store (void *) |
int | add_mesh_face (Dtk_mesh_face *inMesh_face) |
Add a face (Dtk_mesh_face) to the mesh. More... | |
int | add_vertex (const Dtk_pnt *inVertex, const Dtk_dir *inNormal=NULL, const Dtk_RGB *inColor=NULL, Dtk_Float32 inU=0., Dtk_Float32 inV=0., Dtk_Float32 inUBrep=0., Dtk_Float32 inVBrep=0.) |
Add a vertex to the mesh vertices list. More... | |
Dtk_bool | apply_render_infos (Dtk_RenderInfosPtr) |
Apply texture mapping to the mesh. It will modify points texture UV coordinates. More... | |
int | change_vertex_format (int inVertex_format) |
Change Vertex format, check constructor comment to see options. More... | |
Dtk_bool | check_format (int inFormat) |
Checks The current vertex format of the Dtk_mesh object. More... | |
int | compute_bb (Dtk_pnt *min, Dtk_pnt *max) |
Compute the mesh Bounding Box. More... | |
int | compute_bb_center (Dtk_pnt *i) |
Compute the mesh Bounding Box. More... | |
int | compute_round_normals () |
Compute round normals from geometry. More... | |
Dtk_mesh (const Dtk_mesh &inMesh) | |
Dtk_mesh (int inVertex_format=1, Dtk_bool inBack_face_culling=true) | |
Dtk_Int32 | DtkDynamicType (const Dtk_Int32 &inId) |
Retrieves the dynamic entity type. More... | |
int | DtkDynamicType (const int &inId) |
virtual void | dump (FILE *file=stdout) |
int | explode () |
Decompose all complex geometry (triangle strips, fan, polygons) into triangles, and append it into the internal triangle array. More... | |
int | explode (Dtk_bool ExplodeTristrips, Dtk_bool ExplodeTrifans, Dtk_bool ExplodePolygons, Dtk_bool ExplodeMockups) |
Decompose complex geometry (triangle strips, fan, polygons) according to specified parameters into triangles, and append it into the internal triangle array. More... | |
int | get_color (Dtk_Size_t inPos, Dtk_RGB *outColor) |
Return a color (if vertex format includes color) More... | |
int | get_id () |
Return the mesh id. More... | |
Dtk_InfoPtr | get_info () const |
const Dtk_InfoPtr & | get_Infos () |
Return DtkInfosPtr of this Dtk_Mesh may be NULL. More... | |
Dtk_MaterialPtr | get_material () |
Get the material of the mesh. More... | |
Dtk_RGB | get_mesh_color () |
get color in Dtk_mesh More... | |
Dtk_mesh_face * | get_mesh_face (Dtk_Size_t inPos) |
Return a face. More... | |
Dtk_tab< Dtk_mesh_face * > & | get_mesh_face_array () |
Get a reference to the mesh face array // DEPRECATED, UNSAFE. More... | |
Dtk_tab< Dtk_mesh_face * > & | get_mesh_faces () |
Return the array of mesh faces. More... | |
Dtk_tab< Dtk_mesh_face * > const & | get_mesh_faces () const |
Dtk_Size_t | get_nb_facets () |
Return total number of facets. More... | |
Dtk_Size_t | get_nb_mesh_face () const |
Return the faces array size. More... | |
Dtk_Size_t | get_nb_vertices () const |
Return the vertices array size. More... | |
Dtk_dir | get_normal (Dtk_Size_t inPos) |
Return a vertex (2nd form of get_normal) More... | |
int | get_normal (Dtk_Size_t inPos, Dtk_dir *outNormal, Dtk_mesh_face *inMeshFace=NULL) |
Return a normal (if vertex format includes normal) More... | |
int | get_texcoords (Dtk_Size_t inPos, Dtk_Float32 *outU, Dtk_Float32 *outV) |
Return texture coords (if vertex format includes tex coords) More... | |
enum type_detk | get_type_detk () const |
Dtk_pnt | get_vertex (Dtk_Size_t inPos) |
Return a vertex (2nd form of get_vertex) More... | |
int | get_vertex (Dtk_Size_t inPos, Dtk_pnt *outVertex) |
Return a vertex. More... | |
const Dtk_ID & | GetID () const |
Get Internal UniqueID. More... | |
Dtk_Size_t | GetSize () const |
Dtk_StreamPtr | GetStream () const |
Dtk_Float32 | GetUBrep (Dtk_Size_t inPos) const |
Dtk_Float32 | GetUTexture (Dtk_Size_t inPos) const |
Dtk_Float32 | GetVBrep (Dtk_Size_t inPos) const |
Dtk_Float32 | GetVTexture (Dtk_Size_t inPos) const |
Dtk_bool | has_colors () |
Return true if the current vertex format includes color (RGB) More... | |
Dtk_bool | has_normals () |
Return true if the current vertex format includes normal. More... | |
Dtk_bool | has_texcoords () |
Return true if the current vertex format includes texture coords (UVTEXTURES) More... | |
Dtk_bool | has_xyz () |
Return true if the current vertex format includes 3D coords (XYZ) More... | |
Dtk_InfoPtr & | info () |
Dtk_bool | is_backface_culled () |
Return the true of false if culled or not. More... | |
int | makestrips () |
Assemble all simple triangle, try to make triange-strips. More... | |
void | merge (const Dtk_mesh *inMesh) |
Merge another Dtk_mesh. More... | |
void | merge (const Dtk_SmartPtr< Dtk_mesh > &inMesh) |
void | mergemove (Dtk_mesh *inmesh) |
void | mergemove (Dtk_SmartPtr< Dtk_mesh > &inmesh) |
void | mergemove (Dtk_tab< Dtk_MeshPtr > &inArraymesh) |
Dtk_mesh & | operator= (const Dtk_mesh &inMesh) |
virtual void | PrepareTransfo () |
void | reduce () |
Reduce memory cost of the Dtk_mesh, to call after adding all geometry. More... | |
void | reducesubfaces () |
Merge subfaces that have the same properties. More... | |
int | rescale_model (float ratio) |
Perform a scale of the model. More... | |
void | reserve_submesh (Dtk_Size_t nb) |
int | reserve_vertex (Dtk_Size_t nb) |
int | set_color (Dtk_Size_t inPos, const Dtk_RGB *inColor) |
Set a color to a point (if vertex format includes color) More... | |
void | set_id (int inId) |
Set an id to the mesh. More... | |
void | set_Infos (const Dtk_InfoPtr &inDtkInfosPtr) |
Set DtkInfosPtr of this Dtk_Mesh. More... | |
void | set_material (Dtk_MaterialPtr inMat) |
Set the material of the mesh. More... | |
void | set_mesh_color (const Dtk_RGB &inColor) |
set color in Dtk_mesh More... | |
int | set_normal (Dtk_Size_t inPos, const Dtk_dir *inNormal) |
Set a normal to a point (if vertex format includes normal) More... | |
int | set_texcoords (Dtk_Size_t inPos, Dtk_Float32 inU, Dtk_Float32 inV) |
Set texture coords to a point (if vertex format includes tex coords) More... | |
int | set_vertex (Dtk_Size_t inPos, const Dtk_pnt *inVertex, const Dtk_dir *inNormal=NULL, const Dtk_RGB *inColor=NULL, Dtk_Float32 inU=0., Dtk_Float32 inV=0., Dtk_Float32 inUBrep=0., Dtk_Float32 inVBrep=0.) |
Set a vertex. More... | |
void | SetStream (Dtk_StreamPtr inStream) |
Dtk_ErrorStatus | Store (const Dtk_string &inFile, Dtk_Size_t inIo=1) |
Dtk_ErrorStatus | Store (FILE *inFile, Dtk_Size_t inIo=1) |
int | to_stl (Dtk_string inFilename, Dtk_bool inIsAciiMode=DTK_FALSE) |
Dtk_ErrorStatus | Transform (const Dtk_transfo &) |
int | transform (Dtk_matrix *inMatrix) |
Apply a transformation matrix to the Mesh (Deprecated method) More... | |
int | transform (Dtk_transfo *inMatrix) |
Apply a transformation matrix to the Mesh. More... | |
Dtk_mesh * | transform2Cpy (Dtk_transfo *inMatrix) |
Make a copy of the current mesh, applying a transformation on it. More... | |
~Dtk_mesh () | |
Static Public Member Functions | |
static Dtk_MeshPtr | Create (const Dtk_mesh &inToBeCopied) |
Copy constructor. More... | |
static Dtk_MeshPtr | Create (int inVertex_format=1, Dtk_bool inBack_face_culling=true) |
Constructor. More... | |
static Dtk_mesh * | DtkDynamicCast (Dtk_Object *s) |
Performs a dynamic cast - doesn't need RTTI -. More... | |
Protected Types | |
enum | { _typeID = DTK_TYPE_MESH } |
enum | { _typeID = DTK_TYPE_ENTITY } |
Protected Attributes | |
Dtk_Handle * | _Private |
Dtk_StreamPtr | _stream |
Dtk_bool | back_face_culling |
unsigned long | count_ |
Dtk_tab< Dtk_UChar8 > | cvertices |
Dtk_bool | HasTextureValues |
int | id |
Dtk_Size_t | ofsNRM |
Dtk_Size_t | ofsRGB |
Dtk_Size_t | ofsUV |
Dtk_Size_t | ofsUVBrep |
Dtk_Size_t | ofsVTX |
Dtk_Size_t | sizeonevertex |
Dtk_tab< Dtk_mesh_face * > | submeshes |
int | vertex_format |
Friends | |
class | Dtk_mesh_face |
class | Dtk_SmartPtr< Dtk_mesh > |
This is a high level mesh class.
This class gathers all the datas related to a triangulated mesh.
Dtk_mesh::Dtk_mesh | ( | int | inVertex_format = 1 , |
Dtk_bool | inBack_face_culling = true |
||
) |
Dtk_mesh::Dtk_mesh | ( | const Dtk_mesh & | inMesh | ) |
Dtk_mesh::~Dtk_mesh | ( | ) |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
virtualinherited |
Reimplemented in Dtk_Shell, Dtk_Body, Dtk_Lump, Dtk_Volume, Dtk_Face, Dtk_Loop, Dtk_Coedge, Dtk_Edge, Dtk_Vertex, Dtk_TransformedSurface, Dtk_FilletSurface, Dtk_OffsetSurface, Dtk_SphericalSurface, Dtk_ToroidalSurface, Dtk_ConicalSurface, Dtk_CylindricalSurface, Dtk_RuledSurface, Dtk_LinearExtrusionSurface, Dtk_StandardRevolutionSurface, Dtk_RevolutionSurface, Dtk_PlaneSurface, Dtk_NurbsSurface, Dtk_Surface, Dtk_Hyperbola, Dtk_Parabola, Dtk_Ellipse, Dtk_Conic, Dtk_Line, Dtk_Polyline, Dtk_NurbsCurve, Dtk_Curve, and Dtk_Point.
int Dtk_mesh::add_mesh_face | ( | Dtk_mesh_face * | inMesh_face | ) |
Add a face (Dtk_mesh_face) to the mesh.
in_mesh_face | : face to add |
int Dtk_mesh::add_vertex | ( | const Dtk_pnt * | inVertex, |
const Dtk_dir * | inNormal = NULL , |
||
const Dtk_RGB * | inColor = NULL , |
||
Dtk_Float32 | inU = 0. , |
||
Dtk_Float32 | inV = 0. , |
||
Dtk_Float32 | inUBrep = 0. , |
||
Dtk_Float32 | inVBrep = 0. |
||
) |
Add a vertex to the mesh vertices list.
inVertex | : vertex to add |
inNormal | : normal to add (if vertex format includes normal) |
inColor | : color to add (if vertex format includes color) |
inU,inV | : texture coords (if vertex format includes tex coords) |
Dtk_bool Dtk_mesh::apply_render_infos | ( | Dtk_RenderInfosPtr | ) |
Apply texture mapping to the mesh. It will modify points texture UV coordinates.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
int Dtk_mesh::change_vertex_format | ( | int | inVertex_format | ) |
Change Vertex format, check constructor comment to see options.
[in] | inVertex_format | : the chosen vertex format you will work with |
Dtk_bool Dtk_mesh::check_format | ( | int | inFormat | ) |
Checks The current vertex format of the Dtk_mesh object.
inFormat | : vertex format to test with |
|
protected |
|
protected |
|
protected |
|
protectedvirtual |
Implements Dtk_Entity.
Compute the mesh Bounding Box.
[out] | min,max | : computed extrem points of the boundig box |
int Dtk_mesh::compute_bb_center | ( | Dtk_pnt * | i | ) |
Compute the mesh Bounding Box.
[out] | min,max | : computed extrem points of the boundig box |
int Dtk_mesh::compute_round_normals | ( | ) |
Compute round normals from geometry.
|
static |
Copy constructor.
|
static |
Constructor.
inVertex_format | : the chosen vertex format you will work with |
inBack_face_culling | : culling mode |
Vertex formats available:
|
static |
Performs a dynamic cast - doesn't need RTTI -.
|
virtualinherited |
Implements Dtk_Object.
Reimplemented in Dtk_Shell, Dtk_Body, Dtk_Lump, Dtk_Volume, Dtk_Face, Dtk_Loop, Dtk_Coedge, Dtk_Edge, Dtk_Vertex, Dtk_TopologicalEntity, Dtk_MeshSurface, Dtk_TransformedSurface, Dtk_FilletSurface, Dtk_OffsetSurface, Dtk_SphericalSurface, Dtk_ToroidalSurface, Dtk_ConicalSurface, Dtk_CylindricalSurface, Dtk_RuledSurface, Dtk_LinearExtrusionSurface, Dtk_StandardRevolutionSurface, Dtk_RevolutionSurface, Dtk_PlaneSurface, Dtk_NurbsSurface, Dtk_Surface, Dtk_Hyperbola, Dtk_Parabola, Dtk_Ellipse, Dtk_Conic, Dtk_Line, Dtk_Polyline, Dtk_NurbsCurve, Dtk_Curve, Dtk_Point, Dtk_Constraint, Dtk_ConstraintReference, and Dtk_AxisSystem.
|
virtualinherited |
int Dtk_mesh::explode | ( | ) |
Decompose all complex geometry (triangle strips, fan, polygons) into triangles, and append it into the internal triangle array.
Note that mockup decomposition is not yet supported.
int Dtk_mesh::explode | ( | Dtk_bool | ExplodeTristrips, |
Dtk_bool | ExplodeTrifans, | ||
Dtk_bool | ExplodePolygons, | ||
Dtk_bool | ExplodeMockups | ||
) |
Decompose complex geometry (triangle strips, fan, polygons) according to specified parameters into triangles, and append it into the internal triangle array.
Note that mockup decomposition is not yet supported.
int Dtk_mesh::get_color | ( | Dtk_Size_t | inPos, |
Dtk_RGB * | outColor | ||
) |
Return a color (if vertex format includes color)
inPos | : indice in the vertices array | |
[out] | outColor | : color returned |
int Dtk_mesh::get_id | ( | ) |
Return the mesh id.
|
inherited |
const Dtk_InfoPtr& Dtk_mesh::get_Infos | ( | ) |
Return DtkInfosPtr of this Dtk_Mesh may be NULL.
Dtk_MaterialPtr Dtk_mesh::get_material | ( | ) |
Get the material of the mesh.
Dtk_mesh_face* Dtk_mesh::get_mesh_face | ( | Dtk_Size_t | inPos | ) |
Return a face.
inPos | : indice in the faces array |
Dtk_tab<Dtk_mesh_face *>& Dtk_mesh::get_mesh_face_array | ( | ) |
Get a reference to the mesh face array // DEPRECATED, UNSAFE.
Dtk_tab<Dtk_mesh_face *>& Dtk_mesh::get_mesh_faces | ( | ) |
Return the array of mesh faces.
Dtk_tab<Dtk_mesh_face *> const& Dtk_mesh::get_mesh_faces | ( | ) | const |
Dtk_Size_t Dtk_mesh::get_nb_facets | ( | ) |
Return total number of facets.
Dtk_Size_t Dtk_mesh::get_nb_mesh_face | ( | ) | const |
Return the faces array size.
Dtk_Size_t Dtk_mesh::get_nb_vertices | ( | ) | const |
Return the vertices array size.
Dtk_dir Dtk_mesh::get_normal | ( | Dtk_Size_t | inPos | ) |
Return a vertex (2nd form of get_normal)
Note, if vertex format does not support normal, the fonction will return a null vector
inPos | : indice in the vertices array |
int Dtk_mesh::get_normal | ( | Dtk_Size_t | inPos, |
Dtk_dir * | outNormal, | ||
Dtk_mesh_face * | inMeshFace = NULL |
||
) |
Return a normal (if vertex format includes normal)
Note, if vertex format does not support normal, the fonction will return a null vector
inPos | : indice in the vertices array | |
[out] |
int Dtk_mesh::get_texcoords | ( | Dtk_Size_t | inPos, |
Dtk_Float32 * | outU, | ||
Dtk_Float32 * | outV | ||
) |
Return texture coords (if vertex format includes tex coords)
inPos | : indice in the vertices array | |
[out] | outU,outV | : UVtextures returned |
|
virtual |
Implements Dtk_Entity.
Dtk_pnt Dtk_mesh::get_vertex | ( | Dtk_Size_t | inPos | ) |
Return a vertex (2nd form of get_vertex)
inPos | : indice in the vertices array |
int Dtk_mesh::get_vertex | ( | Dtk_Size_t | inPos, |
Dtk_pnt * | outVertex | ||
) |
Return a vertex.
inPos | : indice in the vertices array | |
[out] | outVertex | : vertex returned |
|
inherited |
Get Internal UniqueID.
|
virtual |
Reimplemented from Dtk_Entity.
Dtk_StreamPtr Dtk_mesh::GetStream | ( | ) | const |
Dtk_Float32 Dtk_mesh::GetUBrep | ( | Dtk_Size_t | inPos | ) | const |
Dtk_Float32 Dtk_mesh::GetUTexture | ( | Dtk_Size_t | inPos | ) | const |
Dtk_Float32 Dtk_mesh::GetVBrep | ( | Dtk_Size_t | inPos | ) | const |
Dtk_Float32 Dtk_mesh::GetVTexture | ( | Dtk_Size_t | inPos | ) | const |
Dtk_bool Dtk_mesh::has_colors | ( | ) |
Return true if the current vertex format includes color (RGB)
Dtk_bool Dtk_mesh::has_normals | ( | ) |
Return true if the current vertex format includes normal.
Dtk_bool Dtk_mesh::has_texcoords | ( | ) |
Return true if the current vertex format includes texture coords (UVTEXTURES)
Dtk_bool Dtk_mesh::has_xyz | ( | ) |
Return true if the current vertex format includes 3D coords (XYZ)
|
inherited |
Dtk_bool Dtk_mesh::is_backface_culled | ( | ) |
Return the true of false if culled or not.
int Dtk_mesh::makestrips | ( | ) |
Assemble all simple triangle, try to make triange-strips.
void Dtk_mesh::merge | ( | const Dtk_mesh * | inMesh | ) |
Merge another Dtk_mesh.
inMesh | : mesh to merge. |
void Dtk_mesh::merge | ( | const Dtk_SmartPtr< Dtk_mesh > & | inMesh | ) |
void Dtk_mesh::mergemove | ( | Dtk_mesh * | inmesh | ) |
void Dtk_mesh::mergemove | ( | Dtk_SmartPtr< Dtk_mesh > & | inmesh | ) |
void Dtk_mesh::mergemove | ( | Dtk_tab< Dtk_MeshPtr > & | inArraymesh | ) |
|
virtualinherited |
Reimplemented in Dtk_OffsetSurface.
void Dtk_mesh::reduce | ( | ) |
void Dtk_mesh::reducesubfaces | ( | ) |
Merge subfaces that have the same properties.
int Dtk_mesh::rescale_model | ( | float | ratio | ) |
Perform a scale of the model.
Note : calling this function has the same effect than calling "transform" method with a scale matrix.
void Dtk_mesh::reserve_submesh | ( | Dtk_Size_t | nb | ) |
int Dtk_mesh::reserve_vertex | ( | Dtk_Size_t | nb | ) |
int Dtk_mesh::set_color | ( | Dtk_Size_t | inPos, |
const Dtk_RGB * | inColor | ||
) |
Set a color to a point (if vertex format includes color)
inPos | : indice in the vertices array |
inColor | : color to set |
void Dtk_mesh::set_id | ( | int | inId | ) |
Set an id to the mesh.
inId | : id to set |
void Dtk_mesh::set_Infos | ( | const Dtk_InfoPtr & | inDtkInfosPtr | ) |
Set DtkInfosPtr of this Dtk_Mesh.
void Dtk_mesh::set_material | ( | Dtk_MaterialPtr | inMat | ) |
Set the material of the mesh.
int Dtk_mesh::set_normal | ( | Dtk_Size_t | inPos, |
const Dtk_dir * | inNormal | ||
) |
Set a normal to a point (if vertex format includes normal)
inPos | : indice in the vertices array |
inNormal | : normal to set |
int Dtk_mesh::set_texcoords | ( | Dtk_Size_t | inPos, |
Dtk_Float32 | inU, | ||
Dtk_Float32 | inV | ||
) |
Set texture coords to a point (if vertex format includes tex coords)
inPos | : indice in the vertices array |
inU,inV | : U,V to set |
int Dtk_mesh::set_vertex | ( | Dtk_Size_t | inPos, |
const Dtk_pnt * | inVertex, | ||
const Dtk_dir * | inNormal = NULL , |
||
const Dtk_RGB * | inColor = NULL , |
||
Dtk_Float32 | inU = 0. , |
||
Dtk_Float32 | inV = 0. , |
||
Dtk_Float32 | inUBrep = 0. , |
||
Dtk_Float32 | inVBrep = 0. |
||
) |
Set a vertex.
inPos | : indice in the vertices array |
inVertex | : vertex to set |
inNormal | : normal to set (if vertex format includes normal) |
inColor | : color to set (if vertex format includes color) |
inU,inV | : texture coords (if vertex format includes tex coord) |
void Dtk_mesh::SetStream | ( | Dtk_StreamPtr | inStream | ) |
Dtk_ErrorStatus Dtk_mesh::Store | ( | const Dtk_string & | inFile, |
Dtk_Size_t | inIo = 1 |
||
) |
Dtk_ErrorStatus Dtk_mesh::Store | ( | FILE * | inFile, |
Dtk_Size_t | inIo = 1 |
||
) |
int Dtk_mesh::to_stl | ( | Dtk_string | inFilename, |
Dtk_bool | inIsAciiMode = DTK_FALSE |
||
) |
|
virtual |
Implements Dtk_Entity.
int Dtk_mesh::transform | ( | Dtk_matrix * | inMatrix | ) |
Apply a transformation matrix to the Mesh (Deprecated method)
[in] | inMatrix | : Matrix to apply |
int Dtk_mesh::transform | ( | Dtk_transfo * | inMatrix | ) |
Apply a transformation matrix to the Mesh.
[in] | inMatrix | : Matrix to apply |
Dtk_mesh* Dtk_mesh::transform2Cpy | ( | Dtk_transfo * | inMatrix | ) |
Make a copy of the current mesh, applying a transformation on it.
[in] | inMatrix | : Matrix to apply |
|
friend |
|
friend |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |