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:
authorCampbell Barton <ideasman42@gmail.com>2012-10-17 05:47:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-17 05:47:37 +0400
commitaeda5142ef41ce69264166a5d7e31f2c110c0096 (patch)
tree8c70f463176c22d7a32a344907da8aa93073ef2d
parenta1af01249de4be5f212ff896075626630c453846 (diff)
style cleanup: make OSL follow our C style convention. http://wiki.blender.org/index.php/Dev:Doc/CodeStyle
-rw-r--r--GNUmakefile60
-rwxr-xr-xbuild_files/cmake/project_info.py2
-rw-r--r--build_files/cmake/project_source_info.py2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_attribute.osl4
-rw-r--r--intern/cycles/kernel/osl/nodes/node_background.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_blend_weight.osl6
-rw-r--r--intern/cycles/kernel/osl/nodes/node_brick_texture.osl19
-rw-r--r--intern/cycles/kernel/osl/nodes/node_brightness.osl4
-rw-r--r--intern/cycles/kernel/osl/nodes/node_bump.osl4
-rw-r--r--intern/cycles/kernel/osl/nodes/node_checker_texture.osl12
-rw-r--r--intern/cycles/kernel/osl/nodes/node_convert_from_color.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_convert_from_point.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_diffuse_bsdf.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_emission.osl6
-rw-r--r--intern/cycles/kernel/osl/nodes/node_environment_texture.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_fresnel.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_geometry.osl4
-rw-r--r--intern/cycles/kernel/osl/nodes/node_glass_bsdf.osl16
-rw-r--r--intern/cycles/kernel/osl/nodes/node_glossy_bsdf.osl12
-rw-r--r--intern/cycles/kernel/osl/nodes/node_gradient_texture.osl28
-rw-r--r--intern/cycles/kernel/osl/nodes/node_image_texture.osl4
-rw-r--r--intern/cycles/kernel/osl/nodes/node_magic_texture.osl50
-rw-r--r--intern/cycles/kernel/osl/nodes/node_math.osl46
-rw-r--r--intern/cycles/kernel/osl/nodes/node_mix.osl148
-rw-r--r--intern/cycles/kernel/osl/nodes/node_mix_closure.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_musgrave_texture.osl50
-rw-r--r--intern/cycles/kernel/osl/nodes/node_noise_texture.osl6
-rw-r--r--intern/cycles/kernel/osl/nodes/node_output_displacement.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_rgb_ramp.osl6
-rw-r--r--intern/cycles/kernel/osl/nodes/node_sky_texture.osl70
-rw-r--r--intern/cycles/kernel/osl/nodes/node_texture.h14
-rw-r--r--intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl6
-rw-r--r--intern/cycles/kernel/osl/nodes/node_translucent_bsdf.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_transparent_bsdf.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_vector_math.osl16
-rw-r--r--intern/cycles/kernel/osl/nodes/node_velvet_bsdf.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_voronoi_texture.osl6
-rw-r--r--intern/cycles/kernel/osl/nodes/node_ward_bsdf.osl2
-rw-r--r--intern/cycles/kernel/osl/nodes/node_wave_texture.osl14
41 files changed, 330 insertions, 313 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 58707a03d75..f40f7490c62 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -163,12 +163,14 @@ help:
@echo " * package_archive - build an archive package"
@echo ""
@echo "Testing Targets (not associated with building blender)"
- @echo " * test - run ctest, currently tests import/export, operator execution and that python modules load"
- @echo " * test_cmake - runs our own cmake file checker which detects errors in the cmake file list definitions"
- @echo " * test_pep8 - checks all python script are pep8 which are tagged to use the stricter formatting"
- @echo " * test_deprecated - checks for deprecation tags in our code which may need to be removed"
- @echo " * test_style - checks C/C++ conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
- @echo " * test_style_qtc - same as test_style but outputs QtCreator tasks format"
+ @echo " * test - run ctest, currently tests import/export, operator execution and that python modules load"
+ @echo " * test_cmake - runs our own cmake file checker which detects errors in the cmake file list definitions"
+ @echo " * test_pep8 - checks all python script are pep8 which are tagged to use the stricter formatting"
+ @echo " * test_deprecated - checks for deprecation tags in our code which may need to be removed"
+ @echo " * test_style_c - checks C/C++ conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
+ @echo " * test_style_c_qtc - same as test_style but outputs QtCreator tasks format"
+ @echo " * test_style_osl - checks OpenShadingLanguage conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
+ @echo " * test_style_osl_qtc - checks OpenShadingLanguage conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
@echo ""
@echo "Static Source Code Checking (not associated with building blender)"
@echo " * check_cppcheck - run blender source through cppcheck (C & C++)"
@@ -211,28 +213,40 @@ test:
# run pep8 check check on scripts we distribute.
test_pep8:
- python3.2 source/tests/pep8.py > test_pep8.log 2>&1
+ python3 source/tests/pep8.py > test_pep8.log 2>&1
@echo "written: test_pep8.log"
# run some checks on our cmakefiles.
test_cmake:
- python3.2 build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
+ python3 build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
@echo "written: test_cmake_consistency.log"
# run deprecation tests, see if we have anything to remove.
test_deprecated:
- python3.2 source/tests/check_deprecated.py
+ python3 source/tests/check_deprecated.py
-test_style:
+test_style_c:
# run our own checks on C/C++ style
- PYTHONIOENCODING=utf_8 python3.2 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/source/blender $(BLENDER_DIR)/source/creator --no-length-check
+ PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/source/blender $(BLENDER_DIR)/source/creator --no-length-check
-test_style_qtc:
+test_style_c_qtc:
# run our own checks on C/C++ style
USE_QTC_TASK=1 \
- PYTHONIOENCODING=utf_8 python3.2 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/source/blender $(BLENDER_DIR)/source/creator --no-length-check > \
+ PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/source/blender $(BLENDER_DIR)/source/creator --no-length-check > \
test_style.tasks
+ @echo "written: test_style.tasks"
+
+
+test_style_osl:
+ # run our own checks on C/C++ style
+ PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/intern/cycles/kernel/osl
+
+test_style_osl_qtc:
+ # run our own checks on C/C++ style
+ USE_QTC_TASK=1 \
+ PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/intern/cycles/kernel/osl > \
+ test_style.tasks
@echo "written: test_style.tasks"
# -----------------------------------------------------------------------------
@@ -240,10 +254,10 @@ test_style_qtc:
#
project_qtcreator:
- python3.2 build_files/cmake/cmake_qtcreator_project.py $(BUILD_DIR)
+ python3 build_files/cmake/cmake_qtcreator_project.py $(BUILD_DIR)
project_netbeans:
- python3.2 build_files/cmake/cmake_netbeans_project.py $(BUILD_DIR)
+ python3 build_files/cmake/cmake_netbeans_project.py $(BUILD_DIR)
project_eclipse:
cmake -G"Eclipse CDT4 - Unix Makefiles" -H$(BLENDER_DIR) -B$(BUILD_DIR)
@@ -255,29 +269,29 @@ project_eclipse:
check_cppcheck:
$(CMAKE_CONFIG)
- cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py
+ cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py
check_clang_array:
$(CMAKE_CONFIG)
- cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py
+ cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py
check_splint:
$(CMAKE_CONFIG)
- cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py
+ cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py
check_sparse:
$(CMAKE_CONFIG)
- cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py
+ cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py
check_smatch:
$(CMAKE_CONFIG)
- cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py
+ cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py
check_spelling_py:
- cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3.2 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/release/scripts
+ cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/release/scripts
check_spelling_c:
- cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3.2 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/source
+ cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/source
# -----------------------------------------------------------------------------
@@ -310,7 +324,7 @@ doc_dna:
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
doc_man:
- python3.2 doc/manpage/blender.1.py $(BUILD_DIR)/bin/blender
+ python3 doc/manpage/blender.1.py $(BUILD_DIR)/bin/blender
clean:
diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py
index 7536e93b6ce..b154d578144 100755
--- a/build_files/cmake/project_info.py
+++ b/build_files/cmake/project_info.py
@@ -112,7 +112,7 @@ def is_glsl(filename):
def is_c(filename):
ext = splitext(filename)[1]
- return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc", ".cc", ".inl"))
+ return (ext in {".c", ".cpp", ".cxx", ".m", ".mm", ".rc", ".cc", ".inl", ".osl"})
def is_c_any(filename):
diff --git a/build_files/cmake/project_source_info.py b/build_files/cmake/project_source_info.py
index d80145b989c..10bc36ba1a8 100644
--- a/build_files/cmake/project_source_info.py
+++ b/build_files/cmake/project_source_info.py
@@ -48,7 +48,7 @@ def is_c_header(filename):
def is_c(filename):
ext = os.path.splitext(filename)[1]
- return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc", ".cc", ".inl"))
+ return (ext in {".c", ".cpp", ".cxx", ".m", ".mm", ".rc", ".cc", ".inl", ".osl"})
def is_c_any(filename):
diff --git a/intern/cycles/kernel/osl/nodes/node_attribute.osl b/intern/cycles/kernel/osl/nodes/node_attribute.osl
index d273d0c68d7..8e7c846d1a3 100644
--- a/intern/cycles/kernel/osl/nodes/node_attribute.osl
+++ b/intern/cycles/kernel/osl/nodes/node_attribute.osl
@@ -29,12 +29,12 @@ shader node_attribute(
Vector = point(Color);
getattribute(name, Fac);
- if(bump_offset == "dx") {
+ if (bump_offset == "dx") {
Color += Dx(Color);
Vector += Dx(Vector);
Fac += Dx(Fac);
}
- else if(bump_offset == "dy") {
+ else if (bump_offset == "dy") {
Color += Dy(Color);
Vector += Dy(Vector);
Fac += Dy(Fac);
diff --git a/intern/cycles/kernel/osl/nodes/node_background.osl b/intern/cycles/kernel/osl/nodes/node_background.osl
index 69f8d85a82e..b51a1685294 100644
--- a/intern/cycles/kernel/osl/nodes/node_background.osl
+++ b/intern/cycles/kernel/osl/nodes/node_background.osl
@@ -23,6 +23,6 @@ shader node_background(
float Strength = 1.0,
output closure color Background = background())
{
- Background = Color*Strength*background();
+ Background = Color * Strength * background();
}
diff --git a/intern/cycles/kernel/osl/nodes/node_blend_weight.osl b/intern/cycles/kernel/osl/nodes/node_blend_weight.osl
index d834819ef3a..836897fc5e3 100644
--- a/intern/cycles/kernel/osl/nodes/node_blend_weight.osl
+++ b/intern/cycles/kernel/osl/nodes/node_blend_weight.osl
@@ -26,13 +26,13 @@ shader node_blend_weight(
output float Facing = 0.0)
{
float f = max(1.0 - Blend, 1e-5);
- Fresnel = fresnel_dielectric(I, Normal, backfacing()? f: 1.0/f);
+ Fresnel = fresnel_dielectric(I, Normal, backfacing()? f: 1.0 / f);
Facing = abs(dot(I, Normal));
- if(Blend != 0.5) {
+ if (Blend != 0.5) {
Blend = clamp(Blend, 0.0, 1.0);
- Blend = (Blend < 0.5)? 2.0*Blend: 0.5/(1.0 - Blend);
+ Blend = (Blend < 0.5)? 2.0 * Blend: 0.5 / (1.0 - Blend);
Facing = powf(Facing, Blend);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_brick_texture.osl b/intern/cycles/kernel/osl/nodes/node_brick_texture.osl
index 4daceb4018e..d6af5a21ce1 100644
--- a/intern/cycles/kernel/osl/nodes/node_brick_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_brick_texture.osl
@@ -40,21 +40,21 @@ float brick(point p, float mortar_size, float bias,
rownum = (int)floor(p[1] / row_height);
- if(offset_frequency && squash_frequency) {
+ if (offset_frequency && squash_frequency) {
brick_width *= ((int)(rownum) % squash_frequency ) ? 1.0 : squash_amount; /* squash */
- offset = ((int)(rownum) % offset_frequency ) ? 0 : (brick_width*offset_amount); /* offset */
+ offset = ((int)(rownum) % offset_frequency ) ? 0 : (brick_width * offset_amount); /* offset */
}
- bricknum = (int)floor((p[0]+offset) / brick_width);
+ bricknum = (int)floor((p[0] + offset) / brick_width);
- x = (p[0]+offset) - brick_width*bricknum;
- y = p[1] - row_height*rownum;
+ x = (p[0] + offset) - brick_width * bricknum;
+ y = p[1] - row_height * rownum;
tint = clamp((brick_noise((rownum << 16) + (bricknum & 65535)) + bias), 0.0, 1.0);
return (x < mortar_size || y < mortar_size ||
- x > (brick_width - mortar_size) ||
- y > (row_height - mortar_size)) ? 1.0 : 0.0;
+ x > (brick_width - mortar_size) ||
+ y > (row_height - mortar_size)) ? 1.0 : 0.0;
}
shader node_brick_texture(
@@ -77,10 +77,10 @@ shader node_brick_texture(
float tint = 0.0;
color Col = Color1;
- Fac = brick(Vector*Scale, MortarSize, Bias, BrickWidth, RowHeight,
+ Fac = brick(Vector * Scale, MortarSize, Bias, BrickWidth, RowHeight,
Offset, OffsetFrequency, Squash, SquashFrequency, tint);
- if(Fac != 1.0) {
+ if (Fac != 1.0) {
float facm = 1.0 - tint;
Col[0] = facm * (Color1[0]) + tint * Color2[0];
@@ -89,6 +89,5 @@ shader node_brick_texture(
}
Color = (Fac == 1.0) ? Mortar: Col;
-
}
diff --git a/intern/cycles/kernel/osl/nodes/node_brightness.osl b/intern/cycles/kernel/osl/nodes/node_brightness.osl
index 4f19a20f736..2074623e3ff 100644
--- a/intern/cycles/kernel/osl/nodes/node_brightness.osl
+++ b/intern/cycles/kernel/osl/nodes/node_brightness.osl
@@ -24,7 +24,7 @@ shader node_brightness(
float Contrast = 0.0,
output color ColorOut = color(0.8, 0.8, 0.8))
{
- float delta = Contrast * (1.0/200.0);
+ float delta = Contrast * (1.0 / 200.0);
float a = 1.0 - delta * 2.0;
float b;
@@ -38,7 +38,7 @@ shader node_brightness(
*/
if (Contrast > 0.0) {
- a = (a < 0.0 ? 1.0/a : 0.0);
+ a = (a < 0.0 ? 1.0 / a : 0.0);
b = a * (bright_factor - delta);
}
else {
diff --git a/intern/cycles/kernel/osl/nodes/node_bump.osl b/intern/cycles/kernel/osl/nodes/node_bump.osl
index a3849e70f98..2fda73dabd5 100644
--- a/intern/cycles/kernel/osl/nodes/node_bump.osl
+++ b/intern/cycles/kernel/osl/nodes/node_bump.osl
@@ -37,10 +37,10 @@ surface node_bump(
vector Ry = cross(N, dPdx);
float det = dot(dPdx, Rx);
- vector surfgrad = dx*Rx + dy*Ry;
+ vector surfgrad = dx * Rx + dy * Ry;
surfgrad *= 0.1; /* todo: remove this factor */
- Normal = normalize(abs(det)*N - sign(det)*surfgrad);
+ Normal = normalize(abs(det) * N - sign(det) * surfgrad);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_checker_texture.osl b/intern/cycles/kernel/osl/nodes/node_checker_texture.osl
index e92d7be34fc..577caf308ff 100644
--- a/intern/cycles/kernel/osl/nodes/node_checker_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_checker_texture.osl
@@ -23,15 +23,15 @@
float checker(point p)
{
- p[0] = (p[0] + 0.00001)*0.9999;
- p[1] = (p[1] + 0.00001)*0.9999;
- p[2] = (p[2] + 0.00001)*0.9999;
+ p[0] = (p[0] + 0.00001) * 0.9999;
+ p[1] = (p[1] + 0.00001) * 0.9999;
+ p[2] = (p[2] + 0.00001) * 0.9999;
int xi = (int)fabs(floor(p[0]));
int yi = (int)fabs(floor(p[1]));
int zi = (int)fabs(floor(p[2]));
- if((xi % 2 == yi % 2) == (zi % 2)) {
+ if ((xi % 2 == yi % 2) == (zi % 2)) {
return 1.0;
}
else {
@@ -47,8 +47,8 @@ shader node_checker_texture(
output float Fac = 0.0,
output color Color = color(0.0, 0.0, 0.0))
{
- Fac = checker(Vector*Scale);
- if(Fac == 1.0) {
+ Fac = checker(Vector * Scale);
+ if (Fac == 1.0) {
Color = Color1;
}
else {
diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_color.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_color.osl
index 97356139c48..c55b0f811ff 100644
--- a/intern/cycles/kernel/osl/nodes/node_convert_from_color.osl
+++ b/intern/cycles/kernel/osl/nodes/node_convert_from_color.osl
@@ -25,7 +25,7 @@ shader node_convert_from_color(
output point Point = point(0.0, 0.0, 0.0),
output normal Normal = normal(0.0, 0.0, 0.0))
{
- Val = Color[0]*0.2126 + Color[1]*0.7152 + Color[2]*0.0722;
+ Val = Color[0] * 0.2126 + Color[1] * 0.7152 + Color[2] * 0.0722;
Vector = vector(Color[0], Color[1], Color[2]);
Point = point(Color[0], Color[1], Color[2]);
Normal = normal(Color[0], Color[1], Color[2]);
diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl
index 0bb9092591d..b2c6c76661c 100644
--- a/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl
+++ b/intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl
@@ -25,7 +25,7 @@ shader node_convert_from_normal(
output color Color = color(0.0, 0.0, 0.0),
output point Point = point(0.0, 0.0, 0.0))
{
- Val = (Normal[0] + Normal[1] + Normal[2])*(1.0/3.0);
+ Val = (Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0);
Vector = vector(Normal[0], Normal[1], Normal[2]);
Color = color(Normal[0], Normal[1], Normal[2]);
Point = point(Normal[0], Normal[1], Normal[2]);
diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl
index e66d6a864d6..ae9a17dbc80 100644
--- a/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl
+++ b/intern/cycles/kernel/osl/nodes/node_convert_from_point.osl
@@ -25,7 +25,7 @@ shader node_convert_from_point(
output color Color = color(0.0, 0.0, 0.0),
output normal Normal = normal(0.0, 0.0, 0.0))
{
- Val = (Point[0] + Point[1] + Point[2])*(1.0/3.0);
+ Val = (Point[0] + Point[1] + Point[2]) * (1.0 / 3.0);
Vector = vector(Point[0], Point[1], Point[2]);
Color = color(Point[0], Point[1], Point[2]);
Normal = normal(Point[0], Point[1], Point[2]);
diff --git a/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl b/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl
index 37ba9582cad..19ef9331c0c 100644
--- a/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl
+++ b/intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl
@@ -25,7 +25,7 @@ shader node_convert_from_vector(
output point Point = point(0.0, 0.0, 0.0),
output normal Normal = normal(0.0, 0.0, 0.0))
{
- Val = (Vector[0] + Vector[1] + Vector[2])*(1.0/3.0);
+ Val = (Vector[0] + Vector[1] + Vector[2]) * (1.0 / 3.0);
Color = color(Vector[0], Vector[1], Vector[2]);
Point = point(Vector[0], Vector[1], Vector[2]);
Normal = normal(Vector[0], Vector[1], Vector[2]);
diff --git a/intern/cycles/kernel/osl/nodes/node_diffuse_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_diffuse_bsdf.osl
index 6075b7c93f3..d6dc17316e8 100644
--- a/intern/cycles/kernel/osl/nodes/node_diffuse_bsdf.osl
+++ b/intern/cycles/kernel/osl/nodes/node_diffuse_bsdf.osl
@@ -24,7 +24,7 @@ shader node_diffuse_bsdf(
normal Normal = N,
output closure color BSDF = diffuse(Normal))
{
- if(Roughness == 0.0)
+ if (Roughness == 0.0)
BSDF = Color * diffuse(Normal);
else
BSDF = Color * oren_nayar(Normal, Roughness);
diff --git a/intern/cycles/kernel/osl/nodes/node_emission.osl b/intern/cycles/kernel/osl/nodes/node_emission.osl
index 8bfd1af173a..7ad0f9f7760 100644
--- a/intern/cycles/kernel/osl/nodes/node_emission.osl
+++ b/intern/cycles/kernel/osl/nodes/node_emission.osl
@@ -24,9 +24,9 @@ shader node_emission(
float Strength = 1.0,
output closure color Emission = emission())
{
- if(TotalPower)
- Emission = ((Strength/surfacearea())*Color)*emission();
+ if (TotalPower)
+ Emission = ((Strength / surfacearea()) * Color) * emission();
else
- Emission = (Strength*Color)*emission();
+ Emission = (Strength * Color) * emission();
}
diff --git a/intern/cycles/kernel/osl/nodes/node_environment_texture.osl b/intern/cycles/kernel/osl/nodes/node_environment_texture.osl
index 3ad806781eb..bad62e56ab4 100644
--- a/intern/cycles/kernel/osl/nodes/node_environment_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_environment_texture.osl
@@ -28,7 +28,7 @@ shader node_environment_texture(
{
Color = (color)environment(filename, Vector, "alpha", Alpha);
- if(color_space == "sRGB")
+ if (color_space == "sRGB")
Color = color_srgb_to_scene_linear(Color);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_fresnel.osl b/intern/cycles/kernel/osl/nodes/node_fresnel.osl
index 3af4448b43f..172f4dd9843 100644
--- a/intern/cycles/kernel/osl/nodes/node_fresnel.osl
+++ b/intern/cycles/kernel/osl/nodes/node_fresnel.osl
@@ -25,7 +25,7 @@ shader node_fresnel(
output float Fac = 0.0)
{
float f = max(IOR, 1.0 + 1e-5);
- float eta = backfacing()? 1.0/f: f;
+ float eta = backfacing()? 1.0 / f: f;
Fac = fresnel_dielectric(I, Normal, eta);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_geometry.osl b/intern/cycles/kernel/osl/nodes/node_geometry.osl
index 9efc2a75c64..a3831cbec9c 100644
--- a/intern/cycles/kernel/osl/nodes/node_geometry.osl
+++ b/intern/cycles/kernel/osl/nodes/node_geometry.osl
@@ -38,11 +38,11 @@ shader node_geometry(
Parametric = point(u, v, 0.0);
Backfacing = backfacing();
- if(bump_offset == "dx") {
+ if (bump_offset == "dx") {
Position += Dx(Position);
Parametric += Dx(Parametric);
}
- else if(bump_offset == "dy") {
+ else if (bump_offset == "dy") {
Position += Dy(Position);
Parametric += Dy(Parametric);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_glass_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_glass_bsdf.osl
index 52743669c99..8b069248a35 100644
--- a/intern/cycles/kernel/osl/nodes/node_glass_bsdf.osl
+++ b/intern/cycles/kernel/osl/nodes/node_glass_bsdf.osl
@@ -28,14 +28,16 @@ shader node_glass_bsdf(
output closure color BSDF = diffuse(Normal))
{
float f = max(IOR, 1.0 + 1e-5);
- float eta = backfacing()? 1.0/f: f;
+ float eta = backfacing()? 1.0 / f: f;
float Fr = fresnel_dielectric(I, Normal, eta);
- if(distribution == "Sharp")
- BSDF = Color*(Fr*reflection(Normal) + (1.0-Fr)*refraction(Normal, eta));
- else if(distribution == "Beckmann")
- BSDF = Color*(Fr*microfacet_beckmann(Normal, Roughness, eta) + (1.0-Fr)*microfacet_beckmann_refraction(Normal, Roughness, eta));
- else if(distribution == "GGX")
- BSDF = Color*(Fr*microfacet_ggx(Normal, Roughness, eta) + (1.0-Fr)*microfacet_ggx_refraction(Normal, Roughness, eta));
+ if (distribution == "Sharp")
+ BSDF = Color * (Fr * reflection(Normal) + (1.0 - Fr) * refraction(Normal, eta));
+ else if (distribution == "Beckmann")
+ BSDF = Color * (Fr * microfacet_beckmann(Normal, Roughness, eta) +
+ (1.0 - Fr) * microfacet_beckmann_refraction(Normal, Roughness, eta));
+ else if (distribution == "GGX")
+ BSDF = Color * (Fr * microfacet_ggx(Normal, Roughness, eta) +
+ (1.0 - Fr) * microfacet_ggx_refraction(Normal, Roughness, eta));
}
diff --git a/intern/cycles/kernel/osl/nodes/node_glossy_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_glossy_bsdf.osl
index 3890630e8a2..48d61ea0ab5 100644
--- a/intern/cycles/kernel/osl/nodes/node_glossy_bsdf.osl
+++ b/intern/cycles/kernel/osl/nodes/node_glossy_bsdf.osl
@@ -26,12 +26,12 @@ shader node_glossy_bsdf(
normal Normal = N,
output closure color BSDF = diffuse(Normal))
{
- if(distribution == "Sharp")
- BSDF = Color*reflection(Normal);
- else if(distribution == "Beckmann")
- BSDF = Color*microfacet_beckmann(Normal, Roughness, 1.0);
- else if(distribution == "GGX")
- BSDF = Color*microfacet_ggx(Normal, Roughness, 1.0);
+ if (distribution == "Sharp")
+ BSDF = Color * reflection(Normal);
+ else if (distribution == "Beckmann")
+ BSDF = Color * microfacet_beckmann(Normal, Roughness, 1.0);
+ else if (distribution == "GGX")
+ BSDF = Color * microfacet_ggx(Normal, Roughness, 1.0);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_gradient_texture.osl b/intern/cycles/kernel/osl/nodes/node_gradient_texture.osl
index e0cbc2cc569..ae7cfa51f59 100644
--- a/intern/cycles/kernel/osl/nodes/node_gradient_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_gradient_texture.osl
@@ -31,31 +31,31 @@ float gradient(point p, string type)
float result = 0.0;
- if(type == "Linear") {
+ if (type == "Linear") {
result = x;
}
- else if(type == "Quadratic") {
+ else if (type == "Quadratic") {
float r = max(x, 0.0);
- result = r*r;
+ result = r * r;
}
- else if(type == "Easing") {
+ else if (type == "Easing") {
float r = min(max(x, 0.0), 1.0);
- float t = r*r;
+ float t = r * r;
- result = (3.0*t - 2.0*t*r);
+ result = (3.0 * t - 2.0 * t * r);
}
- else if(type == "Diagonal") {
- result = (x + y)/2.0;
+ else if (type == "Diagonal") {
+ result = (x + y) / 2.0;
}
- else if(type == "Radial") {
- result = atan2(y, x)/(2.0*M_PI) + 0.5;
+ else if (type == "Radial") {
+ result = atan2(y, x) / (2.0 * M_PI) + 0.5;
}
else {
- float r = max(1.0 - sqrt(x*x + y*y + z*z), 0.0);
+ float r = max(1.0 - sqrt(x * x + y * y + z * z), 0.0);
- if(type == "Quadratic Sphere")
- result = r*r;
- else if(type == "Spherical")
+ if (type == "Quadratic Sphere")
+ result = r * r;
+ else if (type == "Spherical")
result = r;
}
diff --git a/intern/cycles/kernel/osl/nodes/node_image_texture.osl b/intern/cycles/kernel/osl/nodes/node_image_texture.osl
index 38126401d76..e005f1f4245 100644
--- a/intern/cycles/kernel/osl/nodes/node_image_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_image_texture.osl
@@ -26,9 +26,9 @@ shader node_image_texture(
output color Color = color(0.0, 0.0, 0.0),
output float Alpha = 1.0)
{
- Color = (color)texture(filename, Vector[0], 1.0-Vector[1], "wrap", "periodic", "alpha", Alpha);
+ Color = (color)texture(filename, Vector[0], 1.0 - Vector[1], "wrap", "periodic", "alpha", Alpha);
- if(color_space == "sRGB")
+ if (color_space == "sRGB")
Color = color_srgb_to_scene_linear(Color);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_magic_texture.osl b/intern/cycles/kernel/osl/nodes/node_magic_texture.osl
index c013ebfe658..e464b83bc9e 100644
--- a/intern/cycles/kernel/osl/nodes/node_magic_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_magic_texture.osl
@@ -25,51 +25,51 @@ color magic(point p, int n, float distortion)
{
float dist = distortion;
- float x = sin((p[0] + p[1] + p[2])*5.0);
- float y = cos((-p[0] + p[1] - p[2])*5.0);
- float z = -cos((-p[0] - p[1] + p[2])*5.0);
+ float x = sin(( p[0] + p[1] + p[2]) * 5.0);
+ float y = cos((-p[0] + p[1] - p[2]) * 5.0);
+ float z = -cos((-p[0] - p[1] + p[2]) * 5.0);
- if(n > 0) {
+ if (n > 0) {
x *= dist;
y *= dist;
z *= dist;
- y = -cos(x-y+z);
+ y = -cos(x - y + z);
y *= dist;
- if(n > 1) {
- x = cos(x-y-z);
+ if (n > 1) {
+ x = cos(x - y - z);
x *= dist;
- if(n > 2) {
- z = sin(-x-y-z);
+ if (n > 2) {
+ z = sin(-x - y - z);
z *= dist;
- if(n > 3) {
- x = -cos(-x+y-z);
+ if (n > 3) {
+ x = -cos(-x + y - z);
x *= dist;
- if(n > 4) {
- y = -sin(-x+y+z);
+ if (n > 4) {
+ y = -sin(-x + y + z);
y *= dist;
- if(n > 5) {
- y = -cos(-x+y+z);
+ if (n > 5) {
+ y = -cos(-x + y + z);
y *= dist;
- if(n > 6) {
- x = cos(x+y+z);
+ if (n > 6) {
+ x = cos(x + y + z);
x *= dist;
- if(n > 7) {
- z = sin(x+y-z);
+ if (n > 7) {
+ z = sin(x + y - z);
z *= dist;
- if(n > 8) {
- x = -cos(-x-y+z);
+ if (n > 8) {
+ x = -cos(-x - y + z);
x *= dist;
- if(n > 9) {
- y = -sin(x-y+z);
+ if (n > 9) {
+ y = -sin(x - y + z);
y *= dist;
}
}
@@ -82,7 +82,7 @@ color magic(point p, int n, float distortion)
}
}
- if(dist != 0.0) {
+ if (dist != 0.0) {
dist *= 2.0;
x /= dist;
y /= dist;
@@ -99,6 +99,6 @@ shader node_magic_texture(
point Vector = P,
output color Color = color(0.0, 0.0, 0.0))
{
- Color = magic(Vector*Scale, Depth, Distortion);
+ Color = magic(Vector * Scale, Depth, Distortion);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_math.osl b/intern/cycles/kernel/osl/nodes/node_math.osl
index 3327795286a..24dce898fd2 100644
--- a/intern/cycles/kernel/osl/nodes/node_math.osl
+++ b/intern/cycles/kernel/osl/nodes/node_math.osl
@@ -22,20 +22,20 @@ float safe_divide(float a, float b)
{
float result;
- if(b == 0.0)
+ if (b == 0.0)
result = 0.0;
else
- result = a/b;
+ result = a / b;
return result;
}
float safe_log(float a, float b)
{
- if(a < 0.0 || b < 0.0)
+ if (a < 0.0 || b < 0.0)
return 0.0;
- return log(a)/log(b);
+ return log(a) / log(b);
}
shader node_math(
@@ -47,42 +47,42 @@ shader node_math(
{
/* OSL asin, acos, pow check for values that could give rise to nan */
- if(type == "Add")
+ if (type == "Add")
Value = Value1 + Value2;
- if(type == "Subtract")
+ if (type == "Subtract")
Value = Value1 - Value2;
- if(type == "Multiply")
- Value = Value1*Value2;
- if(type == "Divide")
+ if (type == "Multiply")
+ Value = Value1 * Value2;
+ if (type == "Divide")
Value = safe_divide(Value1, Value2);
- if(type == "Sine")
+ if (type == "Sine")
Value = sin(Value1);
- if(type == "Cosine")
+ if (type == "Cosine")
Value = cos(Value1);
- if(type == "Tangent")
+ if (type == "Tangent")
Value = tan(Value1);
- if(type == "Arcsine")
+ if (type == "Arcsine")
Value = asin(Value1);
- if(type == "Arccosine")
+ if (type == "Arccosine")
Value = acos(Value1);
- if(type == "Arctangent")
+ if (type == "Arctangent")
Value = atan(Value1);
- if(type == "Power")
+ if (type == "Power")
Value = pow(Value1, Value2);
- if(type == "Logarithm")
+ if (type == "Logarithm")
Value = safe_log(Value1, Value2);
- if(type == "Minimum")
+ if (type == "Minimum")
Value = min(Value1, Value2);
- if(type == "Maximum")
+ if (type == "Maximum")
Value = max(Value1, Value2);
- if(type == "Round")
+ if (type == "Round")
Value = floor(Value1 + 0.5);
- if(type == "Less Than")
+ if (type == "Less Than")
Value = Value1 < Value2;
- if(type == "Greater Than")
+ if (type == "Greater Than")
Value = Value1 > Value2;
- if(Clamp)
+ if (Clamp)
Value = clamp(Value1, 0.0, 1.0);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_mix.osl b/intern/cycles/kernel/osl/nodes/node_mix.osl
index 2ce342c49cd..69e68e5ed15 100644
--- a/intern/cycles/kernel/osl/nodes/node_mix.osl
+++ b/intern/cycles/kernel/osl/nodes/node_mix.osl
@@ -38,7 +38,7 @@ color node_mix_screen(float t, color col1, color col2)
{
float tm = 1.0 - t;
- return color(1.0) - (color(tm) + t*(color(1.0) - col2))*(color(1.0) - col1);
+ return color(1.0) - (color(tm) + t * (color(1.0) - col2)) * (color(1.0) - col1);
}
color node_mix_overlay(float t, color col1, color col2)
@@ -47,20 +47,20 @@ color node_mix_overlay(float t, color col1, color col2)
color outcol = col1;
- if(outcol[0] < 0.5)
- outcol[0] *= tm + 2.0*t*col2[0];
+ if (outcol[0] < 0.5)
+ outcol[0] *= tm + 2.0 * t * col2[0];
else
- outcol[0] = 1.0 - (tm + 2.0*t*(1.0 - col2[0]))*(1.0 - outcol[0]);
+ outcol[0] = 1.0 - (tm + 2.0 * t * (1.0 - col2[0])) * (1.0 - outcol[0]);
- if(outcol[1] < 0.5)
- outcol[1] *= tm + 2.0*t*col2[1];
+ if (outcol[1] < 0.5)
+ outcol[1] *= tm + 2.0 * t * col2[1];
else
- outcol[1] = 1.0 - (tm + 2.0*t*(1.0 - col2[1]))*(1.0 - outcol[1]);
+ outcol[1] = 1.0 - (tm + 2.0 * t * (1.0 - col2[1])) * (1.0 - outcol[1]);
- if(outcol[2] < 0.5)
- outcol[2] *= tm + 2.0*t*col2[2];
+ if (outcol[2] < 0.5)
+ outcol[2] *= tm + 2.0 * t * col2[2];
else
- outcol[2] = 1.0 - (tm + 2.0*t*(1.0 - col2[2]))*(1.0 - outcol[2]);
+ outcol[2] = 1.0 - (tm + 2.0 * t * (1.0 - col2[2])) * (1.0 - outcol[2]);
return outcol;
}
@@ -76,9 +76,9 @@ color node_mix_div(float t, color col1, color col2)
color outcol = col1;
- if(col2[0] != 0.0) outcol[0] = tm*outcol[0] + t*outcol[0]/col2[0];
- if(col2[1] != 0.0) outcol[1] = tm*outcol[1] + t*outcol[1]/col2[1];
- if(col2[2] != 0.0) outcol[2] = tm*outcol[2] + t*outcol[2]/col2[2];
+ if (col2[0] != 0.0) outcol[0] = tm * outcol[0] + t * outcol[0] / col2[0];
+ if (col2[1] != 0.0) outcol[1] = tm * outcol[1] + t * outcol[1] / col2[1];
+ if (col2[2] != 0.0) outcol[2] = tm * outcol[2] + t * outcol[2] / col2[2];
return outcol;
}
@@ -90,41 +90,41 @@ color node_mix_diff(float t, color col1, color col2)
color node_mix_dark(float t, color col1, color col2)
{
- return min(col1, col2*t);
+ return min(col1, col2 * t);
}
color node_mix_light(float t, color col1, color col2)
{
- return max(col1, col2*t);
+ return max(col1, col2 * t);
}
color node_mix_dodge(float t, color col1, color col2)
{
color outcol = col1;
- if(outcol[0] != 0.0) {
- float tmp = 1.0 - t*col2[0];
- if(tmp <= 0.0)
+ if (outcol[0] != 0.0) {
+ float tmp = 1.0 - t * col2[0];
+ if (tmp <= 0.0)
outcol[0] = 1.0;
- else if((tmp = outcol[0]/tmp) > 1.0)
+ else if ((tmp = outcol[0] / tmp) > 1.0)
outcol[0] = 1.0;
else
outcol[0] = tmp;
}
- if(outcol[1] != 0.0) {
- float tmp = 1.0 - t*col2[1];
- if(tmp <= 0.0)
+ if (outcol[1] != 0.0) {
+ float tmp = 1.0 - t * col2[1];
+ if (tmp <= 0.0)
outcol[1] = 1.0;
- else if((tmp = outcol[1]/tmp) > 1.0)
+ else if ((tmp = outcol[1] / tmp) > 1.0)
outcol[1] = 1.0;
else
outcol[1] = tmp;
}
- if(outcol[2] != 0.0) {
- float tmp = 1.0 - t*col2[2];
- if(tmp <= 0.0)
+ if (outcol[2] != 0.0) {
+ float tmp = 1.0 - t * col2[2];
+ if (tmp <= 0.0)
outcol[2] = 1.0;
- else if((tmp = outcol[2]/tmp) > 1.0)
+ else if ((tmp = outcol[2] / tmp) > 1.0)
outcol[2] = 1.0;
else
outcol[2] = tmp;
@@ -139,32 +139,32 @@ color node_mix_burn(float t, color col1, color col2)
color outcol = col1;
- tmp = tm + t*col2[0];
- if(tmp <= 0.0)
+ tmp = tm + t * col2[0];
+ if (tmp <= 0.0)
outcol[0] = 0.0;
- else if((tmp = (1.0 - (1.0 - outcol[0])/tmp)) < 0.0)
+ else if ((tmp = (1.0 - (1.0 - outcol[0]) / tmp)) < 0.0)
outcol[0] = 0.0;
- else if(tmp > 1.0)
+ else if (tmp > 1.0)
outcol[0] = 1.0;
else
outcol[0] = tmp;
- tmp = tm + t*col2[1];
- if(tmp <= 0.0)
+ tmp = tm + t * col2[1];
+ if (tmp <= 0.0)
outcol[1] = 0.0;
- else if((tmp = (1.0 - (1.0 - outcol[1])/tmp)) < 0.0)
+ else if ((tmp = (1.0 - (1.0 - outcol[1]) / tmp)) < 0.0)
outcol[1] = 0.0;
- else if(tmp > 1.0)
+ else if (tmp > 1.0)
outcol[1] = 1.0;
else
outcol[1] = tmp;
- tmp = tm + t*col2[2];
- if(tmp <= 0.0)
+ tmp = tm + t * col2[2];
+ if (tmp <= 0.0)
outcol[2] = 0.0;
- else if((tmp = (1.0 - (1.0 - outcol[2])/tmp)) < 0.0)
+ else if ((tmp = (1.0 - (1.0 - outcol[2]) / tmp)) < 0.0)
outcol[2] = 0.0;
- else if(tmp > 1.0)
+ else if (tmp > 1.0)
outcol[2] = 1.0;
else
outcol[2] = tmp;
@@ -177,7 +177,7 @@ color node_mix_hue(float t, color col1, color col2)
color outcol = col1;
color hsv2 = rgb_to_hsv(col2);
- if(hsv2[1] != 0.0) {
+ if (hsv2[1] != 0.0) {
color hsv = rgb_to_hsv(outcol);
hsv[0] = hsv2[0];
color tmp = hsv_to_rgb(hsv);
@@ -196,10 +196,10 @@ color node_mix_sat(float t, color col1, color col2)
color hsv = rgb_to_hsv(outcol);
- if(hsv[1] != 0.0) {
+ if (hsv[1] != 0.0) {
color hsv2 = rgb_to_hsv(col2);
- hsv[1] = tm*hsv[1] + t*hsv2[1];
+ hsv[1] = tm * hsv[1] + t * hsv2[1];
outcol = hsv_to_rgb(hsv);
}
@@ -213,7 +213,7 @@ color node_mix_val(float t, color col1, color col2)
color hsv = rgb_to_hsv(col1);
color hsv2 = rgb_to_hsv(col2);
- hsv[2] = tm*hsv[2] + t*hsv2[2];
+ hsv[2] = tm * hsv[2] + t * hsv2[2];
return hsv_to_rgb(hsv);
}
@@ -223,7 +223,7 @@ color node_mix_color(float t, color col1, color col2)
color outcol = col1;
color hsv2 = rgb_to_hsv(col2);
- if(hsv2[1] != 0.0) {
+ if (hsv2[1] != 0.0) {
color hsv = rgb_to_hsv(outcol);
hsv[0] = hsv2[0];
hsv[1] = hsv2[1];
@@ -240,29 +240,29 @@ color node_mix_soft(float t, color col1, color col2)
float tm = 1.0 - t;
color one = color(1.0);
- color scr = one - (one - col2)*(one - col1);
+ color scr = one - (one - col2) * (one - col1);
- return tm*col1 + t*((one - col1)*col2*col1 + col1*scr);
+ return tm * col1 + t * ((one - col1) * col2 * col1 + col1 * scr);
}
color node_mix_linear(float t, color col1, color col2)
{
color outcol = col1;
- if(col2[0] > 0.5)
- outcol[0]= col1[0] + t*(2.0*(col2[0] - 0.5));
+ if (col2[0] > 0.5)
+ outcol[0] = col1[0] + t * (2.0 * (col2[0] - 0.5));
else
- outcol[0]= col1[0] + t*(2.0*(col2[0]) - 1.0);
+ outcol[0] = col1[0] + t * (2.0 * (col2[0]) - 1.0);
- if(col2[1] > 0.5)
- outcol[1]= col1[1] + t*(2.0*(col2[1] - 0.5));
+ if (col2[1] > 0.5)
+ outcol[1] = col1[1] + t * (2.0 * (col2[1] - 0.5));
else
- outcol[1]= col1[1] + t*(2.0*(col2[1]) - 1.0);
+ outcol[1] = col1[1] + t * (2.0 * (col2[1]) - 1.0);
- if(col2[2] > 0.5)
- outcol[2]= col1[2] + t*(2.0*(col2[2] - 0.5));
+ if (col2[2] > 0.5)
+ outcol[2] = col1[2] + t * (2.0 * (col2[2] - 0.5));
else
- outcol[2]= col1[2] + t*(2.0*(col2[2]) - 1.0);
+ outcol[2] = col1[2] + t * (2.0 * (col2[2]) - 1.0);
return outcol;
}
@@ -288,44 +288,44 @@ shader node_mix(
{
float t = clamp(Fac, 0.0, 1.0);
- if(type == "Mix")
+ if (type == "Mix")
Color = node_mix_blend(t, Color1, Color2);
- if(type == "Add")
+ if (type == "Add")
Color = node_mix_add(t, Color1, Color2);
- if(type == "Multiply")
+ if (type == "Multiply")
Color = node_mix_mul(t, Color1, Color2);
- if(type == "Screen")
+ if (type == "Screen")
Color = node_mix_screen(t, Color1, Color2);
- if(type == "Overlay")
+ if (type == "Overlay")
Color = node_mix_overlay(t, Color1, Color2);
- if(type == "Subtract")
+ if (type == "Subtract")
Color = node_mix_sub(t, Color1, Color2);
- if(type == "Divide")
+ if (type == "Divide")
Color = node_mix_div(t, Color1, Color2);
- if(type == "Difference")
+ if (type == "Difference")
Color = node_mix_diff(t, Color1, Color2);
- if(type == "Darken")
+ if (type == "Darken")
Color = node_mix_dark(t, Color1, Color2);
- if(type == "Lighten")
+ if (type == "Lighten")
Color = node_mix_light(t, Color1, Color2);
- if(type == "Dodge")
+ if (type == "Dodge")
Color = node_mix_dodge(t, Color1, Color2);
- if(type == "Burn")
+ if (type == "Burn")
Color = node_mix_burn(t, Color1, Color2);
- if(type == "Hue")
+ if (type == "Hue")
Color = node_mix_hue(t, Color1, Color2);
- if(type == "Saturation")
+ if (type == "Saturation")
Color = node_mix_sat(t, Color1, Color2);
- if(type == "Value")
+ if (type == "Value")
Color = node_mix_val (t, Color1, Color2);
- if(type == "Color")
+ if (type == "Color")
Color = node_mix_color(t, Color1, Color2);
- if(type == "Soft Light")
+ if (type == "Soft Light")
Color = node_mix_soft(t, Color1, Color2);
- if(type == "Linear Light")
+ if (type == "Linear Light")
Color = node_mix_linear(t, Color1, Color2);
- if(Clamp)
+ if (Clamp)
Color = node_mix_clamp(Color);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_mix_closure.osl b/intern/cycles/kernel/osl/nodes/node_mix_closure.osl
index 1a377abd381..e28dd1fc436 100644
--- a/intern/cycles/kernel/osl/nodes/node_mix_closure.osl
+++ b/intern/cycles/kernel/osl/nodes/node_mix_closure.osl
@@ -25,6 +25,6 @@ shader node_mix_closure(
output closure color Closure = background())
{
float t = clamp(Fac, 0.0, 1.0);
- Closure = (1.0 - t)*Closure1 + t*Closure2;
+ Closure = (1.0 - t) * Closure1 + t * Closure2;
}
diff --git a/intern/cycles/kernel/osl/nodes/node_musgrave_texture.osl b/intern/cycles/kernel/osl/nodes/node_musgrave_texture.osl
index 7d125d50fd6..71461b8fd79 100644
--- a/intern/cycles/kernel/osl/nodes/node_musgrave_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_musgrave_texture.osl
@@ -36,14 +36,14 @@ float noise_musgrave_fBm(point p, string basis, float H, float lacunarity, float
float pwHL = pow(lacunarity, -H);
int i;
- for(i = 0; i < (int)octaves; i++) {
+ for (i = 0; i < (int)octaves; i++) {
value += noise("perlin", p) * pwr;
pwr *= pwHL;
p *= lacunarity;
}
rmd = octaves - floor(octaves);
- if(rmd != 0.0)
+ if (rmd != 0.0)
value += rmd * noise("perlin", p) * pwr;
return value;
@@ -64,14 +64,14 @@ float noise_musgrave_multi_fractal(point p, string basis, float H, float lacunar
float pwHL = pow(lacunarity, -H);
int i;
- for(i = 0; i < (int)octaves; i++) {
+ for (i = 0; i < (int)octaves; i++) {
value *= (pwr * noise("perlin", p) + 1.0);
pwr *= pwHL;
p *= lacunarity;
}
rmd = octaves - floor(octaves);
- if(rmd != 0.0)
+ if (rmd != 0.0)
value *= (rmd * pwr * noise("perlin", p) + 1.0); /* correct? */
return value;
@@ -96,7 +96,7 @@ float noise_musgrave_hetero_terrain(point p, string basis, float H, float lacuna
value = offset + noise("perlin", p);
p *= lacunarity;
- for(i = 1; i < (int)octaves; i++) {
+ for (i = 1; i < (int)octaves; i++) {
increment = (noise("perlin", p) + offset) * pwr * value;
value += increment;
pwr *= pwHL;
@@ -104,7 +104,7 @@ float noise_musgrave_hetero_terrain(point p, string basis, float H, float lacuna
}
rmd = octaves - floor(octaves);
- if(rmd != 0.0) {
+ if (rmd != 0.0) {
increment = (noise("perlin", p) + offset) * pwr * value;
value += rmd * increment;
}
@@ -120,7 +120,8 @@ float noise_musgrave_hetero_terrain(point p, string basis, float H, float lacuna
* offset: raises the terrain from `sea level'
*/
-float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H, float lacunarity, float octaves, float offset, float gain)
+float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H,
+ float lacunarity, float octaves, float offset, float gain)
{
float result, signal, weight, rmd;
float pwHL = pow(lacunarity, -H);
@@ -131,8 +132,8 @@ float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H, float
weight = gain * result;
p *= lacunarity;
- for(i = 1; (weight > 0.001) && (i < (int)octaves); i++) {
- if(weight > 1.0)
+ for (i = 1; (weight > 0.001) && (i < (int)octaves); i++) {
+ if (weight > 1.0)
weight = 1.0;
signal = (noise("perlin", p) + offset) * pwr;
@@ -143,7 +144,7 @@ float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H, float
}
rmd = octaves - floor(octaves);
- if(rmd != 0.0)
+ if (rmd != 0.0)
result += rmd * ((noise("perlin", p) + offset) * pwr);
return result;
@@ -157,7 +158,8 @@ float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H, float
* offset: raises the terrain from `sea level'
*/
-float noise_musgrave_ridged_multi_fractal(point p, string basis, float H, float lacunarity, float octaves, float offset, float gain)
+float noise_musgrave_ridged_multi_fractal(point p, string basis, float H,
+ float lacunarity, float octaves, float offset, float gain)
{
float result, signal, weight;
float pwHL = pow(lacunarity, -H);
@@ -169,7 +171,7 @@ float noise_musgrave_ridged_multi_fractal(point p, string basis, float H, float
result = signal;
weight = 1.0;
- for(i = 1; i < (int)octaves; i++) {
+ for (i = 1; i < (int)octaves; i++) {
p *= lacunarity;
weight = clamp(signal * gain, 0.0, 1.0);
signal = offset - fabs(noise("perlin", p));
@@ -202,18 +204,18 @@ shader node_musgrave_texture(
string Basis = "Perlin";
float intensity = 1.0;
- point p = Vector*Scale;
-
- if(Type == "Multifractal")
- Fac = intensity*noise_musgrave_multi_fractal(p, Basis, dimension, lacunarity, octaves);
- else if(Type == "fBM")
- Fac = intensity*noise_musgrave_fBm(p, Basis, dimension, lacunarity, octaves);
- else if(Type == "Hybrid Multifractal")
- Fac = intensity*noise_musgrave_hybrid_multi_fractal(p, Basis, dimension, lacunarity, octaves, Offset, Gain);
- else if(Type == "Ridged Multifractal")
- Fac = intensity*noise_musgrave_ridged_multi_fractal(p, Basis, dimension, lacunarity, octaves, Offset, Gain);
- else if(Type == "Hetero Terrain")
- Fac = intensity*noise_musgrave_hetero_terrain(p, Basis, dimension, lacunarity, octaves, Offset);
+ point p = Vector * Scale;
+
+ if (Type == "Multifractal")
+ Fac = intensity * noise_musgrave_multi_fractal(p, Basis, dimension, lacunarity, octaves);
+ else if (Type == "fBM")
+ Fac = intensity * noise_musgrave_fBm(p, Basis, dimension, lacunarity, octaves);
+ else if (Type == "Hybrid Multifractal")
+ Fac = intensity * noise_musgrave_hybrid_multi_fractal(p, Basis, dimension, lacunarity, octaves, Offset, Gain);
+ else if (Type == "Ridged Multifractal")
+ Fac = intensity * noise_musgrave_ridged_multi_fractal(p, Basis, dimension, lacunarity, octaves, Offset, Gain);
+ else if (Type == "Hetero Terrain")
+ Fac = intensity * noise_musgrave_hetero_terrain(p, Basis, dimension, lacunarity, octaves, Offset);
Color = color(Fac, Fac, Fac);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_noise_texture.osl b/intern/cycles/kernel/osl/nodes/node_noise_texture.osl
index 1ddb4d8a08b..227b2bf8cea 100644
--- a/intern/cycles/kernel/osl/nodes/node_noise_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_noise_texture.osl
@@ -25,8 +25,8 @@ float noise(point p, string basis, float distortion, float detail, float fac, co
{
point r;
int hard = 0;
-
- if(distortion != 0.0) {
+
+ if (distortion != 0.0) {
r[0] = noise_basis(p + point(13.5), basis) * distortion;
r[1] = noise_basis(p, basis) * distortion;
r[2] = noise_basis(p - point(13.5), basis) * distortion;
@@ -51,6 +51,6 @@ shader node_noise_texture(
output color Color = color(0.2, 0.2, 0.2))
{
string Basis = "Perlin";
- Fac = noise(Vector*Scale, Basis, Distortion, Detail, Fac, Color);
+ Fac = noise(Vector * Scale, Basis, Distortion, Detail, Fac, Color);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_output_displacement.osl b/intern/cycles/kernel/osl/nodes/node_output_displacement.osl
index a6b452c532a..5649b879c5b 100644
--- a/intern/cycles/kernel/osl/nodes/node_output_displacement.osl
+++ b/intern/cycles/kernel/osl/nodes/node_output_displacement.osl
@@ -20,6 +20,6 @@
displacement node_output_displacement(float Displacement = 0.0)
{
- P += N*Displacement*0.1; /* todo: get rid of this factor */
+ P += N * Displacement * 0.1; /* todo: get rid of this factor */
}
diff --git a/intern/cycles/kernel/osl/nodes/node_rgb_ramp.osl b/intern/cycles/kernel/osl/nodes/node_rgb_ramp.osl
index 2bc10f31cb3..afce1127305 100644
--- a/intern/cycles/kernel/osl/nodes/node_rgb_ramp.osl
+++ b/intern/cycles/kernel/osl/nodes/node_rgb_ramp.osl
@@ -28,7 +28,7 @@ shader node_rgb_ramp(
output float Alpha = 1.0
)
{
- float f = clamp(Fac, 0.0, 1.0)*(RAMP_TABLE_SIZE-1);
+ float f = clamp(Fac, 0.0, 1.0) * (RAMP_TABLE_SIZE - 1);
int i = (int)f;
float t = f - (float)i;
@@ -37,8 +37,8 @@ shader node_rgb_ramp(
Alpha = ramp_alpha[i];
if (t > 0.0) {
- Color = (1.0 - t)*Color + t*ramp_color[i+1];
- Alpha = (1.0 - t)*Alpha + t*ramp_alpha[i+1];
+ Color = (1.0 - t) * Color + t * ramp_color[i + 1];
+ Alpha = (1.0 - t) * Alpha + t * ramp_alpha[i + 1];
}
}
diff --git a/intern/cycles/kernel/osl/nodes/node_sky_texture.osl b/intern/cycles/kernel/osl/nodes/node_sky_texture.osl
index fdb9b1d9708..932fb1e2f17 100644
--- a/intern/cycles/kernel/osl/nodes/node_sky_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_sky_texture.osl
@@ -32,10 +32,10 @@ color xyY_to_xyz(float x, float y, float Y)
{
float X, Z;
- if(y != 0.0) X = (x / y) * Y;
+ if (y != 0.0) X = (x / y) * Y;
else X = 0.0;
- if(y != 0.0 && Y != 0.0) Z = ((1.0 - x - y) / y) * Y;
+ if (y != 0.0 && Y != 0.0) Z = ((1.0 - x - y) / y) * Y;
else Z = 0.0;
return color(X, Y, Z);
@@ -50,11 +50,11 @@ color xyz_to_rgb(float x, float y, float z)
float sky_angle_between(float thetav, float phiv, float theta, float phi)
{
- float cospsi = sin(thetav)*sin(theta)*cos(phi - phiv) + cos(thetav)*cos(theta);
+ float cospsi = sin(thetav) * sin(theta) * cos(phi - phiv) + cos(thetav) * cos(theta);
- if(cospsi > 1.0)
+ if (cospsi > 1.0)
return 0.0;
- if(cospsi < -1.0)
+ if (cospsi < -1.0)
return M_PI;
return acos(cospsi);
@@ -70,7 +70,7 @@ float sky_perez_function(float lam[5], float theta, float gamma)
float ctheta = cos(theta);
float cgamma = cos(gamma);
- return (1.0 + lam[0]*exp(lam[1] / ctheta)) * (1.0 + lam[2]*exp(lam[3]*gamma) + lam[4]*cgamma*cgamma);
+ return (1.0 + lam[0] * exp(lam[1] / ctheta)) * (1.0 + lam[2] * exp(lam[3] * gamma) + lam[4] * cgamma * cgamma);
}
color sky_xyz_radiance(KernelSunSky sunsky, vector dir)
@@ -106,42 +106,42 @@ void precompute_sunsky(vector dir, float turbidity, output KernelSunSky sunsky)
sunsky.phi = phi;
sunsky.dir = dir;
- float theta2 = theta*theta;
- float theta3 = theta*theta*theta;
+ float theta2 = theta * theta;
+ float theta3 = theta * theta * theta;
float T = turbidity;
- float T2 = T*T;
+ float T2 = T * T;
- float chi = (4.0/ 9.0- T / 120.0) * (M_PI - 2.0* theta);
- sunsky.zenith_Y = (4.0453*T - 4.9710) * tan(chi) - 0.2155*T + 2.4192;
+ float chi = (4.0 / 9.0 - T / 120.0) * (M_PI - 2.0 * theta);
+ sunsky.zenith_Y = (4.0453 * T - 4.9710) * tan(chi) - 0.2155 * T + 2.4192;
sunsky.zenith_Y *= 0.06;
sunsky.zenith_x =
- (0.00166* theta3 - 0.00375* theta2 + 0.00209* theta)*T2 +
- (-0.02903* theta3 + 0.06377* theta2 - 0.03202* theta + 0.00394)*T +
- (0.11693* theta3 - 0.21196* theta2 + 0.06052* theta + 0.25886);
+ ( 0.00166 * theta3 - 0.00375 * theta2 + 0.00209 * theta) * T2 +
+ (-0.02903 * theta3 + 0.06377 * theta2 - 0.03202 * theta + 0.00394) * T +
+ ( 0.11693 * theta3 - 0.21196 * theta2 + 0.06052 * theta + 0.25886);
sunsky.zenith_y =
- (0.00275* theta3 - 0.00610* theta2 + 0.00317* theta)*T2 +
- (-0.04214* theta3 + 0.08970* theta2 - 0.04153* theta + 0.00516)*T +
- (0.15346* theta3 - 0.26756* theta2 + 0.06670* theta + 0.26688);
-
- sunsky.perez_Y[0] = (0.1787*T - 1.4630);
- sunsky.perez_Y[1] = (-0.3554*T + 0.4275);
- sunsky.perez_Y[2] = (-0.0227*T + 5.3251);
- sunsky.perez_Y[3] = (0.1206*T - 2.5771);
- sunsky.perez_Y[4] = (-0.0670*T + 0.3703);
-
- sunsky.perez_x[0] = (-0.0193*T - 0.2592);
- sunsky.perez_x[1] = (-0.0665*T + 0.0008);
- sunsky.perez_x[2] = (-0.0004*T + 0.2125);
- sunsky.perez_x[3] = (-0.0641*T - 0.8989);
- sunsky.perez_x[4] = (-0.0033*T + 0.0452);
-
- sunsky.perez_y[0] = (-0.0167*T - 0.2608);
- sunsky.perez_y[1] = (-0.0950*T + 0.0092);
- sunsky.perez_y[2] = (-0.0079*T + 0.2102);
- sunsky.perez_y[3] = (-0.0441*T - 1.6537);
- sunsky.perez_y[4] = (-0.0109*T + 0.0529);
+ ( 0.00275 * theta3 - 0.00610 * theta2 + 0.00317 * theta) * T2 +
+ (-0.04214 * theta3 + 0.08970 * theta2 - 0.04153 * theta + 0.00516) * T +
+ ( 0.15346 * theta3 - 0.26756 * theta2 + 0.06670 * theta + 0.26688);
+
+ sunsky.perez_Y[0] = ( 0.1787 * T - 1.4630);
+ sunsky.perez_Y[1] = (-0.3554 * T + 0.4275);
+ sunsky.perez_Y[2] = (-0.0227 * T + 5.3251);
+ sunsky.perez_Y[3] = ( 0.1206 * T - 2.5771);
+ sunsky.perez_Y[4] = (-0.0670 * T + 0.3703);
+
+ sunsky.perez_x[0] = (-0.0193 * T - 0.2592);
+ sunsky.perez_x[1] = (-0.0665 * T + 0.0008);
+ sunsky.perez_x[2] = (-0.0004 * T + 0.2125);
+ sunsky.perez_x[3] = (-0.0641 * T - 0.8989);
+ sunsky.perez_x[4] = (-0.0033 * T + 0.0452);
+
+ sunsky.perez_y[0] = (-0.0167 * T - 0.2608);
+ sunsky.perez_y[1] = (-0.0950 * T + 0.0092);
+ sunsky.perez_y[2] = (-0.0079 * T + 0.2102);
+ sunsky.perez_y[3] = (-0.0441 * T - 1.6537);
+ sunsky.perez_y[4] = (-0.0109 * T + 0.0529);
sunsky.zenith_Y /= sky_perez_function(sunsky.perez_Y, 0, theta);
sunsky.zenith_x /= sky_perez_function(sunsky.perez_x, 0, theta);
diff --git a/intern/cycles/kernel/osl/nodes/node_texture.h b/intern/cycles/kernel/osl/nodes/node_texture.h
index 7cd0742ffe8..1b3ba8207ab 100644
--- a/intern/cycles/kernel/osl/nodes/node_texture.h
+++ b/intern/cycles/kernel/osl/nodes/node_texture.h
@@ -235,21 +235,21 @@ float noise_turbulence(point p, string basis, float details, int hard)
float rmd = octaves - floor(octaves);
- if(rmd != 0.0) {
- float t = noise_basis(fscale*p, basis);
+ if (rmd != 0.0) {
+ float t = noise_basis(fscale * p, basis);
- if(hard)
- t = fabs(2.0*t - 1.0);
+ if (hard)
+ t = fabs(2.0 * t - 1.0);
float sum2 = sum + t*amp;
- sum *= ((float)(1 << n)/(float)((1 << (n+1)) - 1));
- sum2 *= ((float)(1 << (n+1))/(float)((1 << (n+2)) - 1));
+ sum *= ((float)(1 << n) / (float)((1 << (n + 1)) - 1));
+ sum2 *= ((float)(1 << (n + 1)) / (float)((1 << (n + 2)) - 1));
return (1.0 - rmd)*sum + rmd*sum2;
}
else {
- sum *= ((float)(1 << n)/(float)((1 << (n+1)) - 1));
+ sum *= ((float)(1 << n) / (float)((1 << (n + 1)) - 1));
return sum;
}
}
diff --git a/intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl b/intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl
index 2acf72aef54..883135d2a43 100644
--- a/intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl
+++ b/intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl
@@ -30,7 +30,7 @@ shader node_texture_coordinate(
output point Window = point(0.0, 0.0, 0.0),
output point Reflection = point(0.0, 0.0, 0.0))
{
- if(is_background) {
+ if (is_background) {
Generated = P;
UV = point(0.0, 0.0, 0.0);
Object = P;
@@ -48,14 +48,14 @@ shader node_texture_coordinate(
Reflection = reflect(I, Normal);
}
- if(bump_offset == "dx") {
+ if (bump_offset == "dx") {
Generated += Dx(Generated);
UV += Dx(UV);
Object += Dx(Object);
Camera += Dx(Camera);
Window += Dx(Window);
}
- else if(bump_offset == "dy") {
+ else if (bump_offset == "dy") {
Generated += Dy(Generated);
UV += Dy(UV);
Object += Dy(Object);
diff --git a/intern/cycles/kernel/osl/nodes/node_translucent_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_translucent_bsdf.osl
index 9acd46756d2..e7efe73700c 100644
--- a/intern/cycles/kernel/osl/nodes/node_translucent_bsdf.osl
+++ b/intern/cycles/kernel/osl/nodes/node_translucent_bsdf.osl
@@ -23,6 +23,6 @@ shader node_translucent_bsdf(
normal Normal = N,
output closure color BSDF = diffuse(Normal))
{
- BSDF = Color*translucent(Normal);
+ BSDF = Color * translucent(Normal);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_transparent_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_transparent_bsdf.osl
index b347bfb116b..875bce3f16c 100644
--- a/intern/cycles/kernel/osl/nodes/node_transparent_bsdf.osl
+++ b/intern/cycles/kernel/osl/nodes/node_transparent_bsdf.osl
@@ -23,6 +23,6 @@ shader node_transparent_bsdf(
normal Normal = N,
output closure color BSDF = diffuse(Normal))
{
- BSDF = Color*transparent();
+ BSDF = Color * transparent();
}
diff --git a/intern/cycles/kernel/osl/nodes/node_vector_math.osl b/intern/cycles/kernel/osl/nodes/node_vector_math.osl
index 9e0f0b60522..f22a6e8441a 100644
--- a/intern/cycles/kernel/osl/nodes/node_vector_math.osl
+++ b/intern/cycles/kernel/osl/nodes/node_vector_math.osl
@@ -25,27 +25,27 @@ shader node_vector_math(
output float Value = 0.0,
output vector Vector = vector(0.0, 0.0, 0.0))
{
- if(type == "Add") {
+ if (type == "Add") {
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;
}
- if(type == "Subtract") {
+ if (type == "Subtract") {
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;
}
- if(type == "Average") {
+ if (type == "Average") {
Value = length(Vector1 + Vector2);
Vector = normalize(Vector1 + Vector2);
}
- if(type == "Dot Product") {
+ if (type == "Dot Product") {
Value = dot(Vector1, Vector2);
}
- if(type == "Cross Product") {
+ if (type == "Cross Product") {
vector c = cross(Vector1, Vector2);
Value = length(c);
Vector = normalize(c);
}
- if(type == "Normalize") {
+ if (type == "Normalize") {
Value = length(Vector1);
Vector = normalize(Vector1);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_velvet_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_velvet_bsdf.osl
index 5e0cae8cbd1..4bb4e39a1ba 100644
--- a/intern/cycles/kernel/osl/nodes/node_velvet_bsdf.osl
+++ b/intern/cycles/kernel/osl/nodes/node_velvet_bsdf.osl
@@ -27,6 +27,6 @@ shader node_velvet_bsdf(
{
float sigma = clamp(Sigma, 0.0, 1.0);
- BSDF = Color*ashikhmin_velvet(Normal, sigma, 1.0);
+ BSDF = Color * ashikhmin_velvet(Normal, sigma, 1.0);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_voronoi_texture.osl b/intern/cycles/kernel/osl/nodes/node_voronoi_texture.osl
index db08b64de1c..a44df00a267 100644
--- a/intern/cycles/kernel/osl/nodes/node_voronoi_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_voronoi_texture.osl
@@ -32,16 +32,16 @@ shader node_voronoi_texture(
float da[4];
point pa[4];
- voronoi(Vector*Scale, "Distance Squared", 1.0, da, pa);
+ voronoi(Vector * Scale, "Distance Squared", 1.0, da, pa);
/* Colored output */
- if(Coloring == "Intensity") {
+ if (Coloring == "Intensity") {
Fac = fabs(da[0]);
Color = color(Fac);
}
else {
Color = cellnoise_color(pa[0]);
- Fac = (Color[0]+Color[1]+Color[2])*(1.0/3.0);
+ Fac = (Color[0] + Color[1] + Color[2]) * (1.0 / 3.0);
}
}
diff --git a/intern/cycles/kernel/osl/nodes/node_ward_bsdf.osl b/intern/cycles/kernel/osl/nodes/node_ward_bsdf.osl
index 68db07109ed..e204be123b8 100644
--- a/intern/cycles/kernel/osl/nodes/node_ward_bsdf.osl
+++ b/intern/cycles/kernel/osl/nodes/node_ward_bsdf.osl
@@ -25,6 +25,6 @@ shader node_ward_bsdf(
normal Normal = N,
output closure color BSDF = diffuse(Normal))
{
- BSDF = Color*ward(Normal, normalize(dPdu), RoughnessU, RoughnessV);
+ BSDF = Color * ward(Normal, normalize(dPdu), RoughnessU, RoughnessV);
}
diff --git a/intern/cycles/kernel/osl/nodes/node_wave_texture.osl b/intern/cycles/kernel/osl/nodes/node_wave_texture.osl
index db53faaf94b..79b8a8885d1 100644
--- a/intern/cycles/kernel/osl/nodes/node_wave_texture.osl
+++ b/intern/cycles/kernel/osl/nodes/node_wave_texture.osl
@@ -30,15 +30,15 @@ float wave(point p, float scale, string type, float detail, float distortion, fl
float result = 0.0;
float n = 0.0;
- if(type == "Bands") {
- n = (x + y + z)*10.0;
+ if (type == "Bands") {
+ n = (x + y + z) * 10.0;
}
- else if(type == "Rings") {
- n = (sqrt(x*x + y*y + z*z)*20.0);
+ else if (type == "Rings") {
+ n = (sqrt(x * x + y * y + z * z) * 20.0);
}
-
- if(distortion != 0.0) {
- n = n +(distortion * noise_turbulence(p*dscale, "Perlin", detail, 0));
+
+ if (distortion != 0.0) {
+ n = n + (distortion * noise_turbulence(p * dscale, "Perlin", detail, 0));
}
result = noise_wave("Sine", n);