[Bf-blender-cvs] [e1bcc2d] master: Cycles: Code cleanyp, sky model

Sergey Sharybin noreply at git.blender.org
Fri Mar 27 20:42:03 CET 2015


Commit: e1bcc2d77989453c95cc3fdbd017371748bf8ea7
Author: Sergey Sharybin
Date:   Sat Mar 28 00:28:37 2015 +0500
Branches: master
https://developer.blender.org/rBe1bcc2d77989453c95cc3fdbd017371748bf8ea7

Cycles: Code cleanyp, sky model

For as long as code stays in official folders it should follow
our code style.

===================================================================

M	intern/cycles/render/sky_model.cpp
M	intern/cycles/render/sky_model.h
M	intern/cycles/render/sky_model_data.h

===================================================================

diff --git a/intern/cycles/render/sky_model.cpp b/intern/cycles/render/sky_model.cpp
index f5fac6b..c8a5dbe 100644
--- a/intern/cycles/render/sky_model.cpp
+++ b/intern/cycles/render/sky_model.cpp
@@ -4,7 +4,7 @@ This source is published under the following 3-clause BSD license.
 Copyright (c) 2012 - 2013, Lukas Hosek and Alexander Wilkie
 All rights reserved.
 
-Redistribution and use in source and binary forms, with or without 
+Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
 
     * Redistributions of source code must retain the above copyright
@@ -12,8 +12,8 @@ modification, are permitted provided that the following conditions are met:
     * Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.
-    * None of the names of the contributors may be used to endorse or promote 
-      products derived from this software without specific prior written 
+    * None of the names of the contributors may be used to endorse or promote
+      products derived from this software without specific prior written
       permission.
 
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
@@ -40,24 +40,24 @@ and the 2013 IEEE CG&A paper
 
        "Adding a Solar Radiance Function to the Hosek Skylight Model"
 
-                                   both by 
+                                   both by
 
                        Lukas Hosek and Alexander Wilkie
                 Charles University in Prague, Czech Republic
 
 
                         Version: 1.4a, February 22nd, 2013
-                        
+
 Version history:
 
 1.4a  February 22nd, 2013
-      Removed unnecessary and counter-intuitive solar radius parameters 
+      Removed unnecessary and counter-intuitive solar radius parameters
       from the interface of the colourspace sky dome initialisation functions.
 
 1.4   February 11th, 2013
       Fixed a bug which caused the relative brightness of the solar disc
-      and the sky dome to be off by a factor of about 6. The sun was too 
-      bright: this affected both normal and alien sun scenarios. The 
+      and the sky dome to be off by a factor of about 6. The sun was too
+      bright: this affected both normal and alien sun scenarios. The
       coefficients of the solar radiance function were changed to fix this.
 
 1.3   January 21st, 2013 (not released to the public)
@@ -81,7 +81,7 @@ Version history:
       the result of a simple conversion from spectral data via the CIE 2 degree
       standard observer matching functions. Therefore, after multiplication
       with 683 lm / W, the Y channel now corresponds to luminance in lm.
-     
+
 1.0   May 11th, 2012
       Initial release.
 
@@ -110,7 +110,7 @@ CCL_NAMESPACE_BEGIN
 //   Some macro definitions that occur elsewhere in ART, and that have to be
 //   replicated to make this a stand-alone module.
 
-#ifndef MATH_PI 
+#ifndef MATH_PI
 #define MATH_PI                     3.141592653589793
 #endif
 
