mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-09 22:00:06 +00:00
Modified Far::TopologyRefinerFactory<>::Create() take new Options as argument
- update examples, tutorials, regressions, etc. accordingly
This commit is contained in:
parent
513dc96405
commit
865fe5591f
@ -661,7 +661,8 @@ createOsdMesh(int level, int kernel) {
|
||||
OpenSubdiv::Sdc::Options sdcoptions = GetSdcOptions(*shape);
|
||||
|
||||
OpenSubdiv::Far::TopologyRefiner * refiner =
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(sdctype, sdcoptions, *shape);
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(*shape,
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Options(sdctype, sdcoptions));
|
||||
|
||||
// save coarse topology (used for coarse mesh drawing)
|
||||
|
||||
|
@ -282,7 +282,8 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme=
|
||||
OpenSubdiv::Sdc::Options sdcoptions = GetSdcOptions(*shape);
|
||||
|
||||
OpenSubdiv::Far::TopologyRefiner * refiner =
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(sdctype, sdcoptions, *shape);
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(*shape,
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Options(sdctype, sdcoptions));
|
||||
|
||||
// save coarse topology (used for coarse mesh drawing)
|
||||
int nedges = refiner->GetNumEdges(0),
|
||||
|
@ -333,7 +333,8 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level) {
|
||||
|
||||
delete g_topologyRefiner;
|
||||
OpenSubdiv::Far::TopologyRefiner * g_topologyRefiner =
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(sdctype, sdcoptions, *shape);
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(*shape,
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Options(sdctype, sdcoptions));
|
||||
|
||||
g_orgPositions=shape->verts;
|
||||
g_positions.resize(g_orgPositions.size(), 0.0f);
|
||||
|
@ -319,7 +319,8 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, Scheme scheme = kCatmark)
|
||||
sdcoptions.SetFVarLinearInterpolation(g_fvarBoundary);
|
||||
|
||||
OpenSubdiv::Far::TopologyRefiner * refiner =
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(sdctype, sdcoptions, *shape);
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(*shape,
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Options(sdctype, sdcoptions));
|
||||
|
||||
// save coarse topology (used for coarse mesh drawing)
|
||||
int nedges = refiner->GetNumEdges(0),
|
||||
|
@ -225,7 +225,8 @@ createOsdMesh() {
|
||||
OpenSubdiv::Sdc::Options sdcoptions = GetSdcOptions(*shape);
|
||||
|
||||
OpenSubdiv::Far::TopologyRefiner * refiner =
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(sdctype, sdcoptions, *shape);
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(*shape,
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Options(sdctype, sdcoptions));
|
||||
|
||||
// count ptex face id
|
||||
int numPtexFaces = refiner->GetNumPtexFaces();
|
||||
|
@ -1005,7 +1005,8 @@ createOsdMesh(int level, int kernel) {
|
||||
OpenSubdiv::Sdc::Options sdcoptions = GetSdcOptions(*shape);
|
||||
|
||||
OpenSubdiv::Far::TopologyRefiner * refiner =
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(sdctype, sdcoptions, *shape);
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(*shape,
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Options(sdctype, sdcoptions));
|
||||
|
||||
// save coarse topology (used for coarse mesh drawing)
|
||||
|
||||
|
@ -575,7 +575,8 @@ createOsdMesh( const std::string &shapeStr, int level, Scheme scheme=kCatmark )
|
||||
Sdc::Type type = GetSdcType(*shape);
|
||||
Sdc::Options options = GetSdcOptions(*shape);
|
||||
|
||||
refiner = Far::TopologyRefinerFactory<Shape>::Create(type, options, *shape);
|
||||
refiner = Far::TopologyRefinerFactory<Shape>::Create(*shape,
|
||||
Far::TopologyRefinerFactory<Shape>::Options(type, options));
|
||||
|
||||
assert(refiner);
|
||||
}
|
||||
|
@ -293,7 +293,8 @@ createMesh(ShapeDesc const & shapeDesc, int level) {
|
||||
OpenSubdiv::Sdc::Options sdcoptions = GetSdcOptions(*shape);
|
||||
|
||||
OpenSubdiv::Far::TopologyRefiner * refiner =
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(sdctype, sdcoptions, *shape);
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(*shape,
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Options(sdctype, sdcoptions));
|
||||
|
||||
// save coarse topology (used for coarse mesh drawing)
|
||||
int nedges = refiner->GetNumEdges(0),
|
||||
|
@ -494,7 +494,8 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme=
|
||||
OpenSubdiv::Sdc::Options sdcoptions = GetSdcOptions(*shape);
|
||||
|
||||
OpenSubdiv::Far::TopologyRefiner * refiner =
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(sdctype, sdcoptions, *shape);
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(*shape,
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Options(sdctype, sdcoptions));
|
||||
|
||||
// save coarse topology (used for coarse mesh drawing)
|
||||
int nedges = refiner->GetNumEdges(0),
|
||||
|
@ -384,7 +384,8 @@ gatherTopology( MFnMesh const & inMeshFn,
|
||||
float maxVertexCrease = getCreaseVertices( inMeshFn, desc );
|
||||
|
||||
OpenSubdiv::Far::TopologyRefiner * refiner =
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Descriptor>::Create(type, options, desc);
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Descriptor>::Create(desc,
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Descriptor>::Options(type, options));
|
||||
|
||||
delete [] desc.numVertsPerFace;
|
||||
delete [] desc.vertIndicesPerFace;
|
||||
|
@ -660,7 +660,8 @@ createVtrMesh(Shape * shape, int maxlevel) {
|
||||
OpenSubdiv::Sdc::Options sdcoptions = GetSdcOptions(*shape);
|
||||
|
||||
OpenSubdiv::Far::TopologyRefiner * refiner =
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(sdctype, sdcoptions, *shape);
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Create(*shape,
|
||||
OpenSubdiv::Far::TopologyRefinerFactory<Shape>::Options(sdctype, sdcoptions));
|
||||
|
||||
if (g_Adaptive) {
|
||||
OpenSubdiv::Far::TopologyRefiner::AdaptiveOptions options(maxlevel);
|
||||
|
@ -120,6 +120,21 @@ class TopologyRefinerFactory : public TopologyRefinerFactoryBase {
|
||||
|
||||
public:
|
||||
|
||||
struct Options {
|
||||
|
||||
Options(Sdc::Type sdcType = Sdc::TYPE_CATMARK, Sdc::Options sdcOptions = Sdc::Options()) :
|
||||
schemeType(sdcType),
|
||||
schemeOptions(sdcOptions),
|
||||
validateFullTopology(false) { }
|
||||
|
||||
Sdc::Type schemeType; ///< The subdivision scheme type identifier
|
||||
Sdc::Options schemeOptions; ///< The full set of options for the scheme,
|
||||
///< e.g. boundary interpolation rules...
|
||||
unsigned int validateFullTopology : 1; ///< Apply more extensive validation of
|
||||
///< the constructed topology -- intended
|
||||
///< for debugging.
|
||||
};
|
||||
|
||||
/// \brief Instantiates TopologyRefiner from client-provided topological
|
||||
/// representation.
|
||||
///
|
||||
@ -128,15 +143,13 @@ public:
|
||||
/// requires additional processing. If the client topological rep can
|
||||
/// provide this information, it is highly recommended to do so.
|
||||
///
|
||||
/// @param type The subdivision scheme
|
||||
/// @param mesh Client's topological representation (or a converter)
|
||||
//
|
||||
/// @param options Options controlling the creation of the TopologyRefiner
|
||||
///
|
||||
/// @param options Subdivion options (boundary interpolation rules...)
|
||||
/// return A new instance of TopologyRefiner or NULL for failure
|
||||
///
|
||||
/// @param mesh Client topological representation (or a converter)
|
||||
///
|
||||
/// return An instance of TopologyRefiner or NULL for failure
|
||||
///
|
||||
static TopologyRefiner* Create(Sdc::Type type, Sdc::Options options, MESH const& mesh);
|
||||
static TopologyRefiner* Create(MESH const& mesh, Options options = Options());
|
||||
|
||||
protected:
|
||||
//
|
||||
@ -170,9 +183,9 @@ protected:
|
||||
//
|
||||
template <class MESH>
|
||||
TopologyRefiner*
|
||||
TopologyRefinerFactory<MESH>::Create(Sdc::Type type, Sdc::Options options, MESH const& mesh) {
|
||||
TopologyRefinerFactory<MESH>::Create(MESH const& mesh, Options options) {
|
||||
|
||||
TopologyRefiner * refiner = new TopologyRefiner(type, options);
|
||||
TopologyRefiner * refiner = new TopologyRefiner(options.schemeType, options.schemeOptions);
|
||||
|
||||
//
|
||||
// Construction of a specialized topology refiner involves four steps, each of which
|
||||
@ -202,8 +215,7 @@ TopologyRefinerFactory<MESH>::Create(Sdc::Type type, Sdc::Options options, MESH
|
||||
if (valid) {
|
||||
assignComponentTopology(*refiner, mesh);
|
||||
|
||||
bool fullTopologyValidation = false;
|
||||
valid = prepareComponentTopologyAssignment(*refiner, fullTopologyValidation);
|
||||
valid = prepareComponentTopologyAssignment(*refiner, options.validateFullTopology);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -151,8 +151,8 @@ interpolateVtrVertexData(ShapeDesc const & desc, int maxlevel, std::vector<xyzVV
|
||||
Shape * shape = Shape::parseObj(desc.data.c_str(), desc.scheme);
|
||||
|
||||
FarTopologyRefiner * refiner =
|
||||
FarTopologyRefinerFactory::Create(
|
||||
GetSdcType(*shape), GetSdcOptions(*shape), *shape);
|
||||
FarTopologyRefinerFactory::Create(*shape,
|
||||
FarTopologyRefinerFactory::Options(GetSdcType(*shape), GetSdcOptions(*shape)));
|
||||
assert(refiner);
|
||||
|
||||
FarTopologyRefiner::UniformOptions options(maxlevel);
|
||||
|
@ -120,7 +120,8 @@ int main(int, char **) {
|
||||
|
||||
|
||||
// Instantiate a FarTopologyRefiner from the descriptor
|
||||
Far::TopologyRefiner * refiner = Far::TopologyRefinerFactory<Descriptor>::Create(type, options, desc);
|
||||
Far::TopologyRefiner * refiner = Far::TopologyRefinerFactory<Descriptor>::Create(desc,
|
||||
Far::TopologyRefinerFactory<Descriptor>::Options(type, options));
|
||||
|
||||
int maxlevel = 2;
|
||||
|
||||
|
@ -418,8 +418,9 @@ int main(int, char **) {
|
||||
|
||||
Converter conv;
|
||||
|
||||
Far::TopologyRefiner * refiner = Far::TopologyRefinerFactory<Converter>::Create(
|
||||
conv.GetType(), conv.GetOptions(), conv);
|
||||
Far::TopologyRefiner * refiner =
|
||||
Far::TopologyRefinerFactory<Converter>::Create(conv,
|
||||
Far::TopologyRefinerFactory<Converter>::Options(conv.GetType(), conv.GetOptions()));
|
||||
|
||||
|
||||
int maxlevel = 5;
|
||||
|
@ -221,7 +221,9 @@ createFarTopologyRefiner() {
|
||||
desc.vertIndicesPerFace = g_vertIndices;
|
||||
|
||||
// Instantiate a Far::TopologyRefiner from the descriptor
|
||||
Far::TopologyRefiner * refiner = Far::TopologyRefinerFactory<Descriptor>::Create(type, options, desc);
|
||||
Far::TopologyRefiner * refiner =
|
||||
Far::TopologyRefinerFactory<Descriptor>::Create(desc,
|
||||
Far::TopologyRefinerFactory<Descriptor>::Options(type, options));
|
||||
|
||||
return refiner;
|
||||
}
|
||||
|
@ -187,7 +187,9 @@ int main(int, char **) {
|
||||
desc.fvarChannels = & uvs;
|
||||
|
||||
// Instantiate a FarTopologyRefiner from the descriptor
|
||||
Far::TopologyRefiner * refiner = Far::TopologyRefinerFactory<Descriptor>::Create(type, options, desc);
|
||||
Far::TopologyRefiner * refiner =
|
||||
Far::TopologyRefinerFactory<Descriptor>::Create(desc,
|
||||
Far::TopologyRefinerFactory<Descriptor>::Options(type, options));
|
||||
|
||||
// Uniformly refine the topolgy up to 'maxlevel'
|
||||
// note: fullTopologyInLastLevel must be true to work with face-varying data
|
||||
|
@ -178,7 +178,8 @@ createTopologyRefiner() {
|
||||
desc.vertIndicesPerFace = g_vertIndices;
|
||||
|
||||
// Instantiate a FarTopologyRefiner from the descriptor.
|
||||
return Far::TopologyRefinerFactory<Descriptor>::Create(type, options, desc);
|
||||
return Far::TopologyRefinerFactory<Descriptor>::Create(desc,
|
||||
Far::TopologyRefinerFactory<Descriptor>::Options(type, options));
|
||||
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,8 @@ createTopologyRefiner() {
|
||||
|
||||
// Instantiate a FarTopologyRefiner from the descriptor.
|
||||
Far::TopologyRefiner * refiner =
|
||||
Far::TopologyRefinerFactory<Descriptor>::Create(type, options, desc);
|
||||
Far::TopologyRefinerFactory<Descriptor>::Create(desc,
|
||||
Far::TopologyRefinerFactory<Descriptor>::Options(type, options));
|
||||
|
||||
return refiner;
|
||||
}
|
||||
|
@ -257,7 +257,8 @@ createTopologyRefiner() {
|
||||
|
||||
// Instantiate a FarTopologyRefiner from the descriptor.
|
||||
Far::TopologyRefiner * refiner =
|
||||
Far::TopologyRefinerFactory<Descriptor>::Create(type, options, desc);
|
||||
Far::TopologyRefinerFactory<Descriptor>::Create(desc,
|
||||
Far::TopologyRefinerFactory<Descriptor>::Options(type, options));
|
||||
|
||||
return refiner;
|
||||
}
|
||||
|
@ -230,7 +230,8 @@ createTopologyRefiner() {
|
||||
desc.vertIndicesPerFace = g_vertIndices;
|
||||
|
||||
// Instantiate a FarTopologyRefiner from the descriptor.
|
||||
return Far::TopologyRefinerFactory<Descriptor>::Create(type, options, desc);
|
||||
return Far::TopologyRefinerFactory<Descriptor>::Create(desc,
|
||||
Far::TopologyRefinerFactory<Descriptor>::Options(type, options));
|
||||
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,8 @@ createTopologyRefiner(int maxlevel) {
|
||||
|
||||
// Instantiate a FarTopologyRefiner from the descriptor
|
||||
Far::TopologyRefiner * refiner =
|
||||
Far::TopologyRefinerFactory<Descriptor>::Create(type, options, desc);
|
||||
Far::TopologyRefinerFactory<Descriptor>::Create(desc,
|
||||
Far::TopologyRefinerFactory<Descriptor>::Options(type, options));
|
||||
|
||||
// Uniformly refine the topolgy up to 'maxlevel'
|
||||
refiner->RefineUniform(Far::TopologyRefiner::UniformOptions(maxlevel));
|
||||
|
Loading…
Reference in New Issue
Block a user