All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
material.h
1 //
2 // Copyright 2016 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 HD_MATERIAL_H
25 #define HD_MATERIAL_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/api.h"
29 #include "pxr/imaging/hd/sprim.h"
30 #include "pxr/imaging/hd/sceneDelegate.h"
31 
32 PXR_NAMESPACE_OPEN_SCOPE
33 
37 class HdMaterial : public HdSprim {
38 public:
39  // change tracking for HdMaterial prim
40  enum DirtyBits : HdDirtyBits {
41  Clean = 0,
42  // XXX: Got to skip varying and force sync bits for now
43  DirtySurfaceShader = 1 << 2,
44  DirtyParams = 1 << 3,
45  DirtyResource = 1 << 4,
46  AllDirty = (DirtySurfaceShader
47  |DirtyParams
48  |DirtyResource)
49  };
50 
51  HD_API
52  virtual ~HdMaterial();
53 
55  virtual void Reload() = 0;
56 
57 protected:
58  HD_API
59  HdMaterial(SdfPath const& id);
60 
61 private:
62  // Class can not be default constructed or copied.
63  HdMaterial() = delete;
64  HdMaterial(const HdMaterial &) = delete;
65  HdMaterial &operator =(const HdMaterial &) = delete;
66 };
67 
68 
89  SdfPath inputId;
90  TfToken inputName;
91  SdfPath outputId;
92  TfToken outputName;
93 };
94 
95 // VtValue requirements
96 HD_API
97 bool operator==(const HdMaterialRelationship& lhs,
98  const HdMaterialRelationship& rhs);
99 
100 
106  SdfPath path;
107  TfToken identifier;
108  std::map<TfToken, VtValue> parameters;
109 };
110 
111 // VtValue requirements
112 HD_API
113 bool operator==(const HdMaterialNode& lhs, const HdMaterialNode& rhs);
114 
115 
121  std::vector<HdMaterialRelationship> relationships;
122  std::vector<HdMaterialNode> nodes;
123  TfTokenVector primvars;
124 };
125 
130  std::map<TfToken, HdMaterialNetwork> map;
131  std::vector<SdfPath> terminals;
132 };
133 
134 // VtValue requirements
135 HD_API
136 std::ostream& operator<<(std::ostream& out, const HdMaterialNetwork& pv);
137 HD_API
138 bool operator==(const HdMaterialNetwork& lhs, const HdMaterialNetwork& rhs);
139 HD_API
140 bool operator!=(const HdMaterialNetwork& lhs, const HdMaterialNetwork& rhs);
141 
142 HD_API
143 std::ostream& operator<<(std::ostream& out,
144  const HdMaterialNetworkMap& pv);
145 HD_API
146 bool operator==(const HdMaterialNetworkMap& lhs,
147  const HdMaterialNetworkMap& rhs);
148 HD_API
149 bool operator!=(const HdMaterialNetworkMap& lhs,
150  const HdMaterialNetworkMap& rhs);
151 
152 
153 PXR_NAMESPACE_CLOSE_SCOPE
154 
155 #endif // HD_MATERIAL_H
Describes a material node which is made of a path, an identifier and a list of parameters.
Definition: material.h:105
Describes a material network composed of nodes, primvars, and relationships between the nodes and ter...
Definition: material.h:120
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:438
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
Sprim (state prim) is a base class of managing state for non-drawable scene entity (e...
Definition: sprim.h:54
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
virtual void Reload()=0
Causes the shader to be reloaded.
Hydra Schema for a material object.
Definition: material.h:37
VT_API bool operator==(VtDictionary const &, VtDictionary const &)
Equality comparison.
Describes a map from network type to network.
Definition: material.h:129
Describes a connection between two nodes in a material.
Definition: material.h:88