2014-09-05 22:07:46 +00:00
|
|
|
//
|
|
|
|
// Copyright 2014 DreamWorks Animation LLC.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
|
|
// with the following modification; you may not use this file except in
|
|
|
|
// compliance with the Apache License and the following modification to it:
|
|
|
|
// Section 6. Trademarks. is deleted and replaced with:
|
|
|
|
//
|
|
|
|
// 6. Trademarks. This License does not grant permission to use the trade
|
|
|
|
// names, trademarks, service marks, or product names of the Licensor
|
|
|
|
// and its affiliates, except as required to comply with Section 4(c) of
|
|
|
|
// the License and to reproduce the content of the NOTICE file.
|
|
|
|
//
|
|
|
|
// You may obtain a copy of the Apache License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the Apache License with the above modification is
|
|
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
// KIND, either express or implied. See the Apache License for the specific
|
|
|
|
// language governing permissions and limitations under the Apache License.
|
|
|
|
//
|
2015-05-19 18:22:37 +00:00
|
|
|
#ifndef OPENSUBDIV3_VTR_FVAR_LEVEL_H
|
|
|
|
#define OPENSUBDIV3_VTR_FVAR_LEVEL_H
|
2014-09-05 22:07:46 +00:00
|
|
|
|
|
|
|
#include "../version.h"
|
|
|
|
|
2015-01-06 22:26:20 +00:00
|
|
|
#include "../sdc/types.h"
|
2014-09-05 22:07:46 +00:00
|
|
|
#include "../sdc/crease.h"
|
|
|
|
#include "../sdc/options.h"
|
|
|
|
#include "../vtr/types.h"
|
|
|
|
#include "../vtr/level.h"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <cassert>
|
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
|
|
|
|
namespace OpenSubdiv {
|
|
|
|
namespace OPENSUBDIV_VERSION {
|
|
|
|
|
2014-11-04 01:31:24 +00:00
|
|
|
// Forward declaration of friend classes:
|
|
|
|
namespace Far {
|
|
|
|
class TopologyRefiner;
|
2015-05-22 18:50:01 +00:00
|
|
|
class PatchTableFactory;
|
2014-11-04 01:31:24 +00:00
|
|
|
}
|
2014-09-05 22:07:46 +00:00
|
|
|
namespace Vtr {
|
2014-11-04 01:31:24 +00:00
|
|
|
class Refinement;
|
|
|
|
class FVarRefinement;
|
|
|
|
}
|
2014-09-05 22:07:46 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// FVarLevel:
|
|
|
|
// A "face-varying channel" includes the topology for a set of face-varying
|
|
|
|
// data, relative to the topology of the Level with which it is associated.
|
|
|
|
//
|
|
|
|
// Analogous to a set of vertices and face-vertices that define the topology for
|
|
|
|
// the geometry, a channel requires a set of "values" and "face-values". The
|
|
|
|
// "values" are indices of entries in a set of face-varying data, just as vertices
|
|
|
|
// are indices into a set of vertex data. The face-values identify a value for
|
|
|
|
// each vertex of the face, and so define topology for the values that may be
|
|
|
|
// unique to each channel.
|
|
|
|
//
|
|
|
|
// In addition to the value size and the vector of face-values (which matches the
|
|
|
|
// size of the geometry's face-vertices), tags are associated with each component
|
|
|
|
// to identify deviations of the face-varying topology from the vertex topology.
|
|
|
|
// And since there may be a one-to-many mapping between vertices and face-varying
|
|
|
|
// values, that mapping is also allocated.
|
|
|
|
//
|
|
|
|
// It turns out that the mapping used is able to completely encode the set of
|
|
|
|
// face-values and is more amenable to refinement. Currently the face-values
|
|
|
|
// take up almost half the memory of this representation, so if memory does
|
|
|
|
// become a concern, we do not need to store them. The only reason we do so now
|
|
|
|
// is that the face-value interface for specifying base topology and inspecting
|
|
|
|
// subsequent levels is very familar to that of face-vertices for clients. So
|
|
|
|
// having them available for such access is convenient.
|
|
|
|
//
|
|
|
|
// Regarding scope and access...
|
|
|
|
// Unclear at this early state, but leaning towards nesting this class within
|
|
|
|
// Level, given the intimate dependency between the two.
|
|
|
|
// Everything is being declared public for now to facilitate access until its
|
|
|
|
// clearer how this functionality will be provided.
|
|
|
|
//
|
2014-11-04 01:31:24 +00:00
|
|
|
namespace Vtr {
|
2014-09-05 22:07:46 +00:00
|
|
|
|
|
|
|
class FVarLevel {
|
2014-11-04 01:31:24 +00:00
|
|
|
protected:
|
|
|
|
friend class Level;
|
|
|
|
friend class Refinement;
|
|
|
|
friend class FVarRefinement;
|
|
|
|
friend class Far::TopologyRefiner;
|
2015-05-22 18:50:01 +00:00
|
|
|
friend class Far::PatchTableFactory;
|
2014-09-05 22:07:46 +00:00
|
|
|
|
2014-11-04 01:31:24 +00:00
|
|
|
protected:
|
2014-09-05 22:07:46 +00:00
|
|
|
//
|
|
|
|
// Component tags -- trying to minimize the types needed here:
|
|
|
|
//
|
|
|
|
// Tag per Edge:
|
|
|
|
// - facilitates topological analysis around each vertex
|
|
|
|
// - required during refinement to spawn one or more edge-values
|
|
|
|
//
|
|
|
|
struct ETag {
|
|
|
|
ETag() { }
|
2014-10-13 19:17:25 +00:00
|
|
|
|
|
|
|
void clear() { std::memset(this, 0, sizeof(ETag)); }
|
2014-09-05 22:07:46 +00:00
|
|
|
|
|
|
|
typedef unsigned char ETagSize;
|
|
|
|
|
|
|
|
ETagSize _mismatch : 1; // local FVar topology does not match
|
|
|
|
ETagSize _disctsV0 : 1; // discontinuous at vertex 0
|
|
|
|
ETagSize _disctsV1 : 1; // discontinuous at vertex 1
|
2015-02-12 04:51:00 +00:00
|
|
|
ETagSize _linear : 1; // linear boundary constraints
|
2014-09-05 22:07:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// Tag per Value:
|
|
|
|
// - informs both refinement and interpolation
|
|
|
|
// - every value spawns a child value in refinement
|
|
|
|
// - given ordering of values (1-per-vertex first) serves as a vertex tag
|
|
|
|
//
|
|
|
|
struct ValueTag {
|
|
|
|
ValueTag() { }
|
2014-10-13 19:17:25 +00:00
|
|
|
|
|
|
|
void clear() { std::memset(this, 0, sizeof(ValueTag)); }
|
2014-09-05 22:07:46 +00:00
|
|
|
|
2014-11-04 01:31:24 +00:00
|
|
|
bool isMismatch() const { return _mismatch; }
|
|
|
|
bool isCrease() const { return _crease; }
|
|
|
|
bool isCorner() const { return !_crease; }
|
|
|
|
bool isSemiSharp() const { return _semiSharp; }
|
|
|
|
bool isInfSharp() const { return !_semiSharp && !_crease; }
|
|
|
|
bool isDepSharp() const { return _depSharp; }
|
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
typedef unsigned char ValueTagSize;
|
|
|
|
|
2014-10-06 19:07:44 +00:00
|
|
|
ValueTagSize _mismatch : 1; // local FVar topology does not match
|
|
|
|
ValueTagSize _crease : 1; // value is a crease, otherwise a corner
|
|
|
|
ValueTagSize _semiSharp : 1; // value is a corner decaying to crease
|
2015-02-10 01:41:19 +00:00
|
|
|
ValueTagSize _depSharp : 1; // value is a corner by dependency on another
|
|
|
|
ValueTagSize _xordinary : 1; // value is an x-ordinary crease in the limit
|
2014-09-05 22:07:46 +00:00
|
|
|
};
|
|
|
|
|
2014-12-15 18:23:13 +00:00
|
|
|
typedef Vtr::ConstArray<ValueTag> ConstValueTagArray;
|
2014-11-04 01:31:24 +00:00
|
|
|
typedef Vtr::Array<ValueTag> ValueTagArray;
|
|
|
|
|
2015-02-25 03:57:56 +00:00
|
|
|
ValueTag getFaceCompositeValueTag(ConstIndexArray & faceValues,
|
|
|
|
ConstIndexArray & faceVerts) const;
|
2015-02-12 04:51:00 +00:00
|
|
|
|
|
|
|
Level::VTag getFaceCompositeValueAndVTag(ConstIndexArray & faceValues,
|
|
|
|
ConstIndexArray & faceVerts,
|
|
|
|
Level::VTag * fvarVTags) const;
|
2015-02-10 01:41:19 +00:00
|
|
|
|
2015-02-17 22:16:35 +00:00
|
|
|
Level::ETag getFaceCompositeCombinedEdgeTag(ConstIndexArray & faceEdges,
|
|
|
|
Level::ETag * fvarETags) const;
|
|
|
|
|
2014-11-04 01:31:24 +00:00
|
|
|
//
|
|
|
|
// Simple struct containing the "end faces" of a crease, i.e. the faces which
|
|
|
|
// contain the FVar values to be used when interpolating the crease. (Prefer
|
|
|
|
// the struct over std::pair for its member names)
|
|
|
|
//
|
|
|
|
struct CreaseEndPair {
|
|
|
|
LocalIndex _startFace;
|
|
|
|
LocalIndex _endFace;
|
|
|
|
};
|
|
|
|
|
2014-12-15 18:23:13 +00:00
|
|
|
typedef Vtr::ConstArray<CreaseEndPair> ConstCreaseEndPairArray;
|
2014-11-04 01:31:24 +00:00
|
|
|
typedef Vtr::Array<CreaseEndPair> CreaseEndPairArray;
|
|
|
|
|
2014-12-15 18:23:13 +00:00
|
|
|
typedef LocalIndex Sibling;
|
|
|
|
|
|
|
|
typedef ConstLocalIndexArray ConstSiblingArray;
|
|
|
|
typedef LocalIndexArray SiblingArray;
|
|
|
|
|
2014-11-04 01:31:24 +00:00
|
|
|
protected:
|
2014-09-05 22:07:46 +00:00
|
|
|
FVarLevel(Level const& level);
|
|
|
|
~FVarLevel();
|
|
|
|
|
2014-11-04 01:31:24 +00:00
|
|
|
// Queries for the entire channel:
|
2014-09-05 22:07:46 +00:00
|
|
|
Level const& getLevel() const { return _level; }
|
|
|
|
|
|
|
|
int getNumValues() const { return _valueCount; }
|
|
|
|
int getNumFaceValuesTotal() const { return (int) _faceVertValues.size(); }
|
|
|
|
|
2015-02-10 01:41:19 +00:00
|
|
|
bool isLinear() const { return _isLinear; }
|
2015-02-12 04:51:00 +00:00
|
|
|
bool hasLinearBoundaries() const { return _hasLinearBoundaries; }
|
|
|
|
bool hasSmoothBoundaries() const { return not _hasLinearBoundaries; }
|
2015-02-10 01:41:19 +00:00
|
|
|
|
|
|
|
Sdc::Options getOptions() const { return _options; }
|
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
// Queries per face:
|
2014-12-15 18:23:13 +00:00
|
|
|
ConstIndexArray getFaceValues(Index fIndex) const;
|
2014-11-04 01:31:24 +00:00
|
|
|
IndexArray getFaceValues(Index fIndex);
|
|
|
|
|
|
|
|
// Queries per edge:
|
|
|
|
ETag getEdgeTag(Index eIndex) const { return _edgeTags[eIndex]; }
|
|
|
|
bool edgeTopologyMatches(Index eIndex) const { return !getEdgeTag(eIndex)._mismatch; }
|
2014-09-05 22:07:46 +00:00
|
|
|
|
|
|
|
// Queries per vertex (and its potential sibling values):
|
2014-11-04 01:31:24 +00:00
|
|
|
int getNumVertexValues(Index v) const { return _vertSiblingCounts[v]; }
|
|
|
|
Index getVertexValueOffset(Index v, Sibling i = 0) const { return _vertSiblingOffsets[v] + i; }
|
|
|
|
|
|
|
|
Index getVertexValue(Index v, Sibling i = 0) const { return _vertValueIndices[getVertexValueOffset(v,i)]; }
|
2014-09-05 22:07:46 +00:00
|
|
|
|
2015-02-25 03:57:56 +00:00
|
|
|
Index findVertexValueIndex(Index vertexIndex, Index valueIndex) const;
|
|
|
|
|
2014-11-04 01:31:24 +00:00
|
|
|
// Methods to access/modify array properties per vertex:
|
2014-12-15 18:23:13 +00:00
|
|
|
ConstIndexArray getVertexValues(Index vIndex) const;
|
2014-11-04 01:31:24 +00:00
|
|
|
IndexArray getVertexValues(Index vIndex);
|
2014-09-05 22:07:46 +00:00
|
|
|
|
2014-12-15 18:23:13 +00:00
|
|
|
ConstValueTagArray getVertexValueTags(Index vIndex) const;
|
2014-11-04 01:31:24 +00:00
|
|
|
ValueTagArray getVertexValueTags(Index vIndex);
|
2014-09-05 22:07:46 +00:00
|
|
|
|
2014-12-15 18:23:13 +00:00
|
|
|
ConstCreaseEndPairArray getVertexValueCreaseEnds(Index vIndex) const;
|
2014-11-04 01:31:24 +00:00
|
|
|
CreaseEndPairArray getVertexValueCreaseEnds(Index vIndex);
|
|
|
|
|
2014-12-15 18:23:13 +00:00
|
|
|
ConstSiblingArray getVertexFaceSiblings(Index vIndex) const;
|
2014-11-04 01:31:24 +00:00
|
|
|
SiblingArray getVertexFaceSiblings(Index vIndex);
|
|
|
|
|
|
|
|
// Queries per value:
|
|
|
|
ValueTag getValueTag(Index valueIndex) const { return _vertValueTags[valueIndex]; }
|
|
|
|
bool valueTopologyMatches(Index valueIndex) const { return !getValueTag(valueIndex)._mismatch; }
|
2014-09-30 01:46:33 +00:00
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
// Higher-level topological queries, i.e. values in a neighborhood:
|
|
|
|
void getEdgeFaceValues(Index eIndex, int fIncToEdge, Index valuesPerVert[2]) const;
|
|
|
|
void getVertexEdgeValues(Index vIndex, Index valuesPerEdge[]) const;
|
2014-09-30 01:46:33 +00:00
|
|
|
void getVertexCreaseEndValues(Index vIndex, Sibling sibling, Index endValues[2]) const;
|
|
|
|
|
2014-11-04 01:31:24 +00:00
|
|
|
// Initialization and allocation helpers:
|
2014-09-05 22:07:46 +00:00
|
|
|
void setOptions(Sdc::Options const& options);
|
2014-11-04 01:31:24 +00:00
|
|
|
void resizeVertexValues(int numVertexValues);
|
2014-09-05 22:07:46 +00:00
|
|
|
void resizeValues(int numValues);
|
|
|
|
void resizeComponents();
|
|
|
|
|
2014-11-04 01:31:24 +00:00
|
|
|
// Topological analysis methods -- tagging and face-value population:
|
2015-02-10 01:41:19 +00:00
|
|
|
void completeTopologyFromFaceValues(int regBoundaryValence);
|
2014-09-05 22:07:46 +00:00
|
|
|
void initializeFaceValuesFromFaceVertices();
|
2014-11-04 01:31:24 +00:00
|
|
|
void initializeFaceValuesFromVertexFaceSiblings();
|
2014-09-05 22:07:46 +00:00
|
|
|
|
2014-10-06 19:07:44 +00:00
|
|
|
// Information about the "span" for a value:
|
|
|
|
struct ValueSpan {
|
|
|
|
LocalIndex _size;
|
|
|
|
LocalIndex _start;
|
|
|
|
LocalIndex _disjoint;
|
|
|
|
LocalIndex _semiSharp;
|
|
|
|
};
|
|
|
|
void gatherValueSpans(Index vIndex, ValueSpan * vValueSpans) const;
|
|
|
|
|
2014-11-04 01:31:24 +00:00
|
|
|
// Debugging methods:
|
2014-09-05 22:07:46 +00:00
|
|
|
bool validate() const;
|
|
|
|
void print() const;
|
2014-11-04 01:31:24 +00:00
|
|
|
void buildFaceVertexSiblingsFromVertexFaceSiblings(std::vector<Sibling>& fvSiblings) const;
|
2014-09-05 22:07:46 +00:00
|
|
|
|
2014-11-04 01:31:24 +00:00
|
|
|
protected:
|
2014-09-05 22:07:46 +00:00
|
|
|
Level const & _level;
|
|
|
|
|
2015-02-10 01:41:19 +00:00
|
|
|
// Linear interpolation options vary between channels:
|
2014-09-05 22:07:46 +00:00
|
|
|
Sdc::Options _options;
|
|
|
|
|
2014-09-30 01:46:33 +00:00
|
|
|
bool _isLinear;
|
2015-02-12 04:51:00 +00:00
|
|
|
bool _hasLinearBoundaries;
|
2014-10-24 23:15:22 +00:00
|
|
|
bool _hasDependentSharpness;
|
2014-09-30 01:46:33 +00:00
|
|
|
int _valueCount;
|
2014-09-05 22:07:46 +00:00
|
|
|
|
|
|
|
//
|
2014-11-04 01:31:24 +00:00
|
|
|
// Vectors recording face-varying topology including tags that help propagate
|
|
|
|
// data through the refinement hierarchy. Vectors are not sparse but most use
|
|
|
|
// 8-bit values relative to the local topology.
|
|
|
|
//
|
|
|
|
// The vector of face-values is actually redundant here, but is constructed as
|
|
|
|
// it is most convenient for clients. It represents almost half the memory of
|
|
|
|
// the topology (4 32-bit integers per face) and not surprisingly, populating
|
|
|
|
// it takes a considerable amount of the refinement time (1/3). We can reduce
|
|
|
|
// both if we are willing to compute these on demand for clients.
|
2014-09-05 22:07:46 +00:00
|
|
|
//
|
2014-09-30 01:46:33 +00:00
|
|
|
// Per-face (matches face-verts of corresponding level):
|
|
|
|
std::vector<Index> _faceVertValues;
|
2014-09-05 22:07:46 +00:00
|
|
|
|
|
|
|
// Per-edge:
|
2014-09-30 01:46:33 +00:00
|
|
|
std::vector<ETag> _edgeTags;
|
2014-09-05 22:07:46 +00:00
|
|
|
|
|
|
|
// Per-vertex:
|
2014-09-30 01:46:33 +00:00
|
|
|
std::vector<Sibling> _vertSiblingCounts;
|
|
|
|
std::vector<int> _vertSiblingOffsets;
|
|
|
|
std::vector<Sibling> _vertFaceSiblings;
|
2014-09-05 22:07:46 +00:00
|
|
|
|
|
|
|
// Per-value:
|
2014-11-04 01:31:24 +00:00
|
|
|
std::vector<Index> _vertValueIndices;
|
|
|
|
std::vector<ValueTag> _vertValueTags;
|
|
|
|
std::vector<CreaseEndPair> _vertValueCreaseEnds;
|
2014-09-05 22:07:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// Access/modify the values associated with each face:
|
|
|
|
//
|
2014-12-15 18:23:13 +00:00
|
|
|
inline ConstIndexArray
|
2014-09-05 22:07:46 +00:00
|
|
|
FVarLevel::getFaceValues(Index fIndex) const {
|
|
|
|
|
|
|
|
int vCount = _level._faceVertCountsAndOffsets[fIndex*2];
|
|
|
|
int vOffset = _level._faceVertCountsAndOffsets[fIndex*2+1];
|
2014-12-15 18:23:13 +00:00
|
|
|
return ConstIndexArray(&_faceVertValues[vOffset], vCount);
|
2014-09-05 22:07:46 +00:00
|
|
|
}
|
|
|
|
inline IndexArray
|
|
|
|
FVarLevel::getFaceValues(Index fIndex) {
|
|
|
|
|
|
|
|
int vCount = _level._faceVertCountsAndOffsets[fIndex*2];
|
|
|
|
int vOffset = _level._faceVertCountsAndOffsets[fIndex*2+1];
|
|
|
|
return IndexArray(&_faceVertValues[vOffset], vCount);
|
|
|
|
}
|
|
|
|
|
2014-12-15 18:23:13 +00:00
|
|
|
inline FVarLevel::ConstSiblingArray
|
2014-09-05 22:07:46 +00:00
|
|
|
FVarLevel::getVertexFaceSiblings(Index vIndex) const {
|
|
|
|
|
|
|
|
int vCount = _level._vertFaceCountsAndOffsets[vIndex*2];
|
|
|
|
int vOffset = _level._vertFaceCountsAndOffsets[vIndex*2+1];
|
2014-12-15 18:23:13 +00:00
|
|
|
return ConstSiblingArray(&_vertFaceSiblings[vOffset], vCount);
|
2014-09-05 22:07:46 +00:00
|
|
|
}
|
|
|
|
inline FVarLevel::SiblingArray
|
|
|
|
FVarLevel::getVertexFaceSiblings(Index vIndex) {
|
|
|
|
|
|
|
|
int vCount = _level._vertFaceCountsAndOffsets[vIndex*2];
|
|
|
|
int vOffset = _level._vertFaceCountsAndOffsets[vIndex*2+1];
|
|
|
|
return SiblingArray(&_vertFaceSiblings[vOffset], vCount);
|
|
|
|
}
|
|
|
|
|
2014-12-15 18:23:13 +00:00
|
|
|
inline ConstIndexArray
|
2014-11-04 01:31:24 +00:00
|
|
|
FVarLevel::getVertexValues(Index vIndex) const
|
2014-09-05 22:07:46 +00:00
|
|
|
{
|
2014-11-04 01:31:24 +00:00
|
|
|
int vCount = getNumVertexValues(vIndex);
|
|
|
|
int vOffset = getVertexValueOffset(vIndex);
|
2014-12-15 18:23:13 +00:00
|
|
|
return ConstIndexArray(&_vertValueIndices[vOffset], vCount);
|
2014-09-05 22:07:46 +00:00
|
|
|
}
|
2014-11-04 01:31:24 +00:00
|
|
|
inline IndexArray
|
|
|
|
FVarLevel::getVertexValues(Index vIndex)
|
2014-09-05 22:07:46 +00:00
|
|
|
{
|
2014-11-04 01:31:24 +00:00
|
|
|
int vCount = getNumVertexValues(vIndex);
|
|
|
|
int vOffset = getVertexValueOffset(vIndex);
|
2014-09-05 22:07:46 +00:00
|
|
|
return IndexArray(&_vertValueIndices[vOffset], vCount);
|
|
|
|
}
|
2014-11-04 01:31:24 +00:00
|
|
|
|
2014-12-15 18:23:13 +00:00
|
|
|
inline FVarLevel::ConstValueTagArray
|
2014-11-04 01:31:24 +00:00
|
|
|
FVarLevel::getVertexValueTags(Index vIndex) const
|
|
|
|
{
|
|
|
|
int vCount = getNumVertexValues(vIndex);
|
|
|
|
int vOffset = getVertexValueOffset(vIndex);
|
2014-12-15 18:23:13 +00:00
|
|
|
return ConstValueTagArray(&_vertValueTags[vOffset], vCount);
|
2014-11-04 01:31:24 +00:00
|
|
|
}
|
|
|
|
inline FVarLevel::ValueTagArray
|
|
|
|
FVarLevel::getVertexValueTags(Index vIndex)
|
|
|
|
{
|
|
|
|
int vCount = getNumVertexValues(vIndex);
|
|
|
|
int vOffset = getVertexValueOffset(vIndex);
|
|
|
|
return ValueTagArray(&_vertValueTags[vOffset], vCount);
|
2014-09-05 22:07:46 +00:00
|
|
|
}
|
2014-11-04 01:31:24 +00:00
|
|
|
|
2014-12-15 18:23:13 +00:00
|
|
|
inline FVarLevel::ConstCreaseEndPairArray
|
2014-11-04 01:31:24 +00:00
|
|
|
FVarLevel::getVertexValueCreaseEnds(Index vIndex) const
|
|
|
|
{
|
|
|
|
int vCount = getNumVertexValues(vIndex);
|
|
|
|
int vOffset = getVertexValueOffset(vIndex);
|
2014-12-15 18:23:13 +00:00
|
|
|
return ConstCreaseEndPairArray(&_vertValueCreaseEnds[vOffset], vCount);
|
2014-09-05 22:07:46 +00:00
|
|
|
}
|
2014-11-04 01:31:24 +00:00
|
|
|
inline FVarLevel::CreaseEndPairArray
|
|
|
|
FVarLevel::getVertexValueCreaseEnds(Index vIndex)
|
|
|
|
{
|
|
|
|
int vCount = getNumVertexValues(vIndex);
|
|
|
|
int vOffset = getVertexValueOffset(vIndex);
|
|
|
|
return CreaseEndPairArray(&_vertValueCreaseEnds[vOffset], vCount);
|
2014-09-05 22:07:46 +00:00
|
|
|
}
|
|
|
|
|
2015-02-25 03:57:56 +00:00
|
|
|
inline Index
|
|
|
|
FVarLevel::findVertexValueIndex(Index vertexIndex, Index valueIndex) const {
|
|
|
|
|
|
|
|
if (_level.getDepth() > 0) return valueIndex;
|
|
|
|
|
|
|
|
Index vvIndex = getVertexValueOffset(vertexIndex);
|
|
|
|
while (_vertValueIndices[vvIndex] != valueIndex) {
|
|
|
|
++ vvIndex;
|
|
|
|
}
|
|
|
|
return vvIndex;
|
|
|
|
}
|
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
} // end namespace Vtr
|
|
|
|
|
|
|
|
} // end namespace OPENSUBDIV_VERSION
|
|
|
|
using namespace OPENSUBDIV_VERSION;
|
|
|
|
} // end namespace OpenSubdiv
|
|
|
|
|
2015-05-19 18:22:37 +00:00
|
|
|
#endif /* OPENSUBDIV3_VTR_FVAR_LEVEL_H */
|