This commit is contained in:
Takahito Tejima 2012-06-14 21:25:54 -07:00
commit 91bb75f0ec
20 changed files with 282 additions and 78 deletions

View File

@ -74,9 +74,9 @@ OpenSubdiv::OsdHbrMesh * ConvertToHBR(int nVertices,
std::vector<float> const & edgeCreases2, std::vector<float> const & edgeCreases2,
int interpBoundary, bool loop) int interpBoundary, bool loop)
{ {
static HbrBilinearSubdivision<OpenSubdiv::OsdVertex> _bilinear; static OpenSubdiv::HbrBilinearSubdivision<OpenSubdiv::OsdVertex> _bilinear;
static HbrLoopSubdivision<OpenSubdiv::OsdVertex> _loop; static OpenSubdiv::HbrLoopSubdivision<OpenSubdiv::OsdVertex> _loop;
static HbrCatmarkSubdivision<OpenSubdiv::OsdVertex> _catmark; static OpenSubdiv::HbrCatmarkSubdivision<OpenSubdiv::OsdVertex> _catmark;
OpenSubdiv::OsdHbrMesh *hbrMesh; OpenSubdiv::OsdHbrMesh *hbrMesh;
if (loop) if (loop)

View File

@ -57,6 +57,11 @@
#ifndef HBRALLOCATOR_H #ifndef HBRALLOCATOR_H
#define HBRALLOCATOR_H #define HBRALLOCATOR_H
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
typedef void (*HbrMemStatFunction)(unsigned long bytes); typedef void (*HbrMemStatFunction)(unsigned long bytes);
/** /**
@ -191,4 +196,9 @@ HbrAllocator<T>::Deallocate(T * obj) {
m_freecount++; m_freecount++;
} }
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRALLOCATOR_H */ #endif /* HBRALLOCATOR_H */

View File

@ -60,6 +60,11 @@
/*#define HBR_DEBUG */ /*#define HBR_DEBUG */
#include "../hbr/subdivision.h" #include "../hbr/subdivision.h"
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> template <class T>
class HbrBilinearSubdivision : public HbrSubdivision<T> { class HbrBilinearSubdivision : public HbrSubdivision<T> {
public: public:
@ -917,4 +922,9 @@ HbrBilinearSubdivision<T>::Subdivide(HbrMesh<T>* mesh, HbrVertex<T>* vertex) {
return v; return v;
} }
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRBILINEAR_H */ #endif /* HBRBILINEAR_H */

View File

@ -60,6 +60,11 @@
/*#define HBR_DEBUG */ /*#define HBR_DEBUG */
#include "../hbr/subdivision.h" #include "../hbr/subdivision.h"
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> template <class T>
class HbrCatmarkSubdivision : public HbrSubdivision<T> { class HbrCatmarkSubdivision : public HbrSubdivision<T> {
public: public:
@ -1138,4 +1143,9 @@ HbrCatmarkSubdivision<T>::Subdivide(HbrMesh<T>* mesh, HbrVertex<T>* vertex) {
return v; return v;
} }
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRCATMARK_H */ #endif /* HBRCATMARK_H */

View File

@ -57,6 +57,11 @@
#ifndef HBRCORNEREDIT_H #ifndef HBRCORNEREDIT_H
#define HBRCORNEREDIT_H #define HBRCORNEREDIT_H
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> class HbrCornerEdit; template <class T> class HbrCornerEdit;
template <class T> template <class T>
@ -117,4 +122,9 @@ private:
}; };
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRCORNEREDIT_H */ #endif /* HBRCORNEREDIT_H */

View File

@ -57,6 +57,11 @@
#ifndef HBRCREASEEDIT_H #ifndef HBRCREASEEDIT_H
#define HBRCREASEEDIT_H #define HBRCREASEEDIT_H
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> class HbrCreaseEdit; template <class T> class HbrCreaseEdit;
template <class T> template <class T>
@ -119,4 +124,9 @@ private:
}; };
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRCREASEEDIT_H */ #endif /* HBRCREASEEDIT_H */

View File

@ -71,6 +71,11 @@
#include "libgprims/stitchInternal.h" #include "libgprims/stitchInternal.h"
#endif #endif
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> class HbrVertex; template <class T> class HbrVertex;
template <class T> class HbrHalfedge; template <class T> class HbrHalfedge;
template <class T> class HbrFace; template <class T> class HbrFace;
@ -349,8 +354,16 @@ private:
unsigned short destroyed:1; unsigned short destroyed:1;
}; };
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#include "../hbr/mesh.h" #include "../hbr/mesh.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> template <class T>
HbrFace<T>::HbrFace() HbrFace<T>::HbrFace()
: mesh(0), id(-1), uindex(-1), ptexindex(-1), nvertices(0), extraedges(0), parent(0), children(0), vchild(0), fvarbits(0), : 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() {} virtual ~HbrFaceOperator() {}
}; };
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRFACE_H */ #endif /* HBRFACE_H */

