From ab2e2ec34b14a5410cb0ae2ce37e1f7e90dd432d Mon Sep 17 00:00:00 2001 From: Andrea Weikert Date: Tue, 27 Nov 2007 21:48:14 +0000 Subject: [PATCH] == MSVC 7.1 projectfiles == - update for new particle system - made blenderplayer.exe compile again (DDS library missing) - exchanged a few float math functions (logf, sinf, cosf, expf, powf) with their double counterparts in CMP_nodes (MSVC chokes on them, because the compiler is not C99 compliant) --- .../blender/blenkernel/BKE_blenkernel.vcproj | 7 ++++-- .../blender/blenlib/BLI_blenlib.vcproj | 6 +++++ .../blender/imbuf/BL_imbuf.vcproj | 8 +++---- .../blender/makesdna/DNA_makesdna.vcproj | 3 +++ .../nodes/intern/CMP_nodes/CMP_chromaMatte.c | 4 ++-- .../nodes/intern/CMP_nodes/CMP_glare.c | 10 ++++----- .../nodes/intern/CMP_nodes/CMP_tonemap.c | 22 +++++++++---------- 7 files changed, 36 insertions(+), 24 deletions(-) diff --git a/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj b/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj index 8f473c85976..15614f52fdf 100644 --- a/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj +++ b/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj @@ -229,7 +229,7 @@ + + diff --git a/projectfiles_vc7/blender/blenlib/BLI_blenlib.vcproj b/projectfiles_vc7/blender/blenlib/BLI_blenlib.vcproj index 0951c40d891..b42642c774f 100644 --- a/projectfiles_vc7/blender/blenlib/BLI_blenlib.vcproj +++ b/projectfiles_vc7/blender/blenlib/BLI_blenlib.vcproj @@ -346,6 +346,9 @@ + + @@ -449,6 +452,9 @@ + + diff --git a/projectfiles_vc7/blender/imbuf/BL_imbuf.vcproj b/projectfiles_vc7/blender/imbuf/BL_imbuf.vcproj index b7518c0bc82..b4daf386c26 100644 --- a/projectfiles_vc7/blender/imbuf/BL_imbuf.vcproj +++ b/projectfiles_vc7/blender/imbuf/BL_imbuf.vcproj @@ -228,8 +228,8 @@ + + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c index d836a829696..6a40018e659 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c @@ -89,8 +89,8 @@ static void do_chroma_key(bNode *node, float *out, float *in) if(kfg>0.0) { /* found a pixel that is within key color */ newY=in[0]-(1-c->t3)*kfg; - newCb=in[1]-kfg*cosf(theta); - newCr=in[2]-kfg*sinf(theta); + newCb=in[1]-kfg*cos((double)theta); + newCr=in[2]-kfg*sin((double)theta); alpha=(kfg+c->fsize)*(c->fstrength); beta=atan2(newCr,newCb); diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c index 9943dd2246d..e7b8fd00c93 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c @@ -244,12 +244,12 @@ static void streaks(NodeGlare* ndg, CompBuf* dst, CompBuf* src) for (a=0.f; a<360.f; a+=ang) { const float an = (a + (float)ndg->angle_ofs)*(float)M_PI/180.f; - const float vx = cosf(an), vy = sinf(an); + const float vx = cos((double)an), vy = sin((double)an); for (n=0; niter; ++n) { - const float p4 = powf(4.f, n); + const float p4 = pow(4.0, (double)n); const float vxp = vx*p4, vyp = vy*p4; - const float wt = powf(ndg->fade, p4); - const float cmo = 1.f - powf(ndg->colmod, n+1); // colormodulation amount relative to current pass + const float wt = pow((double)ndg->fade, (double)p4); + const float cmo = 1.f - pow((double)ndg->colmod, (double)n+1); // colormodulation amount relative to current pass float* tdstcol = tdst->rect; for (y=0; yy; ++y) { for (x=0; xx; ++x, tdstcol+=4) { @@ -408,7 +408,7 @@ static void fglow(NodeGlare* ndg, CompBuf* dst, CompBuf* src) // linear window good enough here, visual result counts, not scientific analysis //w = (1.f-fabs(u))*(1.f-fabs(v)); // actually, Hanning window is ok, cos^2 for some reason is slower - w = (0.5f + 0.5f*cosf(u*(float)M_PI))*(0.5f + 0.5f*cosf(v*(float)M_PI)); + w = (0.5f + 0.5f*cos((double)u*M_PI))*(0.5f + 0.5f*cos((double)v*M_PI)); fRGB_mult(fcol, w); qd_setPixel(ckrn, x, y, fcol); } diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c b/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c index cd617eca5c5..662d8e8dde9 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c @@ -50,16 +50,16 @@ static float avgLogLum(CompBuf *src, float* auto_key, float* Lav, float* Cav) float L = 0.212671f*bc[0][0] + 0.71516f*bc[0][1] + 0.072169f*bc[0][2]; *Lav += L; fRGB_add(Cav, bc[0]); - lsum += logf(MAX2(L, 0.f) + 1e-5f); + lsum += (float)log((double)MAX2(L, 0.0) + 1e-5); maxl = (L > maxl) ? L : maxl; minl = (L < minl) ? L : minl; bc++; } *Lav *= sc; fRGB_mult(Cav, sc); - maxl = logf(maxl + 1e-5f); minl = logf(minl + 1e-5f); avl = lsum*sc; + maxl = log((double)maxl + 1e-5); minl = log((double)minl + 1e-5f); avl = lsum*sc; *auto_key = (maxl > minl) ? ((maxl - avl) / (maxl - minl)) : 1.f; - return expf(avl); + return exp((double)avl); } @@ -74,8 +74,8 @@ void static tonemap(NodeTonemap* ntm, CompBuf* dst, CompBuf* src) if (ntm->type == 1) { // Reinhard/Devlin photoreceptor - const float f = expf(-ntm->f); - const float m = (ntm->m > 0.f) ? ntm->m : (0.3f + 0.7f*powf(auto_key, 1.4f)); + const float f = exp((double)-ntm->f); + const float m = (ntm->m > 0.f) ? ntm->m : (0.3f + 0.7f*pow((double)auto_key, 1.4)); const float ic = 1.f - ntm->c, ia = 1.f - ntm->a; if (ntm->m == 0.f) printf("tonemap node, M: %g\n", m); for (y=0; yy; ++y) { @@ -86,15 +86,15 @@ void static tonemap(NodeTonemap* ntm, CompBuf* dst, CompBuf* src) float I_l = sp[x][0] + ic*(L - sp[x][0]); float I_g = Cav[0] + ic*(Lav - Cav[0]); float I_a = I_l + ia*(I_g - I_l); - dp[x][0] /= (dp[x][0] + powf(f*I_a, m)); + dp[x][0] /= (dp[x][0] + pow((double)f*I_a, (double)m)); I_l = sp[x][1] + ic*(L - sp[x][1]); I_g = Cav[1] + ic*(Lav - Cav[1]); I_a = I_l + ia*(I_g - I_l); - dp[x][1] /= (dp[x][1] + powf(f*I_a, m)); + dp[x][1] /= (dp[x][1] + pow((double)f*I_a,(double)m)); I_l = sp[x][2] + ic*(L - sp[x][2]); I_g = Cav[2] + ic*(Lav - Cav[2]); I_a = I_l + ia*(I_g - I_l); - dp[x][2] /= (dp[x][2] + powf(f*I_a, m)); + dp[x][2] /= (dp[x][2] + pow((double)f*I_a, (double)m)); } } return; @@ -114,9 +114,9 @@ void static tonemap(NodeTonemap* ntm, CompBuf* dst, CompBuf* src) dp[x][1] /= ((dg == 0.f) ? 1.f : dg); dp[x][2] /= ((db == 0.f) ? 1.f : db); if (igm != 0.f) { - dp[x][0] = powf(MAX2(dp[x][0], 0.f), igm); - dp[x][1] = powf(MAX2(dp[x][1], 0.f), igm); - dp[x][2] = powf(MAX2(dp[x][2], 0.f), igm); + dp[x][0] = pow((double)MAX2(dp[x][0], 0.), igm); + dp[x][1] = pow((double)MAX2(dp[x][1], 0.), igm); + dp[x][2] = pow((double)MAX2(dp[x][2], 0.), igm); } } }