24 #ifndef PXR_USD_USD_SKEL_BLEND_SHAPE_QUERY_H 25 #define PXR_USD_USD_SKEL_BLEND_SHAPE_QUERY_H 30 #include "pxr/usd/usdSkel/api.h" 32 #include "pxr/usd/usdSkel/inbetweenShape.h" 39 PXR_NAMESPACE_OPEN_SCOPE
58 bool IsValid()
const {
return bool(_prim); }
61 explicit operator bool()
const {
return IsValid(); }
75 size_t GetNumBlendShapes()
const {
return _blendShapes.size(); }
77 size_t GetNumSubShapes()
const {
return _subShapes.size(); }
84 USDSKEL_API std::vector<VtIntArray>
92 USDSKEL_API std::vector<VtVec3fArray>
102 USDSKEL_API std::vector<VtVec3fArray>
116 VtFloatArray* subShapeWeights,
117 VtUIntArray* blendShapeIndices,
118 VtUIntArray* subShapeIndices)
const;
124 VtFloatArray* subShapeWeights)
const;
137 const std::vector<VtIntArray>& blendShapePointIndices,
138 const std::vector<VtVec3fArray>& subShapePointOffsets,
154 const std::vector<VtIntArray>& blendShapePointIndices,
155 const std::vector<VtVec3fArray>& subShapeNormalOffsets,
171 VtVec2iArray* ranges)
const;
174 std::string GetDescription()
const;
180 _SubShape() =
default;
182 _SubShape(
unsigned blendShapeIndex,
int inbetweenIndex,
float weight)
183 : _blendShapeIndex(blendShapeIndex),
184 _inbetweenIndex(inbetweenIndex),
189 int GetInbetweenIndex()
const {
return _inbetweenIndex; }
191 bool IsInbetween()
const {
return _inbetweenIndex >= 0; }
192 bool IsNullShape()
const {
return _weight == 0.0f; }
193 bool IsPrimaryShape()
const {
return _weight == 1.0f; }
195 float GetWeight()
const {
return _weight; }
198 unsigned _blendShapeIndex = 0;
199 int _inbetweenIndex = 0;
203 struct _SubShapeCompareByWeight {
204 bool operator()(
const _SubShape& lhs,
const _SubShape& rhs)
const 205 {
return lhs.GetWeight() < rhs.GetWeight(); }
207 bool operator()(
float lhs,
const _SubShape& rhs)
const 208 {
return lhs < rhs.GetWeight(); }
213 size_t firstSubShape = 0;
214 size_t numSubShapes = 0;
218 std::vector<_SubShape> _subShapes;
219 std::vector<_BlendShape> _blendShapes;
220 std::vector<UsdSkelInbetweenShape> _inbetweens;
223 PXR_NAMESPACE_CLOSE_SCOPE
225 #endif // PXR_USD_USD_SKEL_BLEND_SHAPE_QUERY_H USDSKEL_API bool ComputeFlattenedSubShapeWeights(const TfSpan< const float > &weights, VtFloatArray *subShapeWeights) const
Compute a flattened array of weights for all sub-shapes.
Describes a target blend shape, possibly containing inbetween shapes.
const UsdPrim & GetPrim() const
Returns the prim the blend shapes apply to.
USDSKEL_API UsdSkelInbetweenShape GetInbetween(size_t subShapeIndex) const
Returns the inbetween shape corresponding to sub-shape i, if any.
USDSKEL_API bool ComputePackedShapeTable(VtVec4fArray *offsets, VtVec2iArray *ranges) const
Compute a packed shape table combining all sub-shapes.
USDSKEL_API std::vector< VtVec3fArray > ComputeSubShapeNormalOffsets() const
Compute an array holding the normal offsets of all sub-shapes.
USDSKEL_API std::vector< VtVec3fArray > ComputeSubShapePointOffsets() const
Compute an array holding the point offsets of all sub-shapes.
USDSKEL_API std::vector< VtIntArray > ComputeBlendShapePointIndices() const
Compute an array holding the point indices of all shapes.
Represents a range of contiguous elements.
USDSKEL_API bool ComputeDeformedPoints(const TfSpan< const float > subShapeWeights, const TfSpan< const unsigned > blendShapeIndices, const TfSpan< const unsigned > subShapeIndices, const std::vector< VtIntArray > &blendShapePointIndices, const std::vector< VtVec3fArray > &subShapePointOffsets, TfSpan< GfVec3f > points) const
Deform points using the resolved sub-shapes given by subShapeWeights, blendShapeIndices and subShapeI...
USDSKEL_API bool ComputeDeformedNormals(const TfSpan< const float > subShapeWeights, const TfSpan< const unsigned > blendShapeIndices, const TfSpan< const unsigned > subShapeIndices, const std::vector< VtIntArray > &blendShapePointIndices, const std::vector< VtVec3fArray > &subShapeNormalOffsets, TfSpan< GfVec3f > noramls) const
Deform normals using the resolved sub-shapes given by subShapeWeights, blendShapeIndices and subShape...
Provides API for authoring and extracting all the skinning-related data that lives in the "geometry h...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
bool IsValid() const
Return true if this query is valid.
USDSKEL_API size_t GetBlendShapeIndex(size_t subShapeIndex) const
Returns the blend shape index corresponding to the i'th sub-shape.
USDSKEL_API UsdSkelBlendShape GetBlendShape(size_t blendShapeIndex) const
Returns the blend shape corresponding to blendShapeIndex.
Helper class used to resolve blend shape weights, including inbetweens.
USDSKEL_API bool ComputeSubShapeWeights(const TfSpan< const float > &weights, VtFloatArray *subShapeWeights, VtUIntArray *blendShapeIndices, VtUIntArray *subShapeIndices) const
Compute the resolved weights for all sub-shapes bound to this prim.
Schema wrapper for UsdAttribute for authoring and introspecting attributes that serve as inbetween sh...