Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/nodes.cpp
| Show First 20 Lines • Show All 4,513 Lines • ▼ Show 20 Lines | |||||
| VertexColorNode::VertexColorNode() : ShaderNode(node_type) | VertexColorNode::VertexColorNode() : ShaderNode(node_type) | ||||
| { | { | ||||
| } | } | ||||
| void VertexColorNode::attributes(Shader *shader, AttributeRequestSet *attributes) | void VertexColorNode::attributes(Shader *shader, AttributeRequestSet *attributes) | ||||
| { | { | ||||
| if (!(output("Color")->links.empty() && output("Alpha")->links.empty())) { | if (!(output("Color")->links.empty() && output("Alpha")->links.empty())) { | ||||
| if (layer_name != "") | |||||
| attributes->add_standard(layer_name); | attributes->add_standard(layer_name); | ||||
| else | |||||
| attributes->add(ATTR_STD_VERTEX_COLOR); | |||||
| } | } | ||||
| ShaderNode::attributes(shader, attributes); | ShaderNode::attributes(shader, attributes); | ||||
| } | } | ||||
| void VertexColorNode::compile(SVMCompiler &compiler) | void VertexColorNode::compile(SVMCompiler &compiler) | ||||
| { | { | ||||
| ShaderOutput *color_out = output("Color"); | ShaderOutput *color_out = output("Color"); | ||||
| ShaderOutput *alpha_out = output("Alpha"); | ShaderOutput *alpha_out = output("Alpha"); | ||||
| int layer_id = compiler.attribute(layer_name); | int layer_id = 0; | ||||
| if (layer_name != "") { | |||||
| layer_id = compiler.attribute(layer_name); | |||||
| } | |||||
| else { | |||||
| layer_id = compiler.attribute(ATTR_STD_VERTEX_COLOR); | |||||
| } | |||||
| ShaderNodeType node; | ShaderNodeType node; | ||||
| if (bump == SHADER_BUMP_DX) | if (bump == SHADER_BUMP_DX) | ||||
| node = NODE_VERTEX_COLOR_BUMP_DX; | node = NODE_VERTEX_COLOR_BUMP_DX; | ||||
| else if (bump == SHADER_BUMP_DY) | else if (bump == SHADER_BUMP_DY) | ||||
| node = NODE_VERTEX_COLOR_BUMP_DY; | node = NODE_VERTEX_COLOR_BUMP_DY; | ||||
| else { | else { | ||||
| Show All 10 Lines | if (bump == SHADER_BUMP_DX) { | ||||
| compiler.parameter("bump_offset", "dx"); | compiler.parameter("bump_offset", "dx"); | ||||
| } | } | ||||
| else if (bump == SHADER_BUMP_DY) { | else if (bump == SHADER_BUMP_DY) { | ||||
| compiler.parameter("bump_offset", "dy"); | compiler.parameter("bump_offset", "dy"); | ||||
| } | } | ||||
| else { | else { | ||||
| compiler.parameter("bump_offset", "center"); | compiler.parameter("bump_offset", "center"); | ||||
| } | } | ||||
| if (layer_name.empty()) { | |||||
| compiler.parameter("layer_name", ustring("geom:vertex_color")); | |||||
| } | |||||
| else { | |||||
| if (Attribute::name_standard(layer_name.c_str()) != ATTR_STD_NONE) { | |||||
| compiler.parameter("name", (string("geom:") + layer_name.c_str()).c_str()); | |||||
| } | |||||
| else { | |||||
| compiler.parameter("layer_name", layer_name.c_str()); | compiler.parameter("layer_name", layer_name.c_str()); | ||||
| } | |||||
| } | |||||
| compiler.add(this, "node_vertex_color"); | compiler.add(this, "node_vertex_color"); | ||||
| } | } | ||||
| /* Value */ | /* Value */ | ||||
| NODE_DEFINE(ValueNode) | NODE_DEFINE(ValueNode) | ||||
| { | { | ||||
| NodeType *type = NodeType::add("value", create, NodeType::SHADER); | NodeType *type = NodeType::add("value", create, NodeType::SHADER); | ||||
| ▲ Show 20 Lines • Show All 2,464 Lines • Show Last 20 Lines | |||||