55
66#include < MaterialXGenOslNodes/OslNodesShaderGenerator.h>
77#include < MaterialXGenOslNodes/OslNodesSyntax.h>
8+ #include < MaterialXGenOslNodes/Nodes/OsoNode.h>
89
910#include < MaterialXGenShader/GenContext.h>
1011#include < MaterialXGenShader/Shader.h>
1112#include < MaterialXGenShader/TypeDesc.h>
1213#include < MaterialXGenShader/ShaderStage.h>
13- #include < MaterialXGenShader/Nodes/SourceCodeNode.h>
1414
1515
1616MATERIALX_NAMESPACE_BEGIN
@@ -26,6 +26,11 @@ OslNodesShaderGenerator::OslNodesShaderGenerator(TypeSystemPtr typeSystem) :
2626{
2727}
2828
29+ ShaderNodeImplPtr OslNodesShaderGenerator::createShaderNodeImplForImplementation (const NodeDef& /* nodedef */ ) const
30+ {
31+ return OsoNode::create ();
32+ }
33+
2934static string paramString (const string& paramType, const string& paramName, const string& paramValue)
3035{
3136 return " param " + paramType + " " + paramName + " " + paramValue + " ;" ;
@@ -106,21 +111,13 @@ ShaderPtr OslNodesShaderGenerator::generate(const string& name, ElementPtr eleme
106111 // Keep track of the root output, so we can connect it to our setCi node
107112 lastOutput = node->getOutput (0 );
108113
109- NodeDefPtr nodeDef = document->getNodeDef (node->getNodeDefName ());
110- ImplementationPtr impl = nodeDef->getImplementation (" genoslnodes" )->asA <Implementation>();
111-
112- if (!impl)
113- {
114- printf (" Skipping test due to missing implementation\n " );
115- return nullptr ;
116- }
117-
118- string osoName = impl->getFunction ();
114+ const ShaderNodeImpl& impl = node->getImplementation ();
115+ const OsoNode& osoNodeImpl = dynamic_cast <const OsoNode&>(impl);
119116
120- string osoPath = impl-> getFile ();
117+ const string osoPath = osoNodeImpl. getOsoPath ();
121118 osoPaths.insert (osoPath);
122119
123- emitLine (" shader " + osoName + " " + nodeName + " ;" , stage, false );
120+ emitLine (" shader " + osoNodeImpl. getOsoName () + " " + nodeName + " ;" , stage, false );
124121 lastNodeName = nodeName;
125122 }
126123
0 commit comments