Loading...
Searching...
No Matches
instanceAdapter.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
25#define PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
26
28
29#include "pxr/pxr.h"
30#include "pxr/usdImaging/usdImaging/api.h"
32
33#include "pxr/base/tf/hashmap.h"
34
35#include <mutex>
36
37PXR_NAMESPACE_OPEN_SCOPE
38
39
93{
94public:
96
97 USDIMAGING_API
99 UsdPrim const& prim,
100 UsdImagingIndexProxy* index,
101 UsdImagingInstancerContext const* instancerContext = nullptr) override;
102
103 USDIMAGING_API
104 bool ShouldCullChildren() const override;
105
106 USDIMAGING_API
107 bool IsInstancerAdapter() const override;
108
109 // ---------------------------------------------------------------------- //
111 // ---------------------------------------------------------------------- //
112
113 USDIMAGING_API
114 void TrackVariability(UsdPrim const& prim,
115 SdfPath const& cachePath,
116 HdDirtyBits* timeVaryingBits,
118 instancerContext = NULL) const override;
119
120 USDIMAGING_API
121 void UpdateForTime(UsdPrim const& prim,
122 SdfPath const& cachePath,
123 UsdTimeCode time,
124 HdDirtyBits requestedBits,
126 instancerContext = NULL) const override;
127
128 // ---------------------------------------------------------------------- //
130 // ---------------------------------------------------------------------- //
131
132 USDIMAGING_API
133 HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
134 SdfPath const& cachePath,
135 TfToken const& propertyName)
136 override;
137
138 USDIMAGING_API
139 void ProcessPrimResync(SdfPath const& cachePath,
140 UsdImagingIndexProxy* index) override;
141
142 USDIMAGING_API
143 void ProcessPrimRemoval(SdfPath const& cachePath,
144 UsdImagingIndexProxy* index) override;
145
146
147 USDIMAGING_API
148 void MarkDirty(UsdPrim const& prim,
149 SdfPath const& cachePath,
150 HdDirtyBits dirty,
151 UsdImagingIndexProxy* index) override;
152
153 // As this adapter hijacks the adapter for the child prim
154 // We need to forward these messages on, in case the child
155 // adapter needs them
156 USDIMAGING_API
157 void MarkRefineLevelDirty(UsdPrim const& prim,
158 SdfPath const& cachePath,
159 UsdImagingIndexProxy* index) override;
160
161 USDIMAGING_API
162 void MarkReprDirty(UsdPrim const& prim,
163 SdfPath const& cachePath,
164 UsdImagingIndexProxy* index) override;
165
166 USDIMAGING_API
167 void MarkCullStyleDirty(UsdPrim const& prim,
168 SdfPath const& cachePath,
169 UsdImagingIndexProxy* index) override;
170
171 USDIMAGING_API
172 void MarkRenderTagDirty(UsdPrim const& prim,
173 SdfPath const& cachePath,
174 UsdImagingIndexProxy* index) override;
175
176 USDIMAGING_API
177 void MarkTransformDirty(UsdPrim const& prim,
178 SdfPath const& cachePath,
179 UsdImagingIndexProxy* index) override;
180
181 USDIMAGING_API
182 void MarkVisibilityDirty(UsdPrim const& prim,
183 SdfPath const& cachePath,
184 UsdImagingIndexProxy* index) override;
185
186 // ---------------------------------------------------------------------- //
188 // ---------------------------------------------------------------------- //
189
190 USDIMAGING_API
191 std::vector<VtArray<TfToken>> GetInstanceCategories(
192 UsdPrim const& prim) override;
193
194 USDIMAGING_API
196 SdfPath const& instancerPath,
197 UsdTimeCode time) const override;
198
199 USDIMAGING_API
201 UsdPrim const& usdPrim,
202 SdfPath const& cachePath) const override;
203
204 USDIMAGING_API
206 UsdPrim const& usdPrim,
207 SdfPath const& cachePath) const override;
208
209 USDIMAGING_API
210 size_t SampleInstancerTransform(UsdPrim const& instancerPrim,
211 SdfPath const& instancerPath,
212 UsdTimeCode time,
213 size_t maxSampleCount,
214 float *sampleTimes,
215 GfMatrix4d *sampleValues) override;
216
217 USDIMAGING_API
218 size_t SampleTransform(UsdPrim const& prim,
219 SdfPath const& cachePath,
220 UsdTimeCode time,
221 size_t maxNumSamples,
222 float *sampleTimes,
223 GfMatrix4d *sampleValues) override;
224
225 USDIMAGING_API
226 size_t SamplePrimvar(UsdPrim const& usdPrim,
227 SdfPath const& cachePath,
228 TfToken const& key,
229 UsdTimeCode time,
230 size_t maxNumSamples,
231 float *sampleTimes,
232 VtValue *sampleValues,
233 VtIntArray *sampleIndices) override;
234
235 USDIMAGING_API
237 UsdPrim const& usdPrim,
238 SdfPath const& cachePath,
239 TfToken const& instanceInheritablePurpose) const override;
240
241 USDIMAGING_API
243 SdfPath const& cachePath,
244 UsdTimeCode time) const override;
245
246 USDIMAGING_API
248 SdfPath const& cachePath,
249 UsdTimeCode time) const override;
250
251 USDIMAGING_API
252 HdCullStyle GetCullStyle(UsdPrim const& prim,
253 SdfPath const& cachePath,
254 UsdTimeCode time) const override;
255
256 USDIMAGING_API
257 GfRange3d GetExtent(UsdPrim const& usdPrim,
258 SdfPath const& cachePath,
259 UsdTimeCode time) const override;
260
261 USDIMAGING_API
262 bool IsChildPath(const SdfPath& path) const override;
263
264 bool GetVisible(UsdPrim const& usdPrim,
265 SdfPath const& cachePath,
266 UsdTimeCode time) const override;
267
268 USDIMAGING_API
269 bool GetDoubleSided(UsdPrim const& prim,
270 SdfPath const& cachePath,
271 UsdTimeCode time) const override;
272
273 USDIMAGING_API
275 SdfPath const& cachePath,
276 UsdTimeCode time,
277 bool ignoreRootTransform = false) const override;
278
279 USDIMAGING_API
280 SdfPath GetMaterialId(UsdPrim const& prim,
281 SdfPath const& cachePath,
282 UsdTimeCode time) const override;
283
284 USDIMAGING_API
285 VtValue GetLightParamValue(
286 const UsdPrim& prim,
287 const SdfPath& cachePath,
288 const TfToken& paramName,
289 UsdTimeCode time) const override;
290
291 USDIMAGING_API
292 VtValue GetMaterialResource(
293 const UsdPrim& prim,
294 const SdfPath& cachePath,
295 UsdTimeCode time) const override;
296
297 USDIMAGING_API
298 HdExtComputationInputDescriptorVector
299 GetExtComputationInputs(UsdPrim const& prim,
300 SdfPath const& cachePath,
301 const UsdImagingInstancerContext* instancerContext)
302 const override;
303
304
305 USDIMAGING_API
306 HdExtComputationOutputDescriptorVector
307 GetExtComputationOutputs(UsdPrim const& prim,
308 SdfPath const& cachePath,
309 const UsdImagingInstancerContext* instancerContext)
310 const override;
311
312 USDIMAGING_API
313 HdExtComputationPrimvarDescriptorVector
314 GetExtComputationPrimvars(
315 UsdPrim const& prim,
316 SdfPath const& cachePath,
317 HdInterpolation interpolation,
318 const UsdImagingInstancerContext* instancerContext) const override;
319
320 USDIMAGING_API
321 VtValue
322 GetExtComputationInput(
323 UsdPrim const& prim,
324 SdfPath const& cachePath,
325 TfToken const& name,
326 UsdTimeCode time,
327 const UsdImagingInstancerContext* instancerContext) const override;
328
329 USDIMAGING_API
330 std::string
331 GetExtComputationKernel(
332 UsdPrim const& prim,
333 SdfPath const& cachePath,
334 const UsdImagingInstancerContext* instancerContext) const override;
335
336 USDIMAGING_API
337 VtValue
338 GetInstanceIndices(UsdPrim const& instancerPrim,
339 SdfPath const& instancerCachePath,
340 SdfPath const& prototypeCachePath,
341 UsdTimeCode time) const override;
342
343 USDIMAGING_API
344 VtValue Get(UsdPrim const& prim,
345 SdfPath const& cachePath,
346 TfToken const& key,
347 UsdTimeCode time,
348 VtIntArray *outIndices) const override;
349
350 // ---------------------------------------------------------------------- //
352 // ---------------------------------------------------------------------- //
353
354 USDIMAGING_API
356 SdfPath const &parentInstancerPath,
357 SdfPath const &instancerPath,
358 UsdTimeCode time) const override;
359
360 // ---------------------------------------------------------------------- //
362 // ---------------------------------------------------------------------- //
363
364 USDIMAGING_API
366 SdfPath const& cachePath,
367 int instanceIndex,
368 HdInstancerContext *instancerContext) const override;
369
370 USDIMAGING_API
371 SdfPathVector GetScenePrimPaths(
372 SdfPath const& cachePath,
373 std::vector<int> const& instanceIndices,
374 std::vector<HdInstancerContext> *instancerCtxs) const override;
375
376 USDIMAGING_API
377 bool PopulateSelection(
378 HdSelection::HighlightMode const& highlightMode,
379 SdfPath const &cachePath,
380 UsdPrim const &usdPrim,
381 int const hydraInstanceIndex,
382 VtIntArray const &parentInstanceIndices,
383 HdSelectionSharedPtr const &result) const override;
384
385 // ---------------------------------------------------------------------- //
387 // ---------------------------------------------------------------------- //
388
389 USDIMAGING_API
390 HdVolumeFieldDescriptorVector
391 GetVolumeFieldDescriptors(UsdPrim const& usdPrim, SdfPath const &id,
392 UsdTimeCode time) const override;
393
394protected:
395 USDIMAGING_API
396 void _RemovePrim(SdfPath const& cachePath,
397 UsdImagingIndexProxy* index) override final;
398
399private:
400
401 SdfPath _Populate(UsdPrim const& prim,
403 UsdImagingInstancerContext const* instancerContext,
404 SdfPath const& parentProxyPath);
405
406 struct _ProtoPrim;
407 struct _ProtoGroup;
408 struct _InstancerData;
409
410 bool _IsChildPrim(UsdPrim const& prim,
411 SdfPath const& cachePath) const;
412
413 // Returns true if the given prim serves as an instancer.
414 bool _PrimIsInstancer(UsdPrim const& prim) const;
415
416 // Inserts prototype prims for the usdPrim given by \p iter into the
417 // \p index. Any inserted gprims will be inserted under a special path
418 // combining \p ctx.instancerCachePath and \p ctx.childName.
419 SdfPath
420 _InsertProtoPrim(UsdPrimRange::iterator *iter,
421 const UsdImagingPrimAdapterSharedPtr& primAdapter,
423 UsdImagingIndexProxy* index);
424
425 // For a usd path, collects the instancers to resync.
426 void _ResyncPath(SdfPath const& cachePath,
428 bool reload);
429 // Removes and optionally reloads all instancer data, both locally and
430 // from the render index.
431 void _ResyncInstancer(SdfPath const& instancerPath,
432 UsdImagingIndexProxy* index, bool reload);
433
434 // Computes per-frame data in the instancer map. This is primarily used
435 // during update to send new instance indices out to Hydra.
436 struct _ComputeInstanceMapFn;
437 VtIntArray _ComputeInstanceMap(UsdPrim const& instancerPrim,
438 _InstancerData const& instrData,
439 UsdTimeCode time) const;
440
441 // Precomputes the instancer visibility data (as visible, invis, varying
442 // per-node), and returns whether the instance map is variable.
443 // Note: this function assumes the instancer data is already locked by
444 // the caller...
445 struct _ComputeInstanceMapVariabilityFn;
446 bool _ComputeInstanceMapVariability(UsdPrim const& instancerPrim,
447 _InstancerData const& instrData) const;
448
449 // Gets the associated _ProtoPrim and instancer context for the given
450 // instancer and cache path.
451 _ProtoPrim const& _GetProtoPrim(SdfPath const& instancerPath,
452 SdfPath const& cachePath,
453 UsdImagingInstancerContext* ctx) const;
454
455 // Gets the associated _ProtoPrim and instancerContext if cachePath is a
456 // child path and returns \c true, otherwise returns \c false.
457 bool _GetProtoPrimForChild(
458 UsdPrim const& usdPrim,
459 SdfPath const& cachePath,
460 _ProtoPrim const** proto,
461 UsdImagingInstancerContext* ctx) const;
462
463 // Computes the transforms for all instances corresponding to the given
464 // instancer.
465 struct _ComputeInstanceTransformFn;
466 bool _ComputeInstanceTransforms(UsdPrim const& instancer,
467 VtMatrix4dArray* transforms,
468 UsdTimeCode time) const;
469
470 // Gathers the authored transforms time samples given an instancer.
471 struct _GatherInstanceTransformTimeSamplesFn;
472 bool _GatherInstanceTransformsTimeSamples(UsdPrim const& instancer,
473 GfInterval interval,
474 std::vector<double>* outTimes)
475 const;
476
477 // Gathers the specified primvar time samples given an instancer.
478 struct _GatherInstancePrimvarTimeSamplesFn;
479 bool _GatherInstancePrimvarTimeSamples(UsdPrim const& instancer,
480 TfToken const& key,
481 GfInterval interval,
482 std::vector<double>* outTimes)
483 const;
484
485 // Returns true if any of the instances corresponding to the given
486 // instancer has a varying transform.
487 struct _IsInstanceTransformVaryingFn;
488 bool _IsInstanceTransformVarying(UsdPrim const& instancer) const;
489
490 // Computes the value of a primvar for all instances corresponding to the
491 // given instancer. The templated version runs the templated functor,
492 // and the un-templated version does type dispatch.
493 template<typename T> struct _ComputeInheritedPrimvarFn;
494
495 template<typename T>
496 bool _ComputeInheritedPrimvar(UsdPrim const& instancer,
497 TfToken const& primvarName,
498 VtValue *result,
499 UsdTimeCode time) const;
500
501 bool _ComputeInheritedPrimvar(UsdPrim const& instancer,
502 TfToken const& primvarName,
503 SdfValueTypeName const& type,
504 VtValue *result,
505 UsdTimeCode time) const;
506
507 // Returns true if any of the instances corresponding to the given
508 // instancer has varying inherited primvars.
509 struct _IsInstanceInheritedPrimvarVaryingFn;
510 bool _IsInstanceInheritedPrimvarVarying(UsdPrim const& instancer) const;
511
512 struct _PopulateInstanceSelectionFn;
513 struct _GetScenePrimPathsFn;
514 struct _GetInstanceCategoriesFn;
515
516 // Helper functions for dealing with "actual" instances to be drawn.
517 //
518 // Suppose we have:
519 // /Root
520 // Instance_A (prototype: /__Prototype_1)
521 // Instance_B (prototype: /__Prototype_1)
522 // /__Prototype_1
523 // AnotherInstance_A (prototype: /__Prototype_2)
524 // /__Prototype_2
525 //
526 // /__Prototype_2 has only one associated instance in the Usd scenegraph:
527 // /__Prototype_1/AnotherInstance_A. However, imaging actually needs to draw
528 // two instances of /__Prototype_2, because AnotherInstance_A is a nested
529 // instance beneath /__Prototype_1, and there are two instances of
530 // /__Prototype_1.
531 //
532 // Each instance to be drawn is addressed by the chain of instances
533 // that caused it to be drawn. In the above example, the two instances
534 // of /__Prototype_2 to be drawn are:
535 //
536 // [ /Root/Instance_A, /__Prototype_1/AnotherInstance_A ],
537 // [ /Root/Instance_B, /__Prototype_1/AnotherInstance_A ]
538 //
539 // This "instance context" describes the chain of opinions that
540 // ultimately affect the final drawn instance. For example, the
541 // transform of each instance to draw is the combined transforms
542 // of the prims in each context.
543 template <typename Functor>
544 void _RunForAllInstancesToDraw(UsdPrim const& instancer, Functor* fn) const;
545 template <typename Functor>
546 bool _RunForAllInstancesToDrawImpl(UsdPrim const& instancer,
547 std::vector<UsdPrim>* instanceContext,
548 size_t* instanceIdx,
549 Functor* fn) const;
550
551 typedef TfHashMap<SdfPath, size_t, SdfPath::Hash> _InstancerDrawCounts;
552 size_t _CountAllInstancesToDraw(UsdPrim const& instancer) const;
553 size_t _CountAllInstancesToDrawImpl(UsdPrim const& instancer,
554 _InstancerDrawCounts* drawCounts) const;
555
556 // A proto prim represents a single adapter under a prototype root declared
557 // on the instancer.
558 struct _ProtoPrim {
559 _ProtoPrim() {}
560 // Each prim will become a prototype "child" under the instancer. This
561 // path is the path to the prim on the Usd Stage (the path to a single
562 // mesh, for example).
563 SdfPath path;
564 // The prim adapter for the actual prototype prim.
565 UsdImagingPrimAdapterSharedPtr adapter;
566 };
567
568 // Indexed by prototype cachePath (each prim has one entry)
569 typedef TfHashMap<SdfPath, _ProtoPrim, SdfPath::Hash> _PrimMap;
570
571 // All data associated with a given instancer prim. PrimMap could
572 // technically be split out to avoid two lookups, however it seems cleaner
573 // to keep everything bundled up under the instancer path.
574 struct _InstancerData {
575 _InstancerData() : numInstancesToDraw(0), refresh(false) { }
576
577 // The prototype prim path associated with this instancer.
578 SdfPath prototypePath;
579
580 // The USD material path associated with this instancer.
581 SdfPath materialUsdPath;
582
583 // The drawmode associated with this instancer.
584 TfToken drawMode;
585
586 // The purpose value associated with this instance that can be inherited
587 // by proto prims that need to inherit ancestor purpose.
588 TfToken inheritablePurpose;
589
590 // Inherited primvar
591 struct PrimvarInfo {
592 TfToken name;
593 SdfValueTypeName type;
594 bool operator==(const PrimvarInfo& rhs) const;
595 bool operator<(const PrimvarInfo& rhs) const;
596 };
597 std::vector<PrimvarInfo> inheritedPrimvars;
598
599 // Paths to Usd instance prims. Note that this is not necessarily
600 // equivalent to all the instances that will be drawn. See below.
601 SdfPathSet instancePaths;
602
603 // Number of actual instances of this instancer that will be
604 // drawn. See comment on _RunForAllInstancesToDraw.
605 // XXX: This is mutable so that we can precache it in TrackVariability;
606 // it's inappropriate to track it in _Populate since not all instances
607 // will have been populated.
608 mutable size_t numInstancesToDraw;
609
610 // Cached visibility. This vector contains an entry for each instance
611 // that will be drawn (i.e., visibility.size() == numInstancesToDraw).
612 enum Visibility {
613 Invisible, //< Invisible over all time
614 Visible, //< Visible over all time
615 Varying, //< Visibility varies over time
616 Unknown //< Visibility has not yet been checked
617 };
618 // XXX: This is mutable so that we can precache visibility per-instance
619 // in TrackVariability(). Can we replace this with some kind of usage
620 // of an inherited cache?
621 mutable std::vector<Visibility> visibility;
622
623 // Map of all rprims for this instancer prim.
624 _PrimMap primMap;
625
626 // This is a set of reference paths, where this instancer needs
627 // to deferer to another instancer. While refered to here as a child
628 // instancer, the actual relationship is more like a directed graph.
629 SdfPathSet childPointInstancers;
630
631 // Nested (child) native instances.
632 SdfPathVector nestedInstances;
633
634 // Parent native instances.
635 SdfPathVector parentInstances;
636
637 // Flag indicating we've asked the delegate to refresh this instancer
638 // (via TrackVariability/UpdateForTime). We record this so we don't
639 // do it multiple times.
640 mutable bool refresh;
641 };
642
643 // Map from hydra instancer cache path to the various instancer state we
644 // need to answer adapter queries.
645 // Note: this map is modified in multithreaded code paths and must be
646 // locked.
647 typedef std::unordered_map<SdfPath, _InstancerData, SdfPath::Hash>
648 _InstancerDataMap;
649 _InstancerDataMap _instancerData;
650
651 // Map from USD instance prim paths to the cache path of the hydra instancer
652 // they are assigned to (which will typically be the path to the first
653 // instance of this instance group we run across).
654 // XXX: consider to move this forwarding map into HdRenderIndex.
655 typedef TfHashMap<SdfPath, SdfPath, SdfPath::Hash>
656 _InstanceToInstancerMap;
657 _InstanceToInstancerMap _instanceToInstancerMap;
658
659 // Hd and UsdImaging think of instancing in terms of an 'instancer' that
660 // specifies a list of 'prototype' prims that are shared per instance.
661 //
662 // For Usd scenegraph instancing, a prototype prim and its descendents
663 // roughly correspond to the instancer and prototype prims. However,
664 // Hd requires a different instancer and rprims for different combinations
665 // of inherited attributes (material binding, draw mode, etc).
666 // This means we cannot use the Usd prototype prim as the instancer, because
667 // we can't represent this in the case where multiple Usd instances share
668 // the same prototype but have different bindings.
669 //
670 // Instead, we use the first instance of a prototype with a given set of
671 // inherited attributes as our instancer. For example, if /A and /B are
672 // both instances of /__Prototype_1 but /A and /B have different material
673 // bindings authored on them, both /A and /B will be instancers,
674 // with their own set of rprims and instance indices.
675 //
676 // The below is a multimap from prototype path to the cache path of the
677 // hydra instancer. The data for the instancer is located in the
678 // _InstancerDataMap.
679 typedef TfHashMultiMap<SdfPath, SdfPath, SdfPath::Hash>
680 _PrototypeToInstancerMap;
681 _PrototypeToInstancerMap _prototypeToInstancerMap;
682
683 // Map from instance cache path to their instancer path.
684 // Note: this is for reducing proto prim lookup in _GetProtoPrim method.
685 typedef std::unordered_map<SdfPath, SdfPath, SdfPath::Hash>
686 _ProtoPrimToInstancerMap;
687 _ProtoPrimToInstancerMap _protoPrimToInstancerMap;
688};
689
690PXR_NAMESPACE_CLOSE_SCOPE
691
692#endif // PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
A basic mathematical interval class.
Definition: interval.h:50
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:88
Basic type: 3-dimensional floating point range.
Definition: range3d.h:64
HighlightMode
Selection modes allow differentiation in selection highlight behavior.
Definition: selection.h:56
Tags for non-hierarchial subdiv surfaces.
Definition: subdivTags.h:43
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
Represents a value type name, i.e.
Definition: valueTypeName.h:88
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
This proxy class exposes a subset of the private Delegate API to PrimAdapters.
Definition: indexProxy.h:47
Delegate support for instanced prims.
USDIMAGING_API size_t SamplePrimvar(UsdPrim const &usdPrim, SdfPath const &cachePath, TfToken const &key, UsdTimeCode time, size_t maxNumSamples, float *sampleTimes, VtValue *sampleValues, VtIntArray *sampleIndices) override
Sample the primvar for the given prim.
USDIMAGING_API SdfPathVector GetInstancerPrototypes(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the list of known prototypes of this prim.
bool GetVisible(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Returns true if the given prim is visible, taking into account inherited visibility values.
USDIMAGING_API size_t SampleInstancerTransform(UsdPrim const &instancerPrim, SdfPath const &instancerPath, UsdTimeCode time, size_t maxSampleCount, float *sampleTimes, GfMatrix4d *sampleValues) override
Sample the instancer transform for the given prim.
USDIMAGING_API std::vector< VtArray< TfToken > > GetInstanceCategories(UsdPrim const &prim) override
Return an array of the categories used by each instance.
USDIMAGING_API bool GetDoubleSided(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads double-sided from the given prim. If not authored, returns false.
USDIMAGING_API SdfPath GetScenePrimPath(SdfPath const &cachePath, int instanceIndex, HdInstancerContext *instancerContext) const override
USDIMAGING_API GfMatrix4d GetRelativeInstancerTransform(SdfPath const &parentInstancerPath, SdfPath const &instancerPath, UsdTimeCode time) const override
Returns the transform of protoInstancerPath relative to instancerPath.
USDIMAGING_API VtValue GetTopology(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Gets the topology object of a specific Usd prim.
USDIMAGING_API void ProcessPrimResync(SdfPath const &cachePath, UsdImagingIndexProxy *index) override
When a PrimResync event occurs, the prim may have been deleted entirely, adapter plug-ins should over...
USDIMAGING_API SdfPath Populate(UsdPrim const &prim, UsdImagingIndexProxy *index, UsdImagingInstancerContext const *instancerContext=nullptr) override
Called to populate the RenderIndex for this UsdPrim.
USDIMAGING_API HdCullStyle GetCullStyle(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Gets the cullstyle of a specific path in the scene graph.
USDIMAGING_API void UpdateForTime(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time, HdDirtyBits requestedBits, UsdImagingInstancerContext const *instancerContext=NULL) const override
Populates the cache for the given prim, time and requestedBits.
USDIMAGING_API GfRange3d GetExtent(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads the extent from the given prim.
USDIMAGING_API PxOsdSubdivTags GetSubdivTags(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Get the subdiv tags for this prim.
USDIMAGING_API HdDirtyBits ProcessPropertyChange(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &propertyName) override
Returns a bit mask of attributes to be updated, or HdChangeTracker::AllDirty if the entire prim must ...
USDIMAGING_API void TrackVariability(UsdPrim const &prim, SdfPath const &cachePath, HdDirtyBits *timeVaryingBits, UsdImagingInstancerContext const *instancerContext=NULL) const override
For the given prim, variability is detected and stored in timeVaryingBits.
USDIMAGING_API GfMatrix4d GetInstancerTransform(UsdPrim const &instancerPrim, SdfPath const &instancerPath, UsdTimeCode time) const override
Get the instancer transform for the given prim.
USDIMAGING_API size_t SampleTransform(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time, size_t maxNumSamples, float *sampleTimes, GfMatrix4d *sampleValues) override
Samples the transform for the given prim.
USDIMAGING_API VtValue Get(UsdPrim const &prim, SdfPath const &cachePath, TfToken const &key, UsdTimeCode time, VtIntArray *outIndices) const override
Gets the value of the parameter named key for the given prim (which has the given cache path) and giv...
USDIMAGING_API void ProcessPrimRemoval(SdfPath const &cachePath, UsdImagingIndexProxy *index) override
Removes all associated Rprims and dependencies from the render index without scheduling them for repo...
USDIMAGING_API TfToken GetPurpose(UsdPrim const &usdPrim, SdfPath const &cachePath, TfToken const &instanceInheritablePurpose) const override
Returns the purpose token for prim.
USDIMAGING_API SdfPath GetInstancerId(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the instancerId for this prim.
USDIMAGING_API GfMatrix4d GetTransform(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time, bool ignoreRootTransform=false) const override
Fetches the transform for the given prim at the given time from a pre-computed cache of prim transfor...
Base class for all PrimAdapters.
Definition: primAdapter.h:71
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:134
A forward iterator into a UsdPrimRange.
Definition: primRange.h:140
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:84
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:164
Object used by instancer prim adapters to pass along context about the instancer and instance prim to...