Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/nodes.cpp
| Show First 20 Lines • Show All 2,322 Lines • ▼ Show 20 Lines | void TextureCoordinateNode::compile(OSLCompiler& compiler) | ||||
| if(compiler.output_type() == SHADER_TYPE_VOLUME) | if(compiler.output_type() == SHADER_TYPE_VOLUME) | ||||
| compiler.parameter("is_volume", true); | compiler.parameter("is_volume", true); | ||||
| compiler.parameter("from_dupli", from_dupli); | compiler.parameter("from_dupli", from_dupli); | ||||
| compiler.add(this, "node_texture_coordinate"); | compiler.add(this, "node_texture_coordinate"); | ||||
| } | } | ||||
| UVMapNode::UVMapNode() | |||||
| : ShaderNode("uvmap") | |||||
| { | |||||
| attribute = ""; | |||||
| from_dupli = false; | |||||
| add_output("UV", SHADER_SOCKET_POINT); | |||||
| } | |||||
| void UVMapNode::attributes(Shader *shader, AttributeRequestSet *attributes) | |||||
| { | |||||
| if(shader->has_surface) { | |||||
| if(!from_dupli) { | |||||
| if(!output("UV")->links.empty()) { | |||||
| if (attribute != "") | |||||
| attributes->add(attribute); | |||||
| else | |||||
| attributes->add(ATTR_STD_UV); | |||||
| } | |||||
| } | |||||
| } | |||||
brecht: It doesn't take the UV map name into account because there's no code here to do that. | |||||
| ShaderNode::attributes(shader, attributes); | |||||
| } | |||||
| void UVMapNode::compile(SVMCompiler& compiler) | |||||
| { | |||||
| ShaderOutput *out = output("UV"); | |||||
| NodeType texco_node = NODE_TEX_COORD; | |||||
| NodeType attr_node = NODE_ATTR; | |||||
| int attr; | |||||
| if(!out->links.empty()) { | |||||
| if(from_dupli) { | |||||
| compiler.stack_assign(out); | |||||
| compiler.add_node(texco_node, NODE_TEXCO_DUPLI_UV, out->stack_offset); | |||||
| } | |||||
| else { | |||||
| if (attribute != "") | |||||
| attr = compiler.attribute(attribute); | |||||
| else | |||||
| attr = compiler.attribute(ATTR_STD_UV); | |||||
| compiler.stack_assign(out); | |||||
| compiler.add_node(attr_node, attr, out->stack_offset, NODE_ATTR_FLOAT3); | |||||
| } | |||||
| } | |||||
| } | |||||
| void UVMapNode::compile(OSLCompiler& compiler) | |||||
| { | |||||
| compiler.parameter("from_dupli", from_dupli); | |||||
| compiler.parameter("name", attribute.c_str()); | |||||
| compiler.add(this, "node_uv_map"); | |||||
| } | |||||
| /* Light Path */ | /* Light Path */ | ||||
| LightPathNode::LightPathNode() | LightPathNode::LightPathNode() | ||||
| : ShaderNode("light_path") | : ShaderNode("light_path") | ||||
| { | { | ||||
| add_output("Is Camera Ray", SHADER_SOCKET_FLOAT); | add_output("Is Camera Ray", SHADER_SOCKET_FLOAT); | ||||
| add_output("Is Shadow Ray", SHADER_SOCKET_FLOAT); | add_output("Is Shadow Ray", SHADER_SOCKET_FLOAT); | ||||
| add_output("Is Diffuse Ray", SHADER_SOCKET_FLOAT); | add_output("Is Diffuse Ray", SHADER_SOCKET_FLOAT); | ||||
| ▲ Show 20 Lines • Show All 1,706 Lines • Show Last 20 Lines | |||||
It doesn't take the UV map name into account because there's no code here to do that. ATTR_STD_UV just gives you the default UV map. To get an attribute by name you need to do the same as AttributeNode::compile if the uv map name != "".