<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
<div><span style="background-color: rgba(0, 0, 0, 0);">I tried with this:</span><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>ccl::Shader *shader = new ccl::Shader();</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>if (scene != NULL)</div>
<div><span style="white-space:pre"></span>scene->shaders.push_back(shader);</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>shader->name=ccl::ustring(material->mName);</div>
<div><span style="white-space:pre"></span>ccl::ShaderGraph *graph = new ccl::ShaderGraph();</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>const ccl::NodeType *node_type = ccl::NodeType::find(ccl::ustring("checker_texture"));</div>
<div><span style="white-space:pre"></span>if (!node_type) {</div>
<div><span style="white-space:pre"></span>fprintf(stderr, "Unknown shader node \n");</div>
<div><span style="white-space:pre"></span>}</div>
<div><span style="white-space:pre"></span>else if (node_type->type != ccl::NodeType::SHADER) {</div>
<div><span style="white-space:pre"></span>fprintf(stderr, "Node type \"%s\" is not a shader node.\n", node_type->name.c_str());</div>
<div><span style="white-space:pre"></span>}</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>ccl::ShaderNode* snode = (ccl::ShaderNode*)node_type->create(node_type);</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>ccl::SocketType color1;</div>
<div><span style="white-space:pre"></span>color1.type = ccl::SocketType::COLOR;</div>
<div><span style="white-space:pre"></span>color1.name = ccl::ustring("color1");</div>
<div><span style="white-space:pre"></span>snode->set(color1, ccl::make_float3(1.0f, 0.0f, 0.0f));</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>ccl::SocketType color2;</div>
<div><span style="white-space:pre"></span>color2.type = ccl::SocketType::COLOR;</div>
<div><span style="white-space:pre"></span>color2.name = ccl::ustring("color2");</div>
<div><span style="white-space:pre"></span>snode->set(color2, ccl::make_float3(0.0f, 0.0f, 1.0f));</div>
<div><br>
</div>
<div><span style="white-space:pre"></span>ccl::SocketType scale;</div>
<div><span style="white-space:pre"></span>scale.type = ccl::SocketType::FLOAT;</div>
<div><span style="white-space:pre"></span>scale.name = ccl::ustring("scale");</div>
<div><span style="white-space:pre"></span>snode->set(scale, 1.0f);
<div><br>
</div>
<div><span style="white-space:pre"></span>graph->add(snode);</div>
<div><span style="white-space:pre"></span>shader->set_graph(graph);</div>
</div>
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
But I had crashes creating color2 probably I'm doing it wrongly, is there any sample on this?</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">
Thank you in advance.</div>
</body>
</html>