Loading...
Searching...
No Matches
imageShader.h
1//
2// Copyright 2023 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_IMAGING_HD_IMAGE_SHADER_H
25#define PXR_IMAGING_HD_IMAGE_SHADER_H
26
27#include "pxr/pxr.h"
28#include "pxr/imaging/hd/api.h"
29#include "pxr/imaging/hd/material.h"
30#include "pxr/imaging/hd/sprim.h"
31#include "pxr/imaging/hd/version.h"
32
35
36PXR_NAMESPACE_OPEN_SCOPE
37
38#define HD_IMAGE_SHADER_TOKENS \
39 (enabled) \
40 (priority) \
41 (filePath) \
42 (constants) \
43 (materialNetwork)
44
45TF_DECLARE_PUBLIC_TOKENS(HdImageShaderTokens, HD_API, HD_IMAGE_SHADER_TOKENS);
46
47class HdSceneDelegate;
48
49using HdMaterialNetworkInterfaceUniquePtr =
50 std::unique_ptr<class HdMaterialNetworkInterface>;
51
56class HdImageShader : public HdSprim
57{
58public:
59 HD_API
60 HdImageShader(SdfPath const & id);
61 HD_API
62 ~HdImageShader() override;
63
64 // Change tracking for HdImageShader
65 enum DirtyBits : HdDirtyBits {
66 Clean = 0,
67 DirtyEnabled = 1 << 0,
68 DirtyPriority = 1 << 1,
69 DirtyFilePath = 1 << 2,
70 DirtyConstants = 1 << 3,
71 DirtyMaterialNetwork = 1 << 4,
72
73 AllDirty = (DirtyEnabled
74 |DirtyPriority
75 |DirtyFilePath
76 |DirtyConstants
77 |DirtyMaterialNetwork)
78 };
79
80 // ---------------------------------------------------------------------- //
82 // ---------------------------------------------------------------------- //
83
85 HD_API
86 void Sync(
87 HdSceneDelegate* sceneDelegate,
88 HdRenderParam* renderParam,
89 HdDirtyBits* dirtyBits) override;
90
94 HD_API
95 HdDirtyBits GetInitialDirtyBitsMask() const override;
96
97 // ---------------------------------------------------------------------- //
99 // ---------------------------------------------------------------------- //
100 HD_API
101 bool GetEnabled() const;
102
103 HD_API
104 int GetPriority() const;
105
106 HD_API
107 const std::string& GetFilePath() const;
108
109 HD_API
110 const VtDictionary& GetConstants() const;
111
112 HD_API
113 const HdMaterialNetworkInterface* GetMaterialNetwork() const;
114
115private:
116 bool _enabled;
117 int _priority;
118 std::string _filePath;
119 VtDictionary _constants;
120 HdMaterialNetwork2 _materialNetwork;
121 HdMaterialNetworkInterfaceUniquePtr _materialNetworkInterface;
122};
123
124PXR_NAMESPACE_CLOSE_SCOPE
125
126#endif // PXR_IMAGING_HD_IMAGE_SHADER_H
An image shader.
Definition: imageShader.h:57
HD_API void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Sprim API.
HD_API 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...
HD_API bool GetEnabled() const
Image shader parameters accessor API.
Abstract interface for querying and mutating a material network.
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.
Sprim (state prim) is a base class of managing state for non-drawable scene entity (e....
Definition: sprim.h:52
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
A map with string keys and VtValue values.
Definition: dictionary.h:60
This file defines some macros that are useful for declaring and using static TfTokens.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:98
Container of nodes and top-level terminal connections.
Definition: material.h:178