Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/shaders/node_vector_math.osl
| Show All 25 Lines | shader node_vector_math( | ||||
| if (type == "add") { | if (type == "add") { | ||||
| Vector = Vector1 + Vector2; | Vector = Vector1 + Vector2; | ||||
| Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0; | Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0; | ||||
| } | } | ||||
| else if (type == "subtract") { | else if (type == "subtract") { | ||||
| Vector = Vector1 - Vector2; | Vector = Vector1 - Vector2; | ||||
| Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0; | Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0; | ||||
| } | } | ||||
| else if (type == "multiply") { | |||||
| Vector = Vector1 * Vector2; | |||||
| Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0; | |||||
| } | |||||
| else if (type == "average") { | else if (type == "average") { | ||||
| Value = length(Vector1 + Vector2); | Value = length(Vector1 + Vector2); | ||||
| Vector = normalize(Vector1 + Vector2); | Vector = normalize(Vector1 + Vector2); | ||||
| } | } | ||||
| else if (type == "dot_product") { | else if (type == "dot_product") { | ||||
| Value = dot(Vector1, Vector2); | Value = dot(Vector1, Vector2); | ||||
| } | } | ||||
| else if (type == "cross_product") { | else if (type == "cross_product") { | ||||
| Show All 10 Lines | |||||