DATAKIT API  V2025.1
Dtk_mesh Class Reference

This is a high level mesh class. More...

+ Inheritance diagram for Dtk_mesh:

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_InfoPtrget_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_faceget_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_IDGetID () 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_InfoPtrinfo ()
 
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_meshoperator= (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_meshtransform2Cpy (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_meshDtkDynamicCast (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 Member Functions

void _copy (const Dtk_Entity &s)
 
void _copy (const Dtk_Object &s)
 
void _init ()
 
void _reset ()
 
void C_ComputeOffsets ()
 
void C_GetNormal (Dtk_Size_t i, Dtk_dir &out) const
 
void C_GetRGB (Dtk_Size_t i, Dtk_RGB &out) const
 
Dtk_Float32 C_GetU (Dtk_Size_t i) const
 
Dtk_Float32 C_GetUBrep (Dtk_Size_t i) const
 
Dtk_Float32 C_GetV (Dtk_Size_t i) const
 
Dtk_Float32 C_GetVBrep (Dtk_Size_t i) const
 
void C_GetVertex (Dtk_Size_t i, Dtk_pnt &out) const
 
void C_SetNormal (Dtk_Size_t i, const Dtk_dir &out)
 
void C_SetRGB (Dtk_Size_t i, const Dtk_RGB &out)
 
void C_SetUV (Dtk_Size_t i, Dtk_Float32 u, Dtk_Float32 v)
 
void C_SetUVBrep (Dtk_Size_t i, Dtk_Float32 u, Dtk_Float32 v)
 
void C_SetVertex (Dtk_Size_t i, const Dtk_pnt &out)
 
Dtk_bool check_params (const Dtk_pnt *inVertex, const Dtk_dir *inNormal, const Dtk_RGB *inColor, Dtk_Float32 inU, Dtk_Float32 inV)
 
Dtk_bool check_params (const Dtk_tab< Dtk_pnt > *inVertices, const Dtk_tab< Dtk_dir > *inNormals, const Dtk_tab< Dtk_RGB > *inColors, const Dtk_tab< Dtk_Float32 > *inU, const Dtk_tab< Dtk_Float32 > *inV)
 
void clean_up ()
 
virtual Dtk_ObjectClone ()
 

Protected Attributes

Dtk_Handle * _Private
 
Dtk_StreamPtr _stream
 
Dtk_bool back_face_culling
 
unsigned long count_
 
Dtk_tab< Dtk_UChar8cvertices
 
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 >
 

Detailed Description

This is a high level mesh class.

This class gathers all the datas related to a triangulated mesh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
_typeID 
489  {
491  };

◆ anonymous enum

anonymous enum
protectedinherited
Enumerator
_typeID 

Constructor & Destructor Documentation

◆ Dtk_mesh() [1/2]

Dtk_mesh::Dtk_mesh ( int  inVertex_format = 1,
Dtk_bool  inBack_face_culling = true 
)

◆ Dtk_mesh() [2/2]

Dtk_mesh::Dtk_mesh ( const Dtk_mesh inMesh)

◆ ~Dtk_mesh()

Dtk_mesh::~Dtk_mesh ( )

Member Function Documentation

◆ _copy() [1/2]

void Dtk_Entity::_copy ( const Dtk_Entity s)
protectedinherited

◆ _copy() [2/2]

void Dtk_Object::_copy ( const Dtk_Object s)
protectedinherited

◆ _init()

void Dtk_Entity::_init ( )
protectedinherited

◆ _reset()

void Dtk_Entity::_reset ( )
protectedinherited

◆ _Store()

◆ add_mesh_face()

int Dtk_mesh::add_mesh_face ( Dtk_mesh_face inMesh_face)

Add a face (Dtk_mesh_face) to the mesh.

Parameters
in_mesh_face: face to add
Returns
return 0 if ok, 1 if error

◆ add_vertex()

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.

Parameters
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)
Returns
return 0 if ok, 1 if error, 2 if wrong vertex format

◆ apply_render_infos()

Dtk_bool Dtk_mesh::apply_render_infos ( Dtk_RenderInfosPtr  )

Apply texture mapping to the mesh. It will modify points texture UV coordinates.

◆ C_ComputeOffsets()

void Dtk_mesh::C_ComputeOffsets ( )
protected

◆ C_GetNormal()

void Dtk_mesh::C_GetNormal ( Dtk_Size_t  i,
Dtk_dir out 
) const
protected

◆ C_GetRGB()

void Dtk_mesh::C_GetRGB ( Dtk_Size_t  i,
Dtk_RGB out 
) const
protected

◆ C_GetU()

Dtk_Float32 Dtk_mesh::C_GetU ( Dtk_Size_t  i) const
protected

◆ C_GetUBrep()

Dtk_Float32 Dtk_mesh::C_GetUBrep ( Dtk_Size_t  i) const
protected

◆ C_GetV()

Dtk_Float32 Dtk_mesh::C_GetV ( Dtk_Size_t  i) const
protected

◆ C_GetVBrep()

Dtk_Float32 Dtk_mesh::C_GetVBrep ( Dtk_Size_t  i) const
protected

◆ C_GetVertex()

void Dtk_mesh::C_GetVertex ( Dtk_Size_t  i,
Dtk_pnt out 
) const
protected

◆ C_SetNormal()

void Dtk_mesh::C_SetNormal ( Dtk_Size_t  i,
const Dtk_dir out 
)
protected

◆ C_SetRGB()

void Dtk_mesh::C_SetRGB ( Dtk_Size_t  i,
const Dtk_RGB out 
)
protected

◆ C_SetUV()

void Dtk_mesh::C_SetUV ( Dtk_Size_t  i,
Dtk_Float32  u,
Dtk_Float32  v 
)
protected

◆ C_SetUVBrep()

void Dtk_mesh::C_SetUVBrep ( Dtk_Size_t  i,
Dtk_Float32  u,
Dtk_Float32  v 
)
protected

◆ C_SetVertex()

void Dtk_mesh::C_SetVertex ( Dtk_Size_t  i,
const Dtk_pnt out 
)
protected

◆ change_vertex_format()

int Dtk_mesh::change_vertex_format ( int  inVertex_format)

Change Vertex format, check constructor comment to see options.

Parameters
[in]inVertex_format: the chosen vertex format you will work with
Returns
return 0 if ok

◆ check_format()

Dtk_bool Dtk_mesh::check_format ( int  inFormat)

Checks The current vertex format of the Dtk_mesh object.

Parameters
inFormat: vertex format to test with
Returns
true if the format includes inFormat parameters, else false

◆ check_params() [1/2]

Dtk_bool Dtk_mesh::check_params ( const Dtk_pnt inVertex,
const Dtk_dir inNormal,
const Dtk_RGB inColor,
Dtk_Float32  inU,
Dtk_Float32  inV 
)
protected

◆ check_params() [2/2]

Dtk_bool Dtk_mesh::check_params ( const Dtk_tab< Dtk_pnt > *  inVertices,
const Dtk_tab< Dtk_dir > *  inNormals,
const Dtk_tab< Dtk_RGB > *  inColors,
const Dtk_tab< Dtk_Float32 > *  inU,
const Dtk_tab< Dtk_Float32 > *  inV 
)
protected

◆ clean_up()

void Dtk_mesh::clean_up ( )
protected

◆ Clone()

virtual Dtk_Object* Dtk_mesh::Clone ( )
protectedvirtual

Implements Dtk_Entity.

521 { return new Dtk_mesh(*this); }

◆ compute_bb()

int Dtk_mesh::compute_bb ( Dtk_pnt min,
Dtk_pnt max 
)

Compute the mesh Bounding Box.

Parameters
[out]min,max: computed extrem points of the boundig box
Returns
return 0 if ok

◆ compute_bb_center()

int Dtk_mesh::compute_bb_center ( Dtk_pnt i)

Compute the mesh Bounding Box.

Parameters
[out]min,max: computed extrem points of the boundig box
Returns
return 0 if ok

◆ compute_round_normals()

int Dtk_mesh::compute_round_normals ( )

Compute round normals from geometry.

Warning
Can alter vertex_format
Returns
return 0 if ok

◆ Create() [1/2]

static Dtk_MeshPtr Dtk_mesh::Create ( const Dtk_mesh inToBeCopied)
static

Copy constructor.

◆ Create() [2/2]

static Dtk_MeshPtr Dtk_mesh::Create ( int  inVertex_format = 1,
Dtk_bool  inBack_face_culling = true 
)
static

Constructor.

Parameters
inVertex_format: the chosen vertex format you will work with
inBack_face_culling: culling mode

Vertex formats available:

  • DTK_MESH_XYZ : each point has xyz coords
  • DTK_MESH_NORMAL : each point has a normal
  • DTK_MESH_RGB : each point has a color
  • DTK_MESH_UVTEXTURES : each point has UV texture coords
  • DTK_MESH_UVBBREP : each point has UVbrep match coords
  • DTK_MESH_DOUBLEPRECISION : each point has xyz coords as double

    For example : DTK_MESH_XYZ | DTK_MESH_NORMAL | DTK_MESH_UVTEXTURES : to have coords,normals, and uv textures

◆ DtkDynamicCast()

static Dtk_mesh* Dtk_mesh::DtkDynamicCast ( Dtk_Object s)
static

Performs a dynamic cast - doesn't need RTTI -.

◆ DtkDynamicType() [1/2]

Dtk_Int32 Dtk_mesh::DtkDynamicType ( const Dtk_Int32 inId)

Retrieves the dynamic entity type.

◆ DtkDynamicType() [2/2]

◆ dump()

virtual void Dtk_Object::dump ( FILE *  file = stdout)
virtualinherited

◆ explode() [1/2]

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.

Returns
return 0 if ok

◆ explode() [2/2]

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.

Returns
return 0 if ok

◆ get_color()

int Dtk_mesh::get_color ( Dtk_Size_t  inPos,
Dtk_RGB outColor 
)

Return a color (if vertex format includes color)

Parameters
inPos: indice in the vertices array
[out]outColor: color returned
Returns
return 0 if ok, 1 if error, 2 if wrong vertex format

◆ get_id()

int Dtk_mesh::get_id ( )

Return the mesh id.

◆ get_info()

Dtk_InfoPtr Dtk_Entity::get_info ( ) const
inherited

◆ get_Infos()

const Dtk_InfoPtr& Dtk_mesh::get_Infos ( )

Return DtkInfosPtr of this Dtk_Mesh may be NULL.

◆ get_material()

Dtk_MaterialPtr Dtk_mesh::get_material ( )

Get the material of the mesh.

◆ get_mesh_color()

Dtk_RGB Dtk_mesh::get_mesh_color ( )

get color in Dtk_mesh

◆ get_mesh_face()

Dtk_mesh_face* Dtk_mesh::get_mesh_face ( Dtk_Size_t  inPos)

Return a face.

Parameters
inPos: indice in the faces array

◆ get_mesh_face_array()

Dtk_tab<Dtk_mesh_face *>& Dtk_mesh::get_mesh_face_array ( )

Get a reference to the mesh face array // DEPRECATED, UNSAFE.

◆ get_mesh_faces() [1/2]

Dtk_tab<Dtk_mesh_face *>& Dtk_mesh::get_mesh_faces ( )

Return the array of mesh faces.

◆ get_mesh_faces() [2/2]

Dtk_tab<Dtk_mesh_face *> const& Dtk_mesh::get_mesh_faces ( ) const

◆ get_nb_facets()

Dtk_Size_t Dtk_mesh::get_nb_facets ( )

Return total number of facets.

◆ get_nb_mesh_face()

Dtk_Size_t Dtk_mesh::get_nb_mesh_face ( ) const

Return the faces array size.

◆ get_nb_vertices()

Dtk_Size_t Dtk_mesh::get_nb_vertices ( ) const

Return the vertices array size.

◆ get_normal() [1/2]

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

Parameters
inPos: indice in the vertices array
Returns
The normal

◆ get_normal() [2/2]

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

Parameters
inPos: indice in the vertices array
[out]

◆ get_texcoords()

int Dtk_mesh::get_texcoords ( Dtk_Size_t  inPos,
Dtk_Float32 outU,
Dtk_Float32 outV 
)

Return texture coords (if vertex format includes tex coords)

Parameters
inPos: indice in the vertices array
[out]outU,outV: UVtextures returned
Returns
return 0 if ok, 1 if error, 2 if wrong vertex format

◆ get_type_detk()

enum type_detk Dtk_mesh::get_type_detk ( ) const
virtual

Implements Dtk_Entity.

◆ get_vertex() [1/2]

Dtk_pnt Dtk_mesh::get_vertex ( Dtk_Size_t  inPos)

Return a vertex (2nd form of get_vertex)

Parameters
inPos: indice in the vertices array
Returns
The vertex

◆ get_vertex() [2/2]

int Dtk_mesh::get_vertex ( Dtk_Size_t  inPos,
Dtk_pnt outVertex 
)

Return a vertex.

Parameters
inPos: indice in the vertices array
[out]outVertex: vertex returned
Returns
return 0 if ok, 1 if error, 2 if wrong vertex format

◆ GetID()

const Dtk_ID& Dtk_Entity::GetID ( ) const
inherited

Get Internal UniqueID.

Returns
InternalID

◆ GetSize()

Dtk_Size_t Dtk_mesh::GetSize ( ) const
virtual

Reimplemented from Dtk_Entity.

◆ GetStream()

Dtk_StreamPtr Dtk_mesh::GetStream ( ) const

◆ GetUBrep()

Dtk_Float32 Dtk_mesh::GetUBrep ( Dtk_Size_t  inPos) const

◆ GetUTexture()

Dtk_Float32 Dtk_mesh::GetUTexture ( Dtk_Size_t  inPos) const

◆ GetVBrep()

Dtk_Float32 Dtk_mesh::GetVBrep ( Dtk_Size_t  inPos) const

◆ GetVTexture()

Dtk_Float32 Dtk_mesh::GetVTexture ( Dtk_Size_t  inPos) const

◆ has_colors()

Dtk_bool Dtk_mesh::has_colors ( )

Return true if the current vertex format includes color (RGB)

◆ has_normals()

Dtk_bool Dtk_mesh::has_normals ( )

Return true if the current vertex format includes normal.

◆ has_texcoords()

Dtk_bool Dtk_mesh::has_texcoords ( )

Return true if the current vertex format includes texture coords (UVTEXTURES)

◆ has_xyz()

Dtk_bool Dtk_mesh::has_xyz ( )

Return true if the current vertex format includes 3D coords (XYZ)

◆ info()

Dtk_InfoPtr& Dtk_Entity::info ( )
inherited

◆ is_backface_culled()

Dtk_bool Dtk_mesh::is_backface_culled ( )

Return the true of false if culled or not.

Returns
True or false.

◆ makestrips()

int Dtk_mesh::makestrips ( )

Assemble all simple triangle, try to make triange-strips.

Returns
return 0 if ok

◆ merge() [1/2]

void Dtk_mesh::merge ( const Dtk_mesh inMesh)

Merge another Dtk_mesh.

Parameters
inMesh: mesh to merge.

◆ merge() [2/2]

void Dtk_mesh::merge ( const Dtk_SmartPtr< Dtk_mesh > &  inMesh)

◆ mergemove() [1/3]

void Dtk_mesh::mergemove ( Dtk_mesh inmesh)

◆ mergemove() [2/3]

void Dtk_mesh::mergemove ( Dtk_SmartPtr< Dtk_mesh > &  inmesh)

◆ mergemove() [3/3]

void Dtk_mesh::mergemove ( Dtk_tab< Dtk_MeshPtr > &  inArraymesh)

◆ operator=()

Dtk_mesh& Dtk_mesh::operator= ( const Dtk_mesh inMesh)

◆ PrepareTransfo()

virtual void Dtk_Entity::PrepareTransfo ( )
virtualinherited

Reimplemented in Dtk_OffsetSurface.

◆ reduce()

void Dtk_mesh::reduce ( )

Reduce memory cost of the Dtk_mesh, to call after adding all geometry.

The Dtk_mesh class hold internal containers that keep more memory not to reallocate each data enqueuing (like reserve of a std::vector)

This function remove all reserves to free some useless memory

◆ reducesubfaces()

void Dtk_mesh::reducesubfaces ( )

Merge subfaces that have the same properties.

◆ rescale_model()

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.

◆ reserve_submesh()

void Dtk_mesh::reserve_submesh ( Dtk_Size_t  nb)

◆ reserve_vertex()

int Dtk_mesh::reserve_vertex ( Dtk_Size_t  nb)

◆ set_color()

int Dtk_mesh::set_color ( Dtk_Size_t  inPos,
const Dtk_RGB inColor 
)

Set a color to a point (if vertex format includes color)

Parameters
inPos: indice in the vertices array
inColor: color to set
Returns
return 0 if ok, 1 if error, 2 if wrong vertex format

◆ set_id()

void Dtk_mesh::set_id ( int  inId)

Set an id to the mesh.

Parameters
inId: id to set

◆ set_Infos()

void Dtk_mesh::set_Infos ( const Dtk_InfoPtr inDtkInfosPtr)

Set DtkInfosPtr of this Dtk_Mesh.

◆ set_material()

void Dtk_mesh::set_material ( Dtk_MaterialPtr  inMat)

Set the material of the mesh.

◆ set_mesh_color()

void Dtk_mesh::set_mesh_color ( const Dtk_RGB inColor)

set color in Dtk_mesh

◆ set_normal()

int Dtk_mesh::set_normal ( Dtk_Size_t  inPos,
const Dtk_dir inNormal 
)

Set a normal to a point (if vertex format includes normal)

Parameters
inPos: indice in the vertices array
inNormal: normal to set
Returns
return 0 if ok, 1 if error, 2 if wrong vertex format

◆ set_texcoords()

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)

Parameters
inPos: indice in the vertices array
inU,inV: U,V to set
Returns
return 0 if ok, 1 if error, 2 if wrong vertex format

◆ set_vertex()

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.

Parameters
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)
Returns
return 0 if ok, 1 if error, 2 if wrong vertex format

