Revision: 58960
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58960
Author:   campbellbarton
Date:     2013-08-06 06:36:34 +0000 (Tue, 06 Aug 2013)
Log Message:
-----------
cycles builds with -Wdouble-promotion again.

Modified Paths:
--------------
    trunk/blender/intern/cycles/kernel/svm/svm_blackbody.h
    trunk/blender/intern/cycles/render/blackbody.cpp

Modified: trunk/blender/intern/cycles/kernel/svm/svm_blackbody.h
===================================================================
--- trunk/blender/intern/cycles/kernel/svm/svm_blackbody.h      2013-08-06 
05:35:54 UTC (rev 58959)
+++ trunk/blender/intern/cycles/kernel/svm/svm_blackbody.h      2013-08-06 
06:36:34 UTC (rev 58960)
@@ -42,18 +42,18 @@
        /* Input */
        float temperature = stack_load_float(stack, temperature_offset);
 
-       if (temperature < BB_DRAPPER) {
+       if (temperature < (float)BB_DRAPPER) {
                /* just return very very dim red */
                color_rgb = make_float3(1.0e-6f,0.0f,0.0f);
        }
-       else if (temperature <= BB_MAX_TABLE_RANGE) {
+       else if (temperature <= (float)BB_MAX_TABLE_RANGE) {
                /* This is the overall size of the table */
                const int lookuptablesize = 956;
                const float lookuptablenormalize = 1.0f/956.0f;
 
                /* reconstruct a proper index for the table lookup, compared to 
OSL we don't look up two colors
                just one (the OSL-lerp is also automatically done for us by 
"lookup_table_read") */
-               float t = powf((temperature - BB_DRAPPER) * (1.0f / 
BB_TABLE_SPACING), 1.0f/BB_TABLE_XPOWER);
+               float t = powf((temperature - (float)BB_DRAPPER) * (float)(1.0 
/ BB_TABLE_SPACING), (float)(1.0 / BB_TABLE_XPOWER));
 
                int blackbody_table_offset = kernel_data.blackbody.table_offset;
 

Modified: trunk/blender/intern/cycles/render/blackbody.cpp
===================================================================
--- trunk/blender/intern/cycles/render/blackbody.cpp    2013-08-06 05:35:54 UTC 
(rev 58959)
+++ trunk/blender/intern/cycles/render/blackbody.cpp    2013-08-06 06:36:34 UTC 
(rev 58960)
@@ -91,7 +91,7 @@
        const double c1 = 3.74183e-16; // 2*pi*h*c^2, W*m^2
        const double c2 = 1.4388e-2;   // h*c/k, m*K
                                                                   // h is 
Planck's const, k is Boltzmann's
-       const float dlambda = 5.0f * 1e-9;  // in meters
+       const float dlambda = 5.0f * 1e-9f;  // in meters
 
        /* Blackbody table from 800 to 12k Kelvin (319 entries (317+2 offset) * 
3) */
        vector<float> blackbody_table(956);
@@ -100,7 +100,7 @@
 
        /* ToDo: bring this back to what OSL does with the lastTemperature 
limit ? */
        for (int i = 0;  i <= 317;  ++i) {
-               float Temperature = powf (float(i), BB_TABLE_XPOWER) * 
BB_TABLE_SPACING + BB_DRAPPER;
+               double Temperature = pow((double)i, BB_TABLE_XPOWER) * 
BB_TABLE_SPACING + BB_DRAPPER;
                X = 0;
                Y = 0;
                Z = 0;
@@ -108,10 +108,10 @@
                /* from OSL "spectrum_to_XYZ" */
                for (int n = 0; n < 81; ++n) {
                        float lambda = 380.0f + 5.0f * n;
-                       double wlm = lambda * 1e-9;   // Wavelength in meters
+                       double wlm = lambda * 1e-9f;   // Wavelength in meters
                        // N.B. spec_intens returns result in W/m^2 but it's a 
differential,
                        // needs to be scaled by dlambda!
-                       float spec_intens = float((c1 * powf(wlm,-5.0)) / 
(expf(c2 / (wlm * Temperature)) -1.0f));
+                       float spec_intens = float((c1 * pow(wlm, -5.0)) / 
(exp(c2 / (wlm * Temperature)) -1.0));
                        float Me = spec_intens * dlambda;
 
                        X += Me * cie_colour_match[n][0];
@@ -125,9 +125,9 @@
                /* Clamp to zero if values are smaller */
                col = max(col, make_float3(0.0f, 0.0f, 0.0f));
 
-               col.x = powf(col.x, 1.0f / BB_TABLE_YPOWER);
-               col.y = powf(col.y, 1.0f / BB_TABLE_YPOWER);
-               col.z = powf(col.z, 1.0f / BB_TABLE_YPOWER);
+               col.x = powf(col.x, 1.0 / BB_TABLE_YPOWER);
+               col.y = powf(col.y, 1.0 / BB_TABLE_YPOWER);
+               col.z = powf(col.z, 1.0 / BB_TABLE_YPOWER);
 
                /* Store in table in RRRGGGBBB format */
                blackbody_table[i] = col.x;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to