View File

@ -59,6 +59,11 @@
#include "../hbr/hierarchicalEdit.h" #include "../hbr/hierarchicalEdit.h"
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> class HbrFaceEdit; template <class T> class HbrFaceEdit;
template <class T> template <class T>
@ -141,4 +146,9 @@ private:
}; };
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRFACEEDIT_H */ #endif /* HBRFACEEDIT_H */

View File

@ -60,6 +60,11 @@
#include <string.h> #include <string.h>
#include <cmath> #include <cmath>
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> class HbrFVarEdit; template <class T> class HbrFVarEdit;
template <class T> class HbrFace; template <class T> class HbrFace;
@ -179,8 +184,16 @@ private:
float* const data; float* const data;
}; };
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#include "../hbr/fvarEdit.h" #include "../hbr/fvarEdit.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> template <class T>
void void
HbrFVarData<T>::ApplyFVarEdit(const HbrFVarEdit<T>& edit) { 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 */ #endif /* HBRFVARDATA_H */

View File

@ -60,6 +60,11 @@
#include "../hbr/hierarchicalEdit.h" #include "../hbr/hierarchicalEdit.h"
#include "../hbr/vertexEdit.h" #include "../hbr/vertexEdit.h"
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> class HbrFVarEdit; template <class T> class HbrFVarEdit;
template <class T> template <class T>
@ -140,4 +145,9 @@ private:
}; };
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRFVAREDIT_H */ #endif /* HBRFVAREDIT_H */

View File

@ -67,6 +67,11 @@
#include "libgprims/stitchInternal.h" #include "libgprims/stitchInternal.h"
#endif #endif
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> class HbrFace; template <class T> class HbrFace;
template <class T> class HbrHalfedge; template <class T> class HbrHalfedge;
template <class T> class HbrVertex; template <class T> class HbrVertex;
@ -642,4 +647,9 @@ public:
virtual ~HbrHalfedgeOperator() {} virtual ~HbrHalfedgeOperator() {}
}; };
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRHALFEDGE_H */ #endif /* HBRHALFEDGE_H */

View File

@ -57,6 +57,11 @@
#ifndef HBRHIERARCHICALEDIT_H #ifndef HBRHIERARCHICALEDIT_H
#define HBRHIERARCHICALEDIT_H #define HBRHIERARCHICALEDIT_H
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> class HbrHierarchicalEdit; template <class T> class HbrHierarchicalEdit;
template <class T> class HbrFace; template <class T> class HbrFace;
template <class T> class HbrVertex; 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 "../hbr/face.h"
#include <string.h> #include <string.h>
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> template <class T>
bool bool
HbrHierarchicalEdit<T>::IsRelevantToFace(HbrFace<T>* face) const { HbrHierarchicalEdit<T>::IsRelevantToFace(HbrFace<T>* face) const {
@ -182,4 +195,9 @@ HbrHierarchicalEdit<T>::IsRelevantToFace(HbrFace<T>* face) const {
return true; return true;
} }
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRHIERARCHICALEDIT_H */ #endif /* HBRHIERARCHICALEDIT_H */

View File

@ -57,6 +57,11 @@
#ifndef HBRHOLEEDIT_H #ifndef HBRHOLEEDIT_H
#define HBRHOLEEDIT_H #define HBRHOLEEDIT_H
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> class HbrHoleEdit; template <class T> class HbrHoleEdit;
template <class T> template <class T>
@ -93,4 +98,9 @@ public:
}; };
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRHOLEEDIT_H */ #endif /* HBRHOLEEDIT_H */

View File

@ -63,6 +63,11 @@
#include "../hbr/subdivision.h" #include "../hbr/subdivision.h"
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
/* #define HBR_DEBUG */ /* #define HBR_DEBUG */
template <class T> 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 */ #endif /* HBRLOOP_H */

View File

