Commit Graph

3645 Commits

Author SHA1 Message Date
ganovelli f90bd789a3 added class AllTypes to implement type trait in trimesh/base.h
AllTypes is a class defining, as inner classes, global default names
for vertex,edge and face
2010-03-19 17:02:36 +00:00
ganovelli 5ce2c677f5 added include to trimesh/base.h 2010-03-19 17:00:45 +00:00
Paolo Cignoni a201459a30 removed harmless warnings 2010-03-18 14:20:53 +00:00
Paolo Cignoni 3b770c935a added updateQuality Vertex Clamp 2010-03-18 14:20:29 +00:00
ganovelli 3256d9517c updated to the new definition of mesh type [with UsedTypes] 2010-03-18 13:25:20 +00:00
Paolo Cignoni 51534c9ce9 converted to the new UsedTypes syntax 2010-03-18 11:26:44 +00:00
Paolo Cignoni cf872a327c Doh! Forgot a const in the getbbox of Face Base 2010-03-18 10:28:10 +00:00
Paolo Cignoni 4ee60382b0 put qt debug code inside guards 2010-03-18 10:20:08 +00:00
Paolo Cignoni e4b0019e90 removed harmless warnings 2010-03-18 10:08:12 +00:00
Paolo Cignoni 3976724c18 removed harmless warnings and improved Cone generator 2010-03-18 10:07:39 +00:00
Paolo Cignoni fba6bd5917 removed harmless warnings/English Comments 2010-03-18 10:04:55 +00:00
Paolo Cignoni 9aa23c4f6c removed harmless warnings 2010-03-18 10:03:31 +00:00
Paolo Cignoni 335afeee7e Disambiguated the origin of the ScalarType and CoordType in the simplex class. Now it derives from the type specified by the vertexRef component for the faces and from the Coord component for the vertexes. To be sure the ScalarType and CoordTypes are initialized to weird point3<bool> and char just to detect easisly when the wrong types shallow... 2010-03-18 10:03:00 +00:00
Paolo Cignoni 63e21f15cb Disambiguated the origin of the ScalarType and CoordType in the simplex class. Now it derives from the type specified by the vertexRef component for the faces and from the Coord component for the vertexes. To be sure the ScalarType and CoordTypes are initialized to weird point3<bool> and char just to detect easisly when the wrong types shallow... 2010-03-18 10:02:32 +00:00
Paolo Cignoni 2a1aebfa3d converted to the new UsedTypes syntax 2010-03-17 09:22:23 +00:00
Paolo Cignoni eca7114e6c corrected a small error inserted by mistake in the last commit... 2010-03-16 14:46:55 +00:00
Paolo Cignoni 80f825a428 removed harmless warnings 2010-03-16 14:25:30 +00:00
Paolo Cignoni bf69d1c24a removed harmless warnings 2010-03-16 14:22:08 +00:00
Paolo Cignoni 404831fc2f added a missing 'template' keyword between class and metod name. 2010-03-16 11:06:32 +00:00
ganovelli 09b0fb5ef7 added a way to define a scope, i.e. a collection of bounds between name of the attributes
and their type, so  that one can add an attribute without knowing its type. It is useful
when working with plugin.
example:
vcg::tri::NameTypeScope myScope;


AddNameTypeBound<int>(myScope,std::string("number");
AddNameTypeBound<float>(myScope,std::string("incoming_light"));

we have crated a scope myScope where "number" is bound a int and incoming_light is a float

In another part of code where I may not know the type of "number", I can still do:

AddPerVertexAttribute(myScope, mesh, "number");

and an int attibute name "number" will be added.
2010-03-15 15:17:20 +00:00
ganovelli 2e739825c8 [ Changes in definition of TriMesh: PART I ]
Note for the developers: the change to make to existing projects is very little
but strictly necessary to compile. This change IS NOT backward compliant.


==== OLD ==== way to define a TriMesh:

// forward declarations
class MyVertex;
class MyEdge;
class MyFace;

class MyVertex: public VertexSimp2 < MyVertex, MyEdge, MyFace, vertex::Coord3f,...other components>{};
class MyFace: public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};


==== NEW ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;

// declaration of which types is used as VertexType, which type is used as FaceType and so on...
class MyUsedTypes: public vcg::UsedType < vcg::Use<MyVertex>::AsVertexType,
                                         vcg::Use<MyFace>::AsFaceType>{};

class MyVertex: public Vertex < MyUsedTypes, vertex::Coord3f,...other components>{};
class MyFace: public Face < MyUsedTypes, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};

                               ===== classes introduced         [vcg::UsedType] : it is a class containing all the types that must be passed to the definition of Vertex, Face, Edge... This
