Loading...
Searching...
No Matches
hdMtlx.h
1//
2// Copyright 2021 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HD_MTLX_HDMTLX_H
8#define PXR_IMAGING_HD_MTLX_HDMTLX_H
9
10#include "pxr/pxr.h"
11#include "pxr/base/tf/token.h"
12#include "pxr/imaging/hdMtlx/api.h"
13#include <memory>
14#include <set>
15#include <unordered_map>
16
17#include <MaterialXCore/Library.h>
18
19MATERIALX_NAMESPACE_BEGIN
20 class FileSearchPath;
21 using DocumentPtr = std::shared_ptr<class Document>;
22MATERIALX_NAMESPACE_END
23
24PXR_NAMESPACE_OPEN_SCOPE
25
26class SdfPath;
27class VtValue;
29struct HdMaterialNode2;
31
36HDMTLX_API
37const MaterialX::FileSearchPath&
38HdMtlxSearchPaths();
39
42HDMTLX_API
43const MaterialX::DocumentPtr&
44HdMtlxStdLibraries();
45
47HDMTLX_API
48std::string
49HdMtlxConvertToString(VtValue const& hdParameterValue);
50
51// Storing MaterialX-Hydra texture and primvar information
52struct HdMtlxTexturePrimvarData {
53 HdMtlxTexturePrimvarData() = default;
54 using TextureMap = std::map<std::string, std::set<std::string>>;
55 TextureMap mxHdTextureMap; // Mx-Hd texture name mapping
56 std::set<SdfPath> hdTextureNodes; // Paths to HdTexture Nodes
57 std::set<SdfPath> hdPrimvarNodes; // Paths to HdPrimvar nodes
58};
59
60HDMTLX_API
61std::string
62HdMtlxCreateNameFromPath(SdfPath const& path);
63
67HDMTLX_API
68MaterialX::DocumentPtr
69HdMtlxCreateMtlxDocumentFromHdNetwork(
70 HdMaterialNetwork2 const& hdNetwork,
71 HdMaterialNode2 const& hdMaterialXNode,
72 SdfPath const& hdMaterialXNodePath,
73 SdfPath const& materialPath,
74 MaterialX::DocumentPtr const& libraries,
75 HdMtlxTexturePrimvarData *mxHdData = nullptr);
76
78HDMTLX_API
79MaterialX::DocumentPtr
80HdMtlxCreateMtlxDocumentFromHdMaterialNetworkInterface(
81 HdMaterialNetworkInterface *netInterface,
82 TfToken const& terminalNodeName,
83 TfTokenVector const& terminalNodeConnectionNames,
84 MaterialX::DocumentPtr const& libraries,
85 HdMtlxTexturePrimvarData *mxHdData = nullptr);
86
87PXR_NAMESPACE_CLOSE_SCOPE
88
89#endif
Abstract interface for querying and mutating a material network.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:147
Container of nodes and top-level terminal connections.
Definition: material.h:166
Describes an instance of a node within a network A node contains a (shader) type identifier,...
Definition: material.h:154
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:440