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
63HDMTLX_API
64MaterialX::DocumentPtr
65HdMtlxCreateMtlxDocumentFromHdNetwork(
66 HdMaterialNetwork2 const& hdNetwork,
67 HdMaterialNode2 const& hdMaterialXNode,
68 SdfPath const& hdMaterialXNodePath,
69 SdfPath const& materialPath,
70 MaterialX::DocumentPtr const& libraries,
71 HdMtlxTexturePrimvarData *mxHdData = nullptr);
72
74HDMTLX_API
75MaterialX::DocumentPtr
76HdMtlxCreateMtlxDocumentFromHdMaterialNetworkInterface(
77 HdMaterialNetworkInterface *netInterface,
78 TfToken const& terminalNodeName,
79 TfTokenVector const& terminalNodeConnectionNames,
80 MaterialX::DocumentPtr const& libraries,
81 HdMtlxTexturePrimvarData *mxHdData = nullptr);
82
83PXR_NAMESPACE_CLOSE_SCOPE
84
85#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:161
Describes an instance of a node within a network A node contains a (shader) type identifier,...
Definition: material.h:149
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