class replaces the list of classes to pass as first templates and the need to specify the maximal simplicial. So

< MyVertex, MyEdge, MyFace,  beocmes  MyUsedTypes,
and
VertexSimp2 becomes Vertex

[vcg::Use] : an auxiliary class to give a simple way to specify the role of a type

Note 2: the order of templates parameters to vcg::UsedTypes is unimportant, e.g:

class MyUsedTypes: public vcg::UsedType <vcg::Use<MyVertex>::AsVertexType,
                                        vcg::Use<MyEdge>::AsEdgeType,
                                        vcg::Use<MyFace>::AsFaceType>{};

is the same as:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyFace>::AsFaceType,
                                        vcg::Use<MyEdge>::AsEdgeType,
                                        vcg::Use<MyVertex>::AsVertexType>{};

==== the Part II will be a tiny change to the class TriMesh it self.
2010-03-15 13:10:43 +00:00
ganovelli ae83ca17ed [ Changes in definition of TriMesh: PART I ]
Note for the developers: the change to make to existing projects is very little 
but strictly necessary to compile. This change IS NOT backward compliant.


==== OLD ==== way to define a TriMesh:

// forward declarations
class MyVertex;
class MyEdge;
class MyFace;

class MyVertex: public VertexSimp2 < MyVertex, MyEdge, MyFace, vertex::Coord3f,...other components>{};
class MyFace: public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};


==== NEW ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;

// declaration of which types is used as VertexType, which type is used as FaceType and so on...
class MyUsedTypes: public vcg::UsedType < vcg::Use<MyVertex>::AsVertexType,
                                          vcg::Use<MyFace>::AsFaceType>{};

class MyVertex: public Vertex < MyUsedTypes, vertex::Coord3f,...other components>{};
class MyFace: public Face < MyUsedTypes, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};

                                 
===== classes introduced          
[vcg::UsedType] : it is a class containing all the types that must be passed to the definition of Vertex, Face, Edge... This
class replaces the list of typenames to pass as first templates and the need to specify the maximal simplicial. So 

<MyVertex, MyEdge, MyFace  becomes <MyUsedTypes<

and 

VertexSimp2 becomes Vertex

[vcg::Use] : an auxiliary class to give a simple way to specify the role of a type

Note 2: the order of templates parameters to vcg::UsedTypes is unimportant, e.g:

class MyUsedTypes: public vcg::UsedType <vcg::Use<MyVertex>::AsVertexType,
                                         vcg::Use<MyEdge>::AsEdgeType,
                                         vcg::Use<MyFace>::AsFaceType>{};

is the same as:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyFace>::AsFaceType,
                                         vcg::Use<MyEdge>::AsEdgeType,
                                         vcg::Use<MyVertex>::AsVertexType>{};

Note 3: you only need to specify the type  you use. If you do not have edges you do not need 
to include vcg::Use<MyEdge>::AsEdgeType in the template list of UsedTypes.
==== the Part II will be a tiny change to the class TriMesh it self.
2010-03-15 10:44:40 +00:00
ganovelli 01bb1ff921 [ Changes in definition of TriMesh: PART I ]
Note for the developers: the change to make to existing projects is very little 
but strictly necessary to compile. This change IS NOT backward compliant.


==== OLD ==== way to define a TriMesh:

// forward declarations
class MyVertex;
class MyEdge;
class MyFace;

class MyVertex: public VertexSimp2 < MyVertex, MyEdge, MyFace, vertex::Coord3f,...other components>{};
class MyFace: public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};


==== NEW ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;

// declaration of which types is used as VertexType, which type is used as FaceType and so on...
class MyUsedTypes: public vcg::UsedType < vcg::Use<MyVertex>::AsVertexType,
                                          vcg::Use<MyFace>::AsFaceType>{};

class MyVertex: public Vertex < MyUsedTypes, vertex::Coord3f,...other components>{};
class MyFace: public Face < MyUsedTypes, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};

                                 
===== classes introduced          
[vcg::UsedType] : it is a class containing all the types that must be passed to the definition of Vertex, Face, Edge... This
class replaces the list of typenames to pass as first templates and the need to specify the maximal simplicial. So 

<MyVertex, MyEdge, MyFace  becomes <MyUsedTypes<

and 

VertexSimp2 becomes Vertex

[vcg::Use] : an auxiliary class to give a simple way to specify the role of a type

Note 2: the order of templates parameters to vcg::UsedTypes is unimportant, e.g:

