Working release (compilata solo su MSVC), component_occ è migrato da component_opt
This commit is contained in:
parent
351bebdf50
commit
0c0627ad11
|
@ -0,0 +1,183 @@
|
|||
/****************************************************************************
|
||||
* 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 $
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
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>
|
||||
|
||||
|
||||
namespace vcg {
|
||||
namespace face {
|
||||
|
||||
///*-------------------------- NORMAL ----------------------------------------*/
|
||||
|
||||
template <class A, class T> class NormalOcc: public T {
|
||||
public:
|
||||
typedef A NormalType;
|
||||
NormalType &N() {return CAT< vector_occ<FaceType>,NormalType>::Instance()->Get((FaceType*)this);}
|
||||
static bool HasNormal() { return true; }
|
||||
static bool HasColorOcc() { 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> {};
|
||||
|
||||
///*-------------------------- COLOR ----------------------------------------*/
|
||||
|
||||
template <class A, class T> class ColorOcc: public T {
|
||||
public:
|
||||
typedef A ColorType;
|
||||
ColorType &C() { return CAT< vector_occ<FaceType>,ColorType>::Instance()->Get((FaceType*)this); }
|
||||
static bool HasColor() { return true; }
|
||||
static bool HasColorOcc() { 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:
|
||||
typename T::FacePointer &VFp(const int j) {
|
||||
return (CAT< vector_occ<FaceType>,VFAdjTypeSup<T::FacePointer> >::Instance()->Get((FaceType*)this))._vfp[j];}
|
||||
|
||||
typename T::FacePointer cVFp(const int j) const {
|
||||
return (CAT< vector_occ<FaceType>,VFAdjTypeSup<T::FacePointer> >::Instance()->Get((FaceType*)this))._vfp[j];}
|
||||
|
||||
char &VFi(const int j) { return (CAT< vector_occ<FaceType>,VFAdjTypeSup<T::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;
|
||||
|
||||
typename T::FacePointer &FFp(const int j) {
|
||||
return (CAT< vector_occ<FaceType>,FFAdjTypeSup<T::FacePointer> >::Instance()->Get((FaceType*)this))._ffp[j];}
|
||||
|
||||
typename T::FacePointer const FFp(const int j) const {
|
||||
return (CAT< vector_occ<FaceType>,FFAdjTypeSup<T::FacePointer> >::Instance()->Get((FaceType*)this))._ffp[j];}
|
||||
|
||||
typename T::FacePointer const cFFp(const int j) const {
|
||||
return (CAT< vector_occ<FaceType>,FFAdjTypeSup<T::FacePointer> >::Instance()->Get((FaceType*)this))._ffp[j];}
|
||||
|
||||
char &FFi(const int j) {
|
||||
return (CAT< vector_occ<FaceType>,FFAdjTypeSup<T::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::VertexType::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 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]; }
|
||||
static bool HasVertexRef() { return true; }
|
||||
};
|
||||
|
||||
|
||||
} // end namespace face
|
||||
}// end namespace vcg
|
||||
#endif
|
|
@ -24,6 +24,10 @@
|
|||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.9 2005/10/14 13:30:07 cignoni
|
||||
Added constant access functions and reflective functions (HasSomething stuff)
|
||||
to all the components This is the first really working version...
|
||||
|
||||
Revision 1.8 2005/10/07 15:19:54 cignoni
|
||||
minor updates to keep it in line with the rest of the library
|
||||
|
||||
|
@ -52,6 +56,9 @@ First working version!
|
|||
****************************************************************************/
|
||||
#ifndef __VCG_VERTEX_PLUS_COMPONENT
|
||||
#define __VCG_VERTEX_PLUS_COMPONENT
|
||||
#include <vcg/space/point3.h>
|
||||
#include <vcg/space/tcoord2.h>
|
||||
#include <vcg/space/color4.h>
|
||||
|
||||
namespace vcg {
|
||||
namespace vert {
|
||||
|
|
|
@ -24,22 +24,14 @@
|
|||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.3 2004/03/31 14:16:40 ganovelli
|
||||
Data structure to handle temporary attributes. First version
|
||||
|
||||
Revision 1.2 2004/03/31 13:15:28 cignoni
|
||||
Added optional cpmponent
|
||||
|
||||
Revision 1.1 2004/03/31 12:46:53 cignoni
|
||||
First working version!
|
||||
|
||||
|
||||
****************************************************************************/
|
||||
#ifndef __VCG_VERTEX_PLUS_COMPONENT_OPT
|
||||
#define __VCG_VERTEX_PLUS_COMPONENT_OPT
|
||||
#ifndef __VCG_VERTEX_PLUS_COMPONENT_OCC
|
||||
#define __VCG_VERTEX_PLUS_COMPONENT_OCC
|
||||
|
||||
#include <vcg/simplex/vertexplus/component.h>
|
||||
#include <vcg/container/traced_vector.h>
|
||||
#include <vcg/container/vector_occ.h>
|
||||
|
||||
|
||||
namespace vcg {
|
||||
|
@ -52,92 +44,92 @@ All the Components that can be added to a vertex should be defined in the namesp
|
|||
|
||||
/*------------------------- COORD -----------------------------------------*/
|
||||
|
||||
template <class A, class T> class CoordOpt: public T {
|
||||
template <class A, class T> class CoordOcc: public T {
|
||||
public:
|
||||
typedef A CoordType;
|
||||
typedef typename CoordType::ScalarType ScalarType;
|
||||
CoordType &P() { return CAT< TVector<VertType>,CoordType>::Get((VertType*)this); }
|
||||
CoordType &UberP() { return CAT< TVector<VertType>,CoordType>::Get((VertType*)this); }
|
||||
CoordType &P() { return CAT< vector_occ<VertType>,CoordType>::Instance()->Get((VertType*)this); }
|
||||
CoordType &UberP() { return CAT< vector_occ<VertType>,CoordType>::Instance()->Get((VertType*)this); }
|
||||
};
|
||||
template <class T> class Coord3fOpt: public CoordOpt<vcg::Point3f, T> {};
|
||||
template <class T> class Coord3dOpt: public CoordOpt<vcg::Point3d, T> {};
|
||||
template <class T> class Coord3fOcc: public CoordOcc<vcg::Point3f, T> {};
|
||||
template <class T> class Coord3dOcc: public CoordOcc<vcg::Point3d, T> {};
|
||||
|
||||
|
||||
/*-------------------------- NORMAL ----------------------------------------*/
|
||||
|
||||
template <class A, class T> class NormalOpt: public T {
|
||||
template <class A, class T> class NormalOcc: public T {
|
||||
public:
|
||||
typedef A NormalType;
|
||||
NormalType &N() {return CAT< TVector<VertType>,NormalType>::Get((VertType*)this); }
|
||||
private:
|
||||
NormalType _norm;
|
||||
NormalType &N() {return CAT< vector_occ<VertType>,NormalType>::Instance()->Get((VertType*)this); }
|
||||
/*private:
|
||||
NormalType _norm; */
|
||||
};
|
||||
|
||||
template <class T> class Normal3sOpt: public NormalOpt<vcg::Point3s, T> {};
|
||||
template <class T> class Normal3fOpt: public NormalOpt<vcg::Point3f, T> {};
|
||||
template <class T> class Normal3dOpt: public NormalOpt<vcg::Point3d, T> {};
|
||||
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> {};
|
||||
|
||||
/*-------------------------- TEXTURE ----------------------------------------*/
|
||||
|
||||
template <class A, class T> class TextureOpt: public T {
|
||||
template <class A, class T> class TextureOcc: public T {
|
||||
public:
|
||||
typedef A TextureType;
|
||||
TextureType &T() {return CAT< TVector<VertType>,TextureType>::Get((VertType*)this); }
|
||||
TextureType &T() {return CAT< vector_occ<VertType>,TextureType>::Instance()->Get((VertType*)this); }
|
||||
static bool HasTexture() { return true; }
|
||||
|
||||
private:
|
||||
TextureType _t;
|
||||
/* private:
|
||||
TextureType _t; */
|
||||
};
|
||||
|
||||
template <class T> class Texture2sOpt: public TextureOpt<TCoord2<short,1>, T> {};
|
||||
template <class T> class Texture2fOpt: public TextureOpt<TCoord2<float,1>, T> {};
|
||||
template <class T> class Texture2dOpt: public TextureOpt<TCoord2<double,1>, T> {};
|
||||
template <class T> class Texture2sOcc: public TextureOcc<TCoord2<short,1>, T> {};
|
||||
template <class T> class Texture2fOcc: public TextureOcc<TCoord2<float,1>, T> {};
|
||||
template <class T> class Texture2dOcc: public TextureOcc<TCoord2<double,1>, T> {};
|
||||
|
||||
///*------------------------- FLAGS -----------------------------------------*/
|
||||
|
||||
template <class T> class FlagOpt: public T {
|
||||
template <class T> class FlagOcc: public T {
|
||||
public:
|
||||
int &Flags() {return CAT< TVector<VertType>,int>::Get((VertType*)this); }
|
||||
int &Flags() {return CAT< vector_occ<VertType>,int>::Instance()->Get((VertType*)this); }
|
||||
const int Flags() const {return _flags; }
|
||||
|
||||
/*
|
||||
private:
|
||||
int _flags;
|
||||
int _flags; */
|
||||
};
|
||||
|
||||
///*-------------------------- COLOR ----------------------------------*/
|
||||
|
||||
template <class A, class T> class ColorOpt: public T {
|
||||
template <class A, class T> class ColorOcc: public T {
|
||||
public:
|
||||
typedef A ColorType;
|
||||
ColorType &C() { return CAT< TVector<VertType>,ColorType>::Get((VertType*)this); }
|
||||
ColorType &C() { return CAT< vector_occ<VertType>,ColorType>::Instance()->Get((VertType*)this); }
|
||||
static bool HasColor() { return true; }
|
||||
private:
|
||||
ColorType _color;
|
||||
/*private:
|
||||
ColorType _color; */
|
||||
};
|
||||
|
||||
template <class T> class Color4bOpt: public ColorOpt<vcg::Color4b, T> {};
|
||||
template <class T> class Color4bOcc: public ColorOcc<vcg::Color4b, T> {};
|
||||
|
||||
///*-------------------------- Quality ----------------------------------*/
|
||||
|
||||
template <class A, class T> class QualityOpt: public T {
|
||||
template <class A, class T> class QualityOcc: public T {
|
||||
public:
|
||||
typedef A QualityType;
|
||||
QualityType &Q() { return CAT< TVector<VertType>,QualityType>::Get((VertType*)this);}
|
||||
QualityType &Q() { return CAT< vector_occ<VertType>,QualityType>::Instance()->Get((VertType*)this);}
|
||||
static bool HasQuality() { return true; }
|
||||
|
||||
private:
|
||||
QualityType _quality;
|
||||
/*private:
|
||||
QualityType _quality; */
|
||||
};
|
||||
|
||||
template <class T> class QualitysOpt: public QualityOpt<short, T> {};
|
||||
template <class T> class QualityfOpt: public QualityOpt<float, T> {};
|
||||
template <class T> class QualitydOpt: public QualityOpt<double, T> {};
|
||||
template <class T> class QualitysOcc: public QualityOcc<short, T> {};
|
||||
template <class T> class QualityfOcc: public QualityOcc<float, T> {};
|
||||
template <class T> class QualitydOcc: public QualityOcc<double, T> {};
|
||||
//
|
||||
///*----------------------------- VFADJ ------------------------------*/
|
||||
|
||||
template <class T> class VFAdjOpt: public T {
|
||||
template <class T> class VFAdjOcc: public T {
|
||||
public:
|
||||
typename T::FacePointer &Fp() {return CAT< TVector<VertType>,T::FacePointer>::Get((VertType*)this); }
|
||||
typename T::FacePointer &Fp() {return CAT< vector_occ<VertType>,T::FacePointer>::Instance()->Get((VertType*)this); }
|
||||
int &Zp() {return _zp; }
|
||||
static bool HasVFAdjacency() { return true; }
|
||||
private:
|
Loading…
Reference in New Issue