@@ -138,250 +138,231 @@ typedef const double *ArHosekSkyModel_Radiance_Dataset;
 // internal functions
 
 static void ArHosekSkyModel_CookConfiguration(
-        ArHosekSkyModel_Dataset       dataset,
-        ArHosekSkyModelConfiguration  config, 
-        double                        turbidity, 
-        double                        albedo, 
-        double                        solar_elevation
-        )
+        ArHosekSkyModel_Dataset dataset,
+        ArHosekSkyModelConfiguration config,
+        double turbidity,
+        double albedo,
+        double solar_elevation)
 {
-    const double  * elev_matrix;
-
-    int     int_turbidity = (int)turbidity;
-    double  turbidity_rem = turbidity - (double)int_turbidity;
-
-    solar_elevation = pow(solar_elevation / (MATH_PI / 2.0), (1.0 / 3.0));
-
-    // alb 0 low turb
-
-    elev_matrix = dataset + ( 9 * 6 * (int_turbidity-1) );
-    
-    
-    for( unsigned int i = 0; i < 9; ++i )
-    {
-        //(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
-        config[i] = 
-        (1.0-albedo) * (1.0 - turbidity_rem) 
-        * ( pow(1.0-solar_elevation, 5.0) * elev_matrix[i]  + 
-           5.0  * pow(1.0-solar_elevation, 4.0) * solar_elevation * elev_matrix[i+9] +
-           10.0*pow(1.0-solar_elevation, 3.0)*pow(solar_elevation, 2.0) * elev_matrix[i+18] +
-           10.0*pow(1.0-solar_elevation, 2.0)*pow(solar_elevation, 3.0) * elev_matrix[i+27] +
-           5.0*(1.0-solar_elevation)*pow(solar_elevation, 4.0) * elev_matrix[i+36] +
-           pow(solar_elevation, 5.0)  * elev_matrix[i+45]);
-    }
+	const double  * elev_matrix;
 
-    // alb 1 low turb
-    elev_matrix = dataset + (9*6*10 + 9*6*(int_turbidity-1));
-    for(unsigned int i = 0; i < 9; ++i)
-    {
-        //(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
-        config[i] += 
-        (albedo) * (1.0 - turbidity_rem)
-        * ( pow(1.0-solar_elevation, 5.0) * elev_matrix[i]  + 
-           5.0  * pow(1.0-solar_elevation, 4.0) * solar_elevation * elev_matrix[i+9] +
-           10.0*pow(1.0-solar_elevation, 3.0)*pow(solar_elevation, 2.0) * elev_matrix[i+18] +
-           10.0*pow(1.0-solar_elevation, 2.0)*pow(solar_elevation, 3.0) * elev_matrix[i+27] +
-           5.0*(1.0-solar_elevation)*pow(solar_elevation, 4.0) * elev_matrix[i+36] +
-           pow(solar_elevation, 5.0)  * elev_matrix[i+45]);
-    }
+	int int_turbidity = (int)turbidity;
+	double turbidity_rem = turbidity - (double)int_turbidity;
 
-    if(int_turbidity == 10)
-        return;
-
-    // alb 0 high turb
-    elev_matrix = dataset + (9*6*(int_turbidity));
-    for(unsigned int i = 0; i < 9; ++i)
-    {
-        //(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
-        config[i] += 
-        (1.0-albedo) * (turbidity_rem)
-        * ( pow(1.0-solar_elevation, 5.0) * elev_matrix[i]  + 
-           5.0  * pow(1.0-solar_elevation, 4.0) * solar_elevation * elev_matrix[i+9] +
-           10.0*pow(1.0-solar_elevation, 3.0)*pow(solar_elevation, 2.0) * elev_matrix[i+18] +
-           10.0*pow(1.0-solar_elevation, 2.0)*pow(solar_elevation, 3.0) * elev_matrix[i+27] +
-           5.0*(1.0-solar_elevation)*pow(solar_elevation, 4.0) * elev_matrix[i+36] +
-           pow(solar_elevation, 5.0)  * elev_matrix[i+45]);
-    }
+	solar_elevation = pow(solar_elevation / (MATH_PI / 2.0), (1.0 / 3.0));
+
+	// alb 0 low turb
 
-    // alb 1 high turb
-    elev_matrix = dataset + (9*6*10 + 9*6*(int_turbidity));
-    for(unsigned int i = 0; i < 9; ++i)
-    {
-        //(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
-        config[i] += 
-        (albedo) * (turbidity_rem)
-        * ( pow(1.0-solar_elevation, 5.0) * elev_matrix[i]  + 
-           5.0  * pow(1.0-solar_elevation, 4.0) * solar_elevation * elev_matrix[i+9] +
-           10.0*pow(1.0-solar_elevation, 3.0)*pow(solar_elevation, 2.0) * elev_matrix[i+18] +
-           10.0*pow(1.0-solar_elevation, 2.0)*pow(solar_elevation, 3.0) * elev_matrix[i+27] +
-           5.0*(1.0-solar_elevation)*pow(solar_elevation, 4.0) * elev_matrix[i+36] +
-           pow(solar_elevation, 5.0)  * elev_matrix[i+45]);
+	elev_matrix = dataset + ( 9 * 6 * (int_turbidity-1));
+
+	for(unsigned int i = 0; i < 9; ++i) {
+		//(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
+		config[i] =
+			(1.0-albedo) * (1.0 - turbidity_rem)
+			* ( pow(1.0-solar_elevation, 5.0) * elev_matrix[i]  +
+			    5.0  * pow(1.0-solar_elevation, 4.0) * solar_elevation * elev_matrix[i+9] +
+			    10.0*pow(1.0-solar_elevation, 3.0)*pow(solar_elevation, 2.0) * elev_matrix[i+18] +
+			    10.0*pow(1.0-solar_elevation, 2.0)*pow(solar_elevation, 3.0) * elev_matrix[i+27] +
+			    5.0*(1.0-solar_elevation)*pow(solar_elevation, 4.0) * elev_matrix[i+36] +
+			    pow(solar_elevation, 5.0)  * elev_matrix[i+45]);
     }
+
+	// alb 1 low turb
+	elev_matrix = dataset + (9*6*10 + 9*6*(int_turbidity-1));
+	for(unsigned int i = 0; i < 9; ++i) {
+		//(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
+		config[i] +=
+			(albedo) * (1.0 - turbidity_rem)
+			* ( pow(1.0-solar_elevation, 5.0) * elev_matrix[i]  +
+			    5.0  * pow(1.0-solar_elevation, 4.0) * solar_elevation * elev_matrix[i+9] +
+			    10.0*pow(1.0-solar_elevation, 3.0)*pow(solar_elevation, 2.0) * elev_matrix[i+18] +
+			    10.0*pow(1.0-solar_elevation, 2.0)*pow(solar_elevation, 3.0) * elev_matrix[i+27] +
+			    5.0*(1.0-solar_elevation)*pow(solar_elevation, 4.0) * elev_matrix[i+36] +
+			    pow(solar_elevation, 5.0)  * elev_matrix[i+45]);
+	}
+
+	if(int_turbidity == 10)
+		return;
+
+	// alb 0 high turb
+	elev_matrix = dataset + (9*6*(int_turbidity));
+	for(unsigned int i = 0; i < 9; ++i) {
+		//(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
+		config[i] +=
+			(1.0-albedo) * (turbidity_rem)
+			* ( pow(1.0-solar_elevation, 5.0) * elev_matrix[i]  +
+			    5.0  * pow(1.0-solar_elevation, 4.0) * solar_elevation * elev_matrix[i+9] +
+			    10.0*pow(1.0-solar_elevation, 3.0)*pow(solar_elevation, 2.0) * elev_matrix[i+18] +
+			    10.0*pow(1.0-solar_elevation, 2.0)*pow(solar_elevation, 3.0) * elev_matrix[i+27] +
+			    5.0*(1.0-solar_elevation)*pow(solar_elevation, 4.0) * elev_matrix[i+36] +
+			    pow(solar_elevation, 5.0)  * elev_matrix[i+45]);
+	}
+
+	// alb 1 high turb
+	elev_matrix = dataset + (9*6*10 + 9*6*(int_turbidity));
+	for(unsigned int i = 0; i < 9; ++i) {
+		//(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
+		config[i] +=
+			(albedo) * (turbidity_rem)
+			* ( pow(1.0-solar_elevation, 5.0) * elev_matrix[i]  +
+			    5.0  * pow(1.0-solar_elevation, 4.0) * solar_elevation * elev_matrix[i+9] +
+			    10.0*pow(1.0-solar_elevation, 3.0)*pow(solar_elevation, 2.0) * elev_matrix[i+18] +
+			    10.0*pow(1.0-solar_elevation, 2.0)*pow(solar_elevation, 3.0) * elev_matrix[i+27] +
+			    5.0*(1.0-solar_elevation)*pow(solar_elevation, 4.0) * elev_matrix[i+36] +
+			    pow(solar_elevatio

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list