Revision: 42469
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42469
Author:   dingto
Date:     2011-12-06 20:47:57 +0000 (Tue, 06 Dec 2011)
Log Message:
-----------
Tile Branch
* Compile fixes for MSVC, patch by Andrew Wiggin (ender79). Thanks a lot! 
* Fixed scons compile on win, missing pthreads include. 

Modified Paths:
--------------
    branches/tile/source/blender/blenlib/BLI_math_base.h
    branches/tile/source/blender/compositor/COM_defines.h
    branches/tile/source/blender/compositor/SConscript
    branches/tile/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp
    branches/tile/source/blender/compositor/intern/COM_ExecutionGroup.cpp
    branches/tile/source/blender/compositor/operations/COM_MathBaseOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_TonemapOperation.cpp

Modified: branches/tile/source/blender/blenlib/BLI_math_base.h
===================================================================
--- branches/tile/source/blender/blenlib/BLI_math_base.h        2011-12-06 
18:50:45 UTC (rev 42468)
+++ branches/tile/source/blender/blenlib/BLI_math_base.h        2011-12-06 
20:47:57 UTC (rev 42469)
@@ -78,10 +78,10 @@
 #endif
 
 #ifndef sqrtf
-#define sqrtf(a) ((float)sqrt(a))
+#define sqrtf(a) ((float)sqrt((float)a))
 #endif
 #ifndef powf
-#define powf(a, b) ((float)pow(a, b))
+#define powf(a, b) ((float)pow((float)a, (float)b))
 #endif
 #ifndef cosf
 #define cosf(a) ((float)cos(a))

Modified: branches/tile/source/blender/compositor/COM_defines.h
===================================================================
--- branches/tile/source/blender/compositor/COM_defines.h       2011-12-06 
18:50:45 UTC (rev 42468)
+++ branches/tile/source/blender/compositor/COM_defines.h       2011-12-06 
20:47:57 UTC (rev 42469)
@@ -56,7 +56,7 @@
 
 // chunk size determination
 #define COM_PREVIEW_SIZE 140.0f
-#define COM_OPENCL_ENABLED true
+#define COM_OPENCL_ENABLED TRUE
 // workscheduler threading models
 /**
   * COM_TM_PTHREAD is a threading model based on pthread library. where the 
control (picking new work) is done by each thread
@@ -97,7 +97,7 @@
 /**
   * enable the balancing of memory (saving MemoryBuffer to disc) to free memory
   */
-#define COM_MM_ENABLE false
+#define COM_MM_ENABLE FALSE
 
 #define COM_RM_NORMAL 0
 #define COM_RM_LINEAR 1

Modified: branches/tile/source/blender/compositor/SConscript
===================================================================
--- branches/tile/source/blender/compositor/SConscript  2011-12-06 18:50:45 UTC 
(rev 42468)
+++ branches/tile/source/blender/compositor/SConscript  2011-12-06 20:47:57 UTC 
(rev 42469)
@@ -8,4 +8,7 @@
 incs += ' ../makesrna ../blenloader ../../../intern/guardedalloc ../imbuf 
../windowmanager '
 incs += '../opencl ../nodes ../nodes/intern ../nodes/composite '
 
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+    incs += ' ' + env['BF_PTHREADS_INC']
+
 env.BlenderLib ( 'bf_composite', sources, Split(incs), defines=defs, 
libtype=['core','player'], priority = [191,191] )

Modified: 
branches/tile/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp    
2011-12-06 18:50:45 UTC (rev 42468)
+++ branches/tile/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp    
2011-12-06 20:47:57 UTC (rev 42469)
@@ -32,7 +32,7 @@
 double ChunkOrderHotspot::determineDistance(int x, int y) {
     int dx = x-this->x;
     int dy = y-this->y;
-    double result = sqrt(dx*dx+dy*dy);
+    double result = sqrt((double)(dx*dx+dy*dy));
     result += this->addition;
     return result;
 }

Modified: branches/tile/source/blender/compositor/intern/COM_ExecutionGroup.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_ExecutionGroup.cpp       
2011-12-06 18:50:45 UTC (rev 42468)
+++ branches/tile/source/blender/compositor/intern/COM_ExecutionGroup.cpp       
2011-12-06 20:47:57 UTC (rev 42469)
@@ -205,7 +205,7 @@
        this->chunksFinished = 0;
        this->bTree = bTree;
        unsigned int index;
