All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
instancer.h
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_PLUGIN_HD_EMBREE_INSTANCER_H
8#define PXR_IMAGING_PLUGIN_HD_EMBREE_INSTANCER_H
9
10#include "pxr/pxr.h"
11
12#include "pxr/imaging/hd/instancer.h"
13#include "pxr/imaging/hd/vtBufferSource.h"
14
15#include "pxr/base/tf/hashmap.h"
16#include "pxr/base/tf/token.h"
17
18PXR_NAMESPACE_OPEN_SCOPE
19
34public:
39
42
51 VtMatrix4dArray ComputeInstanceTransforms(SdfPath const &prototypeId);
52
57 void Sync(HdSceneDelegate *sceneDelegate,
58 HdRenderParam *renderParam,
59 HdDirtyBits *dirtyBits) override;
60
61private:
62 // Updates the cached primvars in _primvarMap based on scene delegate
63 // data. This is a helper function for Sync().
64 void _SyncPrimvars(HdSceneDelegate *delegate, HdDirtyBits dirtyBits);
65
66 // Map of the latest primvar data for this instancer, keyed by
67 // primvar name. Primvar values are VtValue, an any-type; they are
68 // interpreted at consumption time (here, in ComputeInstanceTransforms).
69 TfHashMap<TfToken,
71 TfToken::HashFunctor> _primvarMap;
72};
73
74
75PXR_NAMESPACE_CLOSE_SCOPE
76
77#endif // PXR_IMAGING_PLUGIN_HD_EMBREE_INSTANCER_H
HdEmbree implements instancing by adding prototype geometry to the BVH multiple times within HdEmbree...
Definition: instancer.h:33
void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Updates cached primvar data from the scene delegate.
VtMatrix4dArray ComputeInstanceTransforms(SdfPath const &prototypeId)
Computes all instance transforms for the provided prototype id, taking into account the scene delegat...
~HdEmbreeInstancer()
Destructor.
HdEmbreeInstancer(HdSceneDelegate *delegate, SdfPath const &id)
Constructor.
This class exists to facilitate point cloud style instancing.
Definition: instancer.h:108
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
Adapter class providing data exchange with the client scene graph.
An implementation of HdBufferSource where the source data value is a VtValue.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Functor to use for hash maps from tokens to other things.
Definition: token.h:149
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...