Loading...
Searching...
No Matches
hdMtlx.h
1//
2// Copyright 2021 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_MTLX_HDMTLX_H
25#define PXR_IMAGING_HD_MTLX_HDMTLX_H
26
27#include "pxr/pxr.h"
28#include "pxr/base/tf/token.h"
29#include "pxr/imaging/hdMtlx/api.h"
30#include <memory>
31#include <set>
32#include <unordered_map>
33
34#include <MaterialXCore/Library.h>
35
36MATERIALX_NAMESPACE_BEGIN
37 class FileSearchPath;
38 using DocumentPtr = std::shared_ptr<class Document>;
39MATERIALX_NAMESPACE_END
40
41PXR_NAMESPACE_OPEN_SCOPE
42
43class SdfPath;
44class VtValue;
46struct HdMaterialNode2;
48
53HDMTLX_API
54const MaterialX::FileSearchPath&
55HdMtlxSearchPaths();
56
59HDMTLX_API
60const MaterialX::DocumentPtr&
61HdMtlxStdLibraries();
62
64HDMTLX_API
65std::string
66HdMtlxConvertToString(VtValue const& hdParameterValue);
67
68// Storing MaterialX-Hydra texture and primvar information
69struct HdMtlxTexturePrimvarData {
70 HdMtlxTexturePrimvarData()
71 : mxHdTextureMap(MaterialX::StringMap()), // Mx-Hd texture name mapping
72 hdTextureNodes(std::set<SdfPath>()), // Paths to HdTexture Nodes
73 hdPrimvarNodes(std::set<SdfPath>()) {} // Paths to HdPrimvar nodes
74 MaterialX::StringMap mxHdTextureMap;
75 std::set<SdfPath> hdTextureNodes;
76 std::set<SdfPath> hdPrimvarNodes;
77};
78
82HDMTLX_API
83MaterialX::DocumentPtr
84HdMtlxCreateMtlxDocumentFromHdNetwork(
85 HdMaterialNetwork2 const& hdNetwork,
86 HdMaterialNode2 const& hdMaterialXNode,
87 SdfPath const& hdMaterialXNodePath,
88 SdfPath const& materialPath,
89 MaterialX::DocumentPtr const& libraries,
90 HdMtlxTexturePrimvarData *mxHdData = nullptr);
91
93HDMTLX_API
94MaterialX::DocumentPtr
95HdMtlxCreateMtlxDocumentFromHdMaterialNetworkInterface(
96 HdMaterialNetworkInterface *netInterface,
97 TfToken const& terminalNodeName,
98 TfTokenVector const& terminalNodeConnectionNames,
99 MaterialX::DocumentPtr const& libraries,
100 HdMtlxTexturePrimvarData *mxHdData = nullptr);
101
102PXR_NAMESPACE_CLOSE_SCOPE
103
104#endif
Abstract interface for querying and mutating a material network.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:291
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:165
STL namespace.
Container of nodes and top-level terminal connections.
Definition: material.h:178
Describes an instance of a node within a network A node contains a (shader) type identifier,...
Definition: material.h:166
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:457