mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2025-01-06 06:50:07 +00:00
comments
This commit is contained in:
parent
784b6e4475
commit
1cfcb2ae79
@ -77,32 +77,32 @@ template <class T> class FarPatchTablesFactory {
|
||||
protected:
|
||||
template <class X, class Y> friend class FarMeshFactory;
|
||||
|
||||
/// Factory constructor
|
||||
/// Factory constructor for feature-adaptive meshes
|
||||
///
|
||||
/// @param mesh Hbr mesh to generate tables for
|
||||
/// @param mesh Hbr mesh to generate tables for
|
||||
///
|
||||
/// @param nfaces Number of faces in the mesh (cached for speed)
|
||||
/// @param nfaces Number of faces in the mesh (cached for speed)
|
||||
///
|
||||
/// @param remapTable Vertex remapping table generated by FarMeshFactory
|
||||
/// @param remapTable Vertex remapping table generated by FarMeshFactory
|
||||
///
|
||||
FarPatchTablesFactory( HbrMesh<T> const * mesh, int nfaces, std::vector<int> const & remapTable );
|
||||
|
||||
/// Returns a feature-adaptive FarPatchTables instance
|
||||
///
|
||||
/// @param maxlevel Highest level of refinement processed
|
||||
/// @param maxlevel Highest level of refinement processed
|
||||
///
|
||||
/// @param maxvalence Maximum vertex valence in the mesh
|
||||
/// @param maxvalence Maximum vertex valence in the mesh
|
||||
///
|
||||
/// @param requireFVarData Flag for generating face-varying data
|
||||
/// @param requireFVarData Flag for generating face-varying data
|
||||
///
|
||||
/// @return a new instance of FarPatchTables
|
||||
/// @return A new instance of FarPatchTables
|
||||
///
|
||||
FarPatchTables * Create( int maxlevel, int maxvalence, bool requireFVarData=false );
|
||||
|
||||
|
||||
typedef std::vector<std::vector< HbrFace<T> *> > FacesList;
|
||||
|
||||
/// Returns a uniform FarPatchTables instance
|
||||
/// Factory constructor for uniform meshes
|
||||
///
|
||||
/// @param mesh Hbr mesh to generate tables for
|
||||
///
|
||||
@ -118,7 +118,7 @@ protected:
|
||||
///
|
||||
/// @param remapTable Vertex remapping table generated by FarMeshFactory
|
||||
///
|
||||
/// @return a new instance of FarPatchTables
|
||||
/// @return A new instance of FarPatchTables
|
||||
///
|
||||
static FarPatchTables * Create( HbrMesh<T> const * mesh,
|
||||
FacesList const & flist,
|
||||
@ -157,6 +157,7 @@ private:
|
||||
// The number of patch arrays in the mesh
|
||||
int getNumPatchArrays() const;
|
||||
|
||||
// Reserves tables based on the contents of the PatchArrayVector
|
||||
static void allocateTables( FarPatchTables * tables, int fvarwidth );
|
||||
|
||||
// A convenience container for the different types of feature adaptive patches
|
||||
@ -176,7 +177,6 @@ private:
|
||||
int getNumPatchArrays() const;
|
||||
};
|
||||
|
||||
// Useful typedefs
|
||||
typedef PatchTypes<unsigned int*> CVPointers;
|
||||
typedef PatchTypes<FarPatchParam *> ParamPointers;
|
||||
typedef PatchTypes<float *> FVarPointers;
|
||||
@ -199,6 +199,8 @@ private:
|
||||
int _nfaces;
|
||||
};
|
||||
|
||||
// True if the surrounding faces are "tagged" (unsupported feature : watertight
|
||||
// critical patches)
|
||||
template <class T> bool
|
||||
FarPatchTablesFactory<T>::vertexHasTaggedNeighbors(HbrVertex<T> * v) {
|
||||
|
||||
@ -247,6 +249,7 @@ FarPatchTablesFactory<T>::computeCornerPatchRotation( HbrFace<T> * f ) {
|
||||
return rot;
|
||||
}
|
||||
|
||||
// Reserves tables based on the contents of the PatchArrayVector
|
||||
template <class T> void
|
||||
FarPatchTablesFactory<T>::allocateTables( FarPatchTables * tables, int fvarwidth ) {
|
||||
|
||||
@ -256,10 +259,8 @@ FarPatchTablesFactory<T>::allocateTables( FarPatchTables * tables, int fvarwidth
|
||||
if (nverts==0 or npatches==0)
|
||||
return;
|
||||
|
||||
// Reserve memory for the tables
|
||||
tables->_patches.resize( nverts );
|
||||
|
||||
// Allocate memory for the ptex coord tables
|
||||
tables->_paramTable.resize( npatches );
|
||||
|
||||
if (fvarwidth>0) {
|
||||
@ -267,6 +268,7 @@ FarPatchTablesFactory<T>::allocateTables( FarPatchTables * tables, int fvarwidth
|
||||
}
|
||||
}
|
||||
|
||||
// Uniform mesh factory (static function because it requires no cached state)
|
||||
template <class T> FarPatchTables *
|
||||
FarPatchTablesFactory<T>::Create( HbrMesh<T> const * mesh, FacesList const & flist, std::vector<int> const & remapTable, int firstLevel, bool requireFVarData ) {
|
||||
|
||||
@ -282,6 +284,7 @@ FarPatchTablesFactory<T>::Create( HbrMesh<T> const * mesh, FacesList const & fli
|
||||
int firstArray = firstLevel > -1 ? firstLevel : (int)flist.size()-1;
|
||||
|
||||
// Populate the patch array descriptors
|
||||
|
||||
FarPatchTables::PatchArrayVector & parray = result->_patchArrays;
|
||||
parray.reserve( (int)flist.size() - firstArray );
|
||||
|
||||
@ -301,6 +304,8 @@ FarPatchTablesFactory<T>::Create( HbrMesh<T> const * mesh, FacesList const & fli
|
||||
|
||||
int fvarwidth = requireFVarData ? mesh->GetTotalFVarWidth() : 0;
|
||||
|
||||
// Populate the patch / param / fvar tables
|
||||
|
||||
allocateTables( result, fvarwidth );
|
||||
|
||||
unsigned int * iptr = &result->_patches[0];
|
||||
@ -327,6 +332,7 @@ FarPatchTablesFactory<T>::Create( HbrMesh<T> const * mesh, FacesList const & fli
|
||||
return result;
|
||||
}
|
||||
|
||||
// Feature adaptive mesh factory
|
||||
template <class T>
|
||||
FarPatchTablesFactory<T>::FarPatchTablesFactory( HbrMesh<T> const * mesh, int nfaces, std::vector<int> const & remapTable ) :
|
||||
_mesh(mesh),
|
||||
|
Loading…
Reference in New Issue
Block a user