@ -79,6 +79,11 @@
#include "../hbr/creaseEdit.h" #include "../hbr/creaseEdit.h"
#include "../hbr/allocator.h" #include "../hbr/allocator.h"
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> class HbrSubdivision; template <class T> class HbrSubdivision;
template <class T> class HbrMesh { template <class T> class HbrMesh {
@ -394,10 +399,18 @@ private:
}; };
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#include <algorithm> #include <algorithm>
#include "../hbr/mesh.h" #include "../hbr/mesh.h"
#include "../hbr/halfedge.h" #include "../hbr/halfedge.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> template <class T>
HbrMesh<T>::HbrMesh(HbrSubdivision<T>* s, int _fvarcount, const int *_fvarindices, const int *_fvarwidths, int _totalfvarwidth HbrMesh<T>::HbrMesh(HbrSubdivision<T>* s, int _fvarcount, const int *_fvarindices, const int *_fvarwidths, int _totalfvarwidth
#ifdef HBRSTITCH #ifdef HBRSTITCH
@ -1077,4 +1090,9 @@ HbrMesh<T>::FreeTransientData() {
} }
} }
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRMESH_H */ #endif /* HBRMESH_H */

View File

@ -57,6 +57,11 @@
#ifndef HBRSUBDIVISION_H #ifndef HBRSUBDIVISION_H
#define HBRSUBDIVISION_H #define HBRSUBDIVISION_H
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> class HbrFace; template <class T> class HbrFace;
template <class T> class HbrVertex; template <class T> class HbrVertex;
template <class T> class HbrHalfedge; 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); CreaseSubdivisionHalfedgeOperator op(vertex, data, mesh->HasVertexEdits(), next, weight);
vertex->ApplyOperatorSurroundingEdges(op); vertex->ApplyOperatorSurroundingEdges(op);
} }
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRSUBDIVISION_H */ #endif /* HBRSUBDIVISION_H */

View File

@ -64,6 +64,10 @@
#include "../hbr/fvarData.h" #include "../hbr/fvarData.h"
#include "../hbr/face.h" #include "../hbr/face.h"
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> class HbrHalfedge; template <class T> class HbrHalfedge;
template <class T> class HbrHalfedgeCompare; template <class T> class HbrHalfedgeCompare;
@ -1496,5 +1500,10 @@ public:
virtual ~HbrVertexOperator() {} virtual ~HbrVertexOperator() {}
}; };
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRVERTEX_H */ #endif /* HBRVERTEX_H */

View File

@ -60,6 +60,11 @@
#include <algorithm> #include <algorithm>
#include "../hbr/hierarchicalEdit.h" #include "../hbr/hierarchicalEdit.h"
#include "../version.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
template <class T> class HbrVertexEdit; template <class T> class HbrVertexEdit;
template <class T> template <class T>
@ -260,4 +265,9 @@ private:
}; };
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* HBRVERTEXEDIT_H */ #endif /* HBRVERTEXEDIT_H */

View File

