Added WedgeTexture component

This commit is contained in:
Paolo Cignoni 2005-11-16 22:43:36 +00:00
parent 896703158a
commit 4b7b1c1015
1 changed files with 32 additions and 0 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
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 Revision 1.1 2005/10/14 15:07:58 cignoni
First Really Working version First Really Working version
@ -60,6 +63,7 @@ public:
vector_ocf():std::vector<VALUE_TYPE>(){ vector_ocf():std::vector<VALUE_TYPE>(){
ColorEnabled=false; ColorEnabled=false;
NormalEnabled=false; NormalEnabled=false;
WedgeTexEnabled=false;
VFAdjacencyEnabled=false; VFAdjacencyEnabled=false;
FFAdjacencyEnabled=false; FFAdjacencyEnabled=false;
} }
@ -86,6 +90,7 @@ public:
if(NormalEnabled) NV.resize(_size); if(NormalEnabled) NV.resize(_size);
if(VFAdjacencyEnabled) AV.resize(_size); if(VFAdjacencyEnabled) AV.resize(_size);
if(FFAdjacencyEnabled) AF.resize(_size); if(FFAdjacencyEnabled) AF.resize(_size);
if (WedgeTexEnabled) WTV.resize(_size);
} }
void reserve(const unsigned int & _size) void reserve(const unsigned int & _size)
@ -96,6 +101,7 @@ public:
if (NormalEnabled) NV.reserve(_size); if (NormalEnabled) NV.reserve(_size);
if (VFAdjacencyEnabled) AV.reserve(_size); if (VFAdjacencyEnabled) AV.reserve(_size);
if (FFAdjacencyEnabled) AF.reserve(_size); if (FFAdjacencyEnabled) AF.reserve(_size);
if (WedgeTexEnabled) WTV.reserve(_size);
if(oldbegin!=begin()) _update(begin(),end()); if(oldbegin!=begin()) _update(begin(),end());
} }
@ -159,6 +165,17 @@ void DisableFFAdjacency() {
} }
void EnableWedgeTex() {
assert(VALUE_TYPE::HasWedgeTexture());
WedgeTexEnabled=true;
WTV.resize(size());
}
void DisableWedgeTex() {
assert(VALUE_TYPE::HasWedgeTexture());
WedgeTexEnabled=false;
WTV.clear();
}
struct AdjType { struct AdjType {
typename VALUE_TYPE::FacePointer _fp[3] ; typename VALUE_TYPE::FacePointer _fp[3] ;
@ -170,9 +187,11 @@ public:
std::vector<typename VALUE_TYPE::NormalType> NV; std::vector<typename VALUE_TYPE::NormalType> NV;
std::vector<struct AdjType> AV; std::vector<struct AdjType> AV;
std::vector<struct AdjType> AF; std::vector<struct AdjType> AF;
std::vector<typename VALUE_TYPE::TexCoordType> WTV;
bool ColorEnabled; bool ColorEnabled;
bool NormalEnabled; bool NormalEnabled;
bool WedgeTexEnabled;
bool VFAdjacencyEnabled; bool VFAdjacencyEnabled;
bool FFAdjacencyEnabled; bool FFAdjacencyEnabled;
}; };
@ -261,6 +280,19 @@ public:
template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {}; template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {};
///*-------------------------- WEDGE TEXCOORD ----------------------------------*/
template <class A, class TT> class WedgeTextureOcf: public TT {
public:
typedef A TexCoordType;
TexCoordType &WT(const int i) { assert(Base().WedgeTexEnabled); return Base().WTV[Index()]; }
TexCoordType const &cWT(const int i) const { assert(Base().WedgeTexEnabled); return Base().WTV[Index()]; }
static bool HasWedgeTexture() { return true; }
};
template <class T> class WedgeTexturefOcf: public WedgeTextureOcf<TCoord2<float,1>, T> {};
///*-------------------------- InfoOpt ----------------------------------*/ ///*-------------------------- InfoOpt ----------------------------------*/
template < class T> class InfoOcf: public T { template < class T> class InfoOcf: public T {