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_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_MATERIAL_H
8#define EXT_RMANPKG_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 static bool IsTexExt(const std::string& ext);
54
57
60 HdSceneDelegate *sceneDelegate,
61 riley::Riley *riley);
62
63private:
64 void _ResetMaterialWithLock(riley::Riley *riley);
65 void _SyncToRileyWithLock(
66 HdSceneDelegate *sceneDelegate,
67 riley::Riley *riley);
68
69 bool _dirtyMaterial;
70 riley::MaterialId _materialId;
71 bool _dirtyDisplacement;
72 riley::DisplacementId _displacementId;
73
74 // XXX only used to set disp bound for UsdPreviewMaterial cases
75 HdMaterialNetwork2 _materialNetwork;
76
77 mutable std::mutex _syncToRileyMutex;
78 bool _rileyIsInSync;
79};
80
84bool
85HdPrman_ConvertHdMaterialNetwork2ToRmanNodes(
86 SdfPath const& id,
87 HdMaterialNetwork2 const& network,
88 SdfPath const& nodePath,
89 std::vector<riley::ShadingNode> *result);
90
95HdPrmanMaterial_GetFallbackSurfaceMaterialNetwork();
96
97PXR_NAMESPACE_CLOSE_SCOPE
98
99#endif // EXT_RMANPKG_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_MATERIAL_H
Hydra Schema for a material object.
Definition: material.h:23
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 bool IsTexExt(const std::string &ext)
Consult the HD_PRMAN_TEX_EXTS env var to determine which textures should be passed through without pr...
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:166
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440