 |
DATAKIT SDK
V2026.4
|
|
Go to the documentation of this file.
2 #ifndef _UTIL_MESH_DTK_HPP_
3 #define _UTIL_MESH_DTK_HPP_
30 #define DTK_MESH_XYZ 1
31 #define DTK_MESH_NORMAL 2
32 #define DTK_MESH_RGB 4
33 #define DTK_MESH_UV_TEXTURES 8 // textures
34 #define DTK_MESH_UV_BREP 16
35 #define DTK_MESH_DOUBLEPRECISION 32
37 #define DTK_MESH_XYZ_NORMAL 3
38 #define DTK_MESH_XYZ_NORMAL_UVTEXTURES 11
39 #define DTK_MESH_XYZ_NORMAL_RGB 7
40 #define DTK_MESH_ALL 31
48 #define DTK_VALUE_M 1000.0
49 #define DTK_VALUE_CM 10.0
50 #define DTK_VALUE_MM 1.0
51 #define DTK_VALUE_INCH 25.4
52 #define DTK_VALUE_FEET 304.8
56 struct Dtk_bounding_box
63 typedef Dtk_bounding_box dtk_mesh_face_bb;
67 typedef Dtk_bounding_box dtk_mesh_body_bb;
70 typedef Dtk_bounding_box dtk_mesh_all_bodies_bb;
72 typedef Dtk_bounding_box dtk_mesh_crv_bb;
74 typedef Dtk_bounding_box dtk_mesh_all_crvs_bb;
77 class Dtk_material_value
84 SetAsDeprecated(
"2026.4",
"Use Dtk_material_value::Dtk_material_value(const Dtk_material_value &) instead" )
85 void _Copy(const Dtk_material_value & s)
87 NameProperties = s.NameProperties;
88 for(
Dtk_Size_t i=0;i<s.PropertiesValue.size();i++)
102 SetAsDeprecated(
"2026.4",
"Use Dtk_rendering::Dtk_rendering(const Dtk_rendering &) instead" )
103 void _Copy(const Dtk_rendering * s)
121 Dtk_drw( ) : picture( nullptr ){}
128 Dtk_drw(
const Dtk_drw& s ) : name( s.name ), picturename( s.picturename ), picture( nullptr ), value( s.value )
135 Dtk_drw& operator=(
const Dtk_drw& s )
140 picturename = s.picturename;
151 Dtk_drw( Dtk_drw && s )
DTK_NOEXCEPT : name( std::move( s.name ) ), picturename( std::move( s.picturename ) ), picture( s.picture ), value( std::move( s.value ) )
159 name = std::move( s.name );
160 picturename = std::move( s.picturename );
164 value = std::move( s.value );
169 SetAsDeprecated(
"2026.4",
"Use Dtk_drw::Dtk_drw(const Dtk_drw &) instead" )
170 void _Copy( const Dtk_drw* s )
175 picturename = s->picturename;
192 Dtk_drafting() : drw(), value() {}
193 Dtk_drafting(
const Dtk_drafting& s ) : name( s.name ), drw(), value( s.value )
195 for(
Dtk_Size_t i = 0; i < s.drw.size(); i++ )
197 if( s.drw.at( i ) !=
nullptr )
199 drw.
push_back(
new Dtk_drw( *s.drw.at( i ) ) );
204 Dtk_drafting& operator=(
const Dtk_drafting& s )
213 drw.
at( i ) =
nullptr;
217 for(
Dtk_Size_t i = 0; i < s.drw.size(); i++ )
219 if( s.drw.at( i ) ==
nullptr )
224 drw.
push_back(
new Dtk_drw( *s.drw.at( i ) ) );
230 Dtk_drafting( Dtk_drafting && s )
DTK_NOEXCEPT : name( std::move( s.name ) ), drw( std::move( s.drw ) ), value( std::move( s.value ) )
235 Dtk_drafting& operator=( Dtk_drafting && s )
DTK_NOEXCEPT
239 name = std::move( s.name );
240 value = std::move( s.value );
244 drw.
at( i ) =
nullptr;
246 drw = std::move( s.drw );
257 drw.
at( i ) =
nullptr;
262 SetAsDeprecated(
"2026.4",
"Use Dtk_drafting::Dtk_drafting(const Dtk_drafting &) instead" )
263 void _Copy(const Dtk_drafting * s)
270 if( s->drw.at(i) !=
nullptr )
272 drw.
push_back(
new Dtk_drw( *s->drw.at( i ) ) );
287 SetAsDeprecated(
"2026.4",
"Use Dtk_analysis::Dtk_analysis(const Dtk_analysis &) instead" )
288 void _Copy(const Dtk_analysis * s)
305 SetAsDeprecated(
"2026.4",
"Use Dtk_composites::Dtk_composites(const Dtk_composites &) instead" )
306 void _Copy(const Dtk_composites * s)
323 Dtk_positioned() : matrix( nullptr ){}
329 Dtk_positioned(
const Dtk_positioned& s ) : name( s.name ), matrix( nullptr ), value( s.value )
333 matrix =
new Dtk_transfo( s.matrix->getXdir(), s.matrix->getYdir(), s.matrix->getZdir(), s.matrix->getOrigin(), s.matrix->getScale() );
336 Dtk_positioned& operator=(
const Dtk_positioned& s )
346 matrix =
new Dtk_transfo( s.matrix->getXdir(), s.matrix->getYdir(), s.matrix->getZdir(), s.matrix->getOrigin(), s.matrix->getScale() );
351 Dtk_positioned( Dtk_positioned && s )
DTK_NOEXCEPT : name( std::move( s.name ) ), matrix( s.matrix ), value( std::move( s.value ) )
355 Dtk_positioned& operator=( Dtk_positioned && s )
DTK_NOEXCEPT
359 name = std::move( s.name );
360 value = std::move( s.value );
369 SetAsDeprecated(
"2026.4",
"Use Dtk_positioned::Dtk_positioned(const Dtk_positioned &) instead" )
370 void _Copy( const Dtk_positioned* s )
378 matrix =
new Dtk_transfo( s->matrix->getXdir(), s->matrix->getYdir(), s->matrix->getZdir(), s->matrix->getOrigin(), s->matrix->getScale() );
421 Dtk_rendering * rendering;
422 Dtk_drafting * drafting;
423 Dtk_analysis * analysis;
424 Dtk_composites * composites;
425 Dtk_positioned * positioned;
434 return Dtk_material::DtkDynamicType(inId);
440 return static_cast<Dtk_material *
>(s);
446 SetAsDeprecated(
"2026.4",
"Use Dtk_material::Dtk_material(const Dtk_MaterialPtr &) instead" )
452 ambient = s->ambient;
453 diffuse = s->diffuse;
454 specular = s->specular;
455 refraction = s->refraction;
456 transparency = s->transparency;
457 reflectivity = s->reflectivity;
458 roughness = s->roughness;
459 _Density = s->_Density;
460 _renderID = s->_renderID;
461 repeat_u = s->repeat_u;
462 repeat_v = s->repeat_v;
463 texture = s->texture;
464 _identifier_library = s->_identifier_library;
471 rendering =
new Dtk_rendering(*s->rendering);
475 drafting =
new Dtk_drafting( *s->drafting );
479 analysis =
new Dtk_analysis( *s->analysis );
483 composites =
new Dtk_composites( *s->composites );
487 positioned =
new Dtk_positioned( *s->positioned );
492 Dtk_material(
const Dtk_material& s ) : label(s.label), texture(s.texture ),roughness( s.roughness ), refraction( s.refraction ), ambient( s.ambient ), transparency( s.transparency ), diffuse( s.diffuse ), specular( s.specular ),
493 reflectivity( s.reflectivity ), repeat_u( s.repeat_u ), repeat_v( s.repeat_v ), _Density( s._Density ), _renderID( s._renderID ), _physicalID( s._physicalID ),
494 _identifier_library( s._identifier_library ), picture( nullptr ), rendering( nullptr ), drafting( nullptr ), analysis( nullptr ), composites( nullptr ), positioned( nullptr )
502 rendering =
new Dtk_rendering(*s.rendering);
506 drafting =
new Dtk_drafting( *s.drafting );
510 analysis =
new Dtk_analysis( *s.analysis );
514 composites =
new Dtk_composites( *s.composites );
518 positioned =
new Dtk_positioned( *s.positioned );
521 Dtk_material&
operator=(
const Dtk_material& s )
525 roughness = s.roughness;
526 refraction = s.refraction;
528 transparency = s.transparency;
530 specular = s.specular;
531 reflectivity = s.reflectivity;
532 repeat_u = s.repeat_u;
533 repeat_v = s.repeat_v;
534 _Density = s._Density;
535 _renderID = s._renderID;
536 _physicalID = s._physicalID;
537 _identifier_library = s._identifier_library;
543 picture = s.picture ?
new Dtk_picture( *s.picture ) : nullptr;
549 rendering = s.rendering ?
new Dtk_rendering( *s.rendering ) : nullptr;
555 drafting = s.drafting ?
new Dtk_drafting( *s.drafting ) : nullptr;
561 analysis = s.analysis ?
new Dtk_analysis( *s.analysis ) : nullptr;
565 composites =
nullptr;
567 composites = s.composites ?
new Dtk_composites( *s.composites ) : nullptr;
571 positioned =
nullptr;
573 positioned = s.positioned ?
new Dtk_positioned( *s.positioned ) : nullptr;
578 Dtk_material( Dtk_material&& s )
DTK_NOEXCEPT : roughness( s.roughness ), refraction( s.refraction ), ambient( s.ambient ), transparency( s.transparency ), diffuse( s.diffuse ), specular( s.specular ),
579 reflectivity( s.reflectivity ), repeat_u( s.repeat_u ), repeat_v( s.repeat_v ), _Density( s._Density ), _renderID( s._renderID ), _physicalID( s._physicalID ),
580 _identifier_library( s._identifier_library ), picture( s.picture ), rendering( s.rendering ), drafting( s.drafting ), analysis( s.analysis ), composites( s.composites ), positioned( s.positioned )
583 s.rendering =
nullptr;
584 s.drafting =
nullptr;
585 s.analysis =
nullptr;
586 s.composites =
nullptr;
587 s.positioned =
nullptr;
590 Dtk_material() : roughness( 0.0 ), refraction( 0.0 ), ambient( 0.0 ), diffuse( 0.0 ), specular( 0.0 ), transparency( 0.0 ), reflectivity( 0.0 ),
591 repeat_u( 0 ), repeat_v( 0 ), rendering( nullptr ), drafting( nullptr ), analysis( nullptr ), composites( nullptr ), positioned( nullptr ), picture( nullptr ),
592 _Density( 0.0 ), _renderID( -1 ), _physicalID( -1 ), _identifier_library( 0 )
596 roughness = s.roughness;
597 refraction = s.refraction;
600 specular = s.specular;
601 transparency = s.transparency;
602 reflectivity = s.reflectivity;
603 repeat_u = s.repeat_u;
604 repeat_v = s.repeat_v;
605 _Density = s._Density;
606 _renderID = s._renderID;
607 _physicalID = s._physicalID;
608 _identifier_library = s._identifier_library;
614 rendering = s.rendering;
615 s.rendering =
nullptr;
621 drafting = s.drafting;
622 s.drafting =
nullptr;
628 analysis = s.analysis;
629 s.analysis =
nullptr;
633 composites =
nullptr;
635 composites = s.composites;
636 s.composites =
nullptr;
640 positioned =
nullptr;
642 positioned = s.positioned;
643 s.positioned =
nullptr;
671 inline Dtk_Double64 GetDensity()
const {
return _Density;}
672 inline void SetDensity(
const Dtk_Double64 inDensity) {_Density = inDensity;}
673 inline Dtk_Int32 GetRenderID()
const {
return _renderID;}
674 inline void SetRenderID(
const Dtk_Int32 inRenderID) {_renderID = inRenderID;}
675 inline Dtk_Int32 GetPhysicalMaterialID()
const {
return _physicalID; }
676 inline void SetPhysicalMaterialID(
const Dtk_Int32 inPhysicalID) { _physicalID = inPhysicalID; }
705 #ifdef NOCOMPRESSEDVERTICES
1105 int _finddoublonstriangles();
1451 Dtk_tab<int> indices;
1456 friend class Dtk_mesh;
1457 friend class Dtk_mesh_face;
1459 void set_numset(Dtk_Size_t);
1460 void set_mesh(Dtk_mesh* inMesh);
1470 Dtk_facet(Dtk_tab<int> * inIndices);
1480 virtual int compute_normal(Dtk_dir * outNormal) = 0;
1484 virtual Dtk_bool is_valid() = 0;
1489 Dtk_Size_t add_indice(int inIndice);
1498 int add_vertex(Dtk_pnt * inPnt, Dtk_dir * inNormal = NULL, Dtk_RGB * inColor = NULL, Dtk_Float32 inU = 0., Dtk_Float32 inV = 0.);
1501 Dtk_Size_t get_nb_vertices();
1507 int get_vertex(Dtk_Size_t inIndice, Dtk_pnt* outPnt);
1513 int get_normal(Dtk_Size_t inIndice, Dtk_dir* outNormal);
1519 int get_color(Dtk_Size_t inIndice, Dtk_RGB* outColor);
1525 int get_texcoords(Dtk_Size_t inIndice, double* ouU, double* outV);
1528 Dtk_Size_t get_nb_indices();
1531 Dtk_tab<int>get_indices();
1535 int get_indice(int inIndice);
1538 Dtk_mesh * get_mesh();
1549 class Dtk_triangle: public Dtk_facet
1558 Dtk_triangle(Dtk_tab<int> * inIndices);
1564 Dtk_bool is_valid();
1569 int compute_normal(Dtk_dir * outNormal);
1584 Dtk_planar_facet(Dtk_tab<int> *);
1585 ~Dtk_planar_facet();
1587 Dtk_bool is_valid();
1588 int compute_normal(Dtk_dir *);
1590 Dtk_triangle * to_strip();
1591 Dtk_triangle * to_triangles();
Dtk_Size_t get_nbtriangle_fans() const
Get the number of triangle fans kept in the class instance.
Dtk_bool has_colors()
Return true if the current vertex format includes color (RGB)
void set_type(int inType)
Set the curve type.
void set_linetype(int inLineType)
Set line type in Dtk_mesh_curve.
Dtk_RGB get_face_color() const
Return the RGB face color.
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.
int get_id()
Return the mesh id.
Dtk_Int32 SetNormal(const Dtk_dir &)
virtual Dtk_dir GetNormal() const
For internal use.
Definition: util_mesh_dtk.hpp:1005
DTK_FACET_TYPE
Definition: util_mesh_dtk.hpp:44
int DtkDynamicType(const int &inId)
Dtk_tab< Dtk_tab< Dtk_UInt32 > > trifans
Definition: util_mesh_dtk.hpp:1088
Dtk_bool check_params(const Dtk_pnt *inVertex, const Dtk_dir *inNormal, const Dtk_RGB *inColor, Dtk_Float32 inU, Dtk_Float32 inV)
@ DTK_MESH_PLANE
Definition: util_mesh_dtk.hpp:1068
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
virtual Dtk_Float32 GetU() const
virtual Dtk_Int32 SetV(Dtk_Float32)
@ _typeID
Definition: util_mesh_dtk.hpp:699
This is a high level face class.
Definition: util_mesh_dtk.hpp:1076
virtual Dtk_Object * Clone()
Definition: util_mesh_dtk.hpp:730
Dtk_ErrorStatus Store(const Dtk_string &inFile, Dtk_Size_t inIo=1)
int compute_bb(Dtk_pnt *min, Dtk_pnt *max)
Compute the mesh Bounding Box.
Dtk_StreamPtr _stream
Definition: util_mesh_dtk.hpp:724
const Dtk_tab< Dtk_tab< Dtk_UInt32 > > * get_mockup_indices(Dtk_Size_t inI) const
Get inI-th mockup.
const Dtk_InfoPtr & get_Infos()
Return DtkInfosPtr of this Dtk_Mesh may be NULL.
int add_polygon(const Dtk_tab< Dtk_UInt32 > *inIndices)
Add one polygon.
@ DTK_TYPE_MESH_FACE
Definition: define.h:528
int compute_round_normals()
Compute round normals from geometry.
Dtk_tab< Dtk_UInt32 > triangles
Definition: util_mesh_dtk.hpp:1085
@ DTK_TYPE_MESH
Definition: define.h:468
void set_material(Dtk_MaterialPtr inMat)
Set the material of the mesh.
float Dtk_Float32
Definition: define.h:699
void set_Infos(const Dtk_InfoPtr &inDtkInfosPtr)
Set DtkInfosPtr of this Dtk_Mesh.
int get_normal(Dtk_Size_t inPos, Dtk_dir *outNormal, Dtk_mesh_face *inMeshFace=NULL)
Return a normal (if vertex format includes normal)
Dtk_tab< Dtk_tab< Dtk_UInt32 > > tristrips
Definition: util_mesh_dtk.hpp:1087
Dtk_Int32 DtkDynamicType(const Dtk_Int32 &inId)
Retrieves the dynamic entity type.
Dtk_Size_t ofsUVBrep
Definition: util_mesh_dtk.hpp:709
Dtk_dir get_normal(Dtk_Size_t inPos)
Return a vertex (2nd form of get_normal)
Dtk_ErrorStatus _Store(void *)
float get_thickness()
Get thickness of Dtk_mesh_curve.
int compute_round_normals()
Compute round normals from geometry.
void set_id(int inId)
Set an Id to the face.
void set_face_type(DTK_MESH_TYPE_FACE inType)
Set a face type.
Dtk_dir GetNormal() const
Dtk_Size_t get_nb_mesh_face() const
Return the faces array size.
virtual Dtk_Int32 SetRGB(const Dtk_RGB &)
Dtk_UInt32 GetVertexInd(const Dtk_UInt32 ival)
@ DTK_MESH_OTHERSRF
Definition: util_mesh_dtk.hpp:1068
@ _typeID
Definition: util_mesh_dtk.hpp:1081
const Dtk_tab< Dtk_UInt32 > * get_polygon_indices(Dtk_Size_t inI) const
Get inI-th polygon.
Dtk_bool HasTextureValues
Definition: util_mesh_dtk.hpp:703
Dtk_tab< Dtk_tab< Dtk_UInt32 > > polygons
Definition: util_mesh_dtk.hpp:1086
virtual Dtk_Size_t GetSize() const
Dtk_mesh_curve * transform2Cpy(Dtk_transfo *inMatrix)
Dtk_Int32 DtkDynamicType(const Dtk_Int32 &inId)
Retrieves the dynamic entity type.
Dtk_bool back_face_culling
Definition: util_mesh_dtk.hpp:702
int get_linetype()
Get line type of Dtk_mesh_curve.
static Dtk_MeshPtr Create(int inVertex_format=1, Dtk_bool inBack_face_culling=true)
Constructor.
static Dtk_mesh * DtkDynamicCast(Dtk_Object *s)
Performs a dynamic cast - doesn't need RTTI -.
Dtk_Size_t ofsRGB
Definition: util_mesh_dtk.hpp:709
Dtk_dir get_mockup_normal(Dtk_Size_t inI) const
int add_triangle_fan(const Dtk_tab< Dtk_UInt32 > *inIndices)
Add one triangle fan.
Dtk_tab< Dtk_UInt32 > points
Definition: util_mesh_dtk.hpp:1091
Dtk_bool is_backface_culled()
Return the true of false if culled or not.
uint32_t Dtk_UInt32
Definition: define.h:687
Dtk_tab< Dtk_mesh_face * > submeshes
Definition: util_mesh_dtk.hpp:725
This is a high level string class.
Definition: dtk_string.hpp:53
const Dtk_tab< Dtk_UInt32 > * get_triangle_fan_indices(Dtk_Size_t inI) const
Get inI-th triangle fan.
void reduce()
Reduce memory cost of the Dtk_mesh, to call after adding all geometry.
int get_id() const
Return the face Id.
size_t Dtk_Size_t
Definition: define.h:711
void set_mesh_circle_data(const Dtk_mesh_circle_data &inCircle)
Set a mesh_circle_data object to the face, in order to add circular datas (for cylinders)
Dtk_Float32 C_GetU(Dtk_Size_t i) const
Dtk_pnt get_center() const
Return the circle/cylinder center.
double get_radius() const
Return the circle/cylinder radius.
const Dtk_tab< Dtk_UInt32 > * get_polyline_indices(Dtk_Size_t inI) const
Get inI-th polygon.
int add_triangle_strip(const Dtk_tab< Dtk_UInt32 > *inIndices)
Add one triangle strip.
void mergemove(Dtk_SmartPtr< Dtk_mesh > &inmesh)
Dtk_mesh_circle_data get_mesh_circle_data() const
Return the mesh_circle_data of the current face. If it doesn't exist, NULL is returned.
Dtk_mesh * mesh
Definition: util_mesh_dtk.hpp:1083
Dtk_mesh_vertex_norm_color()
Dtk_dir get_triangle_normal(Dtk_Size_t inI) const
Get the center normal of the inI-th triangle.
Dtk_bool has_normals()
Return true if the current vertex format includes normal.
Dtk_Float32 GetVTexture(Dtk_Size_t inPos) const
void set_id(unsigned long inID)
Set an ID to the curve.
void add_vertex(Dtk_pnt inVertex)
Add a vertex to the vertices array.
Dtk_ErrorStatus Store(FILE *inFile, Dtk_Size_t inIo=1)
virtual Dtk_Float32 GetV() const
#define DTK_MESH_XYZ
Definition: util_mesh_dtk.hpp:30
int GetTopoID()
Definition: util_mesh_dtk.hpp:1758
Dtk_Size_t get_nb_vertices(int inOnce=1)
Compute the total number of vertices used in the face.
int vertex_format
Definition: util_mesh_dtk.hpp:704
int compute_bb(Dtk_pnt *min, Dtk_pnt *max)
Compute the mesh Bounding Box.
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)
#define DTK_FALSE
Definition: define.h:727
Dtk_Int32 transform(Dtk_transfo &)
char Dtk_bool
Definition: define.h:724
void merge(const Dtk_mesh *inMesh)
Merge another Dtk_mesh.
Dtk_Int32 SetU(Dtk_Float32)
@ DTK_TYPE_MATERIAL
Definition: define.h:515
void SetStream(Dtk_StreamPtr inStream)
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.
@ DTK_MESH_CYLINDER
Definition: util_mesh_dtk.hpp:1068
@ DTK_MESH_LINE
Definition: util_mesh_dtk.hpp:46
Dtk_Size_t get_nbmockups() const
Get the number of mockups kept in the class instance.
void reducesubfaces()
Merge subfaces that have the same properties.
Dtk_InfoPtr & get_subinfo(Dtk_Size_t inI)
void C_GetRGB(Dtk_Size_t i, Dtk_RGB &out) const
Dtk_bool apply_render_infos(Dtk_RenderInfosPtr)
Apply texture mapping to the mesh. It will modify points texture UV coordinates.
Dtk_mesh(Dtk_mesh &&inMesh) DTK_NOEXCEPT
void reserve_polylines(Dtk_Size_t nb)
int transform(Dtk_transfo *inMatrix)
Apply a transformation matrix to the Mesh.
Dtk_Size_t GetNbVertex()
Definition: util_mesh_dtk.hpp:1760
double Dtk_Double64
Definition: define.h:698
virtual ~Dtk_MeshPolyline()
Dtk_tab< Dtk_InfoPtr > subinfos
Definition: util_mesh_dtk.hpp:1092
Dtk_mesh_vertex(const Dtk_pnt *inVertex)
@ DTK_MOCKUP
Definition: util_mesh_dtk.hpp:44
Dtk_Size_t get_nbpolylines() const
Get the number of polylines kept in the class instance.
int to_stl(Dtk_string inFilename, Dtk_bool inIsAciiMode=DTK_FALSE)
@ DTK_MESH_CIRCLE
Definition: util_mesh_dtk.hpp:46
void set_color(int R, int G, int B)
Set a RGB color to the curve.
Dtk_string get_face_name() const
Get a name for the face.
This is a high level mesh class.
Definition: util_mesh_dtk.hpp:694
void reserve_submesh(Dtk_Size_t nb)
int get_face_icolor() const
Return the RGB face color (indice)
Dtk_bool check_format(int inFormat)
Checks The current vertex format of the Dtk_mesh object.
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 tr...
Dtk_tab< Dtk_mesh_face * > & get_mesh_faces()
Return the array of mesh faces.
virtual Dtk_Int32 SetU(Dtk_Float32)
Definition: dtk_val.hpp:67
enum type_detk get_type_detk() const
int add_subinfo(Dtk_InfoPtr &ininf)
Dtk_RGB get_mesh_color()
get color in Dtk_mesh
static Dtk_Object * DtkDynamicCast(Dtk_Object *s)
void C_SetRGB(Dtk_Size_t i, const Dtk_RGB &out)
This is a high level curve class.
Definition: util_mesh_dtk.hpp:1606
Dtk_Size_t get_nb_vertices() const
Return the vertices array size.
Dtk_Float32 GetVBrep(Dtk_Size_t inPos) const
Dtk_pnt get_triangle_vertex(Dtk_Size_t inI, Dtk_Size_t inV) const
Get the V-th vertex of the inI-th triangle.
Dtk_tab< Dtk_tab< Dtk_UInt32 > > polylines
Definition: util_mesh_dtk.hpp:1090
This class gathers circle datas.
Definition: util_mesh_dtk.hpp:1709
Dtk_Float32 normal[3]
Definition: util_mesh_dtk.hpp:1029
int compute_bb_center(Dtk_pnt *i)
Compute the mesh Bounding Box.
Dtk_tab< Dtk_tab< Dtk_tab< Dtk_UInt32 > > > mockup
Definition: util_mesh_dtk.hpp:1089
int add_mockup(const Dtk_tab< Dtk_tab< Dtk_UInt32 > > *inIndices)
Add one mockup.
This class defines a picture.
Definition: dtk_picture.hpp:39
int get_vertex(Dtk_Size_t inIndice, Dtk_pnt *outVertex)
Get a vertex from the verxtex array.
int get_indice(Dtk_Size_t inNum)
Get an indice from the indices array. Indices array size must be greater than inNum.
Dtk_mesh & operator=(const Dtk_mesh &inMesh)
Dtk_Size_t ofsNRM
Definition: util_mesh_dtk.hpp:709
static Dtk_mesh_facePtr Create(const Dtk_mesh_face &in)
Calls copy constructor to allocate a new object.
virtual ~Dtk_mesh_vertex()
void mergemove(Dtk_mesh *inmesh)
int rescale_model(float ratio)
Perform a scale of the model.
int32_t Dtk_Int32
Definition: define.h:686
Dtk_dir get_axis() const
Return the circle/cylinder axis.
Dtk_mesh_vertex_norm_color(const Dtk_pnt *inVertex, const Dtk_dir *inNorm, const Dtk_RGB *inRGB)
void set_face_normal(const Dtk_dir &)
Some interfaces need to keep a normal for a specific type of face. Use this to store a global face no...
Dtk_Size_t ofsUV
Definition: util_mesh_dtk.hpp:709
Dtk_Float32 vertex[3]
Definition: util_mesh_dtk.hpp:1007
Definition: util_mesh_dtk.hpp:1027
void C_SetVertex(Dtk_Size_t i, const Dtk_pnt &out)
int compute_bb_center(Dtk_pnt *i)
Compute the mesh Bounding Box.
const Dtk_UInt32 * get_triangle_indices(Dtk_Size_t inI) const
Get pointer of triangle indices of i-th triangle.
Dtk_bool has_xyz()
Return true if the current vertex format includes 3D coords (XYZ)
Definition: util_mesh_dtk.hpp:1052
int get_texcoords(Dtk_Size_t inPos, Dtk_Float32 *outU, Dtk_Float32 *outV)
Return texture coords (if vertex format includes tex coords)
virtual Dtk_Int32 transform(Dtk_transfo &)
Dtk_dir get_polygon_normal(Dtk_Size_t inI) const
int explode()
Decompose all complex geometry (triangle strips, fan, polygons) into triangles, and append it into th...
Dtk_SmartPtr< Dtk_MeshPolyline > Dtk_MeshPolylinePtr
Definition: util_mesh_dtk.hpp:1769
void AddVertex(const Dtk_UInt32 ind)
static Dtk_MeshPolyline * DtkDynamicCast(Dtk_Object *nObject)
int add_point(Dtk_UInt32 inpnt)
Dtk_Size_t GetSize() const
void set_mesh_color(const Dtk_RGB &inColor)
set color in Dtk_mesh
void set_radius(double inRadius)
Used to set the circle/cylinder radius.
Dtk_Size_t sizeonevertex
Definition: util_mesh_dtk.hpp:709
DTK_MESH_TYPE_FACE get_face_type() const
Return the current face type.
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
@ DTK_MESH_UNKNOWN_CRV_TYPE
Definition: util_mesh_dtk.hpp:46
int reserve_vertex(Dtk_Size_t nb)
Dtk_UInt32 get_point_indice(Dtk_Size_t inI) const
void reserve(Dtk_Size_t n)
Definition: util_stl_dtk.hpp:801
#define SetAsDeprecated(inFromVersion, inMessage)
Definition: define.h:762
virtual Dtk_Int32 SetNormal(const Dtk_dir &)
@ DTK_UNKNOWN_FACET
Definition: util_mesh_dtk.hpp:44
int id
Definition: util_mesh_dtk.hpp:701
int change_vertex_format(int inVertex_format)
Change Vertex format, check constructor comment to see options.
int get_color(Dtk_Size_t inPos, Dtk_RGB *outColor)
Return a color (if vertex format includes color)
Dtk_Size_t GetSize() const
virtual Dtk_RGB GetRGB() const
Dtk_mesh_face * get_mesh_face(Dtk_Size_t inPos)
Return a face.
int set_normal(Dtk_Size_t inPos, const Dtk_dir *inNormal)
Set a normal to a point (if vertex format includes normal)
Dtk_Size_t get_nbpoints() const
@ DTK_MESH_UNKNOWN_TYPE_FACE
Definition: util_mesh_dtk.hpp:1068
</td ></tr >< tr >< td width="33%"> Translucency</td >< td width="45%"> Alpha A() into Dtk_RGB</td >< td width
Dtk_Size_t get_nb_facets()
Compute all facets (triangles) holded by the class, including trianglestrips, fans,...
Dtk_Size_t get_nbsubinfos() const
void set_face_icolor(int inColor)
Set a color to the face (indexed). Sometimes, one needs to set a color to a face, not the vertices.
int add_mockups(const Dtk_tab< Dtk_tab< Dtk_tab< Dtk_UInt32 > > > *inIndices, const Dtk_tab< Dtk_pnt > *inVertices, const Dtk_tab< Dtk_dir > *inNormals=NULL, const Dtk_tab< Dtk_RGB > *inColors=NULL, const Dtk_tab< Dtk_Float32 > *inU=NULL, const Dtk_tab< Dtk_Float32 > *inV=NULL)
void merge(const Dtk_SmartPtr< Dtk_mesh > &inMesh)
Dtk_InfoPtr _infos
Definition: util_mesh_dtk.hpp:1094
virtual Dtk_Int32 SetVertex(const Dtk_pnt &)
Dtk_SmartPtr< Dtk_mesh > Dtk_MeshPtr
Definition: util_mesh_dtk.hpp:25
Dtk_mesh(int inVertex_format=1, Dtk_bool inBack_face_culling=true)
int reserve_triangle_strip(Dtk_Size_t nb)
This is a mathematical point class.
Definition: dtk_pnt.hpp:20
type_detk
Definition: define.h:21
void set_center(Dtk_pnt inCenter)
Used to set the circle/cylinder center.
Dtk_Size_t ofsVTX
Definition: util_mesh_dtk.hpp:709
Dtk_ErrorStatus Transform(const Dtk_transfo &)
int pop_indice()
Pop the last indice from the indices array.
void mergemove(Dtk_tab< Dtk_MeshPtr > &inArraymesh)
Dtk_SmartPtr< Dtk_mesh_face > Dtk_mesh_facePtr
Definition: util_mesh_dtk.hpp:26
int get_type()
Return the curve type.
Dtk_Size_t get_nbtriangles() const
Get the number of simple triangles kept in the class instance.
Dtk_Float32 GetUTexture(Dtk_Size_t inPos) const
Dtk_Float32 GetUBrep(Dtk_Size_t inPos) const
Dtk_dir get_face_normal() const
Some interfaces need to keep a normal for a specific type of face. Use this to retrieve a global face...
~Dtk_mesh_circle_data()
Default destructor.
int makestrips()
Assemble all simple triangle, try to make triange-strips.
static Dtk_MeshPtr Create(const Dtk_mesh &in)
Calls copy constructor to allocate a new object.
Dtk_mesh_circle_data * get_mesh_circle_data()
static Dtk_mesh_face * DtkDynamicCast(Dtk_Object *s)
Performs a dynamic cast - doesn't need RTTI -.
void reduce()
Reduce memory cost of the Dtk_mesh, to call after adding all geometry.
Dtk_Size_t get_nb_facets()
Return total number of facets.
virtual Dtk_Size_t GetSize() const
void set_mesh_circle_data(Dtk_mesh_circle_data *inCircle)
Set a mesh_circle_data object to the face, in order to add circular datas (for circles)
This is a high level array class.
Definition: util_stl_dtk.hpp:84
DTK_MESH_CRV_TYPE
Definition: util_mesh_dtk.hpp:46
void set_id(int inId)
Set an id to the mesh.
void C_GetNormal(Dtk_Size_t i, Dtk_dir &out) const
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:503
Dtk_Size_t GetSize() const
Dtk_Size_t get_nbpolygons() const
Get the number of polygons kept in the class instance.
@ DTK_TRIANGLE_STRIP
Definition: util_mesh_dtk.hpp:44
void add_indice(int inIndice)
Add an indexed vertex to the curve (indice to an external vertices array, like the one inside Dtk_mes...
int explode()
Decompose all complex geometry (triangle strips, fan, polygons) into triangles, and append it into th...
Dtk_mesh_vertex_norm_color_uv()
Dtk_mesh_curve()
Default constructor.
void SetTopoID(const int ival)
Dtk_Int32 SetRGB(const Dtk_RGB &)
Dtk_mesh(const Dtk_mesh &inMesh)
Dtk_Size_t get_nb_vertices()
Return the vertices array size.
void C_GetVertex(Dtk_Size_t i, Dtk_pnt &out) const
void merge(Dtk_mesh_face *inMeshface)
Merge a face into the current face.
DTK_MESH_TYPE_FACE
Definition: util_mesh_dtk.hpp:1068
Dtk_mesh_face(Dtk_mesh_face &&) DTK_NOEXCEPT
@ DTK_MESH_OTHERCRV
Definition: util_mesh_dtk.hpp:46
Dtk_Size_t GetSize() const
virtual int DtkDynamicType(const int &inId)=0
Dtk_tab< Dtk_mesh_face * > const & get_mesh_faces() const
Dtk_Size_t get_nbtriangle_strips() const
Get the number of triangle strips kept in the class instance.
Dtk_Float32 u
Definition: util_mesh_dtk.hpp:1054
void C_SetUVBrep(Dtk_Size_t i, Dtk_Float32 u, Dtk_Float32 v)
@ DTK_TRIANGLE_FAN
Definition: util_mesh_dtk.hpp:44
Definition: dtk_object.hpp:8
int get_vertex(Dtk_Size_t inPos, Dtk_pnt *outVertex)
Return a vertex.
void set_thickness(float inThickness)
Set thickness in Dtk_mesh_curve.
Dtk_RGB color
Definition: util_mesh_dtk.hpp:1042
void set_face_name(const Dtk_string &inName)
Set a name for the face.
void set_axis(Dtk_dir inAxis)
Used to set the circle/cylinder axis.
T & at(Dtk_Size_t k)
Definition: util_stl_dtk.hpp:397
void C_SetNormal(Dtk_Size_t i, const Dtk_dir &out)
void push_back(const T &x)
Inserts an element at the end of the array.
Definition: util_stl_dtk.hpp:416
Dtk_InfoPtr & info()
acces to class info of mesh_face
Dtk_Float32 C_GetVBrep(Dtk_Size_t i) const
Dtk_Int32 SetV(Dtk_Float32)
Dtk_mesh & operator=(Dtk_mesh &&inMesh) DTK_NOEXCEPT
Dtk_mesh_face(const Dtk_mesh_face &)
Dtk_Float32 v
Definition: util_mesh_dtk.hpp:1054
~Dtk_mesh_curve()
Default destructor.
virtual Dtk_pnt GetVertex() const
void clear(int no_delete=0)
Resets the Dtk_tab content.
Definition: util_stl_dtk.hpp:352
void reverse_triangle(Dtk_Size_t inI)
Reverse the i-th triangle of the set of triangle, so that the normal will be inversed.
Dtk_tab< Dtk_mesh_face * > & get_mesh_face_array()
Get a reference to the mesh face array // DEPRECATED, UNSAFE.
Definition: dtk_rgb.hpp:8
int set_color(Dtk_Size_t inPos, const Dtk_RGB *inColor)
Set a color to a point (if vertex format includes color)
Dtk_mesh_vertex_norm(const Dtk_pnt *inVertex, const Dtk_dir *inNorm)
const Dtk_tab< Dtk_UInt32 > * get_triangle_strip_indices(Dtk_Size_t inI) const
Get inI-th triangle strip.
@ DTK_TRIANGLES
Definition: util_mesh_dtk.hpp:44
This is the Polyline in Mesh mode.
Definition: util_mesh_dtk.hpp:1747
void set_crv_type(DTK_MESH_CRV_TYPE type)
Set the curve nature.
void set_face_color(const Dtk_RGB &inColor)
Set a color to the face. Sometimes, one needs to set a color to a face, not the vertices.
Dtk_Float32 C_GetV(Dtk_Size_t i) const
int add_mesh_face(Dtk_mesh_face *inMesh_face)
Add a face (Dtk_mesh_face) to the mesh.
This is a mathematical direction class.
Definition: dtk_dir.hpp:14
@ DTK_POLYGONS
Definition: util_mesh_dtk.hpp:44
int pop_vertex(Dtk_pnt *)
Pop the last vertex from the vertices array.
int add_polyline(const Dtk_tab< Dtk_UInt32 > *inIndices)
Add one polyline.
unsigned long get_id()
Return the ID of the curve.
Dtk_tab< Dtk_UChar8 > cvertices
Definition: util_mesh_dtk.hpp:708
Dtk_mesh_circle_data()
Default constructor.
int add_points(const Dtk_tab< Dtk_UInt32 > *pnts)
Dtk_SmartPtr< Dtk_material > Dtk_MaterialPtr
Definition: util_mesh_dtk.hpp:23
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)
Dtk_RGB get_color()
Return the curve color.
int add_triangles(Dtk_tab< Dtk_UInt32 > *inIndices)
Add one of multiple triangles.
Dtk_pnt get_vertex(Dtk_Size_t inPos)
Return a vertex (2nd form of get_vertex)
Dtk_MaterialPtr get_material()
Get the material of the mesh.
Dtk_bool has_texcoords()
Return true if the current vertex format includes texture coords (UVTEXTURES)
DTK_MESH_CRV_TYPE get_crv_type()
Return the curve nature.
#define DTK_NOEXCEPT
Definition: config.hpp:20
Dtk_mesh * transform2Cpy(Dtk_transfo *inMatrix)
Make a copy of the current mesh, applying a transformation on it.
Dtk_Object & operator=(const Dtk_Object &s)
Dtk_Float32 C_GetUBrep(Dtk_Size_t i) const
Definition: util_mesh_dtk.hpp:1040
void C_SetUV(Dtk_Size_t i, Dtk_Float32 u, Dtk_Float32 v)
Definition: util_ent_dtk.hpp:367
Dtk_StreamPtr GetStream() const
Dtk_Size_t get_nb_indices()
Return the indices array size.
Dtk_mesh_vertex_norm_color_uv(const Dtk_pnt *inVertex, const Dtk_dir *inNorm, const Dtk_RGB *inRGB, Dtk_Float32 inU, Dtk_Float32 inV)