◆ SetStream()

void Dtk_mesh::SetStream ( Dtk_StreamPtr  inStream)

◆ Store() [1/2]

Dtk_ErrorStatus Dtk_mesh::Store ( const Dtk_string inFile,
Dtk_Size_t  inIo = 1 
)

◆ Store() [2/2]

Dtk_ErrorStatus Dtk_mesh::Store ( FILE *  inFile,
Dtk_Size_t  inIo = 1 
)

◆ to_stl()

int Dtk_mesh::to_stl ( Dtk_string  inFilename,
Dtk_bool  inIsAciiMode = DTK_FALSE 
)

◆ Transform()

Dtk_ErrorStatus Dtk_mesh::Transform ( const Dtk_transfo )
virtual

Implements Dtk_Entity.

◆ transform() [1/2]

int Dtk_mesh::transform ( Dtk_matrix inMatrix)

Apply a transformation matrix to the Mesh (Deprecated method)

Parameters
[in]inMatrix: Matrix to apply
Returns
return 0 if ok

◆ transform() [2/2]

int Dtk_mesh::transform ( Dtk_transfo inMatrix)

Apply a transformation matrix to the Mesh.

Parameters
[in]inMatrix: Matrix to apply
Returns
return 0 if ok

◆ transform2Cpy()

