[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21775] branches/blender2.5/blender/source /blender: 2.5:

Brecht Van Lommel brecht at blender.org
Tue Jul 21 20:23:45 CEST 2009


Revision: 21775
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21775
Author:   blendix
Date:     2009-07-21 20:23:45 +0200 (Tue, 21 Jul 2009)

Log Message:
-----------
2.5:

* Windows fixes for texture filter & bump patches, thanks
  Jean-Michel Soler for noting.

* Added sqrtf/sinf/fabsf/... fallback #ifdefs in BLI_arithb.h,
  those should be safe to use now. Replacing the double for the
  float version throughout the code can be done once, but would
  need proper testing.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenlib/BLI_arithb.h
    branches/blender2.5/blender/source/blender/blenlib/intern/arithb.c
    branches/blender2.5/blender/source/blender/render/intern/source/imagetexture.c

Modified: branches/blender2.5/blender/source/blender/blenlib/BLI_arithb.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenlib/BLI_arithb.h	2009-07-21 15:52:15 UTC (rev 21774)
+++ branches/blender2.5/blender/source/blender/blenlib/BLI_arithb.h	2009-07-21 18:23:45 UTC (rev 21775)
@@ -38,6 +38,12 @@
 extern "C" {
 #endif
 
+#ifdef WIN32
+#define _USE_MATH_DEFINES
+#endif
+
+#include <math.h>
+
 #ifndef M_PI
 #define M_PI		3.14159265358979323846
 #endif
@@ -54,6 +60,65 @@
 #define M_1_PI		0.318309886183790671538
 #endif
 
+#ifndef M_E
+#define M_E             2.7182818284590452354
+#endif
+#ifndef M_LOG2E
+#define M_LOG2E         1.4426950408889634074
+#endif
+#ifndef M_LOG10E
+#define M_LOG10E        0.43429448190325182765
+#endif
+#ifndef M_LN2
+#define M_LN2           0.69314718055994530942
+#endif
+#ifndef M_LN10
+#define M_LN10          2.30258509299404568402
+#endif
+
+#ifndef sqrtf
+#define sqrtf(a) ((float)sqrt(a))
+#endif
+#ifndef powf
+#define powf(a, b) ((float)pow(a, b))
+#endif
+#ifndef cosf
+#define cosf(a) ((float)cos(a))
+#endif
+#ifndef sinf
+#define sinf(a) ((float)sin(a))
+#endif
+#ifndef acosf
+#define acosf(a) ((float)acos(a))
+#endif
+#ifndef asinf
+#define asinf(a) ((float)asin(a))
+#endif
+#ifndef atan2f
+#define atan2f(a, b) ((float)atan2(a, b))
+#endif
+#ifndef tanf
+#define tanf(a) ((float)tan(a))
+#endif
+#ifndef atanf
+#define atanf(a) ((float)atan(a))
+#endif
+#ifndef floorf
+#define floorf(a) ((float)floor(a))
+#endif
+#ifndef ceilf
+#define ceilf(a) ((float)ceil(a))
+#endif
+#ifndef fabsf
+#define fabsf(a) ((float)fabs(a))
+#endif
+#ifndef logf
+#define logf(a) ((float)log(a))
+#endif
+#ifndef expf
+#define expf(a) ((float)exp(a))
+#endif
+
 #ifdef WIN32
 	#ifndef FREE_WINDOWS
 		#define isnan(n) _isnan(n)
@@ -89,6 +154,9 @@
 float saacos(float fac);
 float saasin(float fac);
 float sasqrt(float fac);
+float saacosf(float fac);
+float saasinf(float fac);
+float sasqrtf(float fac);
 
 int FloatCompare(float *v1, float *v2, float limit);
 int FloatCompare4(float *v1, float *v2, float limit);

Modified: branches/blender2.5/blender/source/blender/blenlib/intern/arithb.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenlib/intern/arithb.c	2009-07-21 15:52:15 UTC (rev 21774)
+++ branches/blender2.5/blender/source/blender/blenlib/intern/arithb.c	2009-07-21 18:23:45 UTC (rev 21775)
@@ -92,6 +92,26 @@
 	return (float)sqrt(fac);
 }
 
+float saacosf(float fac)
+{
+	if(fac<= -1.0f) return (float)M_PI;
+	else if(fac>=1.0f) return 0.0f;
+	else return (float)acosf(fac);
+}
+
+float saasinf(float fac)
+{
+	if(fac<= -1.0f) return (float)-M_PI/2.0f;
+	else if(fac>=1.0f) return (float)M_PI/2.0f;
+	else return (float)asinf(fac);
+}
+
+float sasqrtf(float fac)
+{
+	if(fac<=0.0) return 0.0;
+	return (float)sqrtf(fac);
+}
+
 float Normalize(float *n)
 {
 	float d;

Modified: branches/blender2.5/blender/source/blender/render/intern/source/imagetexture.c
===================================================================
--- branches/blender2.5/blender/source/blender/render/intern/source/imagetexture.c	2009-07-21 15:52:15 UTC (rev 21774)
+++ branches/blender2.5/blender/source/blender/render/intern/source/imagetexture.c	2009-07-21 18:23:45 UTC (rev 21775)
@@ -48,6 +48,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_texture_types.h"
 
+#include "BLI_arithb.h"
 #include "BLI_blenlib.h"
 #include "BLI_threads.h"
 





More information about the Bf-blender-cvs mailing list