Change PxOsdUtil prefix to final OsdUtil prefix.

This commit is contained in:
Dirk Van Gelder 2014-03-27 08:26:55 -07:00
parent 84bc05ac9f
commit 061c861dbf
13 changed files with 134 additions and 132 deletions

View File

@ -81,7 +81,7 @@ static bool
uniformTessellate(char *inputFile, char *outputFile, std::string *errorMessage)
{
PxOsdUtilSubdivTopology topology;
OsdUtilSubdivTopology topology;
std::vector<float> pointPositions;
if (not topology.ReadFromObjFile(inputFile, &pointPositions, errorMessage)) {
@ -90,7 +90,7 @@ uniformTessellate(char *inputFile, char *outputFile, std::string *errorMessage)
topology.refinementLevel = 2;
PxOsdUtilUniformEvaluator uniformEvaluator;
OsdUtilUniformEvaluator uniformEvaluator;
// Create uniformEvaluator
if (not uniformEvaluator.Initialize(topology, errorMessage)) {
@ -107,7 +107,7 @@ uniformTessellate(char *inputFile, char *outputFile, std::string *errorMessage)
return false;
}
PxOsdUtilSubdivTopology refinedTopology;
OsdUtilSubdivTopology refinedTopology;
const float *positions = NULL;
if (not uniformEvaluator.GetRefinedTopology(
@ -129,7 +129,7 @@ static bool
blenderStyleTessellate(char *inputFile, char *outputFile, std::string *errorMessage)
{
PxOsdUtilSubdivTopology topology;
OsdUtilSubdivTopology topology;
std::vector<float> pointPositions;
if (not topology.ReadFromObjFile(inputFile, &pointPositions, errorMessage)) {
@ -138,7 +138,7 @@ blenderStyleTessellate(char *inputFile, char *outputFile, std::string *errorMess
topology.refinementLevel = 5;
PxOsdUtilAdaptiveEvaluator adaptiveEvaluator;
OsdUtilAdaptiveEvaluator adaptiveEvaluator;
// Create adaptiveEvaluator
if (not adaptiveEvaluator.Initialize(topology, errorMessage)) {
@ -156,7 +156,7 @@ blenderStyleTessellate(char *inputFile, char *outputFile, std::string *errorMess
return false;
}
PxOsdUtilSubdivTopology refinedTopology;
OsdUtilSubdivTopology refinedTopology;
std::vector<float> positions;
if (not adaptiveEvaluator.GetRefinedTopology(

View File

@ -44,7 +44,7 @@ using namespace OpenSubdiv;
using namespace std;
PxOsdUtilAdaptiveEvaluator::PxOsdUtilAdaptiveEvaluator():
OsdUtilAdaptiveEvaluator::OsdUtilAdaptiveEvaluator():
_refiner(NULL),
_ownsRefiner(false),
_computeContext(NULL),
@ -60,7 +60,7 @@ PxOsdUtilAdaptiveEvaluator::PxOsdUtilAdaptiveEvaluator():
{
}
PxOsdUtilAdaptiveEvaluator::~PxOsdUtilAdaptiveEvaluator()
OsdUtilAdaptiveEvaluator::~OsdUtilAdaptiveEvaluator()
{
if (_ownsRefiner and _refiner) {
delete _refiner;
@ -83,14 +83,14 @@ PxOsdUtilAdaptiveEvaluator::~PxOsdUtilAdaptiveEvaluator()
bool
PxOsdUtilAdaptiveEvaluator::Initialize(
const PxOsdUtilSubdivTopology &t,
OsdUtilAdaptiveEvaluator::Initialize(
const OsdUtilSubdivTopology &t,
string *errorMessage)
{
// create and initialize a refiner, passing "true" for adaptive
// to indicate we wish for adaptive refinement rather than uniform
PxOsdUtilRefiner *refiner = new PxOsdUtilRefiner();
OsdUtilRefiner *refiner = new OsdUtilRefiner();
_ownsRefiner = true;
if (not refiner->Initialize(t, true, errorMessage)) {
@ -101,8 +101,8 @@ PxOsdUtilAdaptiveEvaluator::Initialize(
}
bool
PxOsdUtilAdaptiveEvaluator::Initialize(
PxOsdUtilRefiner *refiner,
OsdUtilAdaptiveEvaluator::Initialize(
OsdUtilRefiner *refiner,
string *errorMessage)
{
@ -189,7 +189,7 @@ PxOsdUtilAdaptiveEvaluator::Initialize(
void
PxOsdUtilAdaptiveEvaluator::SetCoarsePositions(
OsdUtilAdaptiveEvaluator::SetCoarsePositions(
const float *coords, int numFloats, string *errorMessage )
{
//XXX: should be >= num coarse vertices
@ -202,7 +202,7 @@ PxOsdUtilAdaptiveEvaluator::SetCoarsePositions(
}
bool
PxOsdUtilAdaptiveEvaluator::Refine(
OsdUtilAdaptiveEvaluator::Refine(
int numThreads, string *errorMessage)
{
const FarMesh<OsdVertex> *fmesh = _refiner->GetFarMesh();
@ -228,7 +228,7 @@ PxOsdUtilAdaptiveEvaluator::Refine(
}
void
PxOsdUtilAdaptiveEvaluator::EvaluateLimit(
OsdUtilAdaptiveEvaluator::EvaluateLimit(
const OsdEvalCoords &coords, float P[3], float dPdu[3], float dPdv[3])
{
@ -281,14 +281,14 @@ void ccgSubSurf__mapGridToFace(int S, float grid_u, float grid_v,
bool
PxOsdUtilAdaptiveEvaluator::GetRefinedTopology(
PxOsdUtilSubdivTopology *out,
OsdUtilAdaptiveEvaluator::GetRefinedTopology(
OsdUtilSubdivTopology *out,
//positions will have three floats * t->numVertices
std::vector<float> *positions,
std::string *errorMessage)
{
const PxOsdUtilSubdivTopology &t = GetTopology();
const OsdUtilSubdivTopology &t = GetTopology();
positions->clear();

View File

@ -44,11 +44,11 @@
// call the eval API to sample values on subdivision surfaces on the
// limit surface..
//
class PxOsdUtilAdaptiveEvaluator {
class OsdUtilAdaptiveEvaluator {
public:
PxOsdUtilAdaptiveEvaluator();
OsdUtilAdaptiveEvaluator();
~PxOsdUtilAdaptiveEvaluator();
~OsdUtilAdaptiveEvaluator();
// Initialize returns false on error. If errorMessage is non-NULL it'll
// be populated upon error.
@ -63,11 +63,11 @@ class PxOsdUtilAdaptiveEvaluator {
// of refiners among evaluators.
//
bool Initialize(
PxOsdUtilRefiner* refiner,
OsdUtilRefiner* refiner,
std::string *errorMessage = NULL);
bool Initialize(
const PxOsdUtilSubdivTopology &topology,
const OsdUtilSubdivTopology &topology,
std::string *errorMessage = NULL);
// Set new coarse-mesh CV positions, need to call Refine
@ -91,7 +91,7 @@ class PxOsdUtilAdaptiveEvaluator {
float P[3], float dPdu[3], float dPdv[3]);
bool GetRefinedTopology(
PxOsdUtilSubdivTopology *t,
OsdUtilSubdivTopology *t,
//positions will have three floats * t->numVertices
std::vector<float> *positions,
std::string *errorMessage = NULL);
@ -106,7 +106,7 @@ class PxOsdUtilAdaptiveEvaluator {
return _refiner->GetHbrMesh();
}
const PxOsdUtilSubdivTopology &GetTopology() const {
const OsdUtilSubdivTopology &GetTopology() const {
return _refiner->GetTopology();
}
@ -120,7 +120,7 @@ class PxOsdUtilAdaptiveEvaluator {
// own the refiner pointer (if _ownsRefiner is true), or it may
// assume that someone else is responsible for managing that pointer
// if _ownsRefiner is false.
PxOsdUtilRefiner *_refiner;
OsdUtilRefiner *_refiner;
bool _ownsRefiner;
OpenSubdiv::OsdCpuComputeContext *_computeContext;

View File

@ -50,9 +50,9 @@ using namespace OpenSubdiv;
/* **************** Types declaration **************** */
typedef struct OpenSubdiv_EvaluatorDescr {
PxOsdUtilSubdivTopology topology;
PxOsdUtilAdaptiveEvaluator evaluator;
std::vector<float> coarsePositions;
OsdUtilSubdivTopology topology;
OsdUtilAdaptiveEvaluator evaluator;
// std::vector<float> coarsePositions;
} OpenSubdiv_EvaluatorDescr;
@ -115,9 +115,11 @@ int openSubdiv_setEvaluatorCoarsePositions(
// TODO: returns void, need error check on length of positions?
evaluator_descr->evaluator.SetCoarsePositions(
&evaluator_descr->coarsePositions[0],
(int)evaluator_descr->coarsePositions.size(),
&errorMessage);
positions, numVertices, &errorMessage);
if (not errorMessage.empty()) {
std::cout << "OpenSubdiv set coarse positions failed due to " << errorMessage << std::endl;
}
// Refine with 1 thread for now
if (not evaluator_descr->evaluator.Refine(1, &errorMessage)) {

View File

@ -32,7 +32,7 @@ extern "C" {
/* Types declaration. */
struct OpenSubdiv_EvaluationDescr;
struct OpenSubdiv_EvaluatorDescr;
/* Methods to create and delete evaluators. */
struct OpenSubdiv_EvaluatorDescr *openSubdiv_createEvaluatorDescr(int numVertices);

View File

@ -39,23 +39,23 @@ using namespace OpenSubdiv;
template <class T>
static void _ProcessTagsAndFinishMesh(
OpenSubdiv::HbrMesh<T> *mesh,
const PxOsdUtilTagData &tagData);
const OsdUtilTagData &tagData);
template <class T>
PxOsdUtilMesh<T>::PxOsdUtilMesh() :
OsdUtilMesh<T>::OsdUtilMesh() :
_hmesh(NULL),
_valid(false)
{
}
template <class T>
PxOsdUtilMesh<T>::~PxOsdUtilMesh()
OsdUtilMesh<T>::~OsdUtilMesh()
{
delete _hmesh;
}
template <class T> bool
PxOsdUtilMesh<T>::Initialize(const PxOsdUtilSubdivTopology &topology,
OsdUtilMesh<T>::Initialize(const OsdUtilSubdivTopology &topology,
std::string *errorMessage)
{
@ -227,7 +227,7 @@ PxOsdUtilMesh<T>::Initialize(const PxOsdUtilSubdivTopology &topology,
// floats into the "fvdata" vector. The number of added floats is:
// names.size() * NumRefinedFaces * 4
template <class T> void
PxOsdUtilMesh<T>::GetRefinedFVData(
OsdUtilMesh<T>::GetRefinedFVData(
int level, const vector<string>& names, vector<float>* outdata)
{
@ -284,7 +284,7 @@ PxOsdUtilMesh<T>::GetRefinedFVData(
template <class T>
void _ProcessTagsAndFinishMesh(
OpenSubdiv::HbrMesh<T> *mesh,
const PxOsdUtilTagData &tagData)
const OsdUtilTagData &tagData)
{
mesh->SetInterpolateBoundaryMethod(OpenSubdiv::HbrMesh<T>::k_InterpolateBoundaryEdgeOnly);
@ -295,12 +295,12 @@ void _ProcessTagsAndFinishMesh(
// TAGS (crease, corner, hole, smooth triangles, edits(vertex,
// edge, face), creasemethod, facevaryingpropagatecorners, interpolateboundary
for(int i = 0; i < (int)tagData.tags.size(); ++i){
PxOsdUtilTagData::TagType tag = tagData.tags[i];
OsdUtilTagData::TagType tag = tagData.tags[i];
int nint = tagData.numArgs[3*i];
int nfloat = tagData.numArgs[3*i+1];
int nstring = tagData.numArgs[3*i+2];
if (tag == PxOsdUtilTagData::INTERPOLATE_BOUNDARY) {
if (tag == OsdUtilTagData::INTERPOLATE_BOUNDARY) {
// Interp boundaries
assert(nint == 1);
switch(currentInt[0]) {
@ -321,7 +321,7 @@ void _ProcessTagsAndFinishMesh(
break;
}
// Processing of this tag is done in mesh->Finish()
} else if (tag == PxOsdUtilTagData::CREASE) {
} else if (tag == OsdUtilTagData::CREASE) {
for(int j = 0; j < nint-1; ++j) {
// Find the appropriate edge
HbrVertex<T>* v = mesh->GetVertex(currentInt[j]);
@ -343,7 +343,7 @@ void _ProcessTagsAndFinishMesh(
e->SetSharpness(std::max(0.0f, ((nfloat > 1) ? currentFloat[j] : currentFloat[0])));
}
}
} else if (tag == PxOsdUtilTagData::CORNER) {
} else if (tag == OsdUtilTagData::CORNER) {
for(int j = 0; j < nint; ++j) {
HbrVertex<T>* v = mesh->GetVertex(currentInt[j]);
if(v) {
@ -354,7 +354,7 @@ void _ProcessTagsAndFinishMesh(
*/
}
}
} else if ( tag == PxOsdUtilTagData::HOLE ) {
} else if ( tag == OsdUtilTagData::HOLE ) {
for(int j = 0; j < nint; ++j) {
HbrFace<T>* f = mesh->GetFace(currentInt[j]);
if(f) {
@ -367,7 +367,7 @@ void _ProcessTagsAndFinishMesh(
}
}
} else if ( tag ==
PxOsdUtilTagData::FACE_VARYING_INTERPOLATE_BOUNDARY) {
OsdUtilTagData::FACE_VARYING_INTERPOLATE_BOUNDARY) {
switch(currentInt[0]) {
case 0:
mesh->SetFVarInterpolateBoundaryMethod(OpenSubdiv::HbrMesh<T>::k_InterpolateBoundaryNone);
@ -388,9 +388,9 @@ void _ProcessTagsAndFinishMesh(
*/
break;
}
} else if ( tag == PxOsdUtilTagData::SMOOTH_TRIANGLES ) {
} else if ( tag == OsdUtilTagData::SMOOTH_TRIANGLES ) {
// Do nothing - CatmarkMesh should handle it
} else if ( tag == PxOsdUtilTagData::CREASE_METHOD) {
} else if ( tag == OsdUtilTagData::CREASE_METHOD) {
if(nstring < 1) {
/*XXX
TF_WARN("Creasemethod tag missing string argument on SubdivisionMesh.\n");
@ -411,7 +411,7 @@ void _ProcessTagsAndFinishMesh(
*/
}
}
} else if ( tag == PxOsdUtilTagData::FACE_VARYING_PROPOGATE_CORNERS) {
} else if ( tag == OsdUtilTagData::FACE_VARYING_PROPOGATE_CORNERS) {
if(nint != 1) {
/*XXX
TF_WARN("Expecting single integer argument for "
@ -420,8 +420,8 @@ void _ProcessTagsAndFinishMesh(
} else {
mesh->SetFVarPropagateCorners(currentInt[0] != 0);
}
} else if (( tag == PxOsdUtilTagData::VERTEX_EDIT) or
( tag == PxOsdUtilTagData::EDGE_EDIT)) {
} else if (( tag == OsdUtilTagData::VERTEX_EDIT) or
( tag == OsdUtilTagData::EDGE_EDIT)) {
// XXX DO EDITS
/*XXX
TF_WARN("vertexedit and edgeedit not yet supported.\n");
@ -446,13 +446,13 @@ void _ProcessTagsAndFinishMesh(
//XXX Note that these explicit template instantiations
// need to live at the _bottom_ of the file.
// Explicitly instantiate PxOsdUtilMesh for these
// Explicitly instantiate OsdUtilMesh for these
// two vertex types. Since the class members are in
// the .cpp file, clients can't create template
// instances other than these two vertex classes.
//template class PxOsdUtilMesh<OsdVertex>;
template class PxOsdUtilMesh<OsdVertex>;
//template class OsdUtilMesh<OsdVertex>;
template class OsdUtilMesh<OsdVertex>;
//template class PxOsdUtilMesh<FarStencilFactoryVertex>;
template class PxOsdUtilMesh<FarStencilFactoryVertex>;
//template class OsdUtilMesh<FarStencilFactoryVertex>;
template class OsdUtilMesh<FarStencilFactoryVertex>;

View File

@ -51,23 +51,23 @@ namespace OPENSUBDIV_VERSION {
// This class is reponsible for taking a topological description of a mesh
// defined by PxOsdUtilSubdivTopology and turn that into a halfedge mesh
// with detailed connectivity information for mesh traversal. A PxOsdUtilMesh
// defined by OsdUtilSubdivTopology and turn that into a halfedge mesh
// with detailed connectivity information for mesh traversal. A OsdUtilMesh
// object is used for uniform and feature adaptive refinement of subdivision
// surfaces (subdivs), which is itself a requirement for fast run-time
// evaluation of subdivs.
//
template <class T>
class PxOsdUtilMesh {
class OsdUtilMesh {
public:
PxOsdUtilMesh();
OsdUtilMesh();
bool Initialize(
const PxOsdUtilSubdivTopology &topology,
const OsdUtilSubdivTopology &topology,
std::string *errorMessage = NULL);
~PxOsdUtilMesh();
~OsdUtilMesh();
// Fetch the face varying attribute values on refined quads
// Traverse the hbrMesh gathering face varying data created
@ -84,11 +84,11 @@ class PxOsdUtilMesh {
const std::string &GetName() { return _t.name;}
const PxOsdUtilSubdivTopology &GetTopology() const {return _t;}
const OsdUtilSubdivTopology &GetTopology() const {return _t;}
private:
PxOsdUtilSubdivTopology _t;
OsdUtilSubdivTopology _t;
std::vector<int> _fvarwidths;
std::vector<int> _fvarindices;

View File

@ -41,7 +41,7 @@ using namespace std;
// mesh topology
PxOsdUtilRefiner::PxOsdUtilRefiner():
OsdUtilRefiner::OsdUtilRefiner():
_adaptive(false),
_mesh(NULL),
_farMesh(NULL),
@ -56,8 +56,8 @@ PxOsdUtilRefiner::PxOsdUtilRefiner():
bool
PxOsdUtilRefiner::Initialize(
const PxOsdUtilSubdivTopology &topology,
OsdUtilRefiner::Initialize(
const OsdUtilSubdivTopology &topology,
bool adaptive,
string *errorMessage)
{
@ -66,13 +66,13 @@ PxOsdUtilRefiner::Initialize(
return false;
}
_mesh = new PxOsdUtilMesh<OsdVertex>();
_mesh = new OsdUtilMesh<OsdVertex>();
if (not _mesh->Initialize(topology, errorMessage)) {
return false;
}
const PxOsdUtilSubdivTopology &t = _mesh->GetTopology();
const OsdUtilSubdivTopology &t = _mesh->GetTopology();
if (adaptive) {
FarMeshFactory<OsdVertex> adaptiveMeshFactory(
@ -140,7 +140,7 @@ PxOsdUtilRefiner::Initialize(
}
bool
PxOsdUtilRefiner::GetRefinedQuads(
OsdUtilRefiner::GetRefinedQuads(
vector<int>* quads,
string *errorMessage) const
{
@ -200,7 +200,7 @@ _InverseRotate(OpenSubdiv::FarPatchParam::BitField bf, float& u, float& v)
}
bool
PxOsdUtilRefiner::GetRefinedPtexUvs(vector<float>* subfaceUvs,
OsdUtilRefiner::GetRefinedPtexUvs(vector<float>* subfaceUvs,
vector<int>* ptexIndices,
string *errorMessage) const
{
@ -266,7 +266,7 @@ PxOsdUtilRefiner::GetRefinedPtexUvs(vector<float>* subfaceUvs,
}
PxOsdUtilRefiner::~PxOsdUtilRefiner() {
OsdUtilRefiner::~OsdUtilRefiner() {
if (_mesh)
delete _mesh;
@ -277,7 +277,7 @@ PxOsdUtilRefiner::~PxOsdUtilRefiner() {
const std::string &
PxOsdUtilRefiner::GetName()
OsdUtilRefiner::GetName()
{
if (_mesh) {
return _mesh->GetName();
@ -288,7 +288,7 @@ PxOsdUtilRefiner::GetName()
}
OpenSubdiv::HbrMesh<OpenSubdiv::OsdVertex>*
PxOsdUtilRefiner::GetHbrMesh()
OsdUtilRefiner::GetHbrMesh()
{
if (_mesh) {
return _mesh->GetHbrMesh();

View File

@ -50,12 +50,12 @@
// At runtime Osd vertex buffers, compute controllers, and compute contexts
// are used for fast evaluation of the surface given the FarMesh.
//----------------------------------------------------------------------------
class PxOsdUtilRefiner {
class OsdUtilRefiner {
public:
PxOsdUtilRefiner();
OsdUtilRefiner();
~PxOsdUtilRefiner();
~OsdUtilRefiner();
// Returns false on error. If errorMessage is non-NULL it'll
// be populated upon error.
@ -64,7 +64,7 @@ class PxOsdUtilRefiner {
// all variables will be populated for later calls to Refine.
//
bool Initialize(
const PxOsdUtilSubdivTopology &topology, bool adaptive,
const OsdUtilSubdivTopology &topology, bool adaptive,
std::string *errorMessage = NULL);
// Fetch the topology of the post-refined mesh. The "quads" vector
@ -99,7 +99,7 @@ class PxOsdUtilRefiner {
OpenSubdiv::HbrMesh<OpenSubdiv::OsdVertex> *GetHbrMesh();
const PxOsdUtilSubdivTopology &GetTopology() const {return _mesh->GetTopology();}
const OsdUtilSubdivTopology &GetTopology() const {return _mesh->GetTopology();}
bool IsRefined() {return _isRefined;}
@ -120,7 +120,7 @@ class PxOsdUtilRefiner {
// The lowest level mesh, it definies the polygonal topology
// and is used for refinement.
PxOsdUtilMesh<OpenSubdiv::OsdVertex>* _mesh;
OsdUtilMesh<OpenSubdiv::OsdVertex>* _mesh;
// A mesh of patches (adaptive), or quads (uniform) generated
// by performing feature adaptive or uniform subdivision on the hbrMesh.

View File

@ -32,19 +32,19 @@
using namespace std;
PxOsdUtilSubdivTopology::PxOsdUtilSubdivTopology():
OsdUtilSubdivTopology::OsdUtilSubdivTopology():
name("noname"),
numVertices(0),
refinementLevel(2) // arbitrary, start with a reasonable subdivision level
{
}
PxOsdUtilSubdivTopology::~PxOsdUtilSubdivTopology()
OsdUtilSubdivTopology::~OsdUtilSubdivTopology()
{
}
bool
PxOsdUtilSubdivTopology::Initialize(
OsdUtilSubdivTopology::Initialize(
int numVerticesParam,
const int *nvertsParam, int numFaces,
const int *indicesParam, int indicesLen,
@ -70,7 +70,7 @@ PxOsdUtilSubdivTopology::Initialize(
bool
PxOsdUtilSubdivTopology::IsValid(string *errorMessage) const
OsdUtilSubdivTopology::IsValid(string *errorMessage) const
{
if (numVertices == 0) {
if (errorMessage) {
@ -120,7 +120,7 @@ PxOsdUtilSubdivTopology::IsValid(string *errorMessage) const
void
PxOsdUtilSubdivTopology::Print() const
OsdUtilSubdivTopology::Print() const
{
std::cout << "Mesh " << name << "\n";
std::cout << "\tnumVertices = " << numVertices << "\n";
@ -142,7 +142,7 @@ PxOsdUtilSubdivTopology::Print() const
bool
PxOsdUtilSubdivTopology::ReadFromObjFile( char const * fname,
OsdUtilSubdivTopology::ReadFromObjFile( char const * fname,
vector<float> *pointPositions,
std::string *errorMessage ) {
@ -197,7 +197,7 @@ static char const * sgets( char * s, int size, char ** stream ) {
}
bool
PxOsdUtilSubdivTopology::ParseFromObjString(
OsdUtilSubdivTopology::ParseFromObjString(
char const * shapestr, int axis,
vector<float> *pointPositions,
std::string *errorMessage)
@ -270,30 +270,30 @@ PxOsdUtilSubdivTopology::ParseFromObjString(
bool PxOsdUtilTagData::TagTypeFromString(
PxOsdUtilTagData::TagType *tagType,
bool OsdUtilTagData::TagTypeFromString(
OsdUtilTagData::TagType *tagType,
const std::string &str)
{
if (str == "corner") {
*tagType = PxOsdUtilTagData::CORNER;
*tagType = OsdUtilTagData::CORNER;
} else if (str == "crease") {
*tagType = PxOsdUtilTagData::CREASE;
*tagType = OsdUtilTagData::CREASE;
} else if (str == "creasemethod") {
*tagType = PxOsdUtilTagData::CREASE_METHOD;
*tagType = OsdUtilTagData::CREASE_METHOD;
} else if (str == "facevaryinginterpolateboundary") {
*tagType = PxOsdUtilTagData::FACE_VARYING_INTERPOLATE_BOUNDARY;
*tagType = OsdUtilTagData::FACE_VARYING_INTERPOLATE_BOUNDARY;
} else if (str == "facevaryingpropagatecorners") {
*tagType = PxOsdUtilTagData::FACE_VARYING_PROPOGATE_CORNERS;
*tagType = OsdUtilTagData::FACE_VARYING_PROPOGATE_CORNERS;
} else if (str == "hole") {
*tagType = PxOsdUtilTagData::HOLE;
*tagType = OsdUtilTagData::HOLE;
} else if (str == "interpolateboundary") {
*tagType = PxOsdUtilTagData::INTERPOLATE_BOUNDARY;
*tagType = OsdUtilTagData::INTERPOLATE_BOUNDARY;
} else if (str == "smoothtriangles") {
*tagType = PxOsdUtilTagData::SMOOTH_TRIANGLES;
*tagType = OsdUtilTagData::SMOOTH_TRIANGLES;
} else if (str == "vertexedit") {
*tagType = PxOsdUtilTagData::VERTEX_EDIT;
*tagType = OsdUtilTagData::VERTEX_EDIT;
} else if (str == "edgeedit") {
*tagType = PxOsdUtilTagData::EDGE_EDIT;
*tagType = OsdUtilTagData::EDGE_EDIT;
} else {
return false;
}
@ -306,7 +306,7 @@ bool PxOsdUtilTagData::TagTypeFromString(
// If numSharpness == 1, the single sharpness value applies for all vertices
// If numSharpness == numIndices, there is a per-vertex sharpness
bool
PxOsdUtilTagData::AddCorner(int *indices, int numIndices,
OsdUtilTagData::AddCorner(int *indices, int numIndices,
float *sharpness, int numSharpness)
{
tags.push_back(CORNER);
@ -330,7 +330,7 @@ PxOsdUtilTagData::AddCorner(int *indices, int numIndices,
// If numSharpness == numIndices, there is a per-edge sharpness that
// will be interpolated along the crease
bool
PxOsdUtilTagData::AddCrease(int *indices, int numIndices,
OsdUtilTagData::AddCrease(int *indices, int numIndices,
float *sharpness, int numSharpness)
{
return true;
@ -338,7 +338,7 @@ PxOsdUtilTagData::AddCrease(int *indices, int numIndices,
// Either "normal" or "chaikin"
bool
PxOsdUtilTagData::AddCreaseMethod(const std::string &value)
OsdUtilTagData::AddCreaseMethod(const std::string &value)
{
return true;
}
@ -347,7 +347,7 @@ PxOsdUtilTagData::AddCreaseMethod(const std::string &value)
// 1 == OpenSubdiv::HbrMesh<T>::k_InterpolateBoundaryEdgeAndCorner
// 2 == OpenSubdiv::HbrMesh<T>::k_InterpolateBoundaryEdgeOnly
bool
PxOsdUtilTagData::AddInterpolateBoundary(int value)
OsdUtilTagData::AddInterpolateBoundary(int value)
{
return true;
@ -356,7 +356,7 @@ PxOsdUtilTagData::AddInterpolateBoundary(int value)
bool
PxOsdUtilSubdivTopology::WriteObjFile(
OsdUtilSubdivTopology::WriteObjFile(
const char *filename,
const float *positions,
std::string *errorMessage)

View File

@ -35,7 +35,7 @@
// For OpenSubdiv documentation on tags, see:
// See http://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#hierarchical-edits
//
class PxOsdUtilTagData {
class OsdUtilTagData {
public:
enum TagType {
// The strings in comments are the strings as specified by renderman
@ -95,11 +95,11 @@ public:
// of a subdivision surface, and any annotation tags.
// It is used to initialize classes that create and operate on subdivs.
//
class PxOsdUtilSubdivTopology {
class OsdUtilSubdivTopology {
public:
PxOsdUtilSubdivTopology();
~PxOsdUtilSubdivTopology();
OsdUtilSubdivTopology();
~OsdUtilSubdivTopology();
// XXX Would be great for these members to be private with accessors
std::string name;
@ -110,7 +110,7 @@ class PxOsdUtilSubdivTopology {
std::vector<std::string> vvNames;
std::vector<std::string> fvNames;
std::vector<float> fvData;
PxOsdUtilTagData tagData;
OsdUtilTagData tagData;
void AddFace(int numVertsInFace, int *verts) {
nverts.push_back(numVertsInFace);

View File

@ -44,7 +44,7 @@ using namespace OpenSubdiv;
using namespace std;
PxOsdUtilUniformEvaluator::PxOsdUtilUniformEvaluator():
OsdUtilUniformEvaluator::OsdUtilUniformEvaluator():
_refiner(NULL),
_ownsRefiner(false),
_computeContext(NULL),
@ -53,7 +53,7 @@ PxOsdUtilUniformEvaluator::PxOsdUtilUniformEvaluator():
{
}
PxOsdUtilUniformEvaluator::~PxOsdUtilUniformEvaluator()
OsdUtilUniformEvaluator::~OsdUtilUniformEvaluator()
{
if (_ownsRefiner and _refiner) {
delete _refiner;
@ -68,14 +68,14 @@ PxOsdUtilUniformEvaluator::~PxOsdUtilUniformEvaluator()
bool
PxOsdUtilUniformEvaluator::Initialize(
const PxOsdUtilSubdivTopology &t,
OsdUtilUniformEvaluator::Initialize(
const OsdUtilSubdivTopology &t,
string *errorMessage)
{
// create and initialize a refiner, passing "false" for adaptive
// to indicate we wish for uniform refinement
PxOsdUtilRefiner *refiner = new PxOsdUtilRefiner();
OsdUtilRefiner *refiner = new OsdUtilRefiner();
_ownsRefiner = true;
if (not refiner->Initialize(t, false, errorMessage)) {
@ -86,8 +86,8 @@ PxOsdUtilUniformEvaluator::Initialize(
}
bool
PxOsdUtilUniformEvaluator::Initialize(
PxOsdUtilRefiner *refiner,
OsdUtilUniformEvaluator::Initialize(
OsdUtilRefiner *refiner,
string *errorMessage)
{
@ -164,7 +164,7 @@ PxOsdUtilUniformEvaluator::Initialize(
void
PxOsdUtilUniformEvaluator::SetCoarsePositions(
OsdUtilUniformEvaluator::SetCoarsePositions(
const vector<float>& coords, string *errorMessage )
{
const float* pFloats = &coords.front();
@ -181,7 +181,7 @@ PxOsdUtilUniformEvaluator::SetCoarsePositions(
void
PxOsdUtilUniformEvaluator::SetCoarseVVData(
OsdUtilUniformEvaluator::SetCoarseVVData(
const vector<float>& data, string *errorMessage
)
{
@ -200,7 +200,7 @@ PxOsdUtilUniformEvaluator::SetCoarseVVData(
bool
PxOsdUtilUniformEvaluator::Refine(
OsdUtilUniformEvaluator::Refine(
int numThreads, string *errorMessage)
{
const FarMesh<OsdVertex> *fmesh = _refiner->GetFarMesh();
@ -226,7 +226,7 @@ PxOsdUtilUniformEvaluator::Refine(
}
bool
PxOsdUtilUniformEvaluator::GetRefinedPositions(
OsdUtilUniformEvaluator::GetRefinedPositions(
const float **positions, int *numFloats,
string *errorMessage) const
{
@ -268,7 +268,7 @@ PxOsdUtilUniformEvaluator::GetRefinedPositions(
bool
PxOsdUtilUniformEvaluator::GetRefinedVVData(
OsdUtilUniformEvaluator::GetRefinedVVData(
float **data, int *numFloats, int *numElementsRetVal,
std::string *errorMessage ) const
{
@ -318,8 +318,8 @@ PxOsdUtilUniformEvaluator::GetRefinedVVData(
bool
PxOsdUtilUniformEvaluator::GetRefinedTopology(
PxOsdUtilSubdivTopology *t,
OsdUtilUniformEvaluator::GetRefinedTopology(
OsdUtilSubdivTopology *t,
//positions will have three floats * t->numVertices
const float **positions,
std::string *errorMessage)

View File

@ -42,13 +42,13 @@
//
// An important note here is that refined positions and vertex varying
// attributes are sampled at the n-th subdivision level, not at the
// exact limit surface. Use PxOsdUtilAdaptiveEvaluator for true limits.
// exact limit surface. Use OsdUtilAdaptiveEvaluator for true limits.
//
class PxOsdUtilUniformEvaluator {
class OsdUtilUniformEvaluator {
public:
PxOsdUtilUniformEvaluator();
OsdUtilUniformEvaluator();
~PxOsdUtilUniformEvaluator();
~OsdUtilUniformEvaluator();
// Initialize returns false on error. If errorMessage is non-NULL it'll
// be populated upon error.
@ -63,11 +63,11 @@ class PxOsdUtilUniformEvaluator {
// of refiners among evaluators.
//
bool Initialize(
PxOsdUtilRefiner* refiner,
OsdUtilRefiner* refiner,
std::string *errorMessage = NULL);
bool Initialize(
const PxOsdUtilSubdivTopology &topology,
const OsdUtilSubdivTopology &topology,
std::string *errorMessage = NULL);
// Set new coarse-mesh CV positions, need to call Refine
@ -138,7 +138,7 @@ class PxOsdUtilUniformEvaluator {
}
bool GetRefinedTopology(
PxOsdUtilSubdivTopology *t,
OsdUtilSubdivTopology *t,
//positions will have three floats * t->numVertices
const float **positions,
std::string *errorMessage = NULL);
@ -153,7 +153,7 @@ class PxOsdUtilUniformEvaluator {
return _refiner->GetHbrMesh();
}
const PxOsdUtilSubdivTopology &GetTopology() const {
const OsdUtilSubdivTopology &GetTopology() const {
return _refiner->GetTopology();
}
@ -167,7 +167,7 @@ class PxOsdUtilUniformEvaluator {
// own the refiner pointer (if _ownsRefiner is true), or it may
// assume that someone else is responsible for managing that pointer
// if _ownsRefiner is false.
PxOsdUtilRefiner *_refiner;
OsdUtilRefiner *_refiner;
bool _ownsRefiner;
// responsible for performing uniform catmull/clark subdivision