Loading...
Searching...
No Matches
material.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_25_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_MATERIAL_H
8#define EXT_RMANPKG_25_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_MATERIAL_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hd/material.h"
12#include "Riley.h"
13#include <mutex>
14
15PXR_NAMESPACE_OPEN_SCOPE
16
17class HdSceneDelegate;
18class HdPrman_RenderParam;
19
24class HdPrmanMaterial final : public HdMaterial
25{
26public:
27 HdPrmanMaterial(SdfPath const& id);
28 ~HdPrmanMaterial() override;
29
31 void Sync(HdSceneDelegate *sceneDelegate,
32 HdRenderParam *renderParam,
33 HdDirtyBits *dirtyBits) override;
34
38 HdDirtyBits GetInitialDirtyBitsMask() const override;
39
40 riley::MaterialId GetMaterialId() const { return _materialId; }
41 riley::DisplacementId GetDisplacementId() const { return _displacementId; }
42
44 bool IsValid() const;
45
46 void Finalize(HdRenderParam *renderParam) override;
47
50
53
56 HdSceneDelegate *sceneDelegate,
57 riley::Riley *riley);
58
59private:
60 void _ResetMaterialWithLock(riley::Riley *riley);
61 void _SyncToRileyWithLock(
62 HdSceneDelegate *sceneDelegate,
63 riley::Riley *riley);
64
65 riley::MaterialId _materialId;
66 riley::DisplacementId _displacementId;
67
68 // XXX only used to set disp bound for UsdPreviewMaterial cases
69 HdMaterialNetwork2 _materialNetwork;
70
71 mutable std::mutex _syncToRileyMutex;
72 bool _rileyIsInSync;
73};
74
78bool
79HdPrman_ConvertHdMaterialNetwork2ToRmanNodes(
80 HdMaterialNetwork2 const& network,
81 SdfPath const& nodePath,
82 std::vector<riley::ShadingNode> *result);
83
88HdPrmanMaterial_GetFallbackSurfaceMaterialNetwork();
89
90PXR_NAMESPACE_CLOSE_SCOPE
91
92#endif // EXT_RMANPKG_25_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_MATERIAL_H
Hydra Schema for a material object.
Definition: material.h:22
A representation for materials (including displacement) in prman.
Definition: material.h:25
void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Synchronizes state from the delegate to this object.
static TfTokenVector const & GetShaderSourceTypes()
Return the static list of tokens supported.
void SyncToRiley(HdSceneDelegate *sceneDelegate, riley::Riley *riley)
Make sure this material has been updated in Riley.
void Finalize(HdRenderParam *renderParam) override
Finalizes object resources.
bool IsValid() const
Return true if this material is valid.
HdMaterialNetwork2 const & GetMaterialNetwork() const
Return the material network after filtering.
HdDirtyBits GetInitialDirtyBitsMask() const override
Returns the minimal set of dirty bits to place in the change tracker for use in the first sync of thi...
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
Container of nodes and top-level terminal connections.
Definition: material.h:161
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440