Loading...
Searching...
No Matches
volume.h
1//
2// Copyright 2019 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef EXT_RMANPKG_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_VOLUME_H
8#define EXT_RMANPKG_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_VOLUME_H
9
10#include "pxr/pxr.h"
11#include "hdPrman/gprim.h"
12#include "pxr/imaging/hd/field.h"
13#include "pxr/imaging/hd/volume.h"
14
15#include "Riley.h"
16
17PXR_NAMESPACE_OPEN_SCOPE
18
19class HdPrman_Field final : public HdField
20{
21public:
22 HdPrman_Field(TfToken const& typeId, SdfPath const& id);
23 void Sync(HdSceneDelegate *sceneDelegate,
24 HdRenderParam *renderParam,
25 HdDirtyBits *dirtyBits) override;
26 void Finalize(HdRenderParam *renderParam) override;
27 HdDirtyBits GetInitialDirtyBitsMask() const override;
28private:
29 TfToken const _typeId;
30};
31
32class HdPrman_Volume final : public HdPrman_Gprim<HdVolume>
33{
34public:
35 using BASE = HdPrman_Gprim<HdVolume>;
36public:
37
38 HF_MALLOC_TAG_NEW("new HdPrman_Volume");
39
40 HdPrman_Volume(SdfPath const& id, const bool isMeshLight);
41
42 HdDirtyBits GetInitialDirtyBitsMask() const override;
43
61 using HdPrman_VolumeTypeEmitter =
62 void (*)(HdSceneDelegate *sceneDelegate,
63 SdfPath const& id,
64 HdVolumeFieldDescriptorVector const& fields,
65 RtPrimVarList* primvars);
66
70 static bool AddVolumeTypeEmitter(TfToken const& fieldPrimType,
71 HdPrman_VolumeTypeEmitter emitterFunc,
72 bool overrideExisting = false);
73
75 enum FieldType {
76 FloatType = 0,
77 IntType,
78 Float2Type,
79 Int2Type,
80 Float3Type,
81 Int3Type,
82 ColorType,
83 PointType,
84 NormalType,
85 VectorType,
86 Float4Type,
87 MatrixType,
88 StringType
89 };
90
92 static void DeclareFieldPrimvar(RtPrimVarList* primvars,
93 RtUString const& fieldName,
94 FieldType type);
95
96protected:
97 bool _ConvertGeometry(
98 HdPrman_RenderParam *renderParam,
99 HdSceneDelegate *sceneDelegate,
100 const SdfPath &id,
101 RtUString *primType,
102 RtPrimVarList *primvars,
103 std::vector<HdGeomSubset> *geomSubsets,
104 std::vector<RtPrimVarList> *geomSubsetPrimvars) override;
105
106 riley::MaterialId
107 _GetFallbackMaterial(HdPrman_RenderParam *renderParam) override {
108 return renderParam->GetFallbackVolumeMaterialId();
109 }
110
111 bool _PrototypeOnly() override;
112
113 using _VolumeEmitterMap = std::map<TfToken, HdPrman_VolumeTypeEmitter>;
114 static _VolumeEmitterMap& _GetVolumeEmitterMap();
115
116private:
117 bool _isMeshLight;
118};
119
120PXR_NAMESPACE_CLOSE_SCOPE
121
122#endif // EXT_RMANPKG_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_VOLUME_H
virtual HD_API void Finalize(HdRenderParam *renderParam)
Finalizes object resources.
virtual HdDirtyBits GetInitialDirtyBitsMask() const =0
Returns the minimal set of dirty bits to place in the change tracker for use in the first sync of thi...
virtual void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits)=0
Synchronizes state from the delegate to this object.
Hydra schema for a USD field primitive.
Definition: field.h:34
A mix-in template that adds shared gprim behavior to support various HdRprim types.
Definition: gprim.h:30
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.
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