forked from blender/blender
MaterialX: add support for Vector nodes #27
@ -81,7 +81,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
NodeItem location = get_input_value("Location", NodeItem::Type::Vector3);
|
||||
NodeItem scale = get_input_value("Scale", NodeItem::Type::Vector3);
|
||||
NodeItem vector = get_input_link("Vector", NodeItem::Type::Vector3);
|
||||
NodeItem angle = (get_input_value("Rotation", NodeItem::Type::Vector3) / val(float(M_PI))) * val(180.0f);
|
||||
NodeItem angle = (get_input_value("Rotation", NodeItem::Type::Vector3) / val(float(M_PI))) *
|
||||
val(180.0f);
|
||||
MaterialX::Vector3 axis_vector;
|
||||
NodeItem in = empty();
|
||||
const int mode = node_->custom1;
|
||||
@ -122,19 +123,19 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case NODE_MAPPING_TYPE_POINT:
|
||||
res = res + location;
|
||||
break;
|
||||
case NODE_MAPPING_TYPE_POINT:
|
||||
res = res + location;
|
||||
break;
|
||||
|
||||
case NODE_MAPPING_TYPE_TEXTURE:
|
||||
res = res / scale;
|
||||
break;
|
||||
case NODE_MAPPING_TYPE_TEXTURE:
|
||||
res = res / scale;
|
||||
break;
|
||||
|
||||
case NODE_MAPPING_TYPE_NORMAL:
|
||||
NodeItem normalize = create_node("normalize", NodeItem::Type::Vector3);
|
||||
normalize.set_input("in", res);
|
||||
res = normalize;
|
||||
break;
|
||||
case NODE_MAPPING_TYPE_NORMAL:
|
||||
NodeItem normalize = create_node("normalize", NodeItem::Type::Vector3);
|
||||
normalize.set_input("in", res);
|
||||
res = normalize;
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
return res;
|
||||
}
|
||||
return in1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
|
@ -233,7 +233,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
return vector;
|
||||
}
|
||||
angle = (angle / val(float(M_PI))) * val(180.0f);
|
||||
for (int i = node_->custom2 ? 2 : 0; node_->custom2 ? i >= 0 : i <= 2; node_->custom2 ? i-- : i++) {
|
||||
for (int i = node_->custom2 ? 2 : 0; node_->custom2 ? i >= 0 : i <= 2;
|
||||
node_->custom2 ? i-- : i++) {
|
||||
axis_vector = MaterialX::Vector3(0.0f, 0.0f, 0.0f);
|
||||
int inv = invert;
|
||||
if (i == 2) {
|
||||
|
@ -191,7 +191,6 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
|
||||
} // namespace blender::nodes::node_shader_vector_transform_cc
|
||||
|
||||
void register_node_type_sh_vect_transform()
|
||||
|
Loading…
Reference in New Issue
Block a user