mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-12-23 08:20:06 +00:00
Merge branch 'master' of https://github.com/PixarAnimationStudios/OpenSubdiv
This commit is contained in:
commit
91bb75f0ec
@ -74,9 +74,9 @@ OpenSubdiv::OsdHbrMesh * ConvertToHBR(int nVertices,
|
||||
std::vector<float> const & edgeCreases2,
|
||||
int interpBoundary, bool loop)
|
||||
{
|
||||
static HbrBilinearSubdivision<OpenSubdiv::OsdVertex> _bilinear;
|
||||
static HbrLoopSubdivision<OpenSubdiv::OsdVertex> _loop;
|
||||
static HbrCatmarkSubdivision<OpenSubdiv::OsdVertex> _catmark;
|
||||
static OpenSubdiv::HbrBilinearSubdivision<OpenSubdiv::OsdVertex> _bilinear;
|
||||
static OpenSubdiv::HbrLoopSubdivision<OpenSubdiv::OsdVertex> _loop;
|
||||
static OpenSubdiv::HbrCatmarkSubdivision<OpenSubdiv::OsdVertex> _catmark;
|
||||
|
||||
OpenSubdiv::OsdHbrMesh *hbrMesh;
|
||||
if (loop)
|
||||
|
@ -57,6 +57,11 @@
|
||||
#ifndef HBRALLOCATOR_H
|
||||
#define HBRALLOCATOR_H
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
typedef void (*HbrMemStatFunction)(unsigned long bytes);
|
||||
|
||||
/**
|
||||
@ -191,4 +196,9 @@ HbrAllocator<T>::Deallocate(T * obj) {
|
||||
m_freecount++;
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRALLOCATOR_H */
|
||||
|
@ -60,6 +60,11 @@
|
||||
/*#define HBR_DEBUG */
|
||||
#include "../hbr/subdivision.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T>
|
||||
class HbrBilinearSubdivision : public HbrSubdivision<T> {
|
||||
public:
|
||||
@ -917,4 +922,9 @@ HbrBilinearSubdivision<T>::Subdivide(HbrMesh<T>* mesh, HbrVertex<T>* vertex) {
|
||||
return v;
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRBILINEAR_H */
|
||||
|
@ -60,6 +60,11 @@
|
||||
/*#define HBR_DEBUG */
|
||||
#include "../hbr/subdivision.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T>
|
||||
class HbrCatmarkSubdivision : public HbrSubdivision<T> {
|
||||
public:
|
||||
@ -1138,4 +1143,9 @@ HbrCatmarkSubdivision<T>::Subdivide(HbrMesh<T>* mesh, HbrVertex<T>* vertex) {
|
||||
return v;
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRCATMARK_H */
|
||||
|
@ -57,6 +57,11 @@
|
||||
#ifndef HBRCORNEREDIT_H
|
||||
#define HBRCORNEREDIT_H
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T> class HbrCornerEdit;
|
||||
|
||||
template <class T>
|
||||
@ -117,4 +122,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRCORNEREDIT_H */
|
||||
|
@ -57,6 +57,11 @@
|
||||
#ifndef HBRCREASEEDIT_H
|
||||
#define HBRCREASEEDIT_H
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T> class HbrCreaseEdit;
|
||||
|
||||
template <class T>
|
||||
@ -119,4 +124,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRCREASEEDIT_H */
|
||||
|
@ -71,6 +71,11 @@
|
||||
#include "libgprims/stitchInternal.h"
|
||||
#endif
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T> class HbrVertex;
|
||||
template <class T> class HbrHalfedge;
|
||||
template <class T> class HbrFace;
|
||||
@ -349,8 +354,16 @@ private:
|
||||
unsigned short destroyed:1;
|
||||
};
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#include "../hbr/mesh.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T>
|
||||
HbrFace<T>::HbrFace()
|
||||
: mesh(0), id(-1), uindex(-1), ptexindex(-1), nvertices(0), extraedges(0), parent(0), children(0), vchild(0), fvarbits(0),
|
||||
@ -771,4 +784,9 @@ public:
|
||||
virtual ~HbrFaceOperator() {}
|
||||
};
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRFACE_H */
|
||||
|
@ -59,6 +59,11 @@
|
||||
|
||||
#include "../hbr/hierarchicalEdit.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T> class HbrFaceEdit;
|
||||
|
||||
template <class T>
|
||||
@ -141,4 +146,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRFACEEDIT_H */
|
||||
|
@ -60,6 +60,11 @@
|
||||
#include <string.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T> class HbrFVarEdit;
|
||||
template <class T> class HbrFace;
|
||||
|
||||
@ -179,8 +184,16 @@ private:
|
||||
float* const data;
|
||||
};
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#include "../hbr/fvarEdit.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T>
|
||||
void
|
||||
HbrFVarData<T>::ApplyFVarEdit(const HbrFVarEdit<T>& edit) {
|
||||
@ -202,4 +215,9 @@ HbrFVarData<T>::ApplyFVarEdit(const HbrFVarEdit<T>& edit) {
|
||||
}
|
||||
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRFVARDATA_H */
|
||||
|
@ -60,6 +60,11 @@
|
||||
#include "../hbr/hierarchicalEdit.h"
|
||||
#include "../hbr/vertexEdit.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T> class HbrFVarEdit;
|
||||
|
||||
template <class T>
|
||||
@ -140,4 +145,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRFVAREDIT_H */
|
||||
|
@ -67,6 +67,11 @@
|
||||
#include "libgprims/stitchInternal.h"
|
||||
#endif
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T> class HbrFace;
|
||||
template <class T> class HbrHalfedge;
|
||||
template <class T> class HbrVertex;
|
||||
@ -642,4 +647,9 @@ public:
|
||||
virtual ~HbrHalfedgeOperator() {}
|
||||
};
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRHALFEDGE_H */
|
||||
|
@ -57,6 +57,11 @@
|
||||
#ifndef HBRHIERARCHICALEDIT_H
|
||||
#define HBRHIERARCHICALEDIT_H
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T> class HbrHierarchicalEdit;
|
||||
template <class T> class HbrFace;
|
||||
template <class T> class HbrVertex;
|
||||
@ -150,9 +155,17 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#include "../hbr/face.h"
|
||||
#include <string.h>
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
HbrHierarchicalEdit<T>::IsRelevantToFace(HbrFace<T>* face) const {
|
||||
@ -182,4 +195,9 @@ HbrHierarchicalEdit<T>::IsRelevantToFace(HbrFace<T>* face) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRHIERARCHICALEDIT_H */
|
||||
|
@ -57,6 +57,11 @@
|
||||
#ifndef HBRHOLEEDIT_H
|
||||
#define HBRHOLEEDIT_H
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T> class HbrHoleEdit;
|
||||
|
||||
template <class T>
|
||||
@ -93,4 +98,9 @@ public:
|
||||
};
|
||||
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRHOLEEDIT_H */
|
||||
|
@ -63,6 +63,11 @@
|
||||
|
||||
#include "../hbr/subdivision.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
/* #define HBR_DEBUG */
|
||||
|
||||
template <class T>
|
||||
@ -994,4 +999,9 @@ HbrLoopSubdivision<T>::refineFaceAtMiddle(HbrMesh<T>* mesh, HbrFace<T>* face) {
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRLOOP_H */
|
||||
|
@ -79,6 +79,11 @@
|
||||
#include "../hbr/creaseEdit.h"
|
||||
#include "../hbr/allocator.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T> class HbrSubdivision;
|
||||
|
||||
template <class T> class HbrMesh {
|
||||
@ -394,10 +399,18 @@ private:
|
||||
|
||||
};
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#include <algorithm>
|
||||
#include "../hbr/mesh.h"
|
||||
#include "../hbr/halfedge.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T>
|
||||
HbrMesh<T>::HbrMesh(HbrSubdivision<T>* s, int _fvarcount, const int *_fvarindices, const int *_fvarwidths, int _totalfvarwidth
|
||||
#ifdef HBRSTITCH
|
||||
@ -1077,4 +1090,9 @@ HbrMesh<T>::FreeTransientData() {
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRMESH_H */
|
||||
|
@ -57,6 +57,11 @@
|
||||
#ifndef HBRSUBDIVISION_H
|
||||
#define HBRSUBDIVISION_H
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T> class HbrFace;
|
||||
template <class T> class HbrVertex;
|
||||
template <class T> class HbrHalfedge;
|
||||
@ -291,4 +296,10 @@ HbrSubdivision<T>::AddCreaseEdgesWithWeight(HbrMesh<T>* mesh, HbrVertex<T>* vert
|
||||
CreaseSubdivisionHalfedgeOperator op(vertex, data, mesh->HasVertexEdits(), next, weight);
|
||||
vertex->ApplyOperatorSurroundingEdges(op);
|
||||
}
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRSUBDIVISION_H */
|
||||
|
@ -64,6 +64,10 @@
|
||||
#include "../hbr/fvarData.h"
|
||||
#include "../hbr/face.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T> class HbrHalfedge;
|
||||
template <class T> class HbrHalfedgeCompare;
|
||||
@ -1496,5 +1500,10 @@ public:
|
||||
virtual ~HbrVertexOperator() {}
|
||||
};
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRVERTEX_H */
|
||||
|
||||
|
@ -60,6 +60,11 @@
|
||||
#include <algorithm>
|
||||
#include "../hbr/hierarchicalEdit.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
template <class T> class HbrVertexEdit;
|
||||
|
||||
template <class T>
|
||||
@ -260,4 +265,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
using namespace OPENSUBDIV_VERSION;
|
||||
|
||||
} // end namespace OpenSubdiv
|
||||
|
||||
#endif /* HBRVERTEXEDIT_H */
|
||||
|
@ -108,7 +108,7 @@ struct shape {
|
||||
std::vector<float> verts;
|
||||
std::vector<float> uvs;
|
||||
std::vector<int> nvertsPerFace;
|
||||
std::vector<int> faceverts;
|
||||
std::vector<int> faceverts;
|
||||
std::vector<int> faceuvs;
|
||||
std::vector<tag *> tags;
|
||||
};
|
||||
@ -137,28 +137,28 @@ shape::tag * shape::tag::parseTag(char const * line) {
|
||||
|
||||
std::vector<int> intargs;
|
||||
for (int i=0; i<nints; ++i) {
|
||||
int val;
|
||||
while (*cp == ' ') cp++;
|
||||
if (sscanf(cp, "%d", &val)!=1) return t;
|
||||
intargs.push_back(val);
|
||||
int val;
|
||||
while (*cp == ' ') cp++;
|
||||
if (sscanf(cp, "%d", &val)!=1) return t;
|
||||
intargs.push_back(val);
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
}
|
||||
|
||||
std::vector<float> floatargs;
|
||||
for (int i=0; i<nfloats; ++i) {
|
||||
float val;
|
||||
while (*cp == ' ') cp++;
|
||||
if (sscanf(cp, "%f", &val)!=1) return t;
|
||||
floatargs.push_back(val);
|
||||
float val;
|
||||
while (*cp == ' ') cp++;
|
||||
if (sscanf(cp, "%f", &val)!=1) return t;
|
||||
floatargs.push_back(val);
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
}
|
||||
|
||||
std::vector<std::string> stringargs;
|
||||
for (int i=0; i<nstrings; ++i) {
|
||||
char * val;
|
||||
while (*cp == ' ') cp++;
|
||||
if (sscanf(cp, "%s", &val)!=1) return t;
|
||||
stringargs.push_back(val);
|
||||
char * val;
|
||||
while (*cp == ' ') cp++;
|
||||
if (sscanf(cp, "%s", &val)!=1) return t;
|
||||
stringargs.push_back(val);
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
}
|
||||
|
||||
@ -219,8 +219,8 @@ shape * shape::parseShape(char const * shapestr, int axis ) {
|
||||
case 't' : if(line[1] == ' ') {
|
||||
shape::tag * t = tag::parseTag( line );
|
||||
if (t)
|
||||
s->tags.push_back(t);
|
||||
} break;
|
||||
s->tags.push_back(t);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
@ -228,16 +228,16 @@ shape * shape::parseShape(char const * shapestr, int axis ) {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template <class T>
|
||||
void applyTags( HbrMesh<T> * mesh, shape const * sh ) {
|
||||
void applyTags( OpenSubdiv::HbrMesh<T> * mesh, shape const * sh ) {
|
||||
|
||||
for (int i=0; i<(int)sh->tags.size(); ++i) {
|
||||
shape::tag * t = sh->tags[i];
|
||||
|
||||
if (t->name=="crease") {
|
||||
for (int j=0; j<(int)t->intargs.size()-1; ++j) {
|
||||
HbrVertex<T> * v = mesh->GetVertex( t->intargs[j] ),
|
||||
* w = mesh->GetVertex( t->intargs[j+1] );
|
||||
HbrHalfedge<T> * e = 0;
|
||||
OpenSubdiv::HbrVertex<T> * v = mesh->GetVertex( t->intargs[j] ),
|
||||
* w = mesh->GetVertex( t->intargs[j+1] );
|
||||
OpenSubdiv::HbrHalfedge<T> * e = 0;
|
||||
if( v && w ) {
|
||||
if( !(e = v->GetEdge(w) ) )
|
||||
e = w->GetEdge(v);
|
||||
@ -250,7 +250,7 @@ void applyTags( HbrMesh<T> * mesh, shape const * sh ) {
|
||||
}
|
||||
} else if (t->name=="corner") {
|
||||
for (int j=0; j<(int)t->intargs.size(); ++j) {
|
||||
HbrVertex<T> * v = mesh->GetVertex( t->intargs[j] );
|
||||
OpenSubdiv::HbrVertex<T> * v = mesh->GetVertex( t->intargs[j] );
|
||||
if(v) {
|
||||
int nfloat = (int) t->floatargs.size();
|
||||
v->SetSharpness( std::max(0.0f, ((nfloat > 1) ? t->floatargs[j] : t->floatargs[0])) );
|
||||
@ -259,50 +259,52 @@ void applyTags( HbrMesh<T> * mesh, shape const * sh ) {
|
||||
}
|
||||
} else if (t->name=="hole") {
|
||||
for (int j=0; j<(int)t->intargs.size(); ++j) {
|
||||
HbrFace<T> * f = mesh->GetFace( t->intargs[j] );
|
||||
OpenSubdiv::HbrFace<T> * f = mesh->GetFace( t->intargs[j] );
|
||||
if(f) {
|
||||
f->SetHole();
|
||||
} else
|
||||
printf("cannot find face for hole tag (%d)\n", t->intargs[j] );
|
||||
}
|
||||
} else if (t->name=="interpolateboundary") {
|
||||
if ((int)t->intargs.size()!=1) {
|
||||
if ((int)t->intargs.size()!=1) {
|
||||
printf("expecting 1 integer for \"interpolateboundary\" tag n. %d\n", i);
|
||||
continue;
|
||||
}
|
||||
switch( t->intargs[0] )
|
||||
{ case 0 : mesh->SetInterpolateBoundaryMethod(HbrMesh<T>::k_InterpolateBoundaryNone); break;
|
||||
case 1 : mesh->SetInterpolateBoundaryMethod(HbrMesh<T>::k_InterpolateBoundaryEdgeAndCorner); break;
|
||||
case 2 : mesh->SetInterpolateBoundaryMethod(HbrMesh<T>::k_InterpolateBoundaryEdgeOnly); break;
|
||||
default: printf("unknown interpolation boundary : %d\n", t->intargs[0] ); break;
|
||||
}
|
||||
switch( t->intargs[0] ) {
|
||||
case 0 : mesh->SetInterpolateBoundaryMethod(OpenSubdiv::HbrMesh<T>::k_InterpolateBoundaryNone); break;
|
||||
case 1 : mesh->SetInterpolateBoundaryMethod(OpenSubdiv::HbrMesh<T>::k_InterpolateBoundaryEdgeAndCorner); break;
|
||||
case 2 : mesh->SetInterpolateBoundaryMethod(OpenSubdiv::HbrMesh<T>::k_InterpolateBoundaryEdgeOnly); break;
|
||||
default: printf("unknown interpolation boundary : %d\n", t->intargs[0] ); break;
|
||||
}
|
||||
} else if (t->name=="facevaryingpropagatecorners") {
|
||||
if ((int)t->intargs.size()==1)
|
||||
mesh->SetFVarPropagateCorners( t->intargs[0] != 0 );
|
||||
else
|
||||
printf( "expecting single int argument for \"facevaryingpropagatecorners\"\n" );
|
||||
if ((int)t->intargs.size()==1)
|
||||
mesh->SetFVarPropagateCorners( t->intargs[0] != 0 );
|
||||
else
|
||||
printf( "expecting single int argument for \"facevaryingpropagatecorners\"\n" );
|
||||
} else if (t->name=="creasemethod") {
|
||||
|
||||
HbrCatmarkSubdivision<T> * scheme =
|
||||
dynamic_cast<HbrCatmarkSubdivision<T> *>( mesh->GetSubdivision() );
|
||||
|
||||
if (not scheme) {
|
||||
printf("the \"creasemethod\" tag can only be applied to Catmark meshes\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((int)t->stringargs.size()==0) {
|
||||
printf("the \"creasemethod\" tag expects a string argument\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
OpenSubdiv::HbrCatmarkSubdivision<T> * scheme =
|
||||
dynamic_cast<OpenSubdiv::HbrCatmarkSubdivision<T> *>( mesh->GetSubdivision() );
|
||||
|
||||
if (not scheme) {
|
||||
printf("the \"creasemethod\" tag can only be applied to Catmark meshes\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((int)t->stringargs.size()==0) {
|
||||
printf("the \"creasemethod\" tag expects a string argument\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if( t->stringargs[0]=="normal" )
|
||||
scheme->SetTriangleSubdivisionMethod(HbrCatmarkSubdivision<T>::k_Old);
|
||||
scheme->SetTriangleSubdivisionMethod(
|
||||
OpenSubdiv::HbrCatmarkSubdivision<T>::k_Old);
|
||||
else if( t->stringargs[0]=="chaikin" )
|
||||
scheme->SetTriangleSubdivisionMethod(HbrCatmarkSubdivision<T>::k_New);
|
||||
else
|
||||
printf("the \"creasemethod\" tag only accepts \"normal\" or \"chaikin\" as value (%s)\n", t->stringargs[0].c_str());
|
||||
|
||||
scheme->SetTriangleSubdivisionMethod(
|
||||
OpenSubdiv::HbrCatmarkSubdivision<T>::k_New);
|
||||
else
|
||||
printf("the \"creasemethod\" tag only accepts \"normal\" or \"chaikin\" as value (%s)\n", t->stringargs[0].c_str());
|
||||
|
||||
} else if (t->name=="vertexedit" or t->name=="edgeedit") {
|
||||
printf("hierarchical edits not supported (yet)\n");
|
||||
} else {
|
||||
@ -319,19 +321,19 @@ enum Scheme {
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template <class T> HbrMesh<T> *
|
||||
template <class T> OpenSubdiv::HbrMesh<T> *
|
||||
createMesh( Scheme scheme=kCatmark) {
|
||||
|
||||
HbrMesh<T> * mesh = 0;
|
||||
OpenSubdiv::HbrMesh<T> * mesh = 0;
|
||||
|
||||
static HbrBilinearSubdivision<T> _bilinear;
|
||||
static HbrLoopSubdivision<T> _loop;
|
||||
static HbrCatmarkSubdivision<T> _catmark;
|
||||
static OpenSubdiv::HbrBilinearSubdivision<T> _bilinear;
|
||||
static OpenSubdiv::HbrLoopSubdivision<T> _loop;
|
||||
static OpenSubdiv::HbrCatmarkSubdivision<T> _catmark;
|
||||
|
||||
switch (scheme) {
|
||||
case kBilinear : mesh = new HbrMesh<T>( &_bilinear ); break;
|
||||
case kLoop : mesh = new HbrMesh<T>( &_loop ); break;
|
||||
case kCatmark : mesh = new HbrMesh<T>( &_catmark ); break;
|
||||
case kBilinear : mesh = new OpenSubdiv::HbrMesh<T>( &_bilinear ); break;
|
||||
case kLoop : mesh = new OpenSubdiv::HbrMesh<T>( &_loop ); break;
|
||||
case kCatmark : mesh = new OpenSubdiv::HbrMesh<T>( &_catmark ); break;
|
||||
}
|
||||
|
||||
return mesh;
|
||||
@ -339,7 +341,7 @@ createMesh( Scheme scheme=kCatmark) {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template <class T> void
|
||||
createVertices( shape const * sh, HbrMesh<T> * mesh ) {
|
||||
createVertices( shape const * sh, OpenSubdiv::HbrMesh<T> * mesh ) {
|
||||
|
||||
T v;
|
||||
for(int i=0;i<sh->getNverts(); i++ ) {
|
||||
@ -350,7 +352,7 @@ createVertices( shape const * sh, HbrMesh<T> * mesh ) {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template <class T> void
|
||||
createVertices( shape const * sh, HbrMesh<T> * mesh, std::vector<float> & verts ) {
|
||||
createVertices( shape const * sh, OpenSubdiv::HbrMesh<T> * mesh, std::vector<float> & verts ) {
|
||||
|
||||
int nverts = sh->getNverts();
|
||||
verts.resize(nverts*3);
|
||||
@ -367,7 +369,7 @@ createVertices( shape const * sh, HbrMesh<T> * mesh, std::vector<float> & verts
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template <class T> void
|
||||
createTopology( shape const * sh, HbrMesh<T> * mesh, Scheme scheme) {
|
||||
createTopology( shape const * sh, OpenSubdiv::HbrMesh<T> * mesh, Scheme scheme) {
|
||||
|
||||
const int * fv=&(sh->faceverts[0]);
|
||||
for(int f=0, ptxidx=0;f<sh->getNfaces(); f++ ) {
|
||||
@ -380,9 +382,9 @@ createTopology( shape const * sh, HbrMesh<T> * mesh, Scheme scheme) {
|
||||
}
|
||||
|
||||
for(int j=0;j<nv;j++) {
|
||||
HbrVertex<T> * origin = mesh->GetVertex( fv[j] );
|
||||
HbrVertex<T> * destination = mesh->GetVertex( fv[ (j+1)%nv] );
|
||||
HbrHalfedge<T> * opposite = destination->GetEdge(origin);
|
||||
OpenSubdiv::HbrVertex<T> * origin = mesh->GetVertex( fv[j] );
|
||||
OpenSubdiv::HbrVertex<T> * destination = mesh->GetVertex( fv[ (j+1)%nv] );
|
||||
OpenSubdiv::HbrHalfedge<T> * opposite = destination->GetEdge(origin);
|
||||
|
||||
if(origin==NULL || destination==NULL) {
|
||||
printf(" An edge was specified that connected a nonexistent vertex\n");
|
||||
@ -406,7 +408,7 @@ createTopology( shape const * sh, HbrMesh<T> * mesh, Scheme scheme) {
|
||||
}
|
||||
}
|
||||
|
||||
HbrFace<T> * face = mesh->NewFace(nv, (int *)fv, 0);
|
||||
OpenSubdiv::HbrFace<T> * face = mesh->NewFace(nv, (int *)fv, 0);
|
||||
|
||||
face->SetPtexIndex(ptxidx);
|
||||
|
||||
@ -424,12 +426,12 @@ createTopology( shape const * sh, HbrMesh<T> * mesh, Scheme scheme) {
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template <class T> HbrMesh<T> *
|
||||
template <class T> OpenSubdiv::HbrMesh<T> *
|
||||
simpleHbr( char const * shapestr, Scheme scheme=kCatmark) {
|
||||
|
||||
shape * sh = shape::parseShape( shapestr );
|
||||
|
||||
HbrMesh<T> * mesh = createMesh<T>(scheme);
|
||||
OpenSubdiv::HbrMesh<T> * mesh = createMesh<T>(scheme);
|
||||
|
||||
createVertices<T>(sh, mesh);
|
||||
|
||||
@ -441,12 +443,12 @@ simpleHbr( char const * shapestr, Scheme scheme=kCatmark) {
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template <class T> HbrMesh<T> *
|
||||
template <class T> OpenSubdiv::HbrMesh<T> *
|
||||
simpleHbr( char const * shapestr, std::vector<float> & verts, Scheme scheme=kCatmark) {
|
||||
|
||||
shape * sh = shape::parseShape( shapestr );
|
||||
|
||||
HbrMesh<T> * mesh = createMesh<T>(scheme);
|
||||
OpenSubdiv::HbrMesh<T> * mesh = createMesh<T>(scheme);
|
||||
|
||||
createVertices<T>(sh, mesh, verts);
|
||||
|
||||
|
@ -104,12 +104,12 @@ private:
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class xyzFV;
|
||||
typedef HbrMesh<xyzVV> xyzmesh;
|
||||
typedef HbrFace<xyzVV> xyzface;
|
||||
typedef HbrVertex<xyzVV> xyzvertex;
|
||||
typedef HbrHalfedge<xyzVV> xyzhalfedge;
|
||||
typedef HbrFaceOperator<xyzVV> xyzFaceOperator;
|
||||
typedef HbrVertexOperator<xyzVV> xyzVertexOperator;
|
||||
typedef OpenSubdiv::HbrMesh<xyzVV> xyzmesh;
|
||||
typedef OpenSubdiv::HbrFace<xyzVV> xyzface;
|
||||
typedef OpenSubdiv::HbrVertex<xyzVV> xyzvertex;
|
||||
typedef OpenSubdiv::HbrHalfedge<xyzVV> xyzhalfedge;
|
||||
typedef OpenSubdiv::HbrFaceOperator<xyzVV> xyzFaceOperator;
|
||||
typedef OpenSubdiv::HbrVertexOperator<xyzVV> xyzVertexOperator;
|
||||
|
||||
typedef OpenSubdiv::FarMesh<xyzVV> fMesh;
|
||||
typedef OpenSubdiv::FarMeshFactory<xyzVV> fMeshFactory;
|
||||
|
Loading…
Reference in New Issue
Block a user