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"
31
32#include "pxr/base/tf/hashmap.h"
33
34#include <mutex>
35
36PXR_NAMESPACE_OPEN_SCOPE
37
38
92{
93public:
95
98
100 UsdPrim const& prim,
101 UsdImagingIndexProxy* index,
102 UsdImagingInstancerContext const* instancerContext = nullptr) override;
103
104 virtual bool ShouldCullChildren() const override;
105
106 virtual bool IsInstancerAdapter() const override;
107
108 // ---------------------------------------------------------------------- //
110 // ---------------------------------------------------------------------- //
111
112 virtual void TrackVariability(UsdPrim const& prim,
113 SdfPath const& cachePath,
114 HdDirtyBits* timeVaryingBits,
116 instancerContext = NULL) const override;
117
118 virtual void UpdateForTime(UsdPrim const& prim,
119 SdfPath const& cachePath,
120 UsdTimeCode time,
121 HdDirtyBits requestedBits,
123 instancerContext = NULL) const override;
124
125 // ---------------------------------------------------------------------- //
127 // ---------------------------------------------------------------------- //
128
129 virtual HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
130 SdfPath const& cachePath,
131 TfToken const& propertyName)
132 override;
133
134 virtual void ProcessPrimResync(SdfPath const& cachePath,
135 UsdImagingIndexProxy* index) override;
136
137 virtual void ProcessPrimRemoval(SdfPath const& cachePath,
138 UsdImagingIndexProxy* index) override;
139
140
141 virtual void MarkDirty(UsdPrim const& prim,
142 SdfPath const& cachePath,
143 HdDirtyBits dirty,
144 UsdImagingIndexProxy* index) override;
145
146 // As this adapter hijacks the adapter for the child prim
147 // We need to forward these messages on, in case the child
148 // adapter needs them
149 virtual void MarkRefineLevelDirty(UsdPrim const& prim,
150 SdfPath const& cachePath,
151 UsdImagingIndexProxy* index) override;
152
153 virtual void MarkReprDirty(UsdPrim const& prim,
154 SdfPath const& cachePath,
155 UsdImagingIndexProxy* index) override;
156
157 virtual void MarkCullStyleDirty(UsdPrim const& prim,
158 SdfPath const& cachePath,
159 UsdImagingIndexProxy* index) override;
160
161 virtual void MarkRenderTagDirty(UsdPrim const& prim,
162 SdfPath const& cachePath,
163 UsdImagingIndexProxy* index) override;
164
165 virtual void MarkTransformDirty(UsdPrim const& prim,
166 SdfPath const& cachePath,
167 UsdImagingIndexProxy* index) override;
168
169 virtual void MarkVisibilityDirty(UsdPrim const& prim,
170 SdfPath const& cachePath,
171 UsdImagingIndexProxy* index) override;
172
173 // ---------------------------------------------------------------------- //
175 // ---------------------------------------------------------------------- //
176
177 std::vector<VtArray<TfToken>> GetInstanceCategories(
178 UsdPrim const& prim) override;
179
181 SdfPath const& instancerPath,
182 UsdTimeCode time) const override;
183
185 UsdPrim const& usdPrim,
186 SdfPath const& cachePath) const override;
187
189 UsdPrim const& usdPrim,
190 SdfPath const& cachePath) const override;
191
192 size_t SampleInstancerTransform(UsdPrim const& instancerPrim,
193 SdfPath const& instancerPath,
194 UsdTimeCode time,
195 size_t maxSampleCount,
196 float *sampleTimes,
197 GfMatrix4d *sampleValues) override;
198
199 size_t SampleTransform(UsdPrim const& prim,
200 SdfPath const& cachePath,
201 UsdTimeCode time,
202 size_t maxNumSamples,
203 float *sampleTimes,
204 GfMatrix4d *sampleValues) override;
205
206 size_t SamplePrimvar(UsdPrim const& usdPrim,
207 SdfPath const& cachePath,
208 TfToken const& key,
209 UsdTimeCode time,
210 size_t maxNumSamples,
211 float *sampleTimes,
212 VtValue *sampleValues,
213 VtIntArray *sampleIndices) override;
214
216 UsdPrim const& usdPrim,
217 SdfPath const& cachePath,
218 TfToken const& instanceInheritablePurpose) const override;
219
221 SdfPath const& cachePath,
222 UsdTimeCode time) const override;
223
225 SdfPath const& cachePath,
226 UsdTimeCode time) const override;
227
228 HdCullStyle GetCullStyle(UsdPrim const& prim,
229 SdfPath const& cachePath,
230 UsdTimeCode time) const override;
231
232 GfRange3d GetExtent(UsdPrim const& usdPrim,
233 SdfPath const& cachePath,
234 UsdTimeCode time) const override;
235
236 bool GetVisible(UsdPrim const& usdPrim,
237 SdfPath const& cachePath,
238 UsdTimeCode time) const override;
239
240 bool GetDoubleSided(UsdPrim const& prim,
241 SdfPath const& cachePath,
242 UsdTimeCode time) const override;
243
245 SdfPath const& cachePath,
246 UsdTimeCode time,
247 bool ignoreRootTransform = false) const override;
248
249 SdfPath GetMaterialId(UsdPrim const& prim,
250 SdfPath const& cachePath,
251 UsdTimeCode time) const override;
252
253 VtValue GetLightParamValue(
254 const UsdPrim& prim,
255 const SdfPath& cachePath,
256 const TfToken& paramName,
257 UsdTimeCode time) const override;
258
259 VtValue GetMaterialResource(
260 const UsdPrim& prim,
261 const SdfPath& cachePath,
262 UsdTimeCode time) const override;
263
264 HdExtComputationInputDescriptorVector
265 GetExtComputationInputs(UsdPrim const& prim,
266 SdfPath const& cachePath,
267 const UsdImagingInstancerContext* instancerContext)
268 const override;
269
270
271 HdExtComputationOutputDescriptorVector
272 GetExtComputationOutputs(UsdPrim const& prim,
273 SdfPath const& cachePath,
274 const UsdImagingInstancerContext* instancerContext)
275 const override;
276
277 HdExtComputationPrimvarDescriptorVector
278 GetExtComputationPrimvars(
279 UsdPrim const& prim,
280 SdfPath const& cachePath,
281 HdInterpolation interpolation,
282 const UsdImagingInstancerContext* instancerContext) const override;
283
284 VtValue
285 GetExtComputationInput(
286 UsdPrim const& prim,
287 SdfPath const& cachePath,
288 TfToken const& name,
289 UsdTimeCode time,
290 const UsdImagingInstancerContext* instancerContext) const override;
291
292 std::string
293 GetExtComputationKernel(
294 UsdPrim const& prim,
295 SdfPath const& cachePath,
296 const UsdImagingInstancerContext* instancerContext) const override;
297
298 VtValue
299 GetInstanceIndices(UsdPrim const& instancerPrim,
300 SdfPath const& instancerCachePath,
301 SdfPath const& prototypeCachePath,
302 UsdTimeCode time) const override;
303
304 VtValue Get(UsdPrim const& prim,
305 SdfPath const& cachePath,
306 TfToken const& key,
307 UsdTimeCode time,
308 VtIntArray *outIndices) const override;
309
310 // ---------------------------------------------------------------------- //
312 // ---------------------------------------------------------------------- //
313
315 SdfPath const &parentInstancerPath,
316 SdfPath const &instancerPath,
317 UsdTimeCode time) const override;
318
319 // ---------------------------------------------------------------------- //
321 // ---------------------------------------------------------------------- //
322
324 SdfPath const& cachePath,
325 int instanceIndex,
326 HdInstancerContext *instancerContext) const override;
327
328 virtual SdfPathVector GetScenePrimPaths(
329 SdfPath const& cachePath,
330 std::vector<int> const& instanceIndices,
331 std::vector<HdInstancerContext> *instancerCtxs) const override;
332
333 virtual bool PopulateSelection(
334 HdSelection::HighlightMode const& highlightMode,
335 SdfPath const &cachePath,
336 UsdPrim const &usdPrim,
337 int const hydraInstanceIndex,
338 VtIntArray const &parentInstanceIndices,
339 HdSelectionSharedPtr const &result) const override;
340
341 // ---------------------------------------------------------------------- //
343 // ---------------------------------------------------------------------- //
344
345 virtual HdVolumeFieldDescriptorVector
346 GetVolumeFieldDescriptors(UsdPrim const& usdPrim, SdfPath const &id,
347 UsdTimeCode time) const override;
348
349protected:
350 virtual void _RemovePrim(SdfPath const& cachePath,
351 UsdImagingIndexProxy* index) override final;
352
353private:
354
355 SdfPath _Populate(UsdPrim const& prim,
357 UsdImagingInstancerContext const* instancerContext,
358 SdfPath const& parentProxyPath);
359
360 struct _ProtoPrim;
361 struct _ProtoGroup;
362 struct _InstancerData;
363
364 bool _IsChildPrim(UsdPrim const& prim,
365 SdfPath const& cachePath) const;
366
367 // Returns true if the given prim serves as an instancer.
368 bool _PrimIsInstancer(UsdPrim const& prim) const;
369
370 // Inserts prototype prims for the given \p usdPrim into the \p index.
371 // Any inserted gprims will be inserted under a special path combining
372 // \p instancerPath and \p protoName.
373 SdfPath
374 _InsertProtoPrim(UsdPrimRange::iterator *iter,
375 const TfToken& protoName,
376 SdfPath materialId,
377 TfToken drawMode,
378 TfToken inheritablePurpose,
379 SdfPath instancerPath,
380 UsdImagingPrimAdapterSharedPtr const& primAdapter,
381 UsdImagingPrimAdapterSharedPtr const& instancerAdapter,
383 bool *isLeafInstancer);
384
385 // For a usd path, collects the instancers to resync.
386 void _ResyncPath(SdfPath const& cachePath,
388 bool reload);
389 // Removes and optionally reloads all instancer data, both locally and
390 // from the render index.
391 void _ResyncInstancer(SdfPath const& instancerPath,
392 UsdImagingIndexProxy* index, bool reload);
393
394 // Computes per-frame data in the instancer map. This is primarily used
395 // during update to send new instance indices out to Hydra.
396 struct _ComputeInstanceMapFn;
397 VtIntArray _ComputeInstanceMap(UsdPrim const& instancerPrim,
398 _InstancerData const& instrData,
399 UsdTimeCode time) const;
400
401 // Precomputes the instancer visibility data (as visible, invis, varying
402 // per-node), and returns whether the instance map is variable.
403 // Note: this function assumes the instancer data is already locked by
404 // the caller...
405 struct _ComputeInstanceMapVariabilityFn;
406 bool _ComputeInstanceMapVariability(UsdPrim const& instancerPrim,
407 _InstancerData const& instrData) const;
408
409 // Gets the associated _ProtoPrim and instancer context for the given
410 // instancer and cache path.
411 _ProtoPrim const& _GetProtoPrim(SdfPath const& instancerPath,
412 SdfPath const& cachePath,
413 UsdImagingInstancerContext* ctx) const;
414
415 // Gets the associated _ProtoPrim and instancerContext if cachePath is a
416 // child path and returns \c true, otherwise returns \c false.
417 bool _GetProtoPrimForChild(
418 UsdPrim const& usdPrim,
419 SdfPath const& cachePath,
420 _ProtoPrim const** proto,
421 UsdImagingInstancerContext* ctx) const;
422
423 // Computes the transforms for all instances corresponding to the given
424 // instancer.
425 struct _ComputeInstanceTransformFn;
426 bool _ComputeInstanceTransforms(UsdPrim const& instancer,
427 VtMatrix4dArray* transforms,
428 UsdTimeCode time) const;
429
430 // Gathers the authored transforms time samples given an instancer.
431 struct _GatherInstanceTransformTimeSamplesFn;
432 bool _GatherInstanceTransformsTimeSamples(UsdPrim const& instancer,
433 GfInterval interval,
434 std::vector<double>* outTimes)
435 const;
436
437 // Gathers the specified primvar time samples given an instancer.
438 struct _GatherInstancePrimvarTimeSamplesFn;
439 bool _GatherInstancePrimvarTimeSamples(UsdPrim const& instancer,
440 TfToken const& key,
441 GfInterval interval,
442 std::vector<double>* outTimes)
443 const;
444
445 // Returns true if any of the instances corresponding to the given
446 // instancer has a varying transform.
447 struct _IsInstanceTransformVaryingFn;
448 bool _IsInstanceTransformVarying(UsdPrim const& instancer) const;
449
450 // Computes the value of a primvar for all instances corresponding to the
451 // given instancer. The templated version runs the templated functor,
452 // and the un-templated version does type dispatch.
453 template<typename T> struct _ComputeInheritedPrimvarFn;
454
455 template<typename T>
456 bool _ComputeInheritedPrimvar(UsdPrim const& instancer,
457 TfToken const& primvarName,
458 VtValue *result,
459 UsdTimeCode time) const;
460
461 bool _ComputeInheritedPrimvar(UsdPrim const& instancer,
462 TfToken const& primvarName,
463 SdfValueTypeName const& type,
464 VtValue *result,
465 UsdTimeCode time) const;
466
467 // Returns true if any of the instances corresponding to the given
468 // instancer has varying inherited primvars.
469 struct _IsInstanceInheritedPrimvarVaryingFn;
470 bool _IsInstanceInheritedPrimvarVarying(UsdPrim const& instancer) const;
471
472 struct _PopulateInstanceSelectionFn;
473 struct _GetScenePrimPathsFn;
474 struct _GetInstanceCategoriesFn;
475
476 // Helper functions for dealing with "actual" instances to be drawn.
477 //
478 // Suppose we have:
479 // /Root
480 // Instance_A (prototype: /__Prototype_1)
481 // Instance_B (prototype: /__Prototype_1)
482 // /__Prototype_1
483 // AnotherInstance_A (prototype: /__Prototype_2)
484 // /__Prototype_2
485 //
486 // /__Prototype_2 has only one associated instance in the Usd scenegraph:
487 // /__Prototype_1/AnotherInstance_A. However, imaging actually needs to draw
488 // two instances of /__Prototype_2, because AnotherInstance_A is a nested
489 // instance beneath /__Prototype_1, and there are two instances of
490 // /__Prototype_1.
491 //
492 // Each instance to be drawn is addressed by the chain of instances
493 // that caused it to be drawn. In the above example, the two instances
494 // of /__Prototype_2 to be drawn are:
495 //
496 // [ /Root/Instance_A, /__Prototype_1/AnotherInstance_A ],
497 // [ /Root/Instance_B, /__Prototype_1/AnotherInstance_A ]
498 //
499 // This "instance context" describes the chain of opinions that
500 // ultimately affect the final drawn instance. For example, the
501 // transform of each instance to draw is the combined transforms
502 // of the prims in each context.
503 template <typename Functor>
504 void _RunForAllInstancesToDraw(UsdPrim const& instancer, Functor* fn) const;
505 template <typename Functor>
506 bool _RunForAllInstancesToDrawImpl(UsdPrim const& instancer,
507 std::vector<UsdPrim>* instanceContext,
508 size_t* instanceIdx,
509 Functor* fn) const;
510
511 typedef TfHashMap<SdfPath, size_t, SdfPath::Hash> _InstancerDrawCounts;
512 size_t _CountAllInstancesToDraw(UsdPrim const& instancer) const;
513 size_t _CountAllInstancesToDrawImpl(UsdPrim const& instancer,
514 _InstancerDrawCounts* drawCounts) const;
515
516 // A proto prim represents a single adapter under a prototype root declared
517 // on the instancer.
518 struct _ProtoPrim {
519 _ProtoPrim() {}
520 // Each prim will become a prototype "child" under the instancer. This
521 // path is the path to the prim on the Usd Stage (the path to a single
522 // mesh, for example).
523 SdfPath path;
524 // The prim adapter for the actual prototype prim.
525 UsdImagingPrimAdapterSharedPtr adapter;
526 };
527
528 // Indexed by prototype cachePath (each prim has one entry)
529 typedef TfHashMap<SdfPath, _ProtoPrim, SdfPath::Hash> _PrimMap;
530
531 // All data associated with a given instancer prim. PrimMap could
532 // technically be split out to avoid two lookups, however it seems cleaner
533 // to keep everything bundled up under the instancer path.
534 struct _InstancerData {
535 _InstancerData() : numInstancesToDraw(0), refresh(false) { }
536
537 // The prototype prim path associated with this instancer.
538 SdfPath prototypePath;
539
540 // The USD material path associated with this instancer.
541 SdfPath materialUsdPath;
542
543 // The drawmode associated with this instancer.
544 TfToken drawMode;
545
546 // The purpose value associated with this instance that can be inherited
547 // by proto prims that need to inherit ancestor purpose.
548 TfToken inheritablePurpose;
549
550 // Inherited primvar
551 struct PrimvarInfo {
552 TfToken name;
553 SdfValueTypeName type;
554 bool operator==(const PrimvarInfo& rhs) const;
555 bool operator<(const PrimvarInfo& rhs) const;
556 };
557 std::vector<PrimvarInfo> inheritedPrimvars;
558
559 // Paths to Usd instance prims. Note that this is not necessarily
560 // equivalent to all the instances that will be drawn. See below.
561 SdfPathSet instancePaths;
562
563 // Number of actual instances of this instancer that will be
564 // drawn. See comment on _RunForAllInstancesToDraw.
565 // XXX: This is mutable so that we can precache it in TrackVariability;
566 // it's inappropriate to track it in _Populate since not all instances
567 // will have been populated.
568 mutable size_t numInstancesToDraw;
569
570 // Cached visibility. This vector contains an entry for each instance
571 // that will be drawn (i.e., visibility.size() == numInstancesToDraw).
572 enum Visibility {
573 Invisible, //< Invisible over all time
574 Visible, //< Visible over all time
575 Varying, //< Visibility varies over time
576 Unknown //< Visibility has not yet been checked
577 };
578 // XXX: This is mutable so that we can precache visibility per-instance
579 // in TrackVariability(). Can we replace this with some kind of usage
580 // of an inherited cache?
581 mutable std::vector<Visibility> visibility;
582
583 // Map of all rprims for this instancer prim.
584 _PrimMap primMap;
585
586 // This is a set of reference paths, where this instancer needs
587 // to deferer to another instancer. While refered to here as a child
588 // instancer, the actual relationship is more like a directed graph.
589 SdfPathSet childPointInstancers;
590
591 // Nested (child) native instances.
592 SdfPathVector nestedInstances;
593
594 // Parent native instances.
595 SdfPathVector parentInstances;
596
597 // Flag indicating we've asked the delegate to refresh this instancer
598 // (via TrackVariability/UpdateForTime). We record this so we don't
599 // do it multiple times.
600 mutable bool refresh;
601 };
602
603 // Map from hydra instancer cache path to the various instancer state we
604 // need to answer adapter queries.
605 // Note: this map is modified in multithreaded code paths and must be
606 // locked.
607 typedef std::unordered_map<SdfPath, _InstancerData, SdfPath::Hash>
608 _InstancerDataMap;
609 _InstancerDataMap _instancerData;
610
611 // Map from USD instance prim paths to the cache path of the hydra instancer
612 // they are assigned to (which will typically be the path to the first
613 // instance of this instance group we run across).
614 // XXX: consider to move this forwarding map into HdRenderIndex.
615 typedef TfHashMap<SdfPath, SdfPath, SdfPath::Hash>
616 _InstanceToInstancerMap;
617 _InstanceToInstancerMap _instanceToInstancerMap;
618
619 // Hd and UsdImaging think of instancing in terms of an 'instancer' that
620 // specifies a list of 'prototype' prims that are shared per instance.
621 //
622 // For Usd scenegraph instancing, a prototype prim and its descendents
623 // roughly correspond to the instancer and prototype prims. However,
624 // Hd requires a different instancer and rprims for different combinations
625 // of inherited attributes (material binding, draw mode, etc).
626 // This means we cannot use the Usd prototype prim as the instancer, because
627 // we can't represent this in the case where multiple Usd instances share
628 // the same prototype but have different bindings.
629 //
630 // Instead, we use the first instance of a prototype with a given set of
631 // inherited attributes as our instancer. For example, if /A and /B are
632 // both instances of /__Prototype_1 but /A and /B have different material
633 // bindings authored on them, both /A and /B will be instancers,
634 // with their own set of rprims and instance indices.
635 //
636 // The below is a multimap from prototype path to the cache path of the
637 // hydra instancer. The data for the instancer is located in the
638 // _InstancerDataMap.
639 typedef TfHashMultiMap<SdfPath, SdfPath, SdfPath::Hash>
640 _PrototypeToInstancerMap;
641 _PrototypeToInstancerMap _prototypeToInstancerMap;
642
643 // Map from instance cache path to their instancer path.
644 // Note: this is for reducing proto prim lookup in _GetProtoPrim method.
645 typedef std::unordered_map<SdfPath, SdfPath, SdfPath::Hash>
646 _ProtoPrimToInstancerMap;
647 _ProtoPrimToInstancerMap _protoPrimToInstancerMap;
648};
649
650
651PXR_NAMESPACE_CLOSE_SCOPE
652
653#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:291
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.
bool GetDoubleSided(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads double-sided from the given prim. If not authored, returns false.
virtual GfMatrix4d GetRelativeInstancerTransform(SdfPath const &parentInstancerPath, SdfPath const &instancerPath, UsdTimeCode time) const override
Returns the transform of protoInstancerPath relative to instancerPath.
PxOsdSubdivTags GetSubdivTags(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Get the subdiv tags for this prim.
GfRange3d GetExtent(UsdPrim const &usdPrim, SdfPath const &cachePath, UsdTimeCode time) const override
Reads the extent from the given prim.
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.
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.
HdCullStyle GetCullStyle(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Gets the cullstyle of a specific path in the scene graph.
SdfPath GetInstancerId(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the instancerId for this prim.
virtual 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 ...
virtual 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...
virtual 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.
TfToken GetPurpose(UsdPrim const &usdPrim, SdfPath const &cachePath, TfToken const &instanceInheritablePurpose) const override
Returns the purpose token for prim.
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.
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...
VtValue GetTopology(UsdPrim const &prim, SdfPath const &cachePath, UsdTimeCode time) const override
Gets the topology object of a specific Usd prim.
std::vector< VtArray< TfToken > > GetInstanceCategories(UsdPrim const &prim) override
Return an array of the categories used by each instance.
virtual void ProcessPrimRemoval(SdfPath const &cachePath, UsdImagingIndexProxy *index) override
Removes all associated Rprims and dependencies from the render index without scheduling them for repo...
virtual SdfPath Populate(UsdPrim const &prim, UsdImagingIndexProxy *index, UsdImagingInstancerContext const *instancerContext=nullptr) override
Called to populate the RenderIndex for this UsdPrim.
GfMatrix4d GetInstancerTransform(UsdPrim const &instancerPrim, SdfPath const &instancerPath, UsdTimeCode time) const override
Get the instancer transform for the given prim.
virtual 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.
virtual SdfPath GetScenePrimPath(SdfPath const &cachePath, int instanceIndex, HdInstancerContext *instancerContext) const override
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...
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.
SdfPathVector GetInstancerPrototypes(UsdPrim const &usdPrim, SdfPath const &cachePath) const override
Return the list of known prototypes of this prim.
Base class for all PrimAdapters.
Definition: primAdapter.h:70
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:165
Object used by instancer prim adapters to pass along context about the instancer and instance prim to...