Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/osl.cpp
| Show First 20 Lines • Show All 439 Lines • ▼ Show 20 Lines | if(strcmp(input->name, output->name)==0) { | ||||
| sname += "Out"; | sname += "Out"; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| return sname; | return sname; | ||||
| } | } | ||||
| bool OSLCompiler::node_skip_input(ShaderNode *node, ShaderInput *input) | bool OSLCompiler::node_skip_input(const ShaderNode *node, const ShaderInput *input) const | ||||
| { | { | ||||
| /* exception for output node, only one input is actually used | /* exception for output node, only one input is actually used | ||||
| * depending on the current shader type */ | * depending on the current shader type */ | ||||
| if(!(input->usage & ShaderInput::USE_OSL)) | if(!(input->usage & ShaderInput::USE_OSL)) | ||||
| return true; | return true; | ||||
| if(node->name == ustring("output")) { | if(node->name == ustring("output")) { | ||||
| ▲ Show 20 Lines • Show All 232 Lines • ▼ Show 20 Lines | |||||
| void OSLCompiler::parameter_array(const char *name, const Transform tfm[], int arraylen) | void OSLCompiler::parameter_array(const char *name, const Transform tfm[], int arraylen) | ||||
| { | { | ||||
| OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys; | OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys; | ||||
| TypeDesc type = TypeDesc::TypeMatrix; | TypeDesc type = TypeDesc::TypeMatrix; | ||||
| type.arraylen = arraylen; | type.arraylen = arraylen; | ||||
| ss->Parameter(name, type, (const float *)tfm); | ss->Parameter(name, type, (const float *)tfm); | ||||
| } | } | ||||
| void OSLCompiler::find_dependencies(set<ShaderNode*>& dependencies, ShaderInput *input) | void OSLCompiler::find_dependencies(set<ShaderNode*>& dependencies, const ShaderInput *input) const | ||||
| { | { | ||||
| ShaderNode *node = (input->link)? input->link->parent: NULL; | ShaderNode *node = (input->link)? input->link->parent: NULL; | ||||
| if(node) { | if(node && (dependencies.find(node) == dependencies.end())) { | ||||
| foreach(ShaderInput *in, node->inputs) | foreach(ShaderInput *in, node->inputs) | ||||
| if(!node_skip_input(node, in)) | if(!node_skip_input(node, in)) | ||||
| find_dependencies(dependencies, in); | find_dependencies(dependencies, in); | ||||
| dependencies.insert(node); | dependencies.insert(node); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 231 Lines • Show Last 20 Lines | |||||