24 #ifndef PXR_USD_USD_GEOM_BBOX_CACHE_H
25 #define PXR_USD_USD_GEOM_BBOX_CACHE_H
109 bool useExtentsHint=
false,
bool ignoreVisibility=
false);
117 UsdGeomBBoxCache &
operator=(UsdGeomBBoxCache
const &other);
159 const UsdPrim &relativeToAncestorPrim);
216 int64_t
const *instanceIdBegin,
244 int64_t
const *instanceIdBegin,
246 const UsdPrim &relativeToAncestorPrim,
255 const UsdPrim &relativeToAncestorPrim) {
258 instancer, &instanceId, 1, relativeToAncestorPrim, &ret);
274 int64_t
const *instanceIdBegin,
282 int64_t instanceId) {
303 int64_t
const *instanceIdBegin,
312 int64_t instanceId) {
315 instancer, &instanceId, 1, &ret);
340 return _useExtentsHint;
346 return _ignoreVisibility;
367 _baseTime = baseTime;
373 return _baseTime.value_or(
GetTime());
379 _baseTime = std::nullopt;
385 return static_cast<bool>(_baseTime);
393 class _PrototypeBBoxResolver;
396 typedef std::map<TfToken, GfBBox3d, TfTokenFastArbitraryLessThan>
416 struct _PrimContext {
422 TfToken instanceInheritablePurpose;
424 _PrimContext() =
default;
425 explicit _PrimContext(
const UsdPrim &prim_,
427 : prim(prim_), instanceInheritablePurpose(purpose) {};
429 bool operator==(
const _PrimContext &rhs)
const {
430 return prim == rhs.prim &&
431 instanceInheritablePurpose == rhs.instanceInheritablePurpose;
438 template<
typename TransformType>
439 GfBBox3d _ComputeBoundWithOverridesHelper(
446 _ComputePointInstanceBoundsHelper(
448 int64_t
const *instanceIdBegin,
455 bool _ShouldIncludePrim(
const UsdPrim& prim);
466 bool _Resolve(
const UsdPrim& prim, _PurposeToBBoxMap *bboxes);
473 void _ResolvePrim(_BBoxTask* task,
474 const _PrimContext& prim,
485 _PurposeToBBoxMap bboxes;
489 std::shared_ptr<UsdAttributeQuery[]> queries;
511 _Entry* _FindOrCreateEntriesForPrim(
512 const _PrimContext& prim,
513 std::vector<_PrimContext> *prototypePrimContexts);
517 GfBBox3d _GetCombinedBBoxForIncludedPurposes(
518 const _PurposeToBBoxMap &bboxes);
523 bool _GetBBoxFromExtentsHint(
526 _PurposeToBBoxMap *bboxes);
530 bool _ShouldPruneChildren(
const UsdPrim &prim, _Entry *entry);
538 template <
bool IsRecursive>
539 void _ComputePurposeInfo(_Entry *entry,
const _PrimContext &prim);
542 inline bool _UseExtentsHintForPrim(
UsdPrim const &prim)
const;
545 template <
typename HashState>
549 h.Append(key.instanceInheritablePurpose);
555 typedef TfHash _PrimContextHash;
559 _Entry *_FindEntry(
const _PrimContext &primContext)
566 _Entry *_InsertEntry(
const _PrimContext &primContext)
568 return &(_bboxCache[primContext]);
573 std::optional<UsdTimeCode> _baseTime;
576 _PrimBBoxHashMap _bboxCache;
577 bool _useExtentsHint;
578 bool _ignoreVisibility;
584 #endif // PXR_USD_USD_GEOM_BBOX_CACHE_H
USDGEOM_API GfBBox3d ComputeUntransformedBound(const UsdPrim &prim)
USDGEOM_API bool ComputePointInstanceLocalBounds(const UsdGeomPointInstancer &instancer, int64_t const *instanceIdBegin, size_t numIds, GfBBox3d *result)
USDGEOM_API void SetIncludedPurposes(const TfTokenVector &includedPurposes)
USDGEOM_API GfBBox3d ComputeWorldBoundWithOverrides(const UsdPrim &prim, const SdfPathSet &pathsToSkip, const GfMatrix4d &primOverride, const TfHashMap< SdfPath, GfMatrix4d, SdfPath::Hash > &ctmOverrides)
GT_API const UT_StringHolder time
USDGEOM_API GfBBox3d ComputeLocalBound(const UsdPrim &prim)
GLsizei const GLchar *const * string
USDGEOM_API bool ComputePointInstanceWorldBounds(const UsdGeomPointInstancer &instancer, int64_t const *instanceIdBegin, size_t numIds, GfBBox3d *result)
**But if you need a result
bool GetIgnoreVisibility() const
USDGEOM_API void Clear()
Clears all pre-cached values.
bool GetUseExtentsHint() const
USDGEOM_API bool ComputePointInstanceUntransformedBounds(const UsdGeomPointInstancer &instancer, int64_t const *instanceIdBegin, size_t numIds, GfBBox3d *result)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
USDGEOM_API UsdGeomBBoxCache & operator=(UsdGeomBBoxCache const &other)
Copy assignment.
friend size_t hash_value(const _PrimContext &key)
Container::mapped_type * TfMapLookupPtr(Container &map, Key const &key)
GfBBox3d ComputePointInstanceRelativeBound(const UsdGeomPointInstancer &instancer, int64_t instanceId, const UsdPrim &relativeToAncestorPrim)
USDGEOM_API bool ComputePointInstanceRelativeBounds(const UsdGeomPointInstancer &instancer, int64_t const *instanceIdBegin, size_t numIds, const UsdPrim &relativeToAncestorPrim, GfBBox3d *result)
std::vector< TfToken > TfTokenVector
Convenience types.
void SetBaseTime(UsdTimeCode baseTime)
GfBBox3d ComputePointInstanceUntransformedBound(const UsdGeomPointInstancer &instancer, int64_t instanceId)
friend void TfHashAppend(HashState &h, const _PrimContext &key)
std::set< class SdfPath > SdfPathSet
A set of SdfPaths.
GLfloat GLfloat GLfloat GLfloat h
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
GfBBox3d ComputePointInstanceLocalBound(const UsdGeomPointInstancer &instancer, int64_t instanceId)
Compute the oriented bounding boxes of the given point instances.
GfBBox3d ComputePointInstanceWorldBound(const UsdGeomPointInstancer &instancer, int64_t instanceId)
#define PXR_NAMESPACE_CLOSE_SCOPE
USDGEOM_API void SetTime(UsdTimeCode time)
UsdTimeCode GetBaseTime() const
USDGEOM_API GfBBox3d ComputeWorldBound(const UsdPrim &prim)
USDGEOM_API GfBBox3d ComputeRelativeBound(const UsdPrim &prim, const UsdPrim &relativeToAncestorPrim)
USDGEOM_API UsdGeomBBoxCache(UsdTimeCode time, TfTokenVector includedPurposes, bool useExtentsHint=false, bool ignoreVisibility=false)
const TfTokenVector & GetIncludedPurposes()
Get the current set of included purposes.
UsdTimeCode GetTime() const
Get the current time from which this cache is reading values.