Dtk_mesh* Dtk_mesh::transform2Cpy ( Dtk_transfo inMatrix)

Make a copy of the current mesh, applying a transformation on it.

Parameters
[in]inMatrix: Matrix to apply
Returns
The copy mesh, NULL if error.

Friends And Related Function Documentation

◆ Dtk_mesh_face

friend class Dtk_mesh_face
friend

◆ Dtk_SmartPtr< Dtk_mesh >

friend class Dtk_SmartPtr< Dtk_mesh >
friend

Field Documentation

◆ _Private

Dtk_Handle* Dtk_Entity::_Private
protectedinherited

◆ _stream

Dtk_StreamPtr Dtk_mesh::_stream
protected

◆ back_face_culling

Dtk_bool Dtk_mesh::back_face_culling
protected

◆ count_

unsigned long Dtk_Object::count_
protectedinherited

◆ cvertices

Dtk_tab<Dtk_UChar8> Dtk_mesh::cvertices
protected

◆ HasTextureValues

Dtk_bool Dtk_mesh::HasTextureValues
protected

◆ id

int Dtk_mesh::id
protected

◆ ofsNRM

Dtk_Size_t Dtk_mesh::ofsNRM
protected

◆ ofsRGB

Dtk_Size_t Dtk_mesh::ofsRGB
protected

◆ ofsUV

Dtk_Size_t Dtk_mesh::ofsUV
protected

◆ ofsUVBrep

Dtk_Size_t Dtk_mesh::ofsUVBrep
protected

◆ ofsVTX

Dtk_Size_t Dtk_mesh::ofsVTX
protected

◆ sizeonevertex

Dtk_Size_t Dtk_mesh::sizeonevertex
protected

◆ submeshes

Dtk_tab<Dtk_mesh_face *> Dtk_mesh::submeshes
protected

◆ vertex_format

int Dtk_mesh::vertex_format
protected
Dtk_mesh::_typeID
@ _typeID
Definition: util_mesh_dtk.hpp:490
DTK_TYPE_MESH
@ DTK_TYPE_MESH
Definition: define.h:477
DTK_TYPE_ENTITY
@ DTK_TYPE_ENTITY
Definition: define.h:466
Dtk_Entity::_typeID
@ _typeID
Definition: util_ent_dtk.hpp:333
Dtk_mesh::Dtk_mesh
Dtk_mesh(int inVertex_format=1, Dtk_bool inBack_face_culling=true)