Minor revisions to recent promotion regarding smooth UV's in Far:

- changed return type of Vtr array empty() to bool
    - renamed and adjusted arguments to Vtr gather methods for consistency
    - removed lone Vtr gather method that took an explicit offset
    - updated usage of revised Vtr gather methods in Far
    - fixed warnings redeclaring names of local variables already in use
This commit is contained in:
barfowl 2015-03-05 13:09:27 -08:00
parent 2697c31eed
commit 9a41cf59c4
6 changed files with 29 additions and 40 deletions

View File

@ -351,8 +351,8 @@ ProtoBasis::ProtoBasis(Vtr::Level const & level, Index faceIndex, int fvarChanne
org[vid] = facePoints[vid];
int ringSize =
level.gatherManifoldVertexRingFromIncidentQuads(
facePoints[vid], 0, manifoldRing, fvarChannel);
level.gatherQuadRegularRingAroundVertex(
facePoints[vid], manifoldRing, fvarChannel);
int valence;
if (ringSize & 1) {

View File

@ -664,7 +664,7 @@ PatchTablesFactory::gatherFVarData(AdaptiveContext & context, int level,
for (fvc=fvc.begin(); fvc!=fvc.end(); ++fvc) {
Vtr::Level const & vtxLevel = refiner.getLevel(level);
Vtr::FVarLevel const & fvarLevel = refiner.getFVarChannel(level, *fvc);
Vtr::FVarLevel const & fvarLevel = vtxLevel.getFVarLevel(*fvc);
if (refiner.GetFVarLinearInterpolation(*fvc)!=Sdc::Options::FVAR_LINEAR_ALL) {
@ -720,8 +720,6 @@ PatchTablesFactory::gatherFVarData(AdaptiveContext & context, int level,
//
Vtr::Level::VTag fvarVertTags[4];
ConstIndexArray faceVerts = vtxLevel.getFaceVertices(faceIndex);
Vtr::Level::VTag compFVarVTag =
fvarLevel.getFaceCompositeValueAndVTag(fvarValues, faceVerts, fvarVertTags);
@ -805,7 +803,7 @@ PatchTablesFactory::gatherFVarData(AdaptiveContext & context, int level,
vtxLevel.gatherQuadRegularBoundaryPatchPoints(faceIndex, patchVerts, orientationIndex, *fvc);
permutation = permuteBoundary;
} else if (fvarPatchType == PatchDescriptor::QUADS) {
vtxLevel.gatherQuadPoints(faceIndex, patchVerts, orientationIndex, *fvc);
vtxLevel.gatherQuadLinearPatchPoints(faceIndex, patchVerts, orientationIndex, *fvc);
permutation = 0;
} else if (fvarPatchType == PatchDescriptor::GREGORY_BASIS) {
// XXXX
@ -1165,12 +1163,12 @@ PatchTablesFactory::createUniform(TopologyRefiner const & refiner, Options optio
if (generateFVarPatches) {
for (fvc=fvc.begin(); fvc!=fvc.end(); ++fvc) {
ConstIndexArray fverts = refiner.GetFVarFaceValues(level, face, *fvc);
for (int vert=0; vert<fverts.size(); ++vert) {
assert((levelVertOffset + fverts[vert]) < (int)tables->getFVarPatchesValues(fvc.pos()).size());
fptr[fvc.pos()][vert] = levelFVarVertOffsets[fvc.pos()] + fverts[vert];
ConstIndexArray fvalues = refiner.GetFVarFaceValues(level, face, *fvc);
for (int vert=0; vert<fvalues.size(); ++vert) {
assert((levelVertOffset + fvalues[vert]) < (int)tables->getFVarPatchesValues(fvc.pos()).size());
fptr[fvc.pos()][vert] = levelFVarVertOffsets[fvc.pos()] + fvalues[vert];
}
fptr[fvc.pos()]+=fverts.size();
fptr[fvc.pos()]+=fvalues.size();
}
}
@ -1843,8 +1841,11 @@ PatchTablesFactory::populateAdaptivePatches(AdaptiveContext & context) {
//} else {
int * ringDest = vTableEntry + 1,
ringSize = level->gatherManifoldVertexRingFromIncidentQuads(vIndex, vOffset, ringDest);
ringSize = level->gatherQuadRegularRingAroundVertex(vIndex, ringDest);
for (int j = 0; j < ringSize; ++j) {
ringDest[j] += vOffset;
}
if (ringSize & 1) {
// boundary vertex : duplicate boundary vertex index
// and store negative valence.

View File

@ -486,7 +486,7 @@ public:
/// \brief Prints topology information to console
void PrintTopology(int level, bool children = true) const {
_levels[level]->print(children ? _refinements[level] : 0);
_levels[level]->print((children && ((int)_refinements.size() > level)) ? _refinements[level] : 0);
}
//@}
@ -552,9 +552,6 @@ protected:
Vtr::Refinement & getRefinement(int l) { return *_refinements[l]; }
Vtr::Refinement const & getRefinement(int l) const { return *_refinements[l]; }
Vtr::FVarLevel & getFVarChannel(int l, int c) { return *_levels[l]->_fvarChannels[c]; }
Vtr::FVarLevel const & getFVarChannel(int l, int c) const { return *_levels[l]->_fvarChannels[c]; }
private:
void selectFeatureAdaptiveComponents(Vtr::SparseSelector& selector);

View File

@ -71,7 +71,7 @@ public:
size_type size() const { return _size; }
size_type empty() const { return _size==0; }
bool empty() const { return _size==0; }
const_reference operator[](int index) const { return _begin[index]; }
const_iterator begin() const { return _begin; }

View File

@ -589,8 +589,8 @@ namespace {
}
//
// Gathering the one-ring of vertices from quads surrounding a manifold vertex:
// - the neighborhood of the vertex is assumed to be quad-regular
// Gathering the one-ring of vertices from quads surrounding a vertex:
// - the neighborhood of the vertex is assumed to be quad-regular (manifold)
//
// Ordering of resulting vertices:
// The surrounding one-ring follows the ordering of the incident faces. For each
@ -598,19 +598,6 @@ namespace {
// vertex is on a boundary, a third vertex on the boundary edge will be contributed from
// the last face.
//
int
Level::gatherManifoldVertexRingFromIncidentQuads(
Index vIndex, int vOffset, int ringVerts[], int fvarChannel) const {
int ringSize = gatherQuadRegularRingAroundVertex(vIndex, ringVerts, fvarChannel);
if (vOffset) {
for (int i = 0; i < ringSize; ++i) {
ringVerts[i] += vOffset;
}
}
return ringSize;
}
int
Level::gatherQuadRegularRingAroundVertex(
Index vIndex, int ringPoints[], int fvarChannel) const {
@ -656,8 +643,8 @@ Level::gatherQuadRegularRingAroundVertex(
// --1-----2--
// | |
//
void
Level::gatherQuadPoints(
int
Level::gatherQuadLinearPatchPoints(
Index thisFace, Index patchPoints[], int rotation, int fvarChannel) const {
Level const& level = *this;
@ -666,15 +653,16 @@ Level::gatherQuadPoints(
static int const rotationSequence[7] = { 0, 1, 2, 3, 0, 1, 2 };
int const * rotatedVerts = &rotationSequence[rotation];
ConstIndexArray thisFaceVerts = level.getFaceVertices(thisFace);
ConstIndexArray facePoints = (fvarChannel < 0) ? thisFaceVerts :
ConstIndexArray facePoints = (fvarChannel < 0) ?
level.getFaceVertices(thisFace) :
level.getFVarFaceValues(thisFace, fvarChannel);
patchPoints[0] = facePoints[rotatedVerts[0]];
patchPoints[1] = facePoints[rotatedVerts[1]];
patchPoints[2] = facePoints[rotatedVerts[2]];
patchPoints[3] = facePoints[rotatedVerts[3]];
return 4;
}
//

View File

@ -247,6 +247,9 @@ public:
int getNumFVarValues(int channel = 0) const;
ConstIndexArray getFVarFaceValues(Index faceIndex, int channel = 0) const;
FVarLevel & getFVarLevel(int channel = 0) { return *_fvarChannels[channel]; }
FVarLevel const & getFVarLevel(int channel = 0) const { return *_fvarChannels[channel]; }
// Manifold/non-manifold tags:
void setEdgeNonManifold(Index edgeIndex, bool b);
bool isEdgeNonManifold(Index edgeIndex) const;
@ -294,15 +297,15 @@ public:
bool isSingleCreasePatch(Index face, float* sharpnessOut=NULL, int* rotationOut=NULL) const;
int gatherManifoldVertexRingFromIncidentQuads(Index vIndex, int vOffset, int ringVerts[], int fvarChannel=-1) const;
void gatherQuadPoints(Index thisFace, Index patchPoints[], int rotation, int fvarChannel) const;
//
// When gathering "patch points" we may want the indices of the vertices or the corresponding
// FVar values for a particular channel. Both are represented and equally accessible within
// the faces, so we allow all to be returned through these methods. Setting the optional FVar
// channel to -1 will retrieve indices of vertices instead of FVar values:
//
int gatherQuadLinearPatchPoints(Index fIndex, Index patchPoints[], int rotation = 0,
int fvarChannel = -1) const;
int gatherQuadRegularInteriorPatchPoints(Index fIndex, Index patchPoints[], int rotation = 0,
int fvarChannel = -1) const;
int gatherQuadRegularBoundaryPatchPoints(Index fIndex, Index patchPoints[], int boundaryEdgeInFace,