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