Blender V5.3
intern/cycles/hydra/material.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 NVIDIA Corporation
2 * SPDX-FileCopyrightText: 2022 Blender Foundation
3 *
4 * SPDX-License-Identifier: Apache-2.0 */
5
6#pragma once
7
8#include "hydra/config.h"
9
10#include "util/unique_ptr.h"
11
12#include <pxr/imaging/hd/material.h>
13#include <pxr/imaging/hd/materialNetworkSchema.h>
14#include <pxr/imaging/hd/materialNodeParameterSchema.h>
15#include <pxr/imaging/hd/materialNodeSchema.h>
16
18
19class HdCyclesMaterial final : public PXR_NS::HdMaterial {
20 public:
21 HdCyclesMaterial(const PXR_NS::SdfPath &sprimId);
23
24 PXR_NS::HdDirtyBits GetInitialDirtyBitsMask() const override;
25
26 void Sync(PXR_NS::HdSceneDelegate *sceneDelegate,
27 PXR_NS::HdRenderParam *renderParam,
28 PXR_NS::HdDirtyBits *dirtyBits) override;
29
30 void Finalize(PXR_NS::HdRenderParam *renderParam) override;
31
32 CCL_NS::Shader *GetCyclesShader() const
33 {
34 return _shader;
35 }
36
37 private:
38 struct NodeDesc {
39 CCL_NS::ShaderNode *node;
40 const class UsdToCyclesMapping *mapping;
41 };
42
43 void UpdateParameters(NodeDesc &nodeDesc,
44 PXR_NS::HdMaterialNodeParameterContainerSchema params,
45 const PXR_NS::SdfPath &nodePath);
46
47 void UpdateParameters(PXR_NS::HdMaterialNetworkSchema network);
48
49 void UpdateConnections(NodeDesc &nodeDesc,
50 PXR_NS::HdMaterialNodeSchema nodeSchema,
51 const PXR_NS::SdfPath &nodePath,
52 CCL_NS::ShaderGraph *shaderGraph);
53
54 unique_ptr<CCL_NS::ShaderGraph> BuildShaderGraph(PXR_NS::HdMaterialNetworkSchema network);
55
56 CCL_NS::Shader *_shader = nullptr;
57 std::unordered_map<PXR_NS::SdfPath, NodeDesc, PXR_NS::SdfPath::Hash> _nodes;
58};
59
#define final(a, b, c)
Definition BLI_hash_c.hh:21
PXR_NS::HdDirtyBits GetInitialDirtyBitsMask() const override
Definition material.cpp:234
void Finalize(PXR_NS::HdRenderParam *renderParam) override
Definition material.cpp:622
HdCyclesMaterial(const PXR_NS::SdfPath &sprimId)
Definition material.cpp:230
CCL_NS::Shader * GetCyclesShader() const
~HdCyclesMaterial() override
void Sync(PXR_NS::HdSceneDelegate *sceneDelegate, PXR_NS::HdRenderParam *renderParam, PXR_NS::HdDirtyBits *dirtyBits) override
Definition material.cpp:239
#define HDCYCLES_NAMESPACE_CLOSE_SCOPE