@ -228,16 +228,16 @@ shape * shape::parseShape(char const * shapestr, int axis ) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <class T> 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) { for (int i=0; i<(int)sh->tags.size(); ++i) {
shape::tag * t = sh->tags[i]; shape::tag * t = sh->tags[i];
if (t->name=="crease") { if (t->name=="crease") {
for (int j=0; j<(int)t->intargs.size()-1; ++j) { for (int j=0; j<(int)t->intargs.size()-1; ++j) {
HbrVertex<T> * v = mesh->GetVertex( t->intargs[j] ), OpenSubdiv::HbrVertex<T> * v = mesh->GetVertex( t->intargs[j] ),
* w = mesh->GetVertex( t->intargs[j+1] ); * w = mesh->GetVertex( t->intargs[j+1] );
HbrHalfedge<T> * e = 0; OpenSubdiv::HbrHalfedge<T> * e = 0;
if( v && w ) { if( v && w ) {
if( !(e = v->GetEdge(w) ) ) if( !(e = v->GetEdge(w) ) )
e = w->GetEdge(v); e = w->GetEdge(v);
@ -250,7 +250,7 @@ void applyTags( HbrMesh<T> * mesh, shape const * sh ) {
} }
} else if (t->name=="corner") { } else if (t->name=="corner") {
for (int j=0; j<(int)t->intargs.size(); ++j) { 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) { if(v) {
int nfloat = (int) t->floatargs.size(); int nfloat = (int) t->floatargs.size();
v->SetSharpness( std::max(0.0f, ((nfloat > 1) ? t->floatargs[j] : t->floatargs[0])) ); v->SetSharpness( std::max(0.0f, ((nfloat > 1) ? t->floatargs[j] : t->floatargs[0])) );
@ -259,7 +259,7 @@ void applyTags( HbrMesh<T> * mesh, shape const * sh ) {
} }
} else if (t->name=="hole") { } else if (t->name=="hole") {
for (int j=0; j<(int)t->intargs.size(); ++j) { 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) { if(f) {
f->SetHole(); f->SetHole();
} else } else
@ -270,10 +270,10 @@ void applyTags( HbrMesh<T> * mesh, shape const * sh ) {
printf("expecting 1 integer for \"interpolateboundary\" tag n. %d\n", i); printf("expecting 1 integer for \"interpolateboundary\" tag n. %d\n", i);
continue; continue;
} }
switch( t->intargs[0] ) switch( t->intargs[0] ) {
{ case 0 : mesh->SetInterpolateBoundaryMethod(HbrMesh<T>::k_InterpolateBoundaryNone); break; case 0 : mesh->SetInterpolateBoundaryMethod(OpenSubdiv::HbrMesh<T>::k_InterpolateBoundaryNone); break;
case 1 : mesh->SetInterpolateBoundaryMethod(HbrMesh<T>::k_InterpolateBoundaryEdgeAndCorner); break; case 1 : mesh->SetInterpolateBoundaryMethod(OpenSubdiv::HbrMesh<T>::k_InterpolateBoundaryEdgeAndCorner); break;
case 2 : mesh->SetInterpolateBoundaryMethod(HbrMesh<T>::k_InterpolateBoundaryEdgeOnly); break; case 2 : mesh->SetInterpolateBoundaryMethod(OpenSubdiv::HbrMesh<T>::k_InterpolateBoundaryEdgeOnly); break;
default: printf("unknown interpolation boundary : %d\n", t->intargs[0] ); break; default: printf("unknown interpolation boundary : %d\n", t->intargs[0] ); break;
} }
} else if (t->name=="facevaryingpropagatecorners") { } else if (t->name=="facevaryingpropagatecorners") {
@ -283,8 +283,8 @@ void applyTags( HbrMesh<T> * mesh, shape const * sh ) {
printf( "expecting single int argument for \"facevaryingpropagatecorners\"\n" ); printf( "expecting single int argument for \"facevaryingpropagatecorners\"\n" );
} else if (t->name=="creasemethod") { } else if (t->name=="creasemethod") {
HbrCatmarkSubdivision<T> * scheme = OpenSubdiv::HbrCatmarkSubdivision<T> * scheme =
dynamic_cast<HbrCatmarkSubdivision<T> *>( mesh->GetSubdivision() ); dynamic_cast<OpenSubdiv::HbrCatmarkSubdivision<T> *>( mesh->GetSubdivision() );
if (not scheme) { if (not scheme) {
printf("the \"creasemethod\" tag can only be applied to Catmark meshes\n"); printf("the \"creasemethod\" tag can only be applied to Catmark meshes\n");
@ -297,9 +297,11 @@ void applyTags( HbrMesh<T> * mesh, shape const * sh ) {
} }
if( t->stringargs[0]=="normal" ) if( t->stringargs[0]=="normal" )
scheme->SetTriangleSubdivisionMethod(HbrCatmarkSubdivision<T>::k_Old); scheme->SetTriangleSubdivisionMethod(
OpenSubdiv::HbrCatmarkSubdivision<T>::k_Old);
else if( t->stringargs[0]=="chaikin" ) else if( t->stringargs[0]=="chaikin" )
scheme->SetTriangleSubdivisionMethod(HbrCatmarkSubdivision<T>::k_New); scheme->SetTriangleSubdivisionMethod(
OpenSubdiv::HbrCatmarkSubdivision<T>::k_New);
else else
printf("the \"creasemethod\" tag only accepts \"normal\" or \"chaikin\" as value (%s)\n", t->stringargs[0].c_str()); printf("the \"creasemethod\" tag only accepts \"normal\" or \"chaikin\" as value (%s)\n", t->stringargs[0].c_str());
@ -319,19 +321,19 @@ enum Scheme {
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <class T> HbrMesh<T> * template <class T> OpenSubdiv::HbrMesh<T> *
createMesh( Scheme scheme=kCatmark) { createMesh( Scheme scheme=kCatmark) {
HbrMesh<T> * mesh = 0; OpenSubdiv::HbrMesh<T> * mesh = 0;
static HbrBilinearSubdivision<T> _bilinear; static OpenSubdiv::HbrBilinearSubdivision<T> _bilinear;
static HbrLoopSubdivision<T> _loop; static OpenSubdiv::HbrLoopSubdivision<T> _loop;
static HbrCatmarkSubdivision<T> _catmark; static OpenSubdiv::HbrCatmarkSubdivision<T> _catmark;
switch (scheme) { switch (scheme) {
case kBilinear : mesh = new HbrMesh<T>( &_bilinear ); break; case kBilinear : mesh = new OpenSubdiv::HbrMesh<T>( &_bilinear ); break;
case kLoop : mesh = new HbrMesh<T>( &_loop ); break; case kLoop : mesh = new OpenSubdiv::HbrMesh<T>( &_loop ); break;
case kCatmark : mesh = new HbrMesh<T>( &_catmark ); break; case kCatmark : mesh = new OpenSubdiv::HbrMesh<T>( &_catmark ); break;
} }
return mesh; return mesh;
@ -339,7 +341,7 @@ createMesh( Scheme scheme=kCatmark) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <class T> void template <class T> void
createVertices( shape const * sh, HbrMesh<T> * mesh ) { createVertices( shape const * sh, OpenSubdiv::HbrMesh<T> * mesh ) {
T v; T v;
for(int i=0;i<sh->getNverts(); i++ ) { for(int i=0;i<sh->getNverts(); i++ ) {
@ -350,7 +352,7 @@ createVertices( shape const * sh, HbrMesh<T> * mesh ) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <class T> void 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(); int nverts = sh->getNverts();
verts.resize(nverts*3); verts.resize(nverts*3);
@ -367,7 +369,7 @@ createVertices( shape const * sh, HbrMesh<T> * mesh, std::vector<float> & verts
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <class T> void 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]); const int * fv=&(sh->faceverts[0]);
for(int f=0, ptxidx=0;f<sh->getNfaces(); f++ ) { 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++) { for(int j=0;j<nv;j++) {
HbrVertex<T> * origin = mesh->GetVertex( fv[j] ); OpenSubdiv::HbrVertex<T> * origin = mesh->GetVertex( fv[j] );
HbrVertex<T> * destination = mesh->GetVertex( fv[ (j+1)%nv] ); OpenSubdiv::HbrVertex<T> * destination = mesh->GetVertex( fv[ (j+1)%nv] );
HbrHalfedge<T> * opposite = destination->GetEdge(origin); OpenSubdiv::HbrHalfedge<T> * opposite = destination->GetEdge(origin);
if(origin==NULL || destination==NULL) { if(origin==NULL || destination==NULL) {
printf(" An edge was specified that connected a nonexistent vertex\n"); 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); 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) { simpleHbr( char const * shapestr, Scheme scheme=kCatmark) {
shape * sh = shape::parseShape( shapestr ); shape * sh = shape::parseShape( shapestr );
HbrMesh<T> * mesh = createMesh<T>(scheme); OpenSubdiv::HbrMesh<T> * mesh = createMesh<T>(scheme);
createVertices<T>(sh, mesh); 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) { simpleHbr( char const * shapestr, std::vector<float> & verts, Scheme scheme=kCatmark) {
shape * sh = shape::parseShape( shapestr ); shape * sh = shape::parseShape( shapestr );
HbrMesh<T> * mesh = createMesh<T>(scheme); OpenSubdiv::HbrMesh<T> * mesh = createMesh<T>(scheme);
createVertices<T>(sh, mesh, verts); createVertices<T>(sh, mesh, verts);

View File

@ -104,12 +104,12 @@ private:
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
class xyzFV; class xyzFV;
typedef HbrMesh<xyzVV> xyzmesh; typedef OpenSubdiv::HbrMesh<xyzVV> xyzmesh;
typedef HbrFace<xyzVV> xyzface; typedef OpenSubdiv::HbrFace<xyzVV> xyzface;
typedef HbrVertex<xyzVV> xyzvertex; typedef OpenSubdiv::HbrVertex<xyzVV> xyzvertex;
typedef HbrHalfedge<xyzVV> xyzhalfedge; typedef OpenSubdiv::HbrHalfedge<xyzVV> xyzhalfedge;
typedef HbrFaceOperator<xyzVV> xyzFaceOperator; typedef OpenSubdiv::HbrFaceOperator<xyzVV> xyzFaceOperator;
typedef HbrVertexOperator<xyzVV> xyzVertexOperator; typedef OpenSubdiv::HbrVertexOperator<xyzVV> xyzVertexOperator;
typedef OpenSubdiv::FarMesh<xyzVV> fMesh; typedef OpenSubdiv::FarMesh<xyzVV> fMesh;
typedef OpenSubdiv::FarMeshFactory<xyzVV> fMeshFactory; typedef OpenSubdiv::FarMeshFactory<xyzVV> fMeshFactory;