Changeset View
Changeset View
Standalone View
Standalone View
source/blender/io/collada/Materials.cpp
| Context not available. | |||||
| void MaterialNode::set_specular(COLLADAFW::ColorOrTexture &cot) | void MaterialNode::set_specular(COLLADAFW::ColorOrTexture &cot) | ||||
| { | { | ||||
| bool is_zero = false; | |||||
| int locy = -300 * (node_map.size() - 2); | int locy = -300 * (node_map.size() - 2); | ||||
| if (cot.isColor()) { | if (cot.isColor()) { | ||||
| COLLADAFW::Color col = cot.getColor(); | COLLADAFW::Color col = cot.getColor(); | ||||
| bNode *node = add_node(SH_NODE_RGB, -300, locy, "Specular"); | |||||
| set_color(node, col); | if (col.getRed() == 0 && col.getGreen() == 0 && col.getBlue() == 0) { | ||||
| /* TODO: Connect node */ | is_zero = true; | ||||
| } | |||||
| else { | |||||
| bNode *node = add_node(SH_NODE_RGB, -300, locy, "Specular"); | |||||
| set_color(node, col); | |||||
| /* TODO: Connect node */ | |||||
| } | |||||
| } | } | ||||
| /* texture */ | /* texture */ | ||||
| else if (cot.isTexture()) { | else if (cot.isTexture()) { | ||||
| add_texture_node(cot, -300, locy, "Specular"); | add_texture_node(cot, -300, locy, "Specular"); | ||||
| /* TODO: Connect node */ | /* TODO: Connect node */ | ||||
| } | } | ||||
| /* not specified (no specular term) */ | |||||
| else { | |||||
| is_zero = true; | |||||
| } | |||||
| if (is_zero) { | |||||
| bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Specular"); | |||||
| ((bNodeSocketValueFloat *)socket->default_value)->value = 0.0f; | |||||
| } | |||||
| } | } | ||||
| bNode *MaterialNode::add_texture_node(COLLADAFW::ColorOrTexture &cot, | bNode *MaterialNode::add_texture_node(COLLADAFW::ColorOrTexture &cot, | ||||
| Context not available. | |||||