-       unsigned int chunkOrder[this->numberOfChunks];
+       unsigned int *chunkOrder = new unsigned int[this->numberOfChunks];
 
        for (chunkNumber = 0 ; chunkNumber<this->numberOfChunks ; 
chunkNumber++) {
                chunkOrder[chunkNumber] = chunkNumber;
@@ -237,8 +237,8 @@
                        ChunkOrderHotspot **hotspots = new 
ChunkOrderHotspot*[1];
                        hotspots[0] = new 
ChunkOrderHotspot(this->width*centerX, this->height*centerY, 0.0f);
                        rcti rect;
-                       ChunkOrder chunkOrders[numberOfChunks];
-                       for (index = 0 ; index < numberOfChunks; index ++) {
+                       ChunkOrder *chunkOrders = new 
ChunkOrder[this->numberOfChunks];
+                       for (index = 0 ; index < this->numberOfChunks; index 
++) {
                                determineChunkRect(&rect, index);
                                chunkOrders[index].setChunkNumber(index);
                                chunkOrders[index].setX(rect.xmin);
@@ -252,7 +252,8 @@
                        }
 
                        delete hotspots[0];
-                       delete hotspots;
+                       delete[] hotspots;
+                       delete[] chunkOrders;
                }
                break;
        case COM_TO_RULE_OF_THIRDS:
@@ -276,8 +277,8 @@
                        hotspots[7] = new ChunkOrderHotspot(mx, ty, addition*7);
                        hotspots[8] = new ChunkOrderHotspot(mx, by, addition*8);
                        rcti rect;
-                       ChunkOrder chunkOrders[numberOfChunks];
-                       for (index = 0 ; index < numberOfChunks; index ++) {
+                       ChunkOrder *chunkOrders = new 
ChunkOrder[this->numberOfChunks];
+                       for (index = 0 ; index < this->numberOfChunks; index 
++) {
                                determineChunkRect(&rect, index);
                                chunkOrders[index].setChunkNumber(index);
                                chunkOrders[index].setX(rect.xmin);
@@ -300,7 +301,8 @@
                        delete hotspots[6];
                        delete hotspots[7];
                        delete hotspots[8];
-                       delete hotspots;
+                       delete[] hotspots;
+                       delete[] chunkOrders;
                }
                break;
        case COM_TO_TOP_DOWN:
@@ -343,6 +345,8 @@
                        breaked = true;
                }
        }
+
+       delete chunkOrder;
 }
 
 MemoryBuffer** ExecutionGroup::getInputBuffers(int chunkNumber) {

Modified: 
branches/tile/source/blender/compositor/operations/COM_MathBaseOperation.cpp
===================================================================
--- 
branches/tile/source/blender/compositor/operations/COM_MathBaseOperation.cpp    
    2011-12-06 18:50:45 UTC (rev 42468)
+++ 
branches/tile/source/blender/compositor/operations/COM_MathBaseOperation.cpp    
    2011-12-06 20:47:57 UTC (rev 42469)
@@ -23,7 +23,9 @@
 #include "COM_MathBaseOperation.h"
 #include "COM_InputSocket.h"
 #include "COM_OutputSocket.h"
+extern "C" {
 #include "BLI_math.h"
+}
 
 MathBaseOperation::MathBaseOperation(): NodeOperation() {
     this->addInputSocket(COM_DT_VALUE);
@@ -166,9 +168,9 @@
             float y_mod_1 = fmod(inputValue2[0], 1);
             /* if input value is not nearly an integer, fall back to zero, 
nicer than straight rounding */
             if (y_mod_1 > 0.999 || y_mod_1 < 0.001) {
-                    outputValue[0]= pow(inputValue1[0], floor(inputValue2[0] + 
0.5));
+                   outputValue[0]= pow(inputValue1[0], 
(float)floor(inputValue2[0] + 0.5));
             } else {
-                    outputValue[0] = 0.0;
+                   outputValue[0] = 0.0;
             }
     }
 }

Modified: 
branches/tile/source/blender/compositor/operations/COM_TonemapOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_TonemapOperation.cpp 
2011-12-06 18:50:45 UTC (rev 42468)
+++ branches/tile/source/blender/compositor/operations/COM_TonemapOperation.cpp 
2011-12-06 20:47:57 UTC (rev 42469)
@@ -57,9 +57,9 @@
        output[2] /= ((db == 0.f) ? 1.f : db);
        const float igm = avg->igm;
        if (igm != 0.f) {
-               output[0] = pow((double)MAX2(output[0], 0.), igm);
-               output[1] = pow((double)MAX2(output[1], 0.), igm);
-               output[2] = pow((double)MAX2(output[2], 0.), igm);
+               output[0] = pow((double)MAX2(output[0], 0.), (double)igm);
+               output[1] = pow((double)MAX2(output[1], 0.), (double)igm);
+               output[2] = pow((double)MAX2(output[2], 0.), (double)igm);
        }
 
        color[0] = output[0];

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

Reply via email to