Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/kernel/shaders/node_vector_math.osl')
-rw-r--r--intern/cycles/kernel/shaders/node_vector_math.osl60
1 files changed, 29 insertions, 31 deletions
diff --git a/intern/cycles/kernel/shaders/node_vector_math.osl b/intern/cycles/kernel/shaders/node_vector_math.osl
index a7e3637402e..10bb0c7283c 100644
--- a/intern/cycles/kernel/shaders/node_vector_math.osl
+++ b/intern/cycles/kernel/shaders/node_vector_math.osl
@@ -16,36 +16,34 @@
#include "stdosl.h"
-shader node_vector_math(
- string type = "add",
- vector Vector1 = vector(0.0, 0.0, 0.0),
- vector Vector2 = vector(0.0, 0.0, 0.0),
- output float Value = 0.0,
- output vector Vector = vector(0.0, 0.0, 0.0))
+shader node_vector_math(string type = "add",
+ vector Vector1 = vector(0.0, 0.0, 0.0),
+ vector Vector2 = vector(0.0, 0.0, 0.0),
+ output float Value = 0.0,
+ output vector Vector = vector(0.0, 0.0, 0.0))
{
- if (type == "add") {
- Vector = Vector1 + Vector2;
- Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0;
- }
- else if (type == "subtract") {
- Vector = Vector1 - Vector2;
- Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0;
- }
- else if (type == "average") {
- Value = length(Vector1 + Vector2);
- Vector = normalize(Vector1 + Vector2);
- }
- else if (type == "dot_product") {
- Value = dot(Vector1, Vector2);
- }
- else if (type == "cross_product") {
- vector c = cross(Vector1, Vector2);
- Value = length(c);
- Vector = normalize(c);
- }
- else if (type == "normalize") {
- Value = length(Vector1);
- Vector = normalize(Vector1);
- }
+ if (type == "add") {
+ Vector = Vector1 + Vector2;
+ Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0;
+ }
+ else if (type == "subtract") {
+ Vector = Vector1 - Vector2;
+ Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0;
+ }
+ else if (type == "average") {
+ Value = length(Vector1 + Vector2);
+ Vector = normalize(Vector1 + Vector2);
+ }
+ else if (type == "dot_product") {
+ Value = dot(Vector1, Vector2);
+ }
+ else if (type == "cross_product") {
+ vector c = cross(Vector1, Vector2);
+ Value = length(c);
+ Vector = normalize(c);
+ }
+ else if (type == "normalize") {
+ Value = length(Vector1);
+ Vector = normalize(Vector1);
+ }
}
-