forked from blender/blender
Code improvements + Mix node #30
@ -337,7 +337,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
|
||||
NodeItem roughness = in["roughness"];
|
||||
NodeItem anisotropy = in["anisotropic"];
|
||||
NodeItem rotation = in["anisotropic_rotation"] * val(float(180.0f / M_PI));
|
||||
NodeItem rotation = in["anisotropic_rotation"] * val(360.0f);
|
||||
NodeItem base_color = in["base_color"];
|
||||
NodeItem specular = in["specular"];
|
||||
NodeItem coat = in["coat"];
|
||||
@ -501,7 +501,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
NodeItem roughness = in["roughness"];
|
||||
NodeItem base_color = in["base_color"];
|
||||
NodeItem anisotropic = in["anisotropic"];
|
||||
NodeItem rotation = in["anisotropic_rotation"] * val(float(180.0f / M_PI));
|
||||
NodeItem rotation = in["anisotropic_rotation"];
|
||||
|
||||
res = create_node("standard_surface",
|
||||
NodeItem::Type::SurfaceShader,
|
||||
|
@ -215,39 +215,35 @@ static void node_shader_update_vector_rotate(bNodeTree *ntree, bNode *node)
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
/* Axes */
|
||||
const NodeItem X = val(MaterialX::Vector3(1.0f, 0.0f, 0.0f));
|
||||
const NodeItem Y = val(MaterialX::Vector3(0.0f, 1.0f, 0.0f));
|
||||
const NodeItem Z = val(MaterialX::Vector3(0.0f, 0.0f, -1.0f));
|
||||
|
||||
int mode = node_->custom1;
|
||||
bool invert = node_->custom2;
|
||||
|
||||
NodeItem vector = get_input_value("Vector", NodeItem::Type::Vector3);
|
||||
NodeItem center = get_input_value("Center", NodeItem::Type::Vector3) * (X + Y + Z);
|
||||
|
||||
NodeItem center = get_input_value("Center", NodeItem::Type::Vector3);
|
||||
vector = vector - center;
|
||||
|
||||
if (mode == NODE_VECTOR_ROTATE_TYPE_EULER_XYZ) {
|
||||
NodeItem rotation = get_input_value("Rotation", NodeItem::Type::Vector3) *
|
||||
val(float(180.0f / M_PI)) * (X + Y + Z);
|
||||
val(MaterialX::Vector3(1.0f, 1.0f, -1.0f) * 180.0f / M_PI);
|
||||
|
||||
return vector.rotate(invert ? -rotation : rotation, invert) + center;
|
||||
}
|
||||
|
||||
NodeItem angle = get_input_value("Angle", NodeItem::Type::Float) * val(float(180.0f / M_PI));
|
||||
NodeItem axis = empty();
|
||||
switch (mode) {
|
||||
case NODE_VECTOR_ROTATE_TYPE_AXIS:
|
||||
axis = get_input_value("Axis", NodeItem::Type::Vector3) * (X + Y + Z);
|
||||
axis = get_input_value("Axis", NodeItem::Type::Vector3) *
|
||||
val(MaterialX::Vector3(1.0f, 1.0f, -1.0f));
|
||||
break;
|
||||
case NODE_VECTOR_ROTATE_TYPE_AXIS_X:
|
||||
axis = X;
|
||||
axis = val(MaterialX::Vector3(1.0f, 0.0f, 0.0f));
|
||||
break;
|
||||
case NODE_VECTOR_ROTATE_TYPE_AXIS_Y:
|
||||
axis = Y;
|
||||
axis = val(MaterialX::Vector3(0.0f, 1.0f, 0.0f));
|
||||
break;
|
||||
case NODE_VECTOR_ROTATE_TYPE_AXIS_Z:
|
||||
axis = Z;
|
||||
axis = val(MaterialX::Vector3(0.0f, 0.0f, -1.0f));
|
||||
break;
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
|
Loading…
Reference in New Issue
Block a user