class MyUsedTypes: public vcg::UsedType <vcg::Use<MyVertex>::AsVertexType,
                                         vcg::Use<MyEdge>::AsEdgeType,
                                         vcg::Use<MyFace>::AsFaceType>{};

is the same as:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyFace>::AsFaceType,
                                         vcg::Use<MyEdge>::AsEdgeType,
                                         vcg::Use<MyVertex>::AsVertexType>{};

Note 3: you only need to specify the type  you use. If you do not have edges you do not need 
to include vcg::Use<MyEdge>::AsEdgeType in the template list of UsedTypes.
==== the Part II will be a tiny change to the class TriMesh it self.
2010-03-15 10:43:27 +00:00
ganovelli c40a6c3d97 [ Changes in definition of TriMesh: PART I ]
Note for the developers: the change to make to existing projects is very little 
but strictly necessary to compile. This change IS NOT backward compliant.


==== OLD ==== way to define a TriMesh:

// forward declarations
class MyVertex;
class MyEdge;
class MyFace;

class MyVertex: public VertexSimp2 < MyVertex, MyEdge, MyFace, vertex::Coord3f,...other components>{};
class MyFace: public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};


==== NEW ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;

// declaration of which types is used as VertexType, which type is used as FaceType and so on...
class MyUsedTypes: public vcg::UsedType < vcg::Use<MyVertex>::AsVertexType,
                                          vcg::Use<MyFace>::AsFaceType>{};

class MyVertex: public Vertex < MyUsedTypes, vertex::Coord3f,...other components>{};
class MyFace: public Face < MyUsedTypes, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};

                                 
===== classes introduced          
[vcg::UsedType] : it is a class containing all the types that must be passed to the definition of Vertex, Face, Edge... This
class replaces the list of typenames to pass as first templates and the need to specify the maximal simplicial. So 

<MyVertex, MyEdge, MyFace  becomes <MyUsedTypes<

and 

VertexSimp2 becomes Vertex

[vcg::Use] : an auxiliary class to give a simple way to specify the role of a type

Note 2: the order of templates parameters to vcg::UsedTypes is unimportant, e.g:

class MyUsedTypes: public vcg::UsedType <vcg::Use<MyVertex>::AsVertexType,
                                         vcg::Use<MyEdge>::AsEdgeType,
                                         vcg::Use<MyFace>::AsFaceType>{};

is the same as:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyFace>::AsFaceType,
                                         vcg::Use<MyEdge>::AsEdgeType,
                                         vcg::Use<MyVertex>::AsVertexType>{};

Note 3: you only need to specify the type  you use. If you do not have edges you do not need 
to include vcg::Use<MyEdge>::AsEdgeType in the template list of UsedTypes.
==== the Part II will be a tiny change to the class TriMesh it self.
2010-03-15 10:42:52 +00:00
ganovelli cdfed059d3 [ Changes in definition of TriMesh: PART I ]
Note for the developers: the change to make to existing projects is very little 
but strictly necessary to compile. This change IS NOT backward compliant.


==== OLD ==== way to define a TriMesh:

// forward declarations
class MyVertex;
class MyEdge;
class MyFace;

class MyVertex: public VertexSimp2 < MyVertex, MyEdge, MyFace, vertex::Coord3f,...other components>{};
class MyFace: public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};


==== NEW ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;

// declaration of which types is used as VertexType, which type is used as FaceType and so on...
class MyUsedTypes: public vcg::UsedType < vcg::Use<MyVertex>::AsVertexType,
                                          vcg::Use<MyFace>::AsFaceType>{};

class MyVertex: public Vertex < MyUsedTypes, vertex::Coord3f,...other components>{};
class MyFace: public Face < MyUsedTypes, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};

                                 
===== classes introduced          
[vcg::UsedType] : it is a class containing all the types that must be passed to the definition of Vertex, Face, Edge... This
class replaces the list of typenames to pass as first templates and the need to specify the maximal simplicial. So 

<MyVertex, MyEdge, MyFace  becomes <MyUsedTypes<

and 

VertexSimp2 becomes Vertex

[vcg::Use] : an auxiliary class to give a simple way to specify the role of a type

Note 2: the order of templates parameters to vcg::UsedTypes is unimportant, e.g:

class MyUsedTypes: public vcg::UsedType <vcg::Use<MyVertex>::AsVertexType,
                                         vcg::Use<MyEdge>::AsEdgeType,
                                         vcg::Use<MyFace>::AsFaceType>{};

