Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaia Clary <gaia.clary@machinimatrix.org>2021-05-17 21:04:56 +0300
committerGaia Clary <gaia.clary@machinimatrix.org>2021-05-17 21:04:56 +0300
commit1b0ecb2f891e256eabea9f71575aea207fbee08f (patch)
tree8ed61e428a58becfb7d3415fdc00eaec06ed7e7d /source/blender/io/collada
parent1a4e7b16b2640750f6dfe380218aba028f998ae1 (diff)
refactor: minor changes to previous commit
- rename boolean is_zero by more descriptive has_specularity - add some clarifying comments (and TODO)
Diffstat (limited to 'source/blender/io/collada')
-rw-r--r--source/blender/io/collada/Materials.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/io/collada/Materials.cpp b/source/blender/io/collada/Materials.cpp
index 508844de042..4b90e459e61 100644
--- a/source/blender/io/collada/Materials.cpp
+++ b/source/blender/io/collada/Materials.cpp
@@ -376,13 +376,13 @@ void MaterialNode::set_opacity(COLLADAFW::ColorOrTexture &cot)
void MaterialNode::set_specular(COLLADAFW::ColorOrTexture &cot)
{
- bool is_zero = false;
+ bool has_specularity = true;
int locy = -300 * (node_map.size() - 2);
if (cot.isColor()) {
COLLADAFW::Color col = cot.getColor();
if (col.getRed() == 0 && col.getGreen() == 0 && col.getBlue() == 0) {
- is_zero = true;
+ has_specularity = false;
}
else {
bNode *node = add_node(SH_NODE_RGB, -300, locy, "Specular");
@@ -390,17 +390,21 @@ void MaterialNode::set_specular(COLLADAFW::ColorOrTexture &cot)
/* TODO: Connect node */
}
}
- /* texture */
else if (cot.isTexture()) {
add_texture_node(cot, -300, locy, "Specular");
/* TODO: Connect node */
}
- /* not specified (no specular term) */
else {
- is_zero = true;
+ /* no specular term) */
+ has_specularity = false;
}
- if (is_zero) {
+ if (!has_specularity) {
+ /* If specularity is black or not defined reset the Specular value to 0
+ TODO: This is a solution only for a corner case. We must find a better
+ way to handle specularity in general. Also note that currently we
+ do not export specularity values, see EffectExporter::operator()
+ */
bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Specular");
((bNodeSocketValueFloat *)socket->default_value)->value = 0.0f;
}