Cycles: Suppress OSL normalize function warnings.

This patch suppress the OSL warnings resulted from ambiguous calls
to the normalize function. This is done by casting to the vector
type before normalizing.

Reviewed By: Brecht

Differential Revision: https://developer.blender.org/D6621
This commit is contained in:
Omar Emara 2020-01-18 19:19:26 +02:00
parent 966383138a
commit 6dc979e2f9
3 changed files with 3 additions and 3 deletions

View File

@ -31,7 +31,7 @@ shader node_ies_light(int use_mapping = 0,
p = transform(mapping, p);
}
p = normalize(p);
p = normalize((vector)p);
float v_angle = acos(-p[2]);
float h_angle = atan2(p[0], p[1]) + M_PI;

View File

@ -65,7 +65,7 @@ shader node_mapping(string type = "point",
VectorOut = transform(euler_to_mat(Rotation), (VectorIn * Scale));
}
else if (type == "normal") {
VectorOut = normalize(transform(euler_to_mat(Rotation), safe_divide(VectorIn, Scale)));
VectorOut = normalize((vector)transform(euler_to_mat(Rotation), safe_divide(VectorIn, Scale)));
}
else {
warning("%s", "Unknown Mapping vector type!");

View File

@ -603,7 +603,7 @@ void voronoi_distance_to_edge_3d(vector3 coord, float randomness, output float o
vector3 perpendicularToEdge = vectorToPoint - vectorToClosest;
if (dot(perpendicularToEdge, perpendicularToEdge) > 0.0001) {
float distanceToEdge = dot((vectorToClosest + vectorToPoint) / 2.0,
normalize(perpendicularToEdge));
normalize((vector)perpendicularToEdge));
minDistance = min(minDistance, distanceToEdge);
}
}