MaterialX 1.39.1
Loading...
Searching...
No Matches
ShaderTranslator.h
1//
2// Copyright Contributors to the MaterialX Project
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#ifndef MATERIALX_SHADERTRANSLATOR_H
7#define MATERIALX_SHADERTRANSLATOR_H
8
10
13
14MATERIALX_NAMESPACE_BEGIN
15
17using ShaderTranslatorPtr = shared_ptr<class ShaderTranslator>;
18
21class MX_GENSHADER_API ShaderTranslator
22{
23 public:
24 static ShaderTranslatorPtr create()
25 {
26 return ShaderTranslatorPtr(new ShaderTranslator());
27 }
28
30 void translateShader(NodePtr shader, const string& destCategory);
31
34 void translateAllMaterials(DocumentPtr doc, const string& destShader);
35
36 protected:
38
39 // Connect translation node inputs from the original shader
40 void connectTranslationInputs(NodePtr shader, NodeDefPtr translationNodeDef);
41
42 // Connect translation node outputs to finalize shader translation
43 void connectTranslationOutputs(NodePtr shader);
44
45 protected:
46 NodeGraphPtr _graph;
47 NodePtr _translationNode;
48};
49
50MATERIALX_NAMESPACE_END
51
52#endif
shared_ptr< NodeDef > NodeDefPtr
A shared pointer to a NodeDef.
Definition: Definition.h:32
shared_ptr< Document > DocumentPtr
A shared pointer to a Document.
Definition: Document.h:22
Macros for declaring imported and exported symbols.
Shader generation utility methods.
shared_ptr< NodeGraph > NodeGraphPtr
A shared pointer to a NodeGraph.
Definition: Node.h:34
shared_ptr< Node > NodePtr
A shared pointer to a Node.
Definition: Node.h:24
Shader instance class created during shader generation.
A helper class for translating content between shading models.
Definition: ShaderTranslator.h:22
void translateShader(NodePtr shader, const string &destCategory)
Translate a shader node to the destination shading model.
void translateAllMaterials(DocumentPtr doc, const string &destShader)
Translate each material in the input document to the destination shading model.