Fix T74169: Vector Rotate Node - Euler modes not working as intended
Remove additional Euler modes for the time being, not working as intended, will add back if there is a need.
This commit is contained in:
@@ -28,31 +28,6 @@ shader node_vector_rotate(string type = "axis",
|
||||
if (type == "euler_xyz") {
|
||||
VectorOut = transform(euler_to_mat(Rotation), VectorIn - Center) + Center;
|
||||
}
|
||||
else if (type == "euler_xzy") {
|
||||
VectorOut = transform(euler_to_mat(point(-Rotation[0], -Rotation[2], -Rotation[1])),
|
||||
VectorIn - Center) +
|
||||
Center;
|
||||
}
|
||||
else if (type == "euler_yxz") {
|
||||
VectorOut = transform(euler_to_mat(point(-Rotation[1], -Rotation[0], -Rotation[2])),
|
||||
VectorIn - Center) +
|
||||
Center;
|
||||
}
|
||||
else if (type == "euler_yzx") {
|
||||
VectorOut = transform(euler_to_mat(point(Rotation[1], Rotation[2], Rotation[0])),
|
||||
VectorIn - Center) +
|
||||
Center;
|
||||
}
|
||||
else if (type == "euler_zxy") {
|
||||
VectorOut = transform(euler_to_mat(point(Rotation[2], Rotation[0], Rotation[1])),
|
||||
VectorIn - Center) +
|
||||
Center;
|
||||
}
|
||||
else if (type == "euler_zyx") {
|
||||
VectorOut = transform(euler_to_mat(point(-Rotation[2], -Rotation[1], -Rotation[0])),
|
||||
VectorIn - Center) +
|
||||
Center;
|
||||
}
|
||||
else if (type == "x_axis") {
|
||||
VectorOut = rotate(VectorIn - Center, Angle, point(0.0), vector(1.0, 0.0, 0.0)) + Center;
|
||||
}
|
||||
|
||||
@@ -358,11 +358,6 @@ typedef enum NodeVectorRotateType {
|
||||
NODE_VECTOR_ROTATE_TYPE_AXIS_Y,
|
||||
NODE_VECTOR_ROTATE_TYPE_AXIS_Z,
|
||||
NODE_VECTOR_ROTATE_TYPE_EULER_XYZ,
|
||||
NODE_VECTOR_ROTATE_TYPE_EULER_XZY,
|
||||
NODE_VECTOR_ROTATE_TYPE_EULER_YXZ,
|
||||
NODE_VECTOR_ROTATE_TYPE_EULER_YZX,
|
||||
NODE_VECTOR_ROTATE_TYPE_EULER_ZXY,
|
||||
NODE_VECTOR_ROTATE_TYPE_EULER_ZYX,
|
||||
} NodeVectorRotateType;
|
||||
|
||||
typedef enum NodeVectorTransformType {
|
||||
|
||||
@@ -35,26 +35,8 @@ ccl_device void svm_node_vector_rotate(ShaderData *sd,
|
||||
float3 center = stack_load_float3(stack, center_stack_offset);
|
||||
float3 result = make_float3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
if (type != NODE_VECTOR_ROTATE_TYPE_AXIS && type != NODE_VECTOR_ROTATE_TYPE_AXIS_X &&
|
||||
type != NODE_VECTOR_ROTATE_TYPE_AXIS_Y && type != NODE_VECTOR_ROTATE_TYPE_AXIS_Z) {
|
||||
if (type == NODE_VECTOR_ROTATE_TYPE_EULER_XYZ) {
|
||||
float3 rotation = stack_load_float3(stack, rotation_stack_offset); // Default XYZ.
|
||||
switch (type) {
|
||||
case NODE_VECTOR_ROTATE_TYPE_EULER_XZY:
|
||||
rotation = make_float3(-rotation.x, -rotation.z, -rotation.y);
|
||||
break;
|
||||
case NODE_VECTOR_ROTATE_TYPE_EULER_YXZ:
|
||||
rotation = make_float3(-rotation.y, -rotation.x, -rotation.z);
|
||||
break;
|
||||
case NODE_VECTOR_ROTATE_TYPE_EULER_YZX:
|
||||
rotation = make_float3(rotation.y, rotation.z, rotation.x);
|
||||
break;
|
||||
case NODE_VECTOR_ROTATE_TYPE_EULER_ZXY:
|
||||
rotation = make_float3(rotation.z, rotation.x, rotation.y);
|
||||
break;
|
||||
case NODE_VECTOR_ROTATE_TYPE_EULER_ZYX:
|
||||
rotation = make_float3(-rotation.z, -rotation.y, -rotation.x);
|
||||
break;
|
||||
}
|
||||
Transform rotationTransform = euler_to_transform(rotation);
|
||||
result = transform_direction(&rotationTransform, vector - center) + center;
|
||||
}
|
||||
@@ -75,7 +57,7 @@ ccl_device void svm_node_vector_rotate(ShaderData *sd,
|
||||
break;
|
||||
}
|
||||
float angle = stack_load_float(stack, angle_stack_offset);
|
||||
result = is_zero(axis) ? vector : rotate_around_axis(vector - center, axis, angle) + center;
|
||||
result = len(axis) ? rotate_around_axis(vector - center, axis, angle) + center : vector;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
|
||||
@@ -6165,11 +6165,6 @@ NODE_DEFINE(VectorRotateNode)
|
||||
type_enum.insert("y_axis", NODE_VECTOR_ROTATE_TYPE_AXIS_Y);
|
||||
type_enum.insert("z_axis", NODE_VECTOR_ROTATE_TYPE_AXIS_Z);
|
||||
type_enum.insert("euler_xyz", NODE_VECTOR_ROTATE_TYPE_EULER_XYZ);
|
||||
type_enum.insert("euler_xzy", NODE_VECTOR_ROTATE_TYPE_EULER_XZY);
|
||||
type_enum.insert("euler_yxz", NODE_VECTOR_ROTATE_TYPE_EULER_YXZ);
|
||||
type_enum.insert("euler_yzx", NODE_VECTOR_ROTATE_TYPE_EULER_YZX);
|
||||
type_enum.insert("euler_zxy", NODE_VECTOR_ROTATE_TYPE_EULER_ZXY);
|
||||
type_enum.insert("euler_zyx", NODE_VECTOR_ROTATE_TYPE_EULER_ZYX);
|
||||
SOCKET_ENUM(type, "Type", type_enum, NODE_VECTOR_ROTATE_TYPE_AXIS);
|
||||
|
||||
SOCKET_IN_VECTOR(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f));
|
||||
|
||||
@@ -50,33 +50,3 @@ void node_vector_rotate_euler_xyz(
|
||||
{
|
||||
vec = euler_to_mat3(rotation) * (vector_in - center) + center;
|
||||
}
|
||||
|
||||
void node_vector_rotate_euler_xzy(
|
||||
vec3 vector_in, vec3 center, vec3 axis, float angle, vec3 rotation, out vec3 vec)
|
||||
{
|
||||
vec = euler_to_mat3(-rotation.xzy) * (vector_in - center) + center;
|
||||
}
|
||||
|
||||
void node_vector_rotate_euler_yxz(
|
||||
vec3 vector_in, vec3 center, vec3 axis, float angle, vec3 rotation, out vec3 vec)
|
||||
{
|
||||
vec = euler_to_mat3(-rotation.yxz) * (vector_in - center) + center;
|
||||
}
|
||||
|
||||
void node_vector_rotate_euler_yzx(
|
||||
vec3 vector_in, vec3 center, vec3 axis, float angle, vec3 rotation, out vec3 vec)
|
||||
{
|
||||
vec = euler_to_mat3(rotation.yzx) * (vector_in - center) + center;
|
||||
}
|
||||
|
||||
void node_vector_rotate_euler_zxy(
|
||||
vec3 vector_in, vec3 center, vec3 axis, float angle, vec3 rotation, out vec3 vec)
|
||||
{
|
||||
vec = euler_to_mat3(rotation.zxy) * (vector_in - center) + center;
|
||||
}
|
||||
|
||||
void node_vector_rotate_euler_zyx(
|
||||
vec3 vector_in, vec3 center, vec3 axis, float angle, vec3 rotation, out vec3 vec)
|
||||
{
|
||||
vec = euler_to_mat3(-rotation.zyx) * (vector_in - center) + center;
|
||||
}
|
||||
|
||||
@@ -1212,11 +1212,6 @@ enum {
|
||||
NODE_VECTOR_ROTATE_TYPE_AXIS_Y = 2,
|
||||
NODE_VECTOR_ROTATE_TYPE_AXIS_Z = 3,
|
||||
NODE_VECTOR_ROTATE_TYPE_EULER_XYZ = 4,
|
||||
NODE_VECTOR_ROTATE_TYPE_EULER_XZY = 5,
|
||||
NODE_VECTOR_ROTATE_TYPE_EULER_YXZ = 6,
|
||||
NODE_VECTOR_ROTATE_TYPE_EULER_YZX = 7,
|
||||
NODE_VECTOR_ROTATE_TYPE_EULER_ZXY = 8,
|
||||
NODE_VECTOR_ROTATE_TYPE_EULER_ZYX = 9,
|
||||
};
|
||||
|
||||
/* math node clamp */
|
||||
|
||||
@@ -134,34 +134,8 @@ const EnumPropertyItem rna_enum_vector_rotate_type_items[] = {
|
||||
{NODE_VECTOR_ROTATE_TYPE_EULER_XYZ,
|
||||
"EULER_XYZ",
|
||||
0,
|
||||
"XYZ Euler",
|
||||
"Euler",
|
||||
"Rotate a point using XYZ order"},
|
||||
|
||||
{NODE_VECTOR_ROTATE_TYPE_EULER_XZY,
|
||||
"EULER_XZY",
|
||||
0,
|
||||
"XZY Euler",
|
||||
"Rotate a point using XZY order"},
|
||||
{NODE_VECTOR_ROTATE_TYPE_EULER_YXZ,
|
||||
"EULER_YXZ",
|
||||
0,
|
||||
"YXZ Euler",
|
||||
"Rotate a point using YXZ order"},
|
||||
{NODE_VECTOR_ROTATE_TYPE_EULER_YZX,
|
||||
"EULER_YZX",
|
||||
0,
|
||||
"YZX Euler",
|
||||
"Rotate a point using YZX order"},
|
||||
{NODE_VECTOR_ROTATE_TYPE_EULER_ZXY,
|
||||
"EULER_ZXY",
|
||||
0,
|
||||
"ZXY Euler",
|
||||
"Rotate a point using ZXY order"},
|
||||
{NODE_VECTOR_ROTATE_TYPE_EULER_ZYX,
|
||||
"EULER_ZYX",
|
||||
0,
|
||||
"XZY Euler",
|
||||
"Rotate a point using ZYX order"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
|
||||
@@ -48,11 +48,6 @@ static int gpu_shader_vector_rotate(GPUMaterial *mat,
|
||||
[NODE_VECTOR_ROTATE_TYPE_AXIS_Y] = "node_vector_rotate_axis_y",
|
||||
[NODE_VECTOR_ROTATE_TYPE_AXIS_Z] = "node_vector_rotate_axis_z",
|
||||
[NODE_VECTOR_ROTATE_TYPE_EULER_XYZ] = "node_vector_rotate_euler_xyz",
|
||||
[NODE_VECTOR_ROTATE_TYPE_EULER_XZY] = "node_vector_rotate_euler_xzy",
|
||||
[NODE_VECTOR_ROTATE_TYPE_EULER_YXZ] = "node_vector_rotate_euler_yxz",
|
||||
[NODE_VECTOR_ROTATE_TYPE_EULER_YZX] = "node_vector_rotate_euler_yzx",
|
||||
[NODE_VECTOR_ROTATE_TYPE_EULER_ZXY] = "node_vector_rotate_euler_zxy",
|
||||
[NODE_VECTOR_ROTATE_TYPE_EULER_ZYX] = "node_vector_rotate_euler_zyx",
|
||||
};
|
||||
|
||||
if (node->custom1 < ARRAY_SIZE(names) && names[node->custom1]) {
|
||||
@@ -66,21 +61,11 @@ static int gpu_shader_vector_rotate(GPUMaterial *mat,
|
||||
static void node_shader_update_vector_rotate(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
bNodeSocket *sock_rotation = nodeFindSocket(node, SOCK_IN, "Rotation");
|
||||
nodeSetSocketAvailability(sock_rotation,
|
||||
!ELEM(node->custom1,
|
||||
NODE_VECTOR_ROTATE_TYPE_AXIS,
|
||||
NODE_VECTOR_ROTATE_TYPE_AXIS_X,
|
||||
NODE_VECTOR_ROTATE_TYPE_AXIS_Y,
|
||||
NODE_VECTOR_ROTATE_TYPE_AXIS_Z));
|
||||
nodeSetSocketAvailability(sock_rotation, ELEM(node->custom1, NODE_VECTOR_ROTATE_TYPE_EULER_XYZ));
|
||||
bNodeSocket *sock_axis = nodeFindSocket(node, SOCK_IN, "Axis");
|
||||
nodeSetSocketAvailability(sock_axis, ELEM(node->custom1, NODE_VECTOR_ROTATE_TYPE_AXIS));
|
||||
bNodeSocket *sock_angle = nodeFindSocket(node, SOCK_IN, "Angle");
|
||||
nodeSetSocketAvailability(sock_angle,
|
||||
ELEM(node->custom1,
|
||||
NODE_VECTOR_ROTATE_TYPE_AXIS,
|
||||
NODE_VECTOR_ROTATE_TYPE_AXIS_X,
|
||||
NODE_VECTOR_ROTATE_TYPE_AXIS_Y,
|
||||
NODE_VECTOR_ROTATE_TYPE_AXIS_Z));
|
||||
nodeSetSocketAvailability(sock_angle, !ELEM(node->custom1, NODE_VECTOR_ROTATE_TYPE_EULER_XYZ));
|
||||
}
|
||||
|
||||
void register_node_type_sh_vector_rotate(void)
|
||||
|
||||
Reference in New Issue
Block a user