24#ifndef USDGEOM_GENERATED_POINTINSTANCER_H
25#define USDGEOM_GENERATED_POINTINSTANCER_H
30#include "pxr/usd/usdGeom/api.h"
36#include "pxr/base/vt/value.h"
43#include "pxr/base/tf/type.h"
45PXR_NAMESPACE_OPEN_SCOPE
364 static const TfType &_GetStaticTfType();
366 static bool _IsTypedSchema();
370 const TfType &_GetTfType()
const override;
808 VtInt64Array
const *ids =
nullptr)
const;
825 const int elementSize = 1);
939 const std::vector<UsdTimeCode>& times,
997 UsdStageWeakPtr& stage,
999 const VtIntArray& protoIndices,
1000 const VtVec3fArray& positions,
1001 const VtVec3fArray& velocities,
1003 const VtVec3fArray& accelerations,
1004 const VtVec3fArray& scales,
1005 const VtQuatfArray& orientations,
1006 const VtVec3fArray& angularVelocities,
1008 const SdfPathVector& protoPaths,
1009 const std::vector<bool>& mask,
1010 float velocityScale = 1.0);
1020 UsdStageWeakPtr& stage,
1022 const VtIntArray& protoIndices,
1023 const VtVec3fArray& positions,
1024 const VtVec3fArray& velocities,
1026 const VtVec3fArray& accelerations,
1027 const VtVec3fArray& scales,
1028 const VtQuathArray& orientations,
1029 const VtVec3fArray& angularVelocities,
1031 const SdfPathVector& protoPaths,
1032 const std::vector<bool>& mask,
1033 float velocityScale = 1.0);
1039 bool _GetPrototypePathsForInstanceTransforms(
1040 const VtIntArray& protoIndices,
1041 SdfPathVector* protoPaths)
const;
1045 bool _GetProtoIndicesForInstanceTransforms(
1047 VtIntArray* protoIndices)
const;
1052 bool _ComputePointInstancerAttributesPreamble(
1056 VtIntArray* protoIndices,
1057 SdfPathVector* protoPaths,
1058 std::vector<bool>* mask)
const;
1065 template<
class QuatType>
1066 bool _DoComputeInstanceTransformsAtTimes(
1068 const std::vector<UsdTimeCode>& times,
1075 template <
class QuatType>
1076 static bool _DoComputeInstanceTransformsAtTime(
1078 UsdStageWeakPtr& stage,
1080 const VtIntArray& protoIndices,
1081 const VtVec3fArray& positions,
1082 const VtVec3fArray& velocities,
1084 const VtVec3fArray& accelerations,
1085 const VtVec3fArray& scales,
1087 const VtVec3fArray& angularVelocities,
1089 const SdfPathVector& protoPaths,
1090 const std::vector<bool>& mask,
1091 float velocityScale = 1.0);
1132 VtVec3fArray* extent,
1140 VtVec3fArray* extent,
1160 std::vector<VtVec3fArray>* extents,
1161 const std::vector<UsdTimeCode>& times,
1169 std::vector<VtVec3fArray>* extents,
1170 const std::vector<UsdTimeCode>& times,
1184 bool _ComputeExtentAtTimePreamble(
1186 VtIntArray* protoIndices,
1187 std::vector<bool>* mask,
1189 SdfPathVector* protoPaths)
const;
1191 bool _ComputeExtentFromTransforms(
1192 VtVec3fArray* extent,
1193 const VtIntArray& protoIndices,
1194 const std::vector<bool>& mask,
1196 const SdfPathVector& protoPaths,
1197 const VtMatrix4dArray& instanceTransforms,
1201 bool _ComputeExtentAtTime(
1202 VtVec3fArray* extent,
1207 bool _ComputeExtentAtTimes(
1208 std::vector<VtVec3fArray>* extent,
1209 const std::vector<UsdTimeCode>& times,
1218 const int elementSize)
1224 size_t maskSize = mask.size();
1225 if (maskSize == 0 || dataArray->
size() == (
size_t)elementSize){
1228 else if ((maskSize * elementSize) != dataArray->
size()){
1229 TF_WARN(
"Input mask's size (%zu) is not compatible with the "
1230 "input dataArray (%zu) and elementSize (%d).",
1231 maskSize, dataArray->
size(), elementSize);
1235 T* beginData = dataArray->
data();
1236 T* currData = beginData;
1237 size_t numPreserved = 0;
1238 for (
size_t i = 0; i < maskSize; ++i) {
1241 for (
int j = 0; j < elementSize; ++j) {
1242 *currData = beginData[i + j];
1245 numPreserved += elementSize;
1248 if (numPreserved < dataArray->size()) {
1249 dataArray->
resize(numPreserved);
1270PXR_NAMESPACE_CLOSE_SCOPE
Stores a 4x4 matrix of double elements.
Contains an asset path and an optional resolved path.
A path value used to locate objects in layers or scenegraphs.
Token for efficient comparison, assignment, and hashing of known strings.
TfType represents a dynamic runtime type.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Boundable introduces the ability for a prim to persistently cache a rectilinear, local-space,...
Encodes vectorized instancing of multiple, potentially animated, prototypes (object/instance masters)...
USDGEOM_API UsdAttribute GetScalesAttr() const
If authored, per-instance scale to be applied to each instance, before any rotation is applied.
USDGEOM_API bool VisIds(VtInt64Array const &ids, UsdTimeCode const &time) const
Ensure that the instances identified by ids are visible at time.
USDGEOM_API UsdAttribute CreatePositionsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetPositionsAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDGEOM_API UsdAttribute GetProtoIndicesAttr() const
Required property.
USDGEOM_API bool ActivateIds(VtInt64Array const &ids) const
Ensure that the instances identified by ids are active over all time.
USDGEOM_API bool DeactivateIds(VtInt64Array const &ids) const
Ensure that the instances identified by ids are inactive over all time.
USDGEOM_API UsdAttribute CreateAngularVelocitiesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetAngularVelocitiesAttr(), and also Create vs Get Property Methods for when to use Get vs Create...
USDGEOM_API bool ComputeExtentAtTime(VtVec3fArray *extent, const UsdTimeCode time, const UsdTimeCode baseTime, const GfMatrix4d &transform) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USDGEOM_API UsdAttribute GetVelocitiesAttr() const
If provided, per-instance 'velocities' will be used to compute positions between samples for the 'pos...
USDGEOM_API UsdAttribute GetPositionsAttr() const
Required property.
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
UsdGeomPointInstancer(const UsdSchemaBase &schemaObj)
Construct a UsdGeomPointInstancer on the prim held by schemaObj .
USDGEOM_API UsdAttribute CreateScalesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetScalesAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDGEOM_API UsdAttribute GetInvisibleIdsAttr() const
A list of id's to make invisible at the evaluation time.
static bool ApplyMaskToArray(std::vector< bool > const &mask, VtArray< T > *dataArray, const int elementSize=1)
Contract dataArray in-place to contain only the elements whose index in mask is true.
virtual USDGEOM_API ~UsdGeomPointInstancer()
Destructor.
USDGEOM_API UsdRelationship GetPrototypesRel() const
Required property.
USDGEOM_API bool ComputeInstanceTransformsAtTime(VtArray< GfMatrix4d > *xforms, const UsdTimeCode time, const UsdTimeCode baseTime, const ProtoXformInclusion doProtoXforms=IncludeProtoXform, const MaskApplication applyMask=ApplyMask) const
Compute the per-instance, "PointInstancer relative" transforms given the positions,...
static USDGEOM_API bool ComputeInstanceTransformsAtTime(VtArray< GfMatrix4d > *xforms, UsdStageWeakPtr &stage, UsdTimeCode time, const VtIntArray &protoIndices, const VtVec3fArray &positions, const VtVec3fArray &velocities, UsdTimeCode velocitiesSampleTime, const VtVec3fArray &accelerations, const VtVec3fArray &scales, const VtQuatfArray &orientations, const VtVec3fArray &angularVelocities, UsdTimeCode angularVelocitiesSampleTime, const SdfPathVector &protoPaths, const std::vector< bool > &mask, float velocityScale=1.0)
This is an overloaded member function, provided for convenience. It differs from the above function o...
USDGEOM_API UsdAttribute CreateOrientationsfAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetOrientationsfAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDGEOM_API bool ComputeExtentAtTimes(std::vector< VtVec3fArray > *extents, const std::vector< UsdTimeCode > ×, const UsdTimeCode baseTime, const GfMatrix4d &transform) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USDGEOM_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
USDGEOM_API std::vector< bool > ComputeMaskAtTime(UsdTimeCode time, VtInt64Array const *ids=nullptr) const
Computes a presence mask to be applied to per-instance data arrays based on authored inactiveIds,...
static USDGEOM_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor cl...
USDGEOM_API UsdAttribute CreateIdsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetIdsAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDGEOM_API bool ActivateAllIds() const
Ensure that all instances are active over all time.
USDGEOM_API UsdAttribute CreateProtoIndicesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetProtoIndicesAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
static USDGEOM_API UsdGeomPointInstancer Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdGeomPointInstancer holding the prim adhering to this schema at path on stage.
USDGEOM_API bool ActivateId(int64_t id) const
Ensure that the instance identified by id is active over all time.
USDGEOM_API UsdAttribute CreateOrientationsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetOrientationsAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDGEOM_API bool ComputeExtentAtTime(VtVec3fArray *extent, const UsdTimeCode time, const UsdTimeCode baseTime) const
Compute the extent of the point instancer based on the per-instance, "PointInstancer relative" transf...
USDGEOM_API size_t GetInstanceCount(UsdTimeCode timeCode=UsdTimeCode::Default()) const
Returns the number of instances as defined by the size of the protoIndices array at timeCode.
USDGEOM_API bool VisAllIds(UsdTimeCode const &time) const
Ensure that all instances are visible at time.
static USDGEOM_API UsdGeomPointInstancer Define(const UsdStagePtr &stage, const SdfPath &path)
Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefin...
USDGEOM_API bool InvisId(int64_t id, UsdTimeCode const &time) const
Ensure that the instance identified by id is invisible at time.
ProtoXformInclusion
Encodes whether to include each prototype's root prim's transformation as the most-local component of...
@ ExcludeProtoXform
Exclude the transform on the proto's root.
@ IncludeProtoXform
Include the transform on the proto's root.
MaskApplication
Encodes whether to evaluate and apply the PointInstancer's mask to computed results.
@ ApplyMask
Compute and apply the PointInstancer mask.
@ IgnoreMask
Ignore the PointInstancer mask.
USDGEOM_API bool InvisIds(VtInt64Array const &ids, UsdTimeCode const &time) const
Ensure that the instances identified by ids are invisible at time.
USDGEOM_API UsdAttribute CreateVelocitiesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetVelocitiesAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDGEOM_API UsdAttribute GetIdsAttr() const
Ids are optional; if authored, the ids array should be the same length as the protoIndices array,...
USDGEOM_API UsdAttribute CreateInvisibleIdsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetInvisibleIdsAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDGEOM_API bool VisId(int64_t id, UsdTimeCode const &time) const
Ensure that the instance identified by id is visible at time.
USDGEOM_API UsdAttribute GetAccelerationsAttr() const
If authored, per-instance 'accelerations' will be used with velocities to compute positions between s...
USDGEOM_API bool ComputeExtentAtTimes(std::vector< VtVec3fArray > *extents, const std::vector< UsdTimeCode > ×, const UsdTimeCode baseTime) const
Compute the extent of the point instancer as in ComputeExtentAtTime , but across multiple times .
USDGEOM_API bool ComputeInstanceTransformsAtTimes(std::vector< VtArray< GfMatrix4d > > *xformsArray, const std::vector< UsdTimeCode > ×, const UsdTimeCode baseTime, const ProtoXformInclusion doProtoXforms=IncludeProtoXform, const MaskApplication applyMask=ApplyMask) const
Compute the per-instance transforms as in ComputeInstanceTransformsAtTime, but using multiple sample ...
USDGEOM_API UsdAttribute GetOrientationsAttr() const
If authored, per-instance orientation of each instance about its prototype's origin,...
USDGEOM_API UsdAttribute CreateAccelerationsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetAccelerationsAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDGEOM_API bool UsesOrientationsf(UsdAttribute &rotationsAttr) const
Determines if we should prefer orientationsf over orientations based on whether or not orientationsf ...
USDGEOM_API UsdAttribute GetOrientationsfAttr() const
If authored, per-instance orientation of each instance about its prototype's origin,...
UsdGeomPointInstancer(const UsdPrim &prim=UsdPrim())
Construct a UsdGeomPointInstancer on UsdPrim prim .
USDGEOM_API bool DeactivateId(int64_t id) const
Ensure that the instance identified by id is inactive over all time.
USDGEOM_API UsdAttribute GetAngularVelocitiesAttr() const
If authored, per-instance angular velocity vector to be used for interoplating orientations.
USDGEOM_API UsdRelationship CreatePrototypesRel() const
See GetPrototypesRel(), and also Create vs Get Property Methods for when to use Get vs Create.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
The base class for all schema types in Usd.
Singleton registry that provides access to schema type information and the prim definitions for regis...
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
Represents an arbitrary dimensional rectangular container class.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
size_t size() const
Return the total number of elements in this array.
pointer data()
Return a non-const pointer to this array's data.
void resize(size_t newSize)
Resize this array.
#define TF_CODING_ERROR(fmt, args)
Issue an internal programming error, but continue execution.
#define TF_WARN(...)
Issue a warning, but continue execution.
USDGEOM_API bool UsdGeomPointInstancerSetOrMergeOverOp(std::vector< int64_t > const &items, SdfListOpType op, UsdPrim const &prim, TfToken const &metadataName)
Applies a list operation of type op using items over the existing list operation on prim with the nam...
USDGEOM_API bool UsdGeomPointInstancerApplyNewStyleListOps()
Returns true if list ops should be composed with SdfListOp::ApplyOperations() Returns false if list o...
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
std::vector< TfToken > TfTokenVector
Convenience types.