[SIMPLEXplus promotion]
This modification removes the old way to define simplexes (already deprecated and unsupported). In the following SIMPLEX = [vertex|edge|face|tetrahedron] All the stuff that was in vcg/simplex/SIMPLEXplus/ has now been promoted to vcg/simplex/ Details: - the folder vcg/simplex/SIMPLEX/with has been removed - the file vcg/simplex/SIMPLEX/base.h has been renamed into vcg/simplex/SIMPLEX/base_old.h - the content of vcg/simplex/SIMPLEXplus/ has been moved into vcg/simplex/SIMPLEX/ - the folder vcg/simplex/SIMPLEXplus/ has been removed Actions the update the code using vcglib: replace <vcg/simplex/SIMPLEXplus/*> with <vcg/simplex/SIMPLEX/*> in every include for MESHLAB users: already done along with this commit
This commit is contained in:
parent
f9a1578c8d
commit
4f8ed978a7
|
@ -1,360 +0,0 @@
|
|||
/****************************************************************************
|
||||
* VCGLib o o *
|
||||
* Visual and Computer Graphics Library o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2004 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
/****************************************************************************
|
||||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.13 2008/02/03 23:49:42 cignoni
|
||||
Important Change. Now GetBBox return a null bbox if called on a deleted face (instead of crashing)
|
||||
|
||||
Revision 1.12 2007/05/04 16:40:11 ganovelli
|
||||
changes to comply "plus" types
|
||||
|
||||
Revision 1.11 2007/03/27 09:22:11 cignoni
|
||||
Added Visited flags
|
||||
|
||||
Revision 1.10 2007/03/12 15:37:19 tarini
|
||||
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
|
||||
|
||||
Revision 1.9 2007/02/12 19:01:23 ganovelli
|
||||
added Name(std:vector<std::string>& n) that fills n with the names of the attribute of the face type
|
||||
|
||||
Revision 1.8 2006/10/09 20:20:18 cignoni
|
||||
Increased the maximum number of possible template args from 8 to 9
|
||||
|
||||
Revision 1.7 2006/02/27 17:58:11 ponchio
|
||||
Added some documentation
|
||||
|
||||
Revision 1.6 2005/12/16 13:28:09 cignoni
|
||||
Increased the maximum number of possible template args from 7 to 8
|
||||
|
||||
Revision 1.5 2005/12/02 00:41:38 cignoni
|
||||
Added and removed typenames for gcc compiling.
|
||||
Added this-> qualifier for referencing the elemntes of the templated base class
|
||||
(e.g. to refer the possibly overridden flags()) it seems to be needed by the standard
|
||||
|
||||
Revision 1.4 2005/11/16 22:56:32 cignoni
|
||||
Added EmptyMark to base class
|
||||
Standardized name of flags. It is plural becouse each simplex has many flag.
|
||||
|
||||
Revision 1.3 2005/11/12 18:42:18 cignoni
|
||||
Added ClearS and GetBBox
|
||||
|
||||
Revision 1.2 2005/10/14 13:26:57 cignoni
|
||||
First Really Working version
|
||||
|
||||
Revision 1.2 2004/04/03 13:33:55 cignoni
|
||||
Missing include
|
||||
|
||||
Revision 1.1 2004/03/29 08:36:26 cignoni
|
||||
First working version!
|
||||
|
||||
|
||||
****************************************************************************/
|
||||
#ifndef __VCG_FACE_PLUS
|
||||
#define __VCG_FACE_PLUS
|
||||
|
||||
#include <vcg/space/point3.h>
|
||||
#include <vcg/space/texcoord2.h>
|
||||
#include <vcg/space/color4.h>
|
||||
#include <vcg/simplex/faceplus/component.h>
|
||||
#include <vcg/simplex/faceplus/component_polygon.h>
|
||||
#include <vcg/container/derivation_chain.h>
|
||||
|
||||
namespace vcg {
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/*
|
||||
The base class of all the recusive definition chain. It is just a container of the typenames of the various simplexes.
|
||||
These typenames must be known form all the derived classes.
|
||||
*/
|
||||
|
||||
template <class BVT, class BET, class BFT, class BTT>
|
||||
class FaceTypeHolder{
|
||||
public:
|
||||
typedef BVT VertexType;
|
||||
typedef typename VertexType::CoordType CoordType;
|
||||
typedef typename VertexType::ScalarType ScalarType;
|
||||
typedef BET EdgeType;
|
||||
typedef BFT FaceType;
|
||||
typedef BTT TetraType;
|
||||
typedef BVT *VertPointer;
|
||||
typedef BET *EdgePointer;
|
||||
typedef BFT *FacePointer;
|
||||
typedef BTT *TetraPointer;
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & l){}
|
||||
static void Name(std::vector<std::string> & name){}
|
||||
|
||||
|
||||
// prot
|
||||
const int VN() const { return 3;}
|
||||
inline const int Prev(const int & i) const { return (i+(3-1))%3;}
|
||||
inline const int Next(const int & i) const { return (i+1)%3;}
|
||||
inline void Alloc(const int & ){}
|
||||
inline void Dealloc(){}
|
||||
};
|
||||
|
||||
/* The base class form which we start to add our components.
|
||||
it has the empty definition for all the standard members (coords, color flags)
|
||||
Note:
|
||||
in order to avoid both virtual classes and ambiguous definitions all
|
||||
the subsequent overrides must be done in a sequence of derivation.
|
||||
|
||||
In other words we cannot derive and add in a single derivation step
|
||||
(with multiple ancestor), both the real (non-empty) normal and color but
|
||||
we have to build the type a step a time (deriving from a single ancestor at a time).
|
||||
|
||||
|
||||
*/
|
||||
template <class BVT, class BET=DumClass, class BFT=DumClass, class BTT=DumClass>
|
||||
class FaceBase: public face::EmptyPolyInfo<
|
||||
face::EmptyVertexRef<
|
||||
face::EmptyAdj<
|
||||
face::EmptyColorMarkQuality<
|
||||
face::EmptyNormal<
|
||||
face::EmptyBitFlags<
|
||||
face::EmptyWedgeTexCoord<
|
||||
FaceTypeHolder <BVT, BET, BFT, BTT> > > > > > > > {
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* The Real Big Face class;
|
||||
|
||||
The class __FaceArityMax__ is the one that is the Last to be derived,
|
||||
and therefore is the only one to know the real members
|
||||
(after the many overrides) so all the functions with common behaviour
|
||||
using the members defined in the various Empty/nonEmpty component classes
|
||||
MUST be defined here.
|
||||
|
||||
I.e. IsD() that uses the overridden Flags() member must be defined here.
|
||||
|
||||
*/
|
||||
|
||||
template <class BVT, class BET, typename BFT,class BTT,
|
||||
template <typename> class A, template <typename> class B,
|
||||
template <typename> class C, template <typename> class D,
|
||||
template <typename> class E, template <typename> class F,
|
||||
template <typename> class G, template <typename> class H,
|
||||
template <typename> class I, template <typename> class J >
|
||||
class FaceArityMax: public I<Arity9<FaceBase,BVT,BET,BFT,BTT, A, B, C, D, E, F, G, H, J> > {
|
||||
|
||||
// ----- Flags stuff -----
|
||||
public:
|
||||
|
||||
inline int & UberFlags ()
|
||||
{
|
||||
return this->Flags();
|
||||
}
|
||||
inline const int UberFlags() const
|
||||
{
|
||||
return this->Flags();
|
||||
}
|
||||
enum {
|
||||
|
||||
DELETED = 0x00000001, // Face is deleted from the mesh
|
||||
NOTREAD = 0x00000002, // Face of the mesh is not readable
|
||||
NOTWRITE = 0x00000004, // Face of the mesh is not writable
|
||||
VISITED = 0x00000010, // Face has been visited. Usualy this is a per-algorithm used bit.
|
||||
SELECTED = 0x00000020, // Face is selected. Algorithms should try to work only on selected face (if explicitly requested)
|
||||
// Border _flags, it is assumed that BORDERi = BORDER0<<i
|
||||
BORDER0 = 0x00000040,
|
||||
BORDER1 = 0x00000080,
|
||||
BORDER2 = 0x00000100,
|
||||
// Face Orientation Flags, used efficiently compute point face distance
|
||||
NORMX = 0x00000200,
|
||||
NORMY = 0x00000400,
|
||||
NORMZ = 0x00000800,
|
||||
// Crease _flags, it is assumed that FEATUREi = FEATURE0<<i
|
||||
FEATURE0 = 0x00008000,
|
||||
FEATURE1 = 0x00010000,
|
||||
FEATURE2 = 0x00020000,
|
||||
// First user bit
|
||||
USER0 = 0x00040000
|
||||
};
|
||||
|
||||
|
||||
/// checks if the Face is deleted
|
||||
bool IsD() const {return (this->Flags() & DELETED) != 0;}
|
||||
/// checks if the Face is readable
|
||||
bool IsR() const {return (this->Flags() & NOTREAD) == 0;}
|
||||
/// checks if the Face is modifiable
|
||||
bool IsW() const {return (this->Flags() & NOTWRITE)== 0;}
|
||||
/// This funcion checks whether the Face is both readable and modifiable
|
||||
bool IsRW() const {return (this->Flags() & (NOTREAD | NOTWRITE)) == 0;}
|
||||
/// checks if the Face is Modified
|
||||
bool IsS() const {return (this->Flags() & SELECTED) != 0;}
|
||||
/// checks if the Face is Modified
|
||||
bool IsV() const {return (this->Flags() & VISITED) != 0;}
|
||||
|
||||
/** Set the flag value
|
||||
@param flagp Valore da inserire nel flag
|
||||
*/
|
||||
void SetFlags(int flagp) {this->Flags()=flagp;}
|
||||
|
||||
/** Set the flag value
|
||||
@param flagp Valore da inserire nel flag
|
||||
*/
|
||||
void ClearFlags() {this->Flags()=0;}
|
||||
|
||||
/// deletes the Face from the mesh
|
||||
void SetD() {this->Flags() |=DELETED;}
|
||||
/// un-delete a Face
|
||||
void ClearD() {this->Flags() &=(~DELETED);}
|
||||
/// marks the Face as readable
|
||||
void SetR() {this->Flags() &=(~NOTREAD);}
|
||||
/// marks the Face as not readable
|
||||
void ClearR() {this->Flags() |=NOTREAD;}
|
||||
/// marks the Face as writable
|
||||
void SetW() {this->Flags() &=(~NOTWRITE);}
|
||||
/// marks the Face as notwritable
|
||||
void ClearW() {this->Flags() |=NOTWRITE;}
|
||||
/// select the Face
|
||||
void SetS() {this->Flags() |=SELECTED;}
|
||||
/// Un-select a Face
|
||||
void ClearS() {this->Flags() &= ~SELECTED;}
|
||||
/// select the Face
|
||||
void SetV() {this->Flags() |=VISITED;}
|
||||
/// Un-select a Face
|
||||
void ClearV() {this->Flags() &= ~VISITED;}
|
||||
|
||||
/// This function checks if the face is selected
|
||||
bool IsB(int i) const {return (this->Flags() & (BORDER0<<i)) != 0;}
|
||||
/// This function select the face
|
||||
void SetB(int i) {this->Flags() |=(BORDER0<<i);}
|
||||
/// This funcion execute the inverse operation of SetS()
|
||||
void ClearB(int i) {this->Flags() &= (~(BORDER0<<i));}
|
||||
|
||||
/// This function checks if a given side of the face is a feature/internal edge
|
||||
/// it is used by some importer to mark internal
|
||||
/// edges of polygonal faces that have been triangulated
|
||||
bool IsF(int i) const {return (this->Flags() & (FEATURE0<<i)) != 0;}
|
||||
/// This function select the face
|
||||
void SetF(int i) {this->Flags() |=(FEATURE0<<i);}
|
||||
/// This funcion execute the inverse operation of SetS()
|
||||
void ClearF(int i) {this->Flags() &= (~(FEATURE0<<i));}
|
||||
|
||||
/// Return the first bit that is not still used
|
||||
static int &LastBitFlag()
|
||||
{
|
||||
static int b =USER0;
|
||||
return b;
|
||||
}
|
||||
|
||||
/// allocate a bit among the flags that can be used by user.
|
||||
static inline int NewBitFlag()
|
||||
{
|
||||
LastBitFlag()=LastBitFlag()<<1;
|
||||
return LastBitFlag();
|
||||
}
|
||||
// de-allocate a bit among the flags that can be used by user.
|
||||
static inline bool DeleteBitFlag(int bitval)
|
||||
{
|
||||
if(LastBitFlag()==bitval) {
|
||||
LastBitFlag()= LastBitFlag()>>1;
|
||||
return true;
|
||||
}
|
||||
assert(0);
|
||||
return false;
|
||||
}
|
||||
/// This function checks if the given user bit is true
|
||||
bool IsUserBit(int userBit){return (this->Flags() & userBit) != 0;}
|
||||
/// This function set the given user bit
|
||||
void SetUserBit(int userBit){this->Flags() |=userBit;}
|
||||
/// This function clear the given user bit
|
||||
void ClearUserBit(int userBit){this->Flags() &= (~userBit);}
|
||||
|
||||
template<class BoxType>
|
||||
void GetBBox( BoxType & bb ) const
|
||||
{
|
||||
if(this->IsD())
|
||||
{
|
||||
bb.SetNull();
|
||||
return;
|
||||
}
|
||||
bb.Set(this->P(0));
|
||||
bb.Add(this->P(1));
|
||||
bb.Add(this->P(2));
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
template < typename T=int>
|
||||
class FaceDefaultDeriver : public T {};
|
||||
|
||||
/*
|
||||
|
||||
These are the three main classes that are used by the library user to define its own Facees.
|
||||
The user MUST specify the names of all the type involved in a generic complex.
|
||||
so for example when defining a Face of a trimesh you must know the name of the type of the edge and of the face.
|
||||
Typical usage example:
|
||||
|
||||
A Face with coords, flags and normal for use in a standard trimesh:
|
||||
|
||||
class MyFaceNf : public FaceSimp2< VertProto, EdgeProto, MyFaceNf, face::Flag, face::Normal3f > {};
|
||||
|
||||
|
||||
A Face with coords, and normal for use in a tetrahedral mesh AND in a standard trimesh:
|
||||
|
||||
class TetraFace : public FaceSimp3< VertProto, EdgeProto, TetraFace, TetraProto, face::Coord3d, face::Normal3f > {};
|
||||
|
||||
|
||||
A summary of the components that can be added to a face (see components.h for details):
|
||||
|
||||
VertexRef
|
||||
NormalFromVert, WedgeNormal
|
||||
Normal3s, Normal3f, Normal3d
|
||||
WedgeTexCoord2s, WedgeTexCoord2f, WedgeTexCoord2d
|
||||
BitFlags
|
||||
WedgeColor, Color4b
|
||||
Qualitys, Qualityf, Qualityd
|
||||
Mark //Incremental mark (int)
|
||||
VFAdj //Topology vertex face adjacency
|
||||
(pointers to next face in the ring of the vertex
|
||||
FFAdj //topology: face face adj
|
||||
pointers to adjacent faces
|
||||
|
||||
*/
|
||||
|
||||
template <class BVT, class BET, class BFT, class BTT,
|
||||
template <typename> class A = FaceDefaultDeriver, template <typename> class B = FaceDefaultDeriver,
|
||||
template <typename> class C = FaceDefaultDeriver, template <typename> class D = FaceDefaultDeriver,
|
||||
template <typename> class E = FaceDefaultDeriver, template <typename> class F = FaceDefaultDeriver,
|
||||
template <typename> class G = FaceDefaultDeriver, template <typename> class H = FaceDefaultDeriver,
|
||||
template <typename> class I = FaceDefaultDeriver, template <typename> class J = FaceDefaultDeriver >
|
||||
class FaceSimp3: public FaceArityMax<BVT,BET,BFT,BTT, A, B, C, D, E, F, G, H, I, J> {};
|
||||
class DumTT;
|
||||
template <class BVT, class BET, class BFT,
|
||||
template <typename> class A = FaceDefaultDeriver, template <typename> class B = FaceDefaultDeriver,
|
||||
template <typename> class C = FaceDefaultDeriver, template <typename> class D = FaceDefaultDeriver,
|
||||
template <typename> class E = FaceDefaultDeriver, template <typename> class F = FaceDefaultDeriver,
|
||||
template <typename> class G = FaceDefaultDeriver, template <typename> class H = FaceDefaultDeriver,
|
||||
template <typename> class I = FaceDefaultDeriver, template <typename> class J = FaceDefaultDeriver >
|
||||
class FaceSimp2: public FaceArityMax<BVT,BET,BFT,DumTT, A, B, C, D, E, F, G, H, I, J> {};
|
||||
|
||||
|
||||
}// end namespace
|
||||
#endif
|
||||
|
|
@ -1,596 +0,0 @@
|
|||
/****************************************************************************
|
||||
* VCGLib o o *
|
||||
* Visual and Computer Graphics Library o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2004 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
/****************************************************************************
|
||||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.21 2008/02/04 21:26:45 ganovelli
|
||||
added ImportLocal which imports all local attributes into vertexplus and faceplus.
|
||||
A local attribute is everything (N(), C(), Q()....) except pointers to other simplices
|
||||
(i.e. FFAdj, VFAdj, VertexRef) which are set to NULL.
|
||||
Added some function for const attributes
|
||||
|
||||
Revision 1.20 2008/01/28 08:42:51 cignoni
|
||||
added assert when writing on empty data members
|
||||
|
||||
Revision 1.19 2008/01/19 17:49:05 ganovelli
|
||||
missing const cVF added
|
||||
|
||||
Revision 1.18 2007/11/20 09:43:53 ganovelli
|
||||
added missing include to color4
|
||||
|
||||
Revision 1.17 2007/05/04 16:16:04 ganovelli
|
||||
added include to texcoor2
|
||||
|
||||
Revision 1.16 2007/03/12 15:42:11 tarini
|
||||
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
|
||||
|
||||
Revision 1.15 2007/03/12 15:37:19 tarini
|
||||
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
|
||||
|
||||
Revision 1.14 2007/02/27 09:32:00 cignoni
|
||||
Added constructor to the VFadj component to comply to the allocator needs
|
||||
|
||||
Revision 1.13 2007/02/12 19:01:23 ganovelli
|
||||
added Name(std:vector<std::string>& n) that fills n with the names of the attribute of the face type
|
||||
|
||||
Revision 1.12 2007/01/11 10:22:39 cignoni
|
||||
Added intialization of vertexRef to 0.
|
||||
|
||||
Revision 1.11 2006/12/06 00:08:57 cignoni
|
||||
Added FFp1 and FFp2 shortcuts
|
||||
|
||||
Revision 1.10 2006/12/04 11:00:02 ganovelli
|
||||
Cambiate Has*Opt in Has*Occ e aggiunti typedef per la compilazione di Occ
|
||||
|
||||
Revision 1.9 2006/11/28 22:34:28 cignoni
|
||||
Added default constructor with null initialization to adjacency members.
|
||||
AddFaces and AddVertices NEED to know if the topology is correctly computed to update it.
|
||||
|
||||
Revision 1.8 2006/10/07 09:59:42 cignoni
|
||||
Added missing const to EmptyFF
|
||||
|
||||
Revision 1.7 2006/01/09 13:58:55 cignoni
|
||||
Added Initialization of Color in Vertex and Face Components
|
||||
|
||||
Revision 1.6 2005/11/22 15:49:39 cignoni
|
||||
removed two spurious computenormal
|
||||
|
||||
Revision 1.5 2005/11/21 21:44:47 cignoni
|
||||
Moved ComputeNormal and ComputeNormalizedNormal out of the face class (no more a member function!)
|
||||
|
||||
Revision 1.4 2005/11/18 15:44:49 cignoni
|
||||
Access to constant normal changed from by val to by reference
|
||||
|
||||
Revision 1.3 2005/11/16 22:58:17 cignoni
|
||||
Added IncrementalMark and WedgeTexCoord
|
||||
Standardized name of flags. It is plural becouse each simplex has many flag.
|
||||
|
||||
Revision 1.2 2005/11/12 18:43:14 cignoni
|
||||
added missing cFFi
|
||||
|
||||
Revision 1.1 2005/10/14 15:07:58 cignoni
|
||||
First Really Working version
|
||||
|
||||
|
||||
****************************************************************************/
|
||||
#ifndef __VCG_FACE_PLUS_COMPONENT
|
||||
#define __VCG_FACE_PLUS_COMPONENT
|
||||
|
||||
#include <vector>
|
||||
#include <vcg/space/triangle3.h>
|
||||
#include <vcg/space/texcoord2.h>
|
||||
#include <vcg/space/color4.h>
|
||||
|
||||
namespace vcg {
|
||||
namespace face {
|
||||
/*
|
||||
Some naming Rules
|
||||
All the Components that can be added to a vertex should be defined in the namespace vert:
|
||||
|
||||
*/
|
||||
|
||||
/*-------------------------- VERTEX ----------------------------------------*/
|
||||
template <class T> class EmptyVertexRef: public T {
|
||||
public:
|
||||
// typedef typename T::VertexType VertexType;
|
||||
// typedef typename T::CoordType CoordType;
|
||||
inline typename T::VertexType * & V( const int j ) { assert(0); static typename T::VertexType *vp=0; return vp; }
|
||||
inline typename T::VertexType * const & V( const int j ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
|
||||
inline typename T::VertexType * const cV( const int j ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
|
||||
inline typename T::CoordType & P( const int j ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||
inline const typename T::CoordType & P( const int j ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||
inline const typename T::CoordType &cP( const int j ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF) {T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
static bool HasVertexRef() { return false; }
|
||||
static void Name(std::vector<std::string> & name){T::Name(name);}
|
||||
|
||||
};
|
||||
template <class T> class VertexRef: public T {
|
||||
public:
|
||||
VertexRef(){
|
||||
v[0]=0;
|
||||
v[1]=0;
|
||||
v[2]=0;
|
||||
}
|
||||
|
||||
inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<3); return v[j]; }
|
||||
inline typename T::VertexType * const & V( const int j ) const { assert(j>=0 && j<3); return v[j]; }
|
||||
inline typename T::VertexType * const cV( const int j ) const { assert(j>=0 && j<3); return v[j]; }
|
||||
|
||||
// Shortcut per accedere ai punti delle facce
|
||||
inline typename T::CoordType & P( const int j ) { assert(j>=0 && j<3); return v[j]->P(); }
|
||||
inline const typename T::CoordType & P( const int j ) const { assert(j>=0 && j<3); return v[j]->cP(); }
|
||||
inline const typename T::CoordType &cP( const int j ) const { assert(j>=0 && j<3); return v[j]->cP(); }
|
||||
|
||||
/** Return the pointer to the ((j+1)%3)-th vertex of the face.
|
||||
@param j Index of the face vertex.
|
||||
*/
|
||||
inline typename T::VertexType * & V0( const int j ) { return V(j);}
|
||||
inline typename T::VertexType * & V1( const int j ) { return V((j+1)%3);}
|
||||
inline typename T::VertexType * & V2( const int j ) { return V((j+2)%3);}
|
||||
inline const typename T::VertexType * const & V0( const int j ) const { return V(j);}
|
||||
inline const typename T::VertexType * const & V1( const int j ) const { return V((j+1)%3);}
|
||||
inline const typename T::VertexType * const & V2( const int j ) const { return V((j+2)%3);}
|
||||
inline const typename T::VertexType * const & cV0( const int j ) const { return cV(j);}
|
||||
inline const typename T::VertexType * const & cV1( const int j ) const { return cV((j+1)%3);}
|
||||
inline const typename T::VertexType * const & cV2( const int j ) const { return cV((j+2)%3);}
|
||||
|
||||
/// Shortcut per accedere ai punti delle facce
|
||||
inline typename T::CoordType & P0( const int j ) { return V(j)->P();}
|
||||
inline typename T::CoordType & P1( const int j ) { return V((j+1)%3)->P();}
|
||||
inline typename T::CoordType & P2( const int j ) { return V((j+2)%3)->P();}
|
||||
inline const typename T::CoordType & P0( const int j ) const { return V(j)->P();}
|
||||
inline const typename T::CoordType & P1( const int j ) const { return V((j+1)%3)->P();}
|
||||
inline const typename T::CoordType & P2( const int j ) const { return V((j+2)%3)->P();}
|
||||
inline const typename T::CoordType & cP0( const int j ) const { return cV(j)->P();}
|
||||
inline const typename T::CoordType & cP1( const int j ) const { return cV((j+1)%3)->P();}
|
||||
inline const typename T::CoordType & cP2( const int j ) const { return cV((j+2)%3)->P();}
|
||||
|
||||
inline typename T::VertexType * & UberV( const int j ) { assert(j>=0 && j<3); return v[j]; }
|
||||
inline const typename T::VertexType * const & UberV( const int j ) const { assert(j>=0 && j<3); return v[j]; }
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ V(0) = NULL; V(1) = NULL; V(2) = NULL; T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
|
||||
static bool HasVertexRef() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("VertexRef"));T::Name(name);}
|
||||
|
||||
|
||||
private:
|
||||
typename T::VertexType *v[3];
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*-------------------------- NORMAL ----------------------------------------*/
|
||||
|
||||
template <class T> class EmptyNormal: public T {
|
||||
public:
|
||||
//typedef vcg::Point3s NormalType;
|
||||
typedef typename T::VertexType::NormalType NormalType;
|
||||
NormalType &N() { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; }
|
||||
const NormalType &cN() const { static NormalType dummy_normal(0, 0, 0); return dummy_normal; }
|
||||
NormalType &WN(int) { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; }
|
||||
const NormalType cWN(int) const { static NormalType dummy_normal(0, 0, 0); return dummy_normal; }
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ T::ImportLocal(leftF);}
|
||||
static bool HasWedgeNormal() { return false; }
|
||||
static bool HasFaceNormal() { return false; }
|
||||
static bool HasWedgeNormalOcc() { return false; }
|
||||
static bool HasFaceNormalOcc() { return false; }
|
||||
// void ComputeNormal() {assert(0);}
|
||||
// void ComputeNormalizedNormal() {assert(0);}
|
||||
static void Name(std::vector<std::string> & name){ T::Name(name);}
|
||||
|
||||
};
|
||||
template <class T> class NormalFromVert: public T {
|
||||
public:
|
||||
typedef typename T::VertexType::NormalType NormalType;
|
||||
NormalType &N() { return _norm; }
|
||||
NormalType &cN() const { return _norm; }
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ N() = leftF.cN(); T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
static bool HasFaceNormal() { return true; }
|
||||
// void ComputeNormal() { _norm = vcg::Normal<typename T::FaceType>(*(static_cast<typename T::FaceType *>(this))); }
|
||||
// void ComputeNormalizedNormal() { _norm = vcg::NormalizedNormal(*this);}
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("NormalFromVert"));T::Name(name);}
|
||||
|
||||
private:
|
||||
NormalType _norm;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
void ComputeNormal(T &f) { f.N() = vcg::Normal<T>(f); }
|
||||
|
||||
template <class T>
|
||||
void ComputeNormalizedNormal(T &f) { f.N() = vcg::NormalizedNormal<T>(f); }
|
||||
|
||||
template <class A, class T> class NormalAbs: public T {
|
||||
public:
|
||||
typedef A NormalType;
|
||||
NormalType &N() { return _norm; }
|
||||
NormalType cN() const { return _norm; }
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ N() = leftF.cN(); T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
static bool HasFaceNormal() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("NormalAbs"));T::Name(name);}
|
||||
|
||||
private:
|
||||
NormalType _norm;
|
||||
};
|
||||
|
||||
template <class T> class WedgeNormal: public T {
|
||||
public:
|
||||
typedef typename T::VertexType::NormalType NormalType;
|
||||
NormalType &WN(const int j) { return _wnorm[j]; }
|
||||
const NormalType cWN(const int j) const { return _wnorm[j]; }
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ WN() = leftF.cWN(); T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
static bool HasWedgeNormal() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("WedgeNormal"));T::Name(name);}
|
||||
|
||||
private:
|
||||
NormalType _wnorm[3];
|
||||
};
|
||||
|
||||
|
||||
template <class T> class Normal3s: public NormalAbs<vcg::Point3s, T> {
|
||||
public:static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3s"));T::Name(name);}
|
||||
};
|
||||
template <class T> class Normal3f: public NormalAbs<vcg::Point3f, T> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3f"));T::Name(name);}
|
||||
};
|
||||
template <class T> class Normal3d: public NormalAbs<vcg::Point3d, T> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3d"));T::Name(name);}
|
||||
};
|
||||
|
||||
|
||||
/*-------------------------- TexCoord ----------------------------------------*/
|
||||
|
||||
template <class T> class EmptyWedgeTexCoord: public T {
|
||||
public:
|
||||
typedef int WedgeTexCoordType;
|
||||
typedef vcg::TexCoord2<float,1> TexCoordType;
|
||||
TexCoordType &WT(const int) { static TexCoordType dummy_texture; assert(0); return dummy_texture;}
|
||||
TexCoordType const &cWT(const int) const { static TexCoordType dummy_texture; return dummy_texture;}
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
static bool HasWedgeTexCoord() { return false; }
|
||||
static bool HasWedgeTexCoordOcc() { return false; }
|
||||
static void Name(std::vector<std::string> & name){T::Name(name);}
|
||||
|
||||
};
|
||||
template <class A, class T> class WedgeTexCoord: public T {
|
||||
public:
|
||||
typedef int WedgeTexCoordType;
|
||||
typedef A TexCoordType;
|
||||
TexCoordType &WT(const int i) { return _wt[i]; }
|
||||
TexCoordType const &cWT(const int i) const { return _wt[i]; }
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ WT() = leftF.cWT();T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
static bool HasWedgeTexCoord() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("WedgeTexCoord"));T::Name(name);}
|
||||
|
||||
private:
|
||||
TexCoordType _wt[3];
|
||||
};
|
||||
|
||||
template <class TT> class WedgeTexCoord2s: public WedgeTexCoord<TexCoord2<short,1>, TT> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("WedgeTexCoord2s"));TT::Name(name);}
|
||||
};
|
||||
template <class TT> class WedgeTexCoord2f: public WedgeTexCoord<TexCoord2<float,1>, TT> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("WedgeTexCoord2f"));TT::Name(name);}
|
||||
};
|
||||
template <class TT> class WedgeTexCoord2d: public WedgeTexCoord<TexCoord2<double,1>, TT> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("WedgeTexCoord2d"));TT::Name(name);}
|
||||
};
|
||||
|
||||
/*------------------------- FLAGS -----------------------------------------*/
|
||||
template <class T> class EmptyBitFlags: public T {
|
||||
public:
|
||||
/// Return the vector of Flags(), senza effettuare controlli sui bit
|
||||
int &Flags() { static int dummyflags(0); assert(0); return dummyflags; }
|
||||
const int Flags() const { return 0; }
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
static bool HasFlags() { return false; }
|
||||
static bool HasFlagsOcc() { return false; }
|
||||
static void Name(std::vector<std::string> & name){T::Name(name);}
|
||||
|
||||
};
|
||||
|
||||
template <class T> class BitFlags: public T {
|
||||
public:
|
||||
BitFlags(){_flags=0;}
|
||||
int &Flags() {return _flags; }
|
||||
const int Flags() const {return _flags; }
|
||||
const int & cFlags() const {return _flags; }
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ Flags() = leftF.cFlags();T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
static bool HasFlags() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
|
||||
|
||||
|
||||
private:
|
||||
int _flags;
|
||||
};
|
||||
|
||||
/*-------------------------- COLOR ----------------------------------*/
|
||||
|
||||
template <class T> class EmptyColorMarkQuality: public T {
|
||||
public:
|
||||
typedef int MarkType;
|
||||
inline void InitIMark() { }
|
||||
inline int & IMark() { assert(0); static int tmp=-1; return tmp;}
|
||||
inline const int IMark() const {return 0;}
|
||||
|
||||
typedef float QualityType;
|
||||
typedef vcg::Color4b ColorType;
|
||||
ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
|
||||
const ColorType &cC() const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
|
||||
ColorType &WC(const int) { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
|
||||
QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
|
||||
|
||||
static bool HasFaceColor() { return false; }
|
||||
static bool HasWedgeColor() { return false; }
|
||||
static bool HasFaceQuality() { return false; }
|
||||
static bool HasFaceQualityOcf() { return false;}
|
||||
static bool HasFaceColorOcc() { return false;}
|
||||
static bool HasMark() { return false; }
|
||||
static bool HasMarkOcc() { return false; }
|
||||
|
||||
static void Name(std::vector<std::string> & name){T::Name(name);}
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
|
||||
};
|
||||
template <class A, class T> class Color: public T {
|
||||
public:
|
||||
typedef A ColorType;
|
||||
Color():_color(vcg::Color4b::White) {}
|
||||
ColorType &C() { return _color; }
|
||||
const ColorType &cC() const { return _color; }
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ C() = leftF.cC();T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
static bool HasFaceColor() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
|
||||
|
||||
private:
|
||||
ColorType _color;
|
||||
};
|
||||
|
||||
template <class A, class T> class WedgeColor: public T {
|
||||
public:
|
||||
typedef A ColorType;
|
||||
ColorType &WC(const int i) { return _color[i]; }
|
||||
const ColorType &WC(const int i) const { return _color[i]; }
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ WC() = leftF.cWC();T::ImportLocal(leftF);}
|
||||
static bool HasFaceColor() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("WedgeColor"));T::Name(name);}
|
||||
|
||||
private:
|
||||
ColorType _color[3];
|
||||
};
|
||||
|
||||
template <class T> class Color4b: public Color<vcg::Color4b, T> {
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color4b"));T::Name(name);}
|
||||
};
|
||||
|
||||
/*-------------------------- Quality ----------------------------------*/
|
||||
|
||||
template <class A, class T> class Quality: public T {
|
||||
public:
|
||||
typedef A QualityType;
|
||||
QualityType &Q() { return _quality; }
|
||||
const QualityType &cQ() const { return _quality; }
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ Q() = leftF.cQ();T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
static bool HasFaceQuality() { return true; }
|
||||
static bool HasFaceQualityOcc() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));T::Name(name);}
|
||||
private:
|
||||
QualityType _quality;
|
||||
};
|
||||
|
||||
template <class T> class Qualitys: public Quality<short, T> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualitys"));T::Name(name);}
|
||||
};
|
||||
template <class T> class Qualityf: public Quality<float, T> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualityf"));T::Name(name);}
|
||||
};
|
||||
template <class T> class Qualityd: public Quality<double, T> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualityd"));T::Name(name);}
|
||||
};
|
||||
/*-------------------------- INCREMENTAL MARK ----------------------------------------*/
|
||||
|
||||
template <class T> class Mark: public T {
|
||||
public:
|
||||
static bool HasMark() { return true; }
|
||||
static bool HasMarkOcc() { return true; }
|
||||
inline void InitIMark() { _imark = 0; }
|
||||
inline int & IMark() { return _imark;}
|
||||
inline const int & IMark() const {return _imark;}
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ IMark() = leftF.IMark();T::ImportLocal(leftF);}
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
|
||||
|
||||
private:
|
||||
int _imark;
|
||||
};
|
||||
|
||||
|
||||
/*----------------------------- VFADJ ------------------------------*/
|
||||
|
||||
|
||||
template <class T> class EmptyAdj: public T {
|
||||
public:
|
||||
typedef int VFAdjType;
|
||||
typename T::FacePointer &VFp(const int) { static typename T::FacePointer fp=0; assert(0); return fp; }
|
||||
typename T::FacePointer const cVFp(const int) const { static typename T::FacePointer const fp=0; return fp; }
|
||||
typename T::FacePointer &FFp(const int) { static typename T::FacePointer fp=0; assert(0); return fp; }
|
||||
typename T::FacePointer const cFFp(const int) const { static typename T::FacePointer const fp=0; return fp; }
|
||||
typename T::EdgePointer &FEp(const int) { static typename T::EdgePointer fp=0; assert(0); return fp; }
|
||||
typename T::EdgePointer const cFEp(const int) const { static typename T::EdgePointer const fp=0; return fp; }
|
||||
char &VFi(const int j){static char z=0; assert(0); return z;};
|
||||
char &FFi(const int j){static char z=0; assert(0); return z;};
|
||||
const char &cVFi(const int j){static char z=0; return z;};
|
||||
const char &cFFi(const int j){static char z=0; return z;};
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
static bool HasVFAdjacency() { return false; }
|
||||
static bool HasFFAdjacency() { return false; }
|
||||
static bool HasFEAdjacency() { return false; }
|
||||
|
||||
static bool HasFFAdjacencyOcc() { return false; }
|
||||
static bool HasVFAdjacencyOcc() { return false; }
|
||||
static bool HasFEAdjacencyOcc() { return false; }
|
||||
|
||||
static void Name(std::vector<std::string> & name){T::Name(name);}
|
||||
|
||||
};
|
||||
|
||||
template <class T> class VFAdj: public T {
|
||||
public:
|
||||
VFAdj(){
|
||||
_vfp[0]=0;
|
||||
_vfp[1]=0;
|
||||
_vfp[2]=0;
|
||||
}
|
||||
typename T::FacePointer &VFp(const int j) { assert(j>=0 && j<3); return _vfp[j]; }
|
||||
typename T::FacePointer const VFp(const int j) const { assert(j>=0 && j<3); return _vfp[j]; }
|
||||
typename T::FacePointer const cVFp(const int j) const { assert(j>=0 && j<3); return _vfp[j]; }
|
||||
char &VFi(const int j) {return _vfi[j]; }
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
static bool HasVFAdjacency() { return true; }
|
||||
static bool HasVFAdjacencyOcc() { return false; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdj"));T::Name(name);}
|
||||
|
||||
private:
|
||||
typename T::FacePointer _vfp[3] ;
|
||||
char _vfi[3] ;
|
||||
};
|
||||
|
||||
/*----------------------------- FFADJ ------------------------------*/
|
||||
|
||||
template <class T> class FFAdj: public T {
|
||||
public:
|
||||
FFAdj(){
|
||||
_ffp[0]=0;
|
||||
_ffp[1]=0;
|
||||
_ffp[2]=0;
|
||||
}
|
||||
typename T::FacePointer &FFp(const int j) { assert(j>=0 && j<3); return _ffp[j]; }
|
||||
typename T::FacePointer const FFp(const int j) const { assert(j>=0 && j<3); return _ffp[j]; }
|
||||
typename T::FacePointer const cFFp(const int j) const { assert(j>=0 && j<3); return _ffp[j]; }
|
||||
char &FFi(const int j) { return _ffi[j]; }
|
||||
const char &cFFi(const int j) const { return _ffi[j]; }
|
||||
|
||||
typename T::FacePointer &FFp1( const int j ) { return FFp((j+1)%3);}
|
||||
typename T::FacePointer &FFp2( const int j ) { return FFp((j+2)%3);}
|
||||
typename T::FacePointer const FFp1( const int j ) const { return FFp((j+1)%3);}
|
||||
typename T::FacePointer const FFp2( const int j ) const { return FFp((j+2)%3);}
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
static bool HasFFAdjacency() { return true; }
|
||||
static bool HasFFAdjacencyOcc() { return false; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("FFAdj"));T::Name(name);}
|
||||
|
||||
private:
|
||||
typename T::FacePointer _ffp[3] ;
|
||||
char _ffi[3] ;
|
||||
};
|
||||
|
||||
|
||||
/*----------------------------- FEADJ ------------------------------*/
|
||||
|
||||
template <class T> class FEAdj: public T {
|
||||
public:
|
||||
FEAdj(){
|
||||
_fep[0]=0;
|
||||
_fep[1]=0;
|
||||
_fep[2]=0;
|
||||
}
|
||||
typename T::FacePointer &FEp(const int j) { assert(j>=0 && j<3); return _fep[j]; }
|
||||
typename T::FacePointer const FEp(const int j) const { assert(j>=0 && j<3); return _fep[j]; }
|
||||
typename T::FacePointer const cFEp(const int j) const { assert(j>=0 && j<3); return _fep[j]; }
|
||||
char &FEi(const int j) { return _fei[j]; }
|
||||
const char &cFEi(const int j) const { return _fei[j]; }
|
||||
|
||||
typename T::FacePointer &FEp1( const int j ) { return FEp((j+1)%3);}
|
||||
typename T::FacePointer &FEp2( const int j ) { return FEp((j+2)%3);}
|
||||
typename T::FacePointer const FEp1( const int j ) const { return FEp((j+1)%3);}
|
||||
typename T::FacePointer const FEp2( const int j ) const { return FEp((j+2)%3);}
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
static bool HasFEAdjacency() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("FEAdj"));T::Name(name);}
|
||||
|
||||
private:
|
||||
typename T::FacePointer _fep[3] ;
|
||||
char _fei[3] ;
|
||||
};
|
||||
|
||||
} // end namespace face
|
||||
}// end namespace vcg
|
||||
#endif
|
|
@ -1,295 +0,0 @@
|
|||
/****************************************************************************
|
||||
* VCGLib o o *
|
||||
* Visual and Computer Graphics Library o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2004 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
/****************************************************************************
|
||||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.6 2007/03/12 15:37:19 tarini
|
||||
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
|
||||
|
||||
Revision 1.5 2007/01/18 01:29:48 cignoni
|
||||
commented UberP access method (syntax errors)
|
||||
|
||||
Revision 1.4 2006/12/04 10:59:15 ganovelli
|
||||
aggiunte funzioni di override per Has*
|
||||
|
||||
Revision 1.3 2006/06/08 20:32:10 ganovelli
|
||||
aggiunte wedge coord
|
||||
|
||||
Revision 1.2 2005/10/18 14:27:22 ganovelli
|
||||
EdgePLaneType added (_RT)
|
||||
|
||||
Revision 1.1 2005/10/15 16:23:39 ganovelli
|
||||
Working release (compilata solo su MSVC), component_occ <EFBFBD> migrato da component_opt
|
||||
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
Note
|
||||
OCC = Optional Component Compact
|
||||
compare with OCF(Optional Component Fast)
|
||||
|
||||
****************************************************************************/
|
||||
#ifndef __VCG_FACE_PLUS_COMPONENT_OCC
|
||||
#define __VCG_FACE_PLUS_COMPONENT_OCC
|
||||
|
||||
#include <vcg/simplex/faceplus/component.h>
|
||||
#include <vcg/container/vector_occ.h>
|
||||
#include <vcg/space/plane3.h>
|
||||
|
||||
|
||||
namespace vcg {
|
||||
namespace face {
|
||||
|
||||
///*-------------------------- WedgeTexCoordOcc ----------------------------------------*/
|
||||
|
||||
template <class A, class T> class WedgeTexCoordOcc: public T {
|
||||
public:
|
||||
typedef A WedgeTexCoordType;
|
||||
typedef typename T::FaceType FaceType;
|
||||
WedgeTexCoordType &WT(const int&i) {return CAT< vector_occ<FaceType>,WedgeTexCoordType>::Instance()->Get((FaceType*)this);}
|
||||
static bool HasWedgeTexCoord() { return true; }
|
||||
static bool HasWedgeTexCoordOcc() { return true; }
|
||||
};
|
||||
|
||||
template <class T> class WedgeTexCoordfOcc: public WedgeTexCoordOcc<TexCoord2<float,1>, T> {};
|
||||
|
||||
///*-------------------------- FACEINFO ----------------------------------------*/
|
||||
|
||||
template <class A, class T> class InfoOccBase: public T {
|
||||
public:
|
||||
typedef A InfoType;
|
||||
typedef typename T::FaceType FaceType;
|
||||
InfoType &N() {return CAT< vector_occ<FaceType>,InfoType>::Instance()->Get((FaceType*)this);}
|
||||
static bool HasInfo() { return true; }
|
||||
static bool HasInfoOcc() { return true; }
|
||||
};
|
||||
|
||||
template <class T> class InfoOcc: public InfoOccBase<int, T> {};
|
||||
|
||||
///*-------------------------- NORMAL ----------------------------------------*/
|
||||
|
||||
template <class A, class T> class NormalOcc: public T {
|
||||
public:
|
||||
typedef A NormalType;
|
||||
typedef typename T::FaceType FaceType;
|
||||
NormalType &N() {return CAT< vector_occ<FaceType>,NormalType>::Instance()->Get((FaceType*)this);}
|
||||
static bool HasFaceNormal() { return true; }
|
||||
static bool HasFaceNormalOcc() { return true; }
|
||||
};
|
||||
|
||||
template <class T> class Normal3sOcc: public NormalOcc<vcg::Point3s, T> {};
|
||||
template <class T> class Normal3fOcc: public NormalOcc<vcg::Point3f, T> {};
|
||||
template <class T> class Normal3dOcc: public NormalOcc<vcg::Point3d, T> {};
|
||||
|
||||
///*-------------------------- MARK ----------------------------------------*/
|
||||
|
||||
template <class T> class MarkOcc: public T {
|
||||
public:
|
||||
typedef int MarkType;
|
||||
typedef typename T::FaceType FaceType;
|
||||
int &IMark() {return CAT< vector_occ<FaceType>,MarkType>::Instance()->Get((MarkType*)this);}
|
||||
static bool HasFaceMark() { return true; }
|
||||
static bool HasFaceMarkOcc() { return true; }
|
||||
inline void InitIMark() { IMark() = 0; }
|
||||
};
|
||||
|
||||
///*-------------------------- COLOR ----------------------------------------*/
|
||||
|
||||
template <class A, class T> class ColorOcc: public T {
|
||||
public:
|
||||
typedef A ColorType;
|
||||
typedef typename T::FaceType FaceType;
|
||||
ColorType &C() { return CAT< vector_occ<FaceType>,ColorType>::Instance()->Get((FaceType*)this); }
|
||||
static bool HasFaceColor() { return true; }
|
||||
static bool HasfaceColorOcc() { return true; }
|
||||
};
|
||||
|
||||
template <class T> class Color4bOcc: public ColorOcc<vcg::Color4b, T> {};
|
||||
|
||||
/*----------------------------- VFADJ ---------------------------------------*/
|
||||
|
||||
// questo tipo serve per tenere tutte le informazioni sull'adiacenza dentro una
|
||||
// singola classe
|
||||
template <class FP>
|
||||
struct VFAdjTypeSup {
|
||||
FP _vfp[3];
|
||||
char _vfi[3];
|
||||
};
|
||||
|
||||
template <class A, class T> class VFAdjOccBase: public T {
|
||||
public:
|
||||
// typedef A VFAdjType;
|
||||
typedef VFAdjTypeSup<typename T::VertexPointer> VFAdjType;
|
||||
typedef typename T::FaceType FaceType;
|
||||
typedef typename T::FacePointer FacePointer;
|
||||
|
||||
FacePointer &VFp(const int j) {
|
||||
return (CAT< vector_occ<FaceType>,VFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this))._vfp[j];}
|
||||
|
||||
FacePointer cVFp(const int j) const {
|
||||
return (CAT< vector_occ<FaceType>,VFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this))._vfp[j];}
|
||||
|
||||
char &VFi(const int j) { return (CAT< vector_occ<FaceType>,VFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this))._vfi[j];}
|
||||
|
||||
static bool HasVFAdjacency() { return true; }
|
||||
static bool HasVFAdjacencyOcc() { return true; }
|
||||
};
|
||||
|
||||
template <class T> class VFAdjOcc : public VFAdjOccBase<VFAdjTypeSup<typename T::FacePointer>,T>{};
|
||||
|
||||
/*----------------------------- FFADJ -----------------------------------*/
|
||||
|
||||
// questo tipo serve per tenere tutte le informazioni sull'adiacenza dentro una
|
||||
// singola classe
|
||||
template <class FP>
|
||||
struct FFAdjTypeSup {
|
||||
FP _ffp[3];
|
||||
char _ffi[3];
|
||||
};
|
||||
|
||||
template <class A, class T> class FFAdjOccBase: public T {
|
||||
public:
|
||||
|
||||
// typedef A FFAdjType;
|
||||
typedef FFAdjTypeSup<typename T::FacePointer> FFAdjType;
|
||||
typedef typename T::FaceType FaceType;
|
||||
typedef typename T::FacePointer FacePointer;
|
||||
|
||||
FacePointer &FFp(const int j) {
|
||||
return (CAT< vector_occ<FaceType>,FFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this))._ffp[j];}
|
||||
|
||||
FacePointer const FFp(const int j) const {
|
||||
return (CAT< vector_occ<FaceType>,FFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this))._ffp[j];}
|
||||
|
||||
FacePointer const cFFp(const int j) const {
|
||||
return (CAT< vector_occ<FaceType>,FFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this))._ffp[j];}
|
||||
|
||||
char &FFi(const int j) {
|
||||
return (CAT< vector_occ<FaceType>,FFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this))._ffi[j];}
|
||||
|
||||
char cFFi(const int j) const{
|
||||
return (CAT< vector_occ<FaceType>,FFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this ))._ffi[j];
|
||||
}
|
||||
|
||||
static bool HasFFAdjacency() { return true; }
|
||||
static bool HasFFAdjacencyOcc() { return true; }
|
||||
|
||||
};
|
||||
|
||||
template <class T> class FFAdjOcc : public FFAdjOccBase<FFAdjTypeSup<typename T::FacePointer>,T>{};
|
||||
|
||||
template <class T> class VertexRefOcc: public T {
|
||||
public:
|
||||
|
||||
typedef typename T::VertexType VertexType;
|
||||
typedef typename T::FaceType FaceType;
|
||||
typedef typename T::CoordType CoordType;
|
||||
|
||||
inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<3);
|
||||
return (CAT< vector_occ<FaceType>,VertexRef<T> >::Instance()->Get((FaceType*)this)).V(j); }
|
||||
|
||||
inline typename T::VertexType * const & V( const int j ) const { assert(j>=0 && j<3);
|
||||
return (CAT< vector_occ<FaceType>,VertexRef<T> >::Instance()->Get((FaceType*)this)).V(j); }
|
||||
|
||||
inline typename T::VertexType * const cV( const int j ) const { assert(j>=0 && j<3);
|
||||
return (CAT< vector_occ<FaceType>,VertexRef<T> >::Instance()->Get((FaceType*)this)).V(j); }
|
||||
|
||||
// Shortcut per accedere ai punti delle facce
|
||||
inline typename T::CoordType & P( const int j ) { assert(j>=0 && j<3); return V(j)->P(); }
|
||||
inline const typename T::CoordType & P( const int j ) const { assert(j>=0 && j<3); return V(j)->cP(); }
|
||||
inline const typename T::CoordType &cP( const int j ) const { assert(j>=0 && j<3); return V(j)->cP(); }
|
||||
|
||||
/** Return the pointer to the ((j+1)%3)-th vertex of the face.
|
||||
@param j Index of the face vertex.
|
||||
*/
|
||||
inline VertexType * & V0( const int j ) { return V(j);}
|
||||
inline VertexType * & V1( const int j ) { return V((j+1)%3);}
|
||||
inline VertexType * & V2( const int j ) { return V((j+2)%3);}
|
||||
inline const VertexType * const & V0( const int j ) const { return V(j);}
|
||||
inline const VertexType * const & V1( const int j ) const { return V((j+1)%3);}
|
||||
inline const VertexType * const & V2( const int j ) const { return V((j+2)%3);}
|
||||
inline const VertexType * const & cV0( const int j ) const { return cV(j);}
|
||||
inline const VertexType * const & cV1( const int j ) const { return cV((j+1)%3);}
|
||||
inline const VertexType * const & cV2( const int j ) const { return cV((j+2)%3);}
|
||||
|
||||
/// Shortcut per accedere ai punti delle facce
|
||||
inline CoordType & P0( const int j ) { return V(j)->P();}
|
||||
inline CoordType & P1( const int j ) { return V((j+1)%3)->P();}
|
||||
inline CoordType & P2( const int j ) { return V((j+2)%3)->P();}
|
||||
inline const CoordType & P0( const int j ) const { return V(j)->P();}
|
||||
inline const CoordType & P1( const int j ) const { return V((j+1)%3)->P();}
|
||||
inline const CoordType & P2( const int j ) const { return V((j+2)%3)->P();}
|
||||
inline const CoordType & cP0( const int j ) const { return cV(j)->P();}
|
||||
inline const CoordType & cP1( const int j ) const { return cV((j+1)%3)->P();}
|
||||
inline const CoordType & cP2( const int j ) const { return cV((j+2)%3)->P();}
|
||||
|
||||
//inline typename T::VertexType * & UberV( const int j ) { assert(j>=0 && j<3); return v[j]; }
|
||||
//inline const typename T::VertexType * const & UberV( const int j ) const { assert(j>=0 && j<3); return v[j]; }
|
||||
static bool HasVertexRef() { return true; }
|
||||
};
|
||||
} // end namespace face
|
||||
|
||||
template < class, class > class TriMesh;
|
||||
|
||||
namespace tri
|
||||
{
|
||||
/* template < class VertContainerType, class FaceType >
|
||||
bool HasVFAdjacency (const TriMesh < VertContainerType , vector_occ< FaceType > > & m)
|
||||
{
|
||||
if( FaceType::HasVFAdjacencyOcc()) return m.face.IsEnabledAttribute< typename FaceType::VFAdjType >();
|
||||
else return FaceType::HasVFAdjacency();
|
||||
}
|
||||
|
||||
template < class VertContainerType, class FaceType >
|
||||
bool HasFFAdjacency (const TriMesh < VertContainerType , vector_occ< FaceType > > & m)
|
||||
{
|
||||
if(FaceType::HasFFAdjacencyOcc()) return m.face.IsEnabledAttribute<typename FaceType::FFAdjType >();
|
||||
else return FaceType::HasFFAdjacency();
|
||||
}
|
||||
|
||||
template < class VertContainerType, class FaceType >
|
||||
bool HasPerWedgeTexCoord (const TriMesh < VertContainerType , vector_occ< FaceType > > & m)
|
||||
{
|
||||
if(FaceType::HasWedgeTexCoordOcc()) return m.face.IsEnabledAttribute<typename FaceType::WedgeTexCoordType >();
|
||||
else return FaceType::HasWedgeTexCoord();
|
||||
}
|
||||
|
||||
template < class VertContainerType, class FaceType >
|
||||
bool HasPerFaceColor (const TriMesh < VertContainerType , vector_occ< FaceType > > & m)
|
||||
{
|
||||
if(FaceType::HasFaceColorOcc()) return m.face.IsEnabledAttribute<typename FaceType::ColorType>();
|
||||
else return FaceType::HasFaceColor();
|
||||
}
|
||||
|
||||
template < class VertContainerType, class FaceType >
|
||||
bool HasPerFaceMark (const TriMesh < VertContainerType , vector_occ< FaceType > > & m)
|
||||
{
|
||||
if(FaceType::HasFaceMarkOcc()) return m.face.IsEnabledAttribute<typename FaceType::MarkType>();
|
||||
else return FaceType::HasFaceMark();
|
||||
}
|
||||
*/
|
||||
}; // end namesace tri
|
||||
}// end namespace vcg
|
||||
#endif
|
|
@ -1,685 +0,0 @@
|
|||
/****************************************************************************
|
||||
* VCGLib o o *
|
||||
* Visual and Computer Graphics Library o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2004 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
/****************************************************************************
|
||||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.25 2008/03/11 09:22:07 cignoni
|
||||
Completed the garbage collecting functions CompactVertexVector and CompactFaceVector.
|
||||
|
||||
Revision 1.24 2008/02/28 15:41:17 cignoni
|
||||
Added FFpi methods and better init of texture coords
|
||||
|
||||
Revision 1.23 2008/02/05 10:11:34 cignoni
|
||||
A small typo (a T:: instead of TT::)
|
||||
|
||||
Revision 1.22 2008/02/04 21:26:45 ganovelli
|
||||
added ImportLocal which imports all local attributes into vertexplus and faceplus.
|
||||
A local attribute is everything (N(), C(), Q()....) except pointers to other simplices
|
||||
(i.e. FFAdj, VFAdj, VertexRef) which are set to NULL.
|
||||
Added some function for const attributes
|
||||
|
||||
Revision 1.21 2007/10/09 12:03:13 corsini
|
||||
remove signed/unsigned warning
|
||||
|
||||
Revision 1.20 2007/03/12 15:37:19 tarini
|
||||
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
|
||||
|
||||
Revision 1.19 2006/11/28 22:34:28 cignoni
|
||||
Added default constructor with null initialization to adjacency members.
|
||||
AddFaces and AddVertices NEED to know if the topology is correctly computed to update it.
|
||||
|
||||
Revision 1.18 2006/11/07 11:29:24 cignoni
|
||||
Corrected some errors in the reflections Has*** functions
|
||||
|
||||
Revision 1.17 2006/10/31 16:02:18 ganovelli
|
||||
vesione 2005 compliant
|
||||
|
||||
Revision 1.16 2006/10/27 14:15:10 ganovelli
|
||||
added overrides to HasFFAddAdjacency and HasVFAddAdjacency
|
||||
|
||||
Revision 1.15 2006/10/16 08:49:29 cignoni
|
||||
Better managment of resize overloading when reducing the size of a vector
|
||||
|
||||
Revision 1.14 2006/10/09 20:20:55 cignoni
|
||||
Added some missing Add***Ocf() for the default case.
|
||||
|
||||
Revision 1.13 2006/05/25 09:39:09 cignoni
|
||||
missing std and other gcc detected syntax errors
|
||||
|
||||
Revision 1.12 2006/05/03 21:37:02 cignoni
|
||||
Added Optional Mark
|
||||
|
||||
Revision 1.11 2006/02/28 11:59:39 ponchio
|
||||
g++ compliance:
|
||||
|
||||
begin() -> (*this).begin() and for end(), size(), Base(), Index()
|
||||
|
||||
Revision 1.10 2006/01/30 08:47:40 cignoni
|
||||
Corrected HasPerWedgeTexture
|
||||
|
||||
Revision 1.9 2006/01/05 15:46:06 cignoni
|
||||
Removed a syntax error (double >) in HasPerWedgeTexture/HasPerFaceColor
|
||||
|
||||
Revision 1.8 2006/01/04 18:46:25 cignoni
|
||||
Corrected push_back (did not worked at all!)
|
||||
added missing cFFi
|
||||
|
||||
Revision 1.7 2006/01/03 10:54:21 cignoni
|
||||
Corrected HasPerFaceColor and HasPerWedgeTexture to comply gcc
|
||||
|
||||
Revision 1.6 2005/12/12 11:17:32 cignoni
|
||||
Corrected update function, now only the needed simplexes should be updated.
|
||||
|
||||
Revision 1.5 2005/11/26 00:16:44 cignoni
|
||||
Corrected a lot of bugs about the use of enabled entities
|
||||
|
||||
Revision 1.4 2005/11/21 21:46:20 cignoni
|
||||
Changed HasColor -> HasFaceColor and HasNormal ->HasFaceNormal
|
||||
|
||||
Revision 1.3 2005/11/16 22:43:36 cignoni
|
||||
Added WedgeTexture component
|
||||
|
||||
Revision 1.2 2005/10/22 13:16:46 cignoni
|
||||
Added a missing ';' in FFAdjOcf (thanks to Mario Latronico).
|
||||
|
||||
Revision 1.1 2005/10/14 15:07:58 cignoni
|
||||
First Really Working version
|
||||
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
Note
|
||||
OCF = Optional Component Fast (hopefully)
|
||||
compare with OCC(Optional Component Compact)
|
||||
|
||||
Mainly the trick here is to store a base pointer in each simplex...
|
||||
|
||||
****************************************************************************/
|
||||
#ifndef __VCG_FACE_PLUS_COMPONENT_OCF
|
||||
#define __VCG_FACE_PLUS_COMPONENT_OCF
|
||||
|
||||
#include <vcg/simplex/faceplus/component.h>
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
|
||||
|
||||
namespace vcg {
|
||||
namespace face {
|
||||
/*
|
||||
All the Components that can be added to a faceex should be defined in the namespace face:
|
||||
|
||||
*/
|
||||
|
||||
template <class VALUE_TYPE>
|
||||
class vector_ocf: public std::vector<VALUE_TYPE> {
|
||||
typedef std::vector<VALUE_TYPE> BaseType;
|
||||
typedef typename vector_ocf<VALUE_TYPE>::iterator ThisTypeIterator;
|
||||
|
||||
public:
|
||||
vector_ocf():std::vector<VALUE_TYPE>(){
|
||||
ColorEnabled=false;
|
||||
QualityEnabled=false;
|
||||
MarkEnabled=false;
|
||||
NormalEnabled=false;
|
||||
WedgeTexEnabled=false;
|
||||
VFAdjacencyEnabled=false;
|
||||
FFAdjacencyEnabled=false;
|
||||
}
|
||||
|
||||
// Auxiliary types to build internal vectors
|
||||
struct AdjTypePack {
|
||||
typename VALUE_TYPE::FacePointer _fp[3] ;
|
||||
char _zp[3] ;
|
||||
|
||||
// Default constructor.
|
||||
// Needed because we need to know if adjacency is initialized or not
|
||||
// when resizing vectors and during an allocate face.
|
||||
AdjTypePack() {
|
||||
_fp[0]=0;
|
||||
_fp[1]=0;
|
||||
_fp[2]=0;
|
||||
}
|
||||
};
|
||||
|
||||
//template <class TexCoordType>
|
||||
class WedgeTexTypePack {
|
||||
public:
|
||||
WedgeTexTypePack() {
|
||||
wt[0].U()=.5;wt[0].V()=.5;
|
||||
wt[1].U()=.5;wt[1].V()=.5;
|
||||
wt[2].U()=.5;wt[2].V()=.5;
|
||||
wt[0].N()=-1;
|
||||
wt[1].N()=-1;
|
||||
wt[2].N()=-1;
|
||||
}
|
||||
|
||||
typename VALUE_TYPE::TexCoordType wt[3];
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// override di tutte le funzioni che possono spostare
|
||||
// l'allocazione in memoria del container
|
||||
void push_back(const VALUE_TYPE & v)
|
||||
{
|
||||
BaseType::push_back(v);
|
||||
BaseType::back()._ovp = this;
|
||||
if (QualityEnabled) QV.push_back(0);
|
||||
if (ColorEnabled) CV.push_back(vcg::Color4b(vcg::Color4b::White));
|
||||
if (MarkEnabled) MV.push_back(0);
|
||||
if (NormalEnabled) NV.push_back(typename VALUE_TYPE::NormalType());
|
||||
if (VFAdjacencyEnabled) AV.push_back(AdjTypePack());
|
||||
if (FFAdjacencyEnabled) AF.push_back(AdjTypePack());
|
||||
if (WedgeTexEnabled) WTV.push_back(WedgeTexTypePack());
|
||||
}
|
||||
void pop_back();
|
||||
void resize(const unsigned int & _size)
|
||||
{
|
||||
unsigned int oldsize = BaseType::size();
|
||||
BaseType::resize(_size);
|
||||
if(oldsize<_size){
|
||||
ThisTypeIterator firstnew = BaseType::begin();
|
||||
advance(firstnew,oldsize);
|
||||
_updateOVP(firstnew,(*this).end());
|
||||
}
|
||||
if (QualityEnabled) QV.resize(_size);
|
||||
if (ColorEnabled) CV.resize(_size);
|
||||
if (MarkEnabled) MV.resize(_size);
|
||||
if (NormalEnabled) NV.resize(_size);
|
||||
if (VFAdjacencyEnabled) AV.resize(_size);
|
||||
if (FFAdjacencyEnabled) AF.resize(_size);
|
||||
if (WedgeTexEnabled) WTV.resize(_size,WedgeTexTypePack());
|
||||
|
||||
}
|
||||
void reserve(const unsigned int & _size)
|
||||
{
|
||||
ThisTypeIterator oldbegin=(*this).begin();
|
||||
BaseType::reserve(_size);
|
||||
|
||||
if (QualityEnabled) QV.reserve(_size);
|
||||
if (ColorEnabled) CV.reserve(_size);
|
||||
if (MarkEnabled) MV.reserve(_size);
|
||||
if (NormalEnabled) NV.reserve(_size);
|
||||
if (VFAdjacencyEnabled) AV.reserve(_size);
|
||||
if (FFAdjacencyEnabled) AF.reserve(_size);
|
||||
if (WedgeTexEnabled) WTV.reserve(_size);
|
||||
|
||||
if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
|
||||
}
|
||||
|
||||
void _updateOVP(ThisTypeIterator lbegin, ThisTypeIterator lend)
|
||||
{
|
||||
ThisTypeIterator fi;
|
||||
//for(fi=(*this).begin();vi!=(*this).end();++vi)
|
||||
for(fi=lbegin;fi!=lend;++fi)
|
||||
(*fi)._ovp=this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// this function is called by the specialized Reorder function, that is called whenever someone call the allocator::CompactVertVector
|
||||
void ReorderFace(std::vector<size_t> &newFaceIndex )
|
||||
{
|
||||
size_t i=0;
|
||||
if (QualityEnabled) assert( QV.size() == newFaceIndex.size() );
|
||||
if (ColorEnabled) assert( CV.size() == newFaceIndex.size() );
|
||||
if (MarkEnabled) assert( MV.size() == newFaceIndex.size() );
|
||||
if (NormalEnabled) assert( NV.size() == newFaceIndex.size() );
|
||||
if (VFAdjacencyEnabled)assert( AV.size() == newFaceIndex.size() );
|
||||
if (FFAdjacencyEnabled)assert( AF.size() == newFaceIndex.size() );
|
||||
if (WedgeTexEnabled) assert(WTV.size() == newFaceIndex.size() );
|
||||
|
||||
for(i=0;i<newFaceIndex.size();++i)
|
||||
{
|
||||
if(newFaceIndex[i] != std::numeric_limits<size_t>::max() )
|
||||
{
|
||||
assert(newFaceIndex[i] <= i);
|
||||
if (QualityEnabled) QV[newFaceIndex[i]] = QV[i];
|
||||
if (ColorEnabled) CV[newFaceIndex[i]] = CV[i];
|
||||
if (MarkEnabled) MV[newFaceIndex[i]] = MV[i];
|
||||
if (NormalEnabled) NV[newFaceIndex[i]] = NV[i];
|
||||
if (VFAdjacencyEnabled) AV[newFaceIndex[i]] = AV[i];
|
||||
if (FFAdjacencyEnabled) AF[newFaceIndex[i]] = AF[i];
|
||||
if (WedgeTexEnabled) WTV[newFaceIndex[i]] = WTV[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (QualityEnabled) QV.resize(BaseType::size());
|
||||
if (ColorEnabled) CV.resize(BaseType::size());
|
||||
if (MarkEnabled) MV.resize(BaseType::size());
|
||||
if (NormalEnabled) NV.resize(BaseType::size());
|
||||
if (VFAdjacencyEnabled) AV.resize(BaseType::size());
|
||||
if (FFAdjacencyEnabled) AF.resize(BaseType::size());
|
||||
if (WedgeTexEnabled) WTV.resize(BaseType::size());
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
// Enabling Functions
|
||||
|
||||
bool IsQualityEnabled() const {return QualityEnabled;}
|
||||
void EnableQuality() {
|
||||
assert(VALUE_TYPE::HasFaceQualityOcf());
|
||||
QualityEnabled=true;
|
||||
QV.resize((*this).size());
|
||||
}
|
||||
|
||||
void DisableQuality() {
|
||||
assert(VALUE_TYPE::HasFaceQualityOcf());
|
||||
QualityEnabled=false;
|
||||
QV.clear();
|
||||
}
|
||||
|
||||
bool IsColorEnabled() const {return ColorEnabled;}
|
||||
void EnableColor() {
|
||||
assert(VALUE_TYPE::HasFaceColorOcf());
|
||||
ColorEnabled=true;
|
||||
CV.resize((*this).size());
|
||||
}
|
||||
|
||||
void DisableColor() {
|
||||
assert(VALUE_TYPE::HasFaceColorOcf());
|
||||
ColorEnabled=false;
|
||||
CV.clear();
|
||||
}
|
||||
|
||||
bool IsMarkEnabled() const {return MarkEnabled;}
|
||||
void EnableMark() {
|
||||
assert(VALUE_TYPE::HasFaceMarkOcf());
|
||||
MarkEnabled=true;
|
||||
MV.resize((*this).size());
|
||||
}
|
||||
|
||||
void DisableMark() {
|
||||
assert(VALUE_TYPE::HasFaceMarkOcf());
|
||||
MarkEnabled=false;
|
||||
MV.clear();
|
||||
}
|
||||
|
||||
bool IsNormalEnabled() const {return NormalEnabled;}
|
||||
void EnableNormal() {
|
||||
assert(VALUE_TYPE::HasFaceNormalOcf());
|
||||
NormalEnabled=true;
|
||||
NV.resize((*this).size());
|
||||
}
|
||||
|
||||
void DisableNormal() {
|
||||
assert(VALUE_TYPE::HasFaceNormalOcf());
|
||||
NormalEnabled=false;
|
||||
NV.clear();
|
||||
}
|
||||
|
||||
bool IsVFAdjacencyEnabled() const {return VFAdjacencyEnabled;}
|
||||
void EnableVFAdjacency() {
|
||||
assert(VALUE_TYPE::HasVFAdjacencyOcf());
|
||||
VFAdjacencyEnabled=true;
|
||||
AV.resize((*this).size());
|
||||
}
|
||||
|
||||
void DisableVFAdjacency() {
|
||||
assert(VALUE_TYPE::HasVFAdjacencyOcf());
|
||||
VFAdjacencyEnabled=false;
|
||||
AV.clear();
|
||||
}
|
||||
|
||||
|
||||
bool IsFFAdjacencyEnabled() const {return FFAdjacencyEnabled;}
|
||||
void EnableFFAdjacency() {
|
||||
assert(VALUE_TYPE::HasFFAdjacencyOcf());
|
||||
FFAdjacencyEnabled=true;
|
||||
AF.resize((*this).size());
|
||||
}
|
||||
|
||||
void DisableFFAdjacency() {
|
||||
assert(VALUE_TYPE::HasFFAdjacencyOcf());
|
||||
FFAdjacencyEnabled=false;
|
||||
AF.clear();
|
||||
}
|
||||
|
||||
bool IsWedgeTexEnabled() const {return WedgeTexEnabled;}
|
||||
void EnableWedgeTex() {
|
||||
assert(VALUE_TYPE::HasWedgeTexCoordOcf());
|
||||
WedgeTexEnabled=true;
|
||||
WTV.resize((*this).size(),WedgeTexTypePack());
|
||||
}
|
||||
|
||||
void DisableWedgeTex() {
|
||||
assert(VALUE_TYPE::HasWedgeTexCoordOcf());
|
||||
WedgeTexEnabled=false;
|
||||
WTV.clear();
|
||||
}
|
||||
|
||||
public:
|
||||
std::vector<float> QV;
|
||||
std::vector<typename VALUE_TYPE::ColorType> CV;
|
||||
std::vector<int> MV;
|
||||
std::vector<typename VALUE_TYPE::NormalType> NV;
|
||||
std::vector<struct AdjTypePack> AV;
|
||||
std::vector<struct AdjTypePack> AF;
|
||||
std::vector<class WedgeTexTypePack> WTV;
|
||||
|
||||
bool QualityEnabled;
|
||||
bool ColorEnabled;
|
||||
bool MarkEnabled;
|
||||
bool NormalEnabled;
|
||||
bool WedgeTexEnabled;
|
||||
bool VFAdjacencyEnabled;
|
||||
bool FFAdjacencyEnabled;
|
||||
}; // end class vector_ocf
|
||||
|
||||
|
||||
//template<> void EnableAttribute<typename VALUE_TYPE::NormalType>(){ NormalEnabled=true;}
|
||||
|
||||
/*------------------------- COORD -----------------------------------------*/
|
||||
/*----------------------------- VFADJ ------------------------------*/
|
||||
|
||||
|
||||
template <class T> class VFAdjOcf: public T {
|
||||
public:
|
||||
typename T::FacePointer &VFp(const int j) {
|
||||
assert((*this).Base().VFAdjacencyEnabled);
|
||||
return (*this).Base().AV[(*this).Index()]._fp[j];
|
||||
}
|
||||
|
||||
typename T::FacePointer cVFp(const int j) const {
|
||||
if(! (*this).Base().VFAdjacencyEnabled ) return 0;
|
||||
else return (*this).Base().AV[(*this).Index()]._fp[j];
|
||||
}
|
||||
|
||||
char &VFi(const int j) {
|
||||
assert((*this).Base().VFAdjacencyEnabled);
|
||||
return (*this).Base().AV[(*this).Index()]._zp[j];
|
||||
}
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){
|
||||
if(leftF.Base().VFAdjacencyEnabled && this->Base().VFAdjacencyEnabled){
|
||||
VFp(0) = NULL; VFp(1) = NULL; VFp(2) = NULL;
|
||||
VFi(0) = -1; VFi(1) = -1; VFi(2) = -1;
|
||||
}
|
||||
T::ImportLocal(leftF);
|
||||
}
|
||||
static bool HasVFAdjacency() { return true; }
|
||||
static bool HasVFAdjacencyOcf() { return true; }
|
||||
|
||||
private:
|
||||
};
|
||||
/*----------------------------- FFADJ ------------------------------*/
|
||||
|
||||
|
||||
template <class T> class FFAdjOcf: public T {
|
||||
public:
|
||||
typename T::FacePointer &FFp(const int j) {
|
||||
assert((*this).Base().FFAdjacencyEnabled);
|
||||
return (*this).Base().AF[(*this).Index()]._fp[j];
|
||||
}
|
||||
|
||||
typename T::FacePointer const FFp(const int j) const { return cFFp(j);}
|
||||
typename T::FacePointer const cFFp(const int j) const {
|
||||
if(! (*this).Base().FFAdjacencyEnabled ) return 0;
|
||||
else return (*this).Base().AF[(*this).Index()]._fp[j];
|
||||
}
|
||||
|
||||
char &FFi(const int j) {
|
||||
assert((*this).Base().FFAdjacencyEnabled);
|
||||
return (*this).Base().AF[(*this).Index()]._zp[j];
|
||||
}
|
||||
const char cFFi(const int j) const {
|
||||
assert((*this).Base().FFAdjacencyEnabled);
|
||||
return (*this).Base().AF[(*this).Index()]._zp[j];
|
||||
}
|
||||
|
||||
typename T::FacePointer &FFp1( const int j ) { return FFp((j+1)%3);}
|
||||
typename T::FacePointer &FFp2( const int j ) { return FFp((j+2)%3);}
|
||||
typename T::FacePointer const FFp1( const int j ) const { return FFp((j+1)%3);}
|
||||
typename T::FacePointer const FFp2( const int j ) const { return FFp((j+2)%3);}
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){
|
||||
if(leftF.Base().FFAdjacencyEnabled && this->Base().FFAdjacencyEnabled) {
|
||||
FFp(0) = NULL; FFp(1) = NULL; FFp(2) = NULL;
|
||||
FFi(0) = -1; FFi(1) = -1; FFi(2) = -1;
|
||||
}
|
||||
T::ImportLocal(leftF);
|
||||
}
|
||||
static bool HasFFAdjacency() { return true; }
|
||||
static bool HasFFAdjacencyOcf() { return true; }
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
/*------------------------- Normal -----------------------------------------*/
|
||||
|
||||
template <class A, class T> class NormalOcf: public T {
|
||||
public:
|
||||
typedef A NormalType;
|
||||
static bool HasFaceNormal() { return true; }
|
||||
static bool HasFaceNormalOcf() { return true; }
|
||||
|
||||
NormalType &N() {
|
||||
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
|
||||
assert((*this).Base().NormalEnabled);
|
||||
return (*this).Base().NV[(*this).Index()]; }
|
||||
const NormalType &cN() const {
|
||||
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
|
||||
assert((*this).Base().NormalEnabled);
|
||||
return (*this).Base().NV[(*this).Index()]; }
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){
|
||||
if((*this).Base().NormalEnabled && leftF.Base().NormalEnabled)
|
||||
N() = leftF.cN();
|
||||
T::ImportLocal(leftF);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <class T> class Normal3sOcf: public NormalOcf<vcg::Point3s, T> {};
|
||||
template <class T> class Normal3fOcf: public NormalOcf<vcg::Point3f, T> {};
|
||||
template <class T> class Normal3dOcf: public NormalOcf<vcg::Point3d, T> {};
|
||||
|
||||
///*-------------------------- QUALITY ----------------------------------*/
|
||||
|
||||
template <class A, class T> class QualityOcf: public T {
|
||||
public:
|
||||
typedef A QualityType;
|
||||
QualityType &Q() {
|
||||
assert((*this).Base().QualityEnabled);
|
||||
return (*this).Base().QV[(*this).Index()];
|
||||
}
|
||||
const QualityType Q() const {
|
||||
assert((*this).Base().QualityEnabled);
|
||||
return (*this).Base().QV[(*this).Index()];
|
||||
}
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){
|
||||
if((*this).Base().QualityEnabled && leftF.Base().QualityEnabled)
|
||||
Q() = leftF.Q();
|
||||
T::ImportLocal(leftF);
|
||||
}
|
||||
static bool HasFaceQuality() { return true; }
|
||||
static bool HasFaceQualityOcf() { return true; }
|
||||
};
|
||||
|
||||
template <class T> class QualityfOcf: public QualityOcf<float, T> {};
|
||||
|
||||
///*-------------------------- COLOR ----------------------------------*/
|
||||
|
||||
template <class A, class T> class ColorOcf: public T {
|
||||
public:
|
||||
typedef A ColorType;
|
||||
ColorType &C() {
|
||||
assert((*this).Base().ColorEnabled);
|
||||
return (*this).Base().CV[(*this).Index()];
|
||||
}
|
||||
const ColorType C() const {
|
||||
assert((*this).Base().ColorEnabled);
|
||||
return (*this).Base().CV[(*this).Index()];
|
||||
}
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){
|
||||
if((*this).Base().ColorEnabled && leftF.Base().ColorEnabled)
|
||||
C() = leftF.C();
|
||||
T::ImportLocal(leftF);
|
||||
}
|
||||
static bool HasFaceColor() { return true; }
|
||||
static bool HasFaceColorOcf() { return true; }
|
||||
};
|
||||
|
||||
template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {};
|
||||
|
||||
///*-------------------------- MARK ----------------------------------*/
|
||||
|
||||
template <class T> class MarkOcf: public T {
|
||||
public:
|
||||
inline int & IMark() {
|
||||
assert((*this).Base().MarkEnabled);
|
||||
return (*this).Base().MV[(*this).Index()];
|
||||
}
|
||||
|
||||
inline int IMark() const {
|
||||
assert((*this).Base().MarkEnabled);
|
||||
return (*this).Base().MV[(*this).Index()];
|
||||
} ;
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){
|
||||
if((*this).Base().MarkEnabled && leftF.Base().MarkEnabled)
|
||||
IMark() = leftF.IMark();
|
||||
T::ImportLocal(leftF);
|
||||
}
|
||||
static bool HasFaceMark() { return true; }
|
||||
static bool HasFaceMarkOcf() { return true; }
|
||||
inline void InitIMark() { IMark() = 0; }
|
||||
};
|
||||
|
||||
///*-------------------------- WEDGE TEXCOORD ----------------------------------*/
|
||||
|
||||
template <class A, class TT> class WedgeTexCoordOcf: public TT {
|
||||
public:
|
||||
WedgeTexCoordOcf(){ }
|
||||
typedef A TexCoordType;
|
||||
TexCoordType &WT(const int i) { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; }
|
||||
TexCoordType const &cWT(const int i) const { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; }
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){
|
||||
if(this->Base().WedgeTexEnabled && leftF.Base().WedgeTexEnabled)
|
||||
{ WT(0) = leftF.cWT(0); WT(1) = leftF.cWT(1); WT(2) = leftF.cWT(2); }
|
||||
TT::ImportLocal(leftF);
|
||||
}
|
||||
static bool HasWedgeTexCoord() { return true; }
|
||||
static bool HasWedgeTexCoordOcf() { return true; }
|
||||
};
|
||||
|
||||
template <class T> class WedgeTexCoordfOcf: public WedgeTexCoordOcf<TexCoord2<float,1>, T> {};
|
||||
|
||||
///*-------------------------- InfoOpt ----------------------------------*/
|
||||
|
||||
template < class T> class InfoOcf: public T {
|
||||
public:
|
||||
vector_ocf<typename T::FaceType> &Base() const { return *_ovp;}
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){T::ImportLocal(leftF);}
|
||||
|
||||
static bool HasFaceColorOcf() { return false; }
|
||||
static bool HasFaceNormalOcf() { return false; }
|
||||
static bool HasFaceMarkOcf() { return false; }
|
||||
static bool HasWedgeTexCoordOcf() { return false; }
|
||||
static bool HasFFAdjacencyOcf() { return false; }
|
||||
static bool HasVFAdjacencyOcf() { return false; }
|
||||
//static bool HasFaceQualityOcf() { return false; }
|
||||
|
||||
inline int Index() const {
|
||||
typename T::FaceType const *tp=static_cast<typename T::FaceType const *>(this);
|
||||
int tt2=tp- &*(_ovp->begin());
|
||||
return tt2;
|
||||
}
|
||||
public:
|
||||
// ovp Optional Vector Pointer
|
||||
// Pointer to the base vector where each face element is stored.
|
||||
// used to access to the vectors of the other optional members.
|
||||
vector_ocf<typename T::FaceType> *_ovp;
|
||||
};
|
||||
|
||||
} // end namespace face
|
||||
|
||||
template < class, class,class > class TriMesh;
|
||||
|
||||
namespace tri
|
||||
{
|
||||
template < class VertContainerType, class FaceType, class EdgeContainerType >
|
||||
bool HasVFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, EdgeContainerType > & m)
|
||||
{
|
||||
if(FaceType::HasVFAdjacencyOcf()) return m.face.IsVFAdjacencyEnabled();
|
||||
else return FaceType::FaceType::HasVFAdjacency();
|
||||
}
|
||||
|
||||
template < class VertContainerType, class FaceType, class EdgeContainerType>
|
||||
bool HasFFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, EdgeContainerType > & m)
|
||||
{
|
||||
if(FaceType::HasFFAdjacencyOcf()) return m.face.IsFFAdjacencyEnabled();
|
||||
else return FaceType::FaceType::HasFFAdjacency();
|
||||
}
|
||||
|
||||
template < class VertContainerType, class FaceType, class EdgeContainerType >
|
||||
bool HasPerWedgeTexCoord (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, EdgeContainerType > & m)
|
||||
{
|
||||
if(FaceType::HasWedgeTexCoordOcf()) return m.face.IsWedgeTexEnabled();
|
||||
else return FaceType::HasWedgeTexCoord();
|
||||
}
|
||||
|
||||
template < class VertContainerType, class FaceType, class EdgeContainerType >
|
||||
bool HasPerFaceColor (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, EdgeContainerType > & m)
|
||||
{
|
||||
if(FaceType::HasFaceColorOcf()) return m.face.IsColorEnabled();
|
||||
else return FaceType::HasFaceColor();
|
||||
}
|
||||
|
||||
template < class VertContainerType, class FaceType, class EdgeContainerType >
|
||||
bool HasPerFaceQuality (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, EdgeContainerType > & m)
|
||||
{
|
||||
if(FaceType::HasFaceQualityOcf()) return m.face.IsQualityEnabled();
|
||||
else return FaceType::HasFaceQuality();
|
||||
}
|
||||
|
||||
template < class VertContainerType, class FaceType, class EdgeContainerType >
|
||||
bool HasPerFaceMark (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, EdgeContainerType > & m)
|
||||
{
|
||||
if(FaceType::HasFaceMarkOcf()) return m.face.IsMarkEnabled();
|
||||
else return FaceType::HasFaceMark();
|
||||
}
|
||||
|
||||
template < class FaceType >
|
||||
void ReorderFace( std::vector<size_t> &newFaceIndex, face::vector_ocf< FaceType > &faceVec)
|
||||
{
|
||||
faceVec.ReorderFace(newFaceIndex);
|
||||
}
|
||||
|
||||
}
|
||||
}// end namespace vcg
|
||||
#endif
|
|
@ -1,315 +0,0 @@
|
|||
/****************************************************************************
|
||||
* VCGLib o o *
|
||||
* Visual and Computer Graphics Library o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2004 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __VCG_POLYGON_COMPONENT
|
||||
#define __VCG_POLYGON_COMPONENT
|
||||
|
||||
//#include <vector>
|
||||
//#include <vcg/space/triangle3.h>
|
||||
//#include <vcg/space/texcoord2.h>
|
||||
//#include <vcg/space/color4.h>
|
||||
|
||||
namespace vcg {
|
||||
namespace face {
|
||||
/*
|
||||
Some naming Rules
|
||||
All the Components that can be added to a vertex should be defined in the namespace vert:
|
||||
|
||||
*/
|
||||
|
||||
/*-------------------------- PolInfo -------------------------------------------*/
|
||||
template <class T> class EmptyPolyInfo: public T {
|
||||
protected:
|
||||
inline void SetVN(const int & n) {assert(0);}
|
||||
public:
|
||||
/* Note: the destructor will not be called in general because there are no virtual destructors.
|
||||
Instead, the job of deallocating the memory will be done bu the edge allocator.
|
||||
This destructor is only done for those who istance a face alone (outside a mesh)
|
||||
*/
|
||||
static bool HasPolyInfo() { return false; }
|
||||
inline void Alloc(const int & ns){T::Alloc(ns);};// it should be useless
|
||||
inline void Dealloc(){T::Dealloc();};// it should be useless
|
||||
};
|
||||
|
||||
|
||||
template <class T> class PolyInfo: public T {
|
||||
protected:
|
||||
inline void SetVN(const int & n) {_ns = n;}
|
||||
public:
|
||||
PolyInfo(){ _ns = -1; }
|
||||
/* Note: the destructor will not be called in general because there are no virtual destructors.
|
||||
Instead, the job of deallocating the memory will be done bu the face allocator.
|
||||
This destructor is only done for those who istance a face alone (outside a mesh)
|
||||
*/
|
||||
static bool HasPolyInfo() { return true; }
|
||||
inline const int & VN() const { return _ns;}
|
||||
inline int Prev(const int & i){ return (i+(VN()-1))%VN();}
|
||||
inline int Next(const int & i){ return (i+1)%VN();}
|
||||
inline void Alloc(const int & ns){};
|
||||
inline void Dealloc(){};
|
||||
private:
|
||||
int _ns;
|
||||
};
|
||||
|
||||
/*-------------------------- VERTEX ----------------------------------------*/
|
||||
template <class T> class PEmptyFVAdj: public T {
|
||||
public:
|
||||
typedef typename T::VertexType VertexType;
|
||||
// typedef typename T::CoordType CoordType;
|
||||
inline typename T::VertexType * & V( const int j ) { assert(0); static typename T::VertexType *vp=0; return vp; }
|
||||
inline typename T::VertexType * const & V( const int j ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
|
||||
inline typename T::VertexType * const cV( const int j ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
|
||||
inline typename T::CoordType & P( const int j ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||
inline const typename T::CoordType & P( const int j ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||
inline const typename T::CoordType &cP( const int j ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF) {T::ImportLocal(leftF);}
|
||||
static bool HasFVAdjN() { return false; }
|
||||
static void Name(std::vector<std::string> & name){T::Name(name);}
|
||||
inline void Alloc(const int & ns){T::Alloc();};
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
|
||||
};
|
||||
template <class T> class PFVAdj: public T {
|
||||
public:
|
||||
PFVAdj(){_vpoly = NULL;}
|
||||
inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<this->VN()); return _vpoly[j]; }
|
||||
inline typename T::VertexType * const & V( const int j ) const { assert(j>=0 && j<this->VN()); return _vpoly[j]; }
|
||||
inline typename T::VertexType * const cV( const int j ) const { assert(j>=0 && j<this->VN()); return _vpoly[j]; }
|
||||
|
||||
|
||||
/** Return the pointer to the ((j+1)%3)-th vertex of the face.
|
||||
@param j Index of the face vertex.
|
||||
*/
|
||||
inline typename T::VertexType * & V0( const int j ) { return V(j);}
|
||||
inline typename T::VertexType * & V1( const int j ) { return V((j+1)%this->VN());}
|
||||
inline typename T::VertexType * & V2( const int j ) { return V((j+2)%this->VN());}
|
||||
inline const typename T::VertexType * const & V0( const int j ) const { return V(j);}
|
||||
inline const typename T::VertexType * const & V1( const int j ) const { return V((j+1)%this->VN());}
|
||||
inline const typename T::VertexType * const & V2( const int j ) const { return V((j+2)%this->VN());}
|
||||
inline const typename T::VertexType * const & cV0( const int j ) const { return cV(j);}
|
||||
inline const typename T::VertexType * const & cV1( const int j ) const { return cV((j+1)%this->VN());}
|
||||
inline const typename T::VertexType * const & cV2( const int j ) const { return cV((j+2)%this->VN());}
|
||||
|
||||
// Shortcut per accedere ai punti delle facce
|
||||
inline typename T::CoordType & P( const int j ) { assert(j>=0 && j<this->VN()); return _vpoly[j]->P(); }
|
||||
inline const typename T::CoordType & P( const int j ) const { assert(j>=0 && j<this->VN()); return _vpoly[j]->cP(); }
|
||||
inline const typename T::CoordType &cP( const int j ) const { assert(j>=0 && j<this->VN()); return _vpoly[j]->cP(); }
|
||||
|
||||
/// Shortcut per accedere ai punti delle facce
|
||||
inline typename T::CoordType & P0( const int j ) { return V(j)->P();}
|
||||
inline typename T::CoordType & P1( const int j ) { return V((j+1)%this->VN())->P();}
|
||||
inline typename T::CoordType & P2( const int j ) { return V((j+2)%this->VN())->P();}
|
||||
inline const typename T::CoordType & P0( const int j ) const { return V(j)->P();}
|
||||
inline const typename T::CoordType & P1( const int j ) const { return V((j+1)%this->VN())->P();}
|
||||
inline const typename T::CoordType & P2( const int j ) const { return V((j+2)%this->VN())->P();}
|
||||
inline const typename T::CoordType & cP0( const int j ) const { return cV(j)->P();}
|
||||
inline const typename T::CoordType & cP1( const int j ) const { return cV((j+1)%this->VN())->P();}
|
||||
inline const typename T::CoordType & cP2( const int j ) const { return cV((j+2)%this->VN())->P();}
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ for(int i =0; i < this->VN(); ++i) V(i) = NULL; T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns) {
|
||||
if(_vpoly == NULL){this->SetVN(ns);
|
||||
_vpoly = new typename T::VertexType*[this->VN()];
|
||||
for(int i = 0; i < this->VN(); ++i) _vpoly[i] = 0;
|
||||
}
|
||||
T::Alloc(ns);
|
||||
}
|
||||
inline void Dealloc() { if(_vpoly!=NULL){
|
||||
delete [] _vpoly;
|
||||
_vpoly = NULL;
|
||||
}
|
||||
T::Dealloc();
|
||||
}
|
||||
|
||||
static bool HasFVAdjacency() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("PFVAdj"));T::Name(name);}
|
||||
|
||||
private:
|
||||
typename T::VertPointer *_vpoly;
|
||||
};
|
||||
|
||||
/*----------------------------- PVFADJ ------------------------------*/
|
||||
template <class T> class EmptyPVFAdj: public T {
|
||||
public:
|
||||
typedef typename T::VertexType VertexType;
|
||||
typedef int VFAdjType;
|
||||
typename T::FacePointer &VFp(const int) { static typename T::FacePointer fp=0; assert(0); return fp; }
|
||||
typename T::FacePointer const cVFp(const int) const { static typename T::FacePointer const fp=0; return fp; }
|
||||
typename T::FacePointer &FFp(const int) { static typename T::FacePointer fp=0; assert(0); return fp; }
|
||||
typename T::FacePointer const cFFp(const int) const { static typename T::FacePointer const fp=0; return fp; }
|
||||
char &VFi(const int j){static char z=0; assert(0); return z;};
|
||||
char &FFi(const int j){static char z=0; assert(0); return z;};
|
||||
const char &cVFi(const int j){static char z=0; return z;};
|
||||
const char &cFFi(const int j){static char z=0; return z;};
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){ T::ImportLocal(leftF);}
|
||||
void Alloc(const int & ns){T::Alloc(ns);}
|
||||
void Dealloc(){T::Dealloc();}
|
||||
static bool HasVFAdjacency() { return false; }
|
||||
static bool HasFFAdjacency() { return false; }
|
||||
static bool HasFFAdjacencyOcc() { return false; }
|
||||
static bool HasVFAdjacencyOcc() { return false; }
|
||||
static void Name(std::vector<std::string> & name){T::Name(name);}
|
||||
|
||||
};
|
||||
|
||||
template <class T> class PVFAdj: public T {
|
||||
public:
|
||||
|
||||
PVFAdj(){_vfiP = NULL; _vfiP = NULL;}
|
||||
/* Note: the destructor will not be called in general because there are no virtual destructors.
|
||||
Instead, the job of deallocating the memory will be done bu the edge allocator.
|
||||
This destructor is only done for those who istance a face alone (outside a mesh)
|
||||
*/
|
||||
typedef typename T::VertexType VertexType;
|
||||
typedef typename T::FaceType FaceType;
|
||||
typename T::FacePointer &VFp(const int j) { assert(j>=0 && j<this->VN()); return _vfpP[j]; }
|
||||
typename T::FacePointer const VFp(const int j) const { assert(j>=0 && j<this->VN()); return _vfpP[j]; }
|
||||
typename T::FacePointer const cVFp(const int j) const { assert(j>=0 && j<this->VN()); return _vfpP[j]; }
|
||||
char &VFi(const int j) {return _vfiP[j]; }
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns) {
|
||||
if(_vfpP == NULL){
|
||||
this->SetVN(ns);
|
||||
_vfpP = new FaceType*[this->VN()];
|
||||
_vfiP = new char[this->VN()];
|
||||
for(int i = 0; i < this->VN(); ++i) {_vfpP[i] = 0;_vfiP = -1;}
|
||||
}
|
||||
T::Alloc(ns);
|
||||
|
||||
}
|
||||
inline void Dealloc() { if(_vfpP!=NULL){
|
||||
delete [] _vfpP; _vfpP = NULL;
|
||||
delete [] _vfiP; _vfiP = NULL;
|
||||
}
|
||||
T::Dealloc();
|
||||
}
|
||||
|
||||
static bool HasVFAdjacency() { return true; }
|
||||
static bool HasVFAdjacencyOcc() { return false; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("PVFAdj"));T::Name(name);}
|
||||
|
||||
private:
|
||||
typename T::FacePointer *_vfpP ;
|
||||
char *_vfiP ;
|
||||
};
|
||||
|
||||
/*----------------------------- FFADJ ------------------------------*/
|
||||
|
||||
template <class T> class PFFAdj: public T {
|
||||
public:
|
||||
typedef typename T::FaceType FaceType;
|
||||
PFFAdj(){_ffpP = NULL; _ffiP = NULL; }
|
||||
typename T::FacePointer &FFp(const int j) { assert(j>=0 && j<this->VN()); return _ffpP[j]; }
|
||||
typename T::FacePointer const FFp(const int j) const { assert(j>=0 && j<this->VN()); return _ffpP[j]; }
|
||||
typename T::FacePointer const cFFp(const int j) const { assert(j>=0 && j<this->VN()); return _ffpP[j]; }
|
||||
char &FFi(const int j) { return _ffiP[j]; }
|
||||
const char &cFFi(const int j) const { return _ffiP[j]; }
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns) {
|
||||
if( _ffpP == NULL){
|
||||
this->SetVN(ns);
|
||||
_ffpP = new FaceType*[this->VN()];
|
||||
_ffiP = new char[this->VN()];
|
||||
for(int i = 0; i < this->VN(); ++i) {_ffpP[i] = 0;_ffiP[i] = 0;}
|
||||
}
|
||||
T::Alloc(ns);
|
||||
}
|
||||
inline void Dealloc() { if(_ffpP!=NULL){
|
||||
delete [] _ffpP; _ffpP = NULL;
|
||||
delete [] _ffiP; _ffiP = NULL;
|
||||
}
|
||||
T::Dealloc();
|
||||
}
|
||||
|
||||
static bool HasFFAdjacency() { return true; }
|
||||
static bool HasFFAdjacencyOcc() { return false; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("PFFAdj"));T::Name(name);}
|
||||
|
||||
//private:
|
||||
typename T::FacePointer *_ffpP ;
|
||||
char *_ffiP ;
|
||||
};
|
||||
|
||||
/*----------------------------- PFEADJ ------------------------------*/
|
||||
|
||||
template <class T> class PFEAdj: public T {
|
||||
public:
|
||||
typedef typename T::EdgeType EdgeType;
|
||||
PFEAdj(){_fepP = NULL; }
|
||||
typename T::EdgePointer &FEp(const int j) { assert(j>=0 && j<this->VN()); return _fepP[j]; }
|
||||
typename T::EdgePointer const FEp(const int j) const { assert(j>=0 && j<this->VN()); return _fepP[j]; }
|
||||
typename T::EdgePointer const cFEp(const int j) const { assert(j>=0 && j<this->VN()); return _fepP[j]; }
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns) {
|
||||
if( _fepP == NULL){
|
||||
this->SetVN(ns);
|
||||
_fepP = new EdgeType *[this->VN()];
|
||||
for(int i = 0; i < this->VN(); ++i) {_fepP[i] = 0;}
|
||||
}
|
||||
T::Alloc(ns);
|
||||
}
|
||||
inline void Dealloc() { if(_fepP!=NULL) {delete [] _fepP; _fepP = NULL;} T::Dealloc();}
|
||||
|
||||
static bool HasFEAdjacency() { return true; }
|
||||
static bool HasFEAdjacencyOcc() { return false; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("PFEAdj"));T::Name(name);}
|
||||
|
||||
//private:
|
||||
typename T::EdgePointer *_fepP ;
|
||||
};
|
||||
|
||||
/*----------------------------- PFEADJ ------------------------------*/
|
||||
|
||||
template <class T> class PFHEAdj: public T {
|
||||
public:
|
||||
typedef typename T::EdgeType EdgeType;
|
||||
PFHEAdj(){_fhepP = NULL; }
|
||||
typename T::EdgePointer &FHEp() { return _fhepP; }
|
||||
typename T::EdgePointer const FHEp() const { return _fhepP; }
|
||||
typename T::EdgePointer const cFHEp() const { return _fhepP; }
|
||||
|
||||
template <class LeftF>
|
||||
void ImportLocal(const LeftF & leftF){T::ImportLocal(leftF);}
|
||||
inline void Alloc(const int & ns) {T::Alloc(ns);}
|
||||
inline void Dealloc() { T::Dealloc();}
|
||||
|
||||
static bool HasFHEAdjacency() { return true; }
|
||||
static bool HasFHEAdjacencyOcc() { return false; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("PFHEAdj"));T::Name(name);}
|
||||
|
||||
//private:
|
||||
typename T::EdgePointer _fhepP ;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace face
|
||||
}// end namespace vcg
|
||||
#endif
|
|
@ -1,79 +0,0 @@
|
|||
/****************************************************************************
|
||||
* VCGLib o o *
|
||||
* Visual and Computer Graphics Library o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2006 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
/****************************************************************************
|
||||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.2 2007/05/04 16:16:40 ganovelli
|
||||
standardized to component style
|
||||
|
||||
Revision 1.1 2006/10/13 14:11:49 cignoni
|
||||
first version
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __VCG_FACE_PLUS_COMPONENT_RT
|
||||
#define __VCG_FACE_PLUS_COMPONENT_RT
|
||||
|
||||
#include <vcg/space/plane3.h>
|
||||
|
||||
namespace vcg {
|
||||
namespace face {
|
||||
|
||||
template <class CoordType>
|
||||
struct EdgePlaneInfo{
|
||||
CoordType edge[3];
|
||||
::vcg::Plane3<typename CoordType::ScalarType> plane;
|
||||
typename CoordType::ScalarType edgescale;
|
||||
};
|
||||
|
||||
template <class T> class EdgePlane: public T {
|
||||
public:
|
||||
typedef EdgePlaneInfo<typename T::VertexType::CoordType> EdgePlaneType;
|
||||
|
||||
typename T::VertexType::CoordType &Edge(const int j) {
|
||||
return _ep.edge[j];
|
||||
}
|
||||
typename T::VertexType::CoordType cEdge(const int j)const {
|
||||
return _ep.edge[j];
|
||||
}
|
||||
|
||||
typename vcg::Plane3<typename T::VertexType::CoordType::ScalarType> &Plane() {
|
||||
return _ep.plane;
|
||||
}
|
||||
typename vcg::Plane3<typename T::VertexType::CoordType::ScalarType> cPlane()const {
|
||||
return _ep.plane;
|
||||
}
|
||||
|
||||
static bool HasEdgePlane() { return true; }
|
||||
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("EdgePlane"));T::Name(name);}
|
||||
|
||||
private:
|
||||
|
||||
EdgePlaneType _ep;
|
||||
};
|
||||
|
||||
} // end namespace face
|
||||
}// end namespace vcg
|
||||
#endif
|
Loading…
Reference in New Issue