HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CompoundNodeMdl.h
Go to the documentation of this file.
1 //
2 // Copyright Contributors to the MaterialX Project
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 
6 #ifndef MATERIALX_COMPOUNDNODEMDL_H
7 #define MATERIALX_COMPOUNDNODEMDL_H
8 
10 
12 
14 
15 /// Generator context data class to pass strings.
17 {
18  public:
19  GenUserDataString(const std::string& value) : _value(value) {}
20  const string& getValue() const { return _value; }
21 
22  private:
23  string _value;
24 };
25 
26 /// Shared pointer to a GenUserDataString
27 using GenUserDataStringPtr = std::shared_ptr<GenUserDataString>;
28 
29 /// Compound node implementation
31 {
32  public:
33  static ShaderNodeImplPtr create();
34 
35  void initialize(const InterfaceElement& element, GenContext& context) override;
36  void emitFunctionDefinition(const ShaderNode& node, GenContext& context, ShaderStage& stage) const override;
37  void emitFunctionCall(const ShaderNode& node, GenContext& context, ShaderStage& stage) const override;
38 
39  bool isReturnStruct() const { return !_returnStruct.empty(); }
40  bool unrollReturnStructMembers() const { return _unrollReturnStructMembers; }
41 
42  protected:
43  void emitFunctionSignature(const ShaderNode& node, GenContext& context, ShaderStage& stage) const;
44 
45  string _returnStruct;
46  bool _unrollReturnStructMembers = false;
47 
49 };
50 
52 
53 #endif
shared_ptr< ShaderNodeImpl > ShaderNodeImplPtr
Shared pointer to a ShaderNodeImpl.
Definition: Library.h:40
void emitFunctionCall(const ShaderNode &node, GenContext &context, ShaderStage &stage) const override
Emit the function call or inline source code for given node instance in the given context...
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
void initialize(const InterfaceElement &element, GenContext &context) override
#define MX_GENMDL_API
Definition: Export.h:18
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
static ShaderNodeImplPtr create()
Compound node implementation.
Definition: CompoundNode.h:16
GenUserDataString(const std::string &value)
bool isReturnStruct() const
void emitFunctionDefinition(const ShaderNode &node, GenContext &context, ShaderStage &stage) const override
Emit function definition for the given node instance.
std::shared_ptr< GenUserDataString > GenUserDataStringPtr
Shared pointer to a GenUserDataString.
const string & getValue() const
Definition: core.h:1131
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26
Generator context data class to pass strings.
bool unrollReturnStructMembers() const
static const string GEN_USER_DATA_RETURN_STRUCT_FIELD_NAME
Compound node implementation.