mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-09 13:50:05 +00:00
Minor improvements to Far tutorials:
- addressed leaks-on-exit (#1226) and return value from main() for all - fixed color indexing bug in tutorial_2_2 (#1241) - suppressed a few compiler warnings
This commit is contained in:
parent
35c1c5f642
commit
a492af45e3
@ -182,6 +182,9 @@ int main(int, char **) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
delete refiner;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -289,4 +289,7 @@ int main(int, char **) {
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
delete refiner;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -207,6 +207,9 @@ int main(int, char **) {
|
||||
}
|
||||
printf(";\n");
|
||||
}
|
||||
|
||||
delete refiner;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -333,7 +333,7 @@ int main(int, char **) {
|
||||
// Print colors
|
||||
int firstOfLastColors = refiner->GetNumFVarValuesTotal(channelColor) - ncolors;
|
||||
|
||||
for (int fvvert = 0; fvvert < nuvs; ++fvvert) {
|
||||
for (int fvvert = 0; fvvert < ncolors; ++fvvert) {
|
||||
FVarVertexColor const & c = fvVertsColor[firstOfLastColors + fvvert];
|
||||
printf("c %f %f %f %f\n", c.r, c.g, c.b, c.a);
|
||||
}
|
||||
@ -355,5 +355,8 @@ int main(int, char **) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
delete refiner;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -523,5 +523,8 @@ int main(int argc, char ** argv) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
delete refiner;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -269,7 +269,7 @@ bool
|
||||
TopologyRefinerFactory<Converter>::assignComponentTopology(
|
||||
TopologyRefiner & refiner, Converter const & conv) {
|
||||
|
||||
typedef Far::IndexArray IndexArray;
|
||||
using Far::IndexArray;
|
||||
|
||||
{ // Face relations:
|
||||
int nfaces = conv.GetNumFaces();
|
||||
@ -488,6 +488,9 @@ int main(int, char **) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
delete refiner;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -155,6 +155,7 @@ int main(int, char **) {
|
||||
|
||||
delete refiner;
|
||||
delete stencilTable;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -206,6 +206,7 @@ int main(int, char **) {
|
||||
|
||||
delete vertexStencils;
|
||||
delete varyingStencils;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -209,6 +209,7 @@ int main(int, char **) {
|
||||
|
||||
delete refiner;
|
||||
delete stencilTable;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -222,10 +222,10 @@ int main(int, char **) {
|
||||
Far::PtexIndices ptexIndices(*refiner);
|
||||
|
||||
// Generate random samples on each ptex face
|
||||
int nsamples = 200,
|
||||
int nsamplesPerFace = 200,
|
||||
nfaces = ptexIndices.GetNumFaces();
|
||||
|
||||
std::vector<LimitFrame> samples(nsamples * nfaces);
|
||||
std::vector<LimitFrame> samples(nsamplesPerFace * nfaces);
|
||||
|
||||
srand( static_cast<int>(2147483647) );
|
||||
|
||||
@ -233,7 +233,7 @@ int main(int, char **) {
|
||||
|
||||
for (int face=0, count=0; face<nfaces; ++face) {
|
||||
|
||||
for (int sample=0; sample<nsamples; ++sample, ++count) {
|
||||
for (int sample=0; sample<nsamplesPerFace; ++sample, ++count) {
|
||||
|
||||
Real s = (Real)rand()/(Real)RAND_MAX,
|
||||
t = (Real)rand()/(Real)RAND_MAX;
|
||||
@ -303,6 +303,9 @@ int main(int, char **) {
|
||||
printf("select deriv1Shape deriv2Shape;\n");
|
||||
}
|
||||
|
||||
delete refiner;
|
||||
delete patchTable;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -172,7 +172,8 @@ namespace {
|
||||
for (int x = 0; x < multiplier; ++x) {
|
||||
for (int y = 0; y < multiplier; ++y) {
|
||||
for (int z = 0; z < multiplier; ++z) {
|
||||
appendDefaultPrimitive(Pos(x * 2.0f, y * 2.0f, z * 2.0f),
|
||||
appendDefaultPrimitive(
|
||||
Pos((float)x * 2.0f, (float)y * 2.0f, (float)z * 2.0f),
|
||||
vertsPerFace, faceVerts, positionsPerVert);
|
||||
}
|
||||
}
|
||||
@ -284,7 +285,8 @@ namespace {
|
||||
|
||||
int numVertices = refiner->GetNumVerticesTotal();
|
||||
posVector.resize(numVertices);
|
||||
std::memcpy(&posVector[0], &shape->verts[0], numVertices * sizeof(Pos));
|
||||
std::memcpy(&posVector[0].p[0], &shape->verts[0],
|
||||
numVertices * 3 * sizeof(float));
|
||||
|
||||
delete shape;
|
||||
return refiner;
|
||||
|
@ -228,7 +228,8 @@ namespace {
|
||||
|
||||
int numVertices = refiner->GetNumVerticesTotal();
|
||||
posVector.resize(numVertices);
|
||||
std::memcpy(&posVector[0], &shape->verts[0], numVertices * sizeof(Pos));
|
||||
std::memcpy(&posVector[0].p[0], &shape->verts[0],
|
||||
numVertices * 3 * sizeof(float));
|
||||
|
||||
delete shape;
|
||||
return refiner;
|
||||
|
Loading…
Reference in New Issue
Block a user