mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-30 15:20:07 +00:00
Removed old to COMPUTE_MASK_WEIGHTS and store them within a Refinement.
This commit is contained in:
parent
6115eb9c4d
commit
165fac6ddd
@ -1224,120 +1224,6 @@ Refinement::markSparseEdgeChildren() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef _VTR_COMPUTE_MASK_WEIGHTS_ENABLED
|
||||
void
|
||||
Refinement::computeMaskWeights() {
|
||||
|
||||
const Level& parent = *this->_parent;
|
||||
Level& child = *this->_child;
|
||||
|
||||
assert(child.getNumVertices() != 0);
|
||||
|
||||
_faceVertWeights.resize(parent.faceVertCount());
|
||||
_edgeVertWeights.resize(parent.edgeVertCount());
|
||||
_edgeFaceWeights.resize(parent.edgeFaceCount());
|
||||
_vertVertWeights.resize(parent.getNumVertices());
|
||||
_vertEdgeWeights.resize(parent.vertEdgeCount());
|
||||
_vertFaceWeights.resize(parent.vertEdgeCount());
|
||||
|
||||
//
|
||||
// Hard-coding this for Catmark temporarily for testing...
|
||||
//
|
||||
assert(_schemeType == Sdc::TYPE_CATMARK);
|
||||
Sdc::Scheme<Sdc::TYPE_CATMARK> scheme(_options);
|
||||
|
||||
if (_childVertFromFaceCount) {
|
||||
for (int pFace = 0; pFace < parent.getNumFaces(); ++pFace) {
|
||||
Index cVert = _faceChildVertIndex[pFace];
|
||||
if (!IndexIsValid(cVert)) continue;
|
||||
|
||||
int fVertCount = parent.faceVertCount(pFace);
|
||||
int fVertOffset = parent.faceVertOffset(pFace);
|
||||
float* fVertWeights = &_faceVertWeights[fVertOffset];
|
||||
|
||||
MaskInterface fMask(fVertWeights, 0, 0);
|
||||
FaceInterface fHood(fVertCount);
|
||||
|
||||
scheme.ComputeFaceVertexMask(fHood, fMask);
|
||||
}
|
||||
}
|
||||
if (_childVertFromEdgeCount) {
|
||||
EdgeInterface eHood(parent);
|
||||
|
||||
for (int pEdge = 0; pEdge < parent.getNumEdges(); ++pEdge) {
|
||||
Index cVert = _edgeChildVertIndex[pEdge];
|
||||
if (!IndexIsValid(cVert)) continue;
|
||||
|
||||
//
|
||||
// Update the locations for the mask weights:
|
||||
//
|
||||
int eFaceCount = parent.edgeFaceCount(pEdge);
|
||||
int eFaceOffset = parent.edgeFaceOffset(pEdge);
|
||||
float* eFaceWeights = &_edgeFaceWeights[eFaceOffset];
|
||||
float* eVertWeights = &_edgeVertWeights[2 * pEdge];
|
||||
|
||||
MaskInterface eMask(eVertWeights, 0, eFaceWeights);
|
||||
|
||||
//
|
||||
// Identify the parent and child and compute weights -- note that the face
|
||||
// weights may not be populated, so set them to zero if not:
|
||||
//
|
||||
eHood.SetIndex(pEdge);
|
||||
|
||||
Sdc::Rule pRule = (parent._edgeSharpness[pEdge] > 0.0) ? Sdc::Crease::RULE_CREASE : Sdc::Crease::RULE_SMOOTH;
|
||||
Sdc::Rule cRule = child.getVertexRule(cVert);
|
||||
|
||||
scheme.ComputeEdgeVertexMask(eHood, eMask, pRule, cRule);
|
||||
|
||||
if (eMask.GetFaceWeightCount() == 0) {
|
||||
std::fill(eFaceWeights, eFaceWeights + eFaceCount, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_childVertFromVertCount) {
|
||||
VertexInterface vHood(parent, child);
|
||||
|
||||
for (int pVert = 0; pVert < parent.getNumVertices(); ++pVert) {
|
||||
Index cVert = _vertChildVertIndex[pVert];
|
||||
if (!IndexIsValid(cVert)) continue;
|
||||
|
||||
//
|
||||
// Update the locations for the mask weights:
|
||||
//
|
||||
float* vVertWeights = &_vertVertWeights[pVert];
|
||||
|
||||
int vEdgeCount = parent.vertEdgeCount(pVert);
|
||||
int vEdgeOffset = parent.vertEdgeOffset(pVert);
|
||||
float* vEdgeWeights = &_vertEdgeWeights[vEdgeOffset];
|
||||
|
||||
int vFaceCount = parent.vertFaceCount(pVert);
|
||||
int vFaceOffset = parent.vertFaceOffset(pVert);
|
||||
float* vFaceWeights = &_vertFaceWeights[vFaceOffset];
|
||||
|
||||
MaskInterface vMask(vVertWeights, vEdgeWeights, vFaceWeights);
|
||||
|
||||
//
|
||||
// Initialize the neighborhood and gather the pre-determined Rules:
|
||||
//
|
||||
vHood.SetIndex(pVert, cVert);
|
||||
|
||||
Sdc::Rule pRule = parent.vertRule(pVert);
|
||||
Sdc::Rule cRule = child.vertRule(cVert);
|
||||
|
||||
scheme.ComputeVertexVertexMask(vHood, vMask, pRule, cRule);
|
||||
|
||||
if (vMask.GetEdgeWeightCount() == 0) {
|
||||
std::fill(vEdgeWeights, vEdgeWeights + vEdgeCount, 0.0);
|
||||
}
|
||||
if (vMask.GetFaceWeightCount() == 0) {
|
||||
std::fill(vFaceWeights, vFaceWeights + vFaceCount, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // end namespace Vtr
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
|
@ -391,36 +391,6 @@ protected:
|
||||
// Refinement data for face-varying channels present in the Levels being refined:
|
||||
//
|
||||
std::vector<FVarRefinement*> _fvarChannels;
|
||||
|
||||
public:
|
||||
//#define _VTR_COMPUTE_MASK_WEIGHTS_ENABLED
|
||||
#ifdef _VTR_COMPUTE_MASK_WEIGHTS_ENABLED
|
||||
// TEMPORARY -- FOR ILLUSTRATIVE PURPOSES ONLY...
|
||||
//
|
||||
// Mask for the child vertices stored relative to parent topology, i.e. weights
|
||||
// for a child face-vertex are stored relative to the parent face -- a weight for
|
||||
// each of the parent face's vertices.
|
||||
//
|
||||
// Currently the full complement of weights is used and expected to be applied, e.g.
|
||||
// for a crease in the interior, there may be no face-vert weights in the stencil
|
||||
// and so no need to apply them, but we require all and so set these to zero for now.
|
||||
// We will need some kind of stencil type associated with each child vertex if we
|
||||
// are to avoid doing so in order to detect the difference.
|
||||
//
|
||||
// Note this is potentially extremely wasteful in terms of memory when the set of
|
||||
// refined components in the child is small relative to the parent. All possible
|
||||
// stencil weights (i.e. for uniform refinement) will be allocated here if the
|
||||
// corresonding counts/offset of the parent are to be used.
|
||||
//
|
||||
void computeMaskWeights();
|
||||
|
||||
std::vector<float> _faceVertWeights; // matches parent face vert counts and offsets
|
||||
std::vector<float> _edgeVertWeights; // trivially 2 per parent edge
|
||||
std::vector<float> _edgeFaceWeights; // matches parent edge face counts and offsets
|
||||
std::vector<float> _vertVertWeights; // trivially 1 per parent vert
|
||||
std::vector<float> _vertEdgeWeights; // matches parent vert edge counts and offsets
|
||||
std::vector<float> _vertFaceWeights; // matches parent vert face counts and offsets
|
||||
#endif
|
||||
};
|
||||
|
||||
inline ConstIndexArray
|
||||
|
Loading…
Reference in New Issue
Block a user