is the same as:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyFace>::AsFaceType,
                                         vcg::Use<MyEdge>::AsEdgeType,
                                         vcg::Use<MyVertex>::AsVertexType>{};

Note 3: you only need to specify the type  you use. If you do not have edges you do not need 
to include vcg::Use<MyEdge>::AsEdgeType in the template list of UsedTypes.
==== the Part II will be a tiny change to the class TriMesh it self.
2010-03-15 10:42:03 +00:00
mtarini 54ca153009 mini-changes at various importer exporters, to maximize compatibility 2010-03-13 00:52:17 +00:00
ganovelli 9768533095 (involuntary commit reverted) 2010-03-12 14:58:02 +00:00
Paolo Cignoni 2a18ebd5f5 Heavily restructured component of vertex simplex. Compacted all the emptyXXXX into a single EmptyCore class. Cleaned up the interface for the optional stuff now there is a standard static function that can say if a given component is enabled or not. 2010-03-04 13:34:38 +00:00
Paolo Cignoni 5e1f0ce521 Heavily restructured component of vertex simplex. Compacted all the emptyXXXX into a single EmptyCore class. Cleaned up the interface for the optional stuff now there is a standard static function that can say if a given component is enabled or not. 2010-03-03 16:01:39 +00:00
Paolo Cignoni 56bde62d80 removed old 'uber' access to component members 2010-03-03 15:57:58 +00:00
Paolo Cignoni 5ef6d30d37 Added a test to check in the point to face distance computation to manage the case of degenerated faces. Now correctly resort to distance point to segment. 2010-03-03 00:35:20 +00:00
Paolo Cignoni d340b8b92a removed harmless gcc warnings 2010-03-02 23:17:15 +00:00
Paolo Cignoni c2456526fd added vertex picking 2010-02-26 16:20:15 +00:00
Paolo Cignoni 96d770c828 corrected bug in the exporting of the texture file name (removed extra space) (thnx to anonymous bug submitter) 2010-02-26 16:14:20 +00:00
Paolo Cignoni 355edd042e removed harmless warnings 2010-02-24 09:56:58 +00:00
Paolo Cignoni 9f8497013f removed harmless warnings 2010-02-24 09:55:28 +00:00
Paolo Cignoni bb75099c5d corrected a wrong bbox type (mismatched between a fixed box3f and the mesh bbox type) 2010-02-23 16:50:47 +00:00
Paolo Cignoni 319a87d5c0 Changed all the m.HasPerVertexXXX into the more safe HasPerVertexXXX(m) (it caused a bug in the saving of per-vertex tex coords) 2010-02-23 16:48:02 +00:00
Paolo Cignoni fc6483307b added a missing cVFi() 2010-02-23 16:45:45 +00:00
Paolo Cignoni 866abb0921 improved the support of per vertex texture data. Now it is correctly handled in OFF and PLY 2010-02-23 01:51:25 +00:00
Paolo Cignoni 18c92582d4 Cleaned up the CompactFaceVector and the CompactVertexVector, Now they correctly manage existing FV and FF topology by preserving them (if they are initialized to something meaningful). 2010-02-22 17:37:51 +00:00
Nico Pietroni 98eba3ef33 corrected minor compiling issues 2010-02-22 01:03:23 +00:00
Paolo Cignoni de93d3d941 Yet another bunch of missing typenames; corrected a signature mismatch between LoadMask and GetHeader 2010-02-20 00:59:40 +00:00
ganovelli 9057e1dcd6 added bbox in the header, added missing typenames 2010-02-19 17:34:38 +00:00
Paolo Cignoni 446400f6fc Now the compactvertex and compactface funtions use the importlocal chain so we are sure that all the meaningful data is correctly copied (otherwise ocf stuff will not be copied) On the other hand when using ImportLocal we do not copy pointer based stuff like adjacency and *vertex pointers* that must be terefore copied by hand... 2010-02-19 00:21:26 +00:00
Paolo Cignoni 87599e519f added a minimal support for failing and reporting errors 2010-02-18 23:33:56 +00:00
ganovelli 898fedcfdf ongoing 2010-02-14 10:23:28 +00:00
Paolo Cignoni 95e1b391c8 min in std limits is a function 2010-02-11 20:07:27 +00:00
Paolo Cignoni 41fda194bd Correctly defined int inside loop as per MSVC requirements, changed assert as to be more accurate 2010-02-11 20:06:14 +00:00
Paolo Cignoni 3b152298cc added runtime assert to prevent dangerous simplex to simplex assignment in the case of OCF optional attributes. 2010-02-11 00:14:35 +00:00