Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-21 22:23:45 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-21 22:23:45 +0400
commita1407ff34215e5a72de2988e06c54379a1843c14 (patch)
tree8ad3d63a087733b7c50910602ae079b388b5f89b /source/blender/blenlib
parente4b79972776f9873fde045f4b93537309fba1817 (diff)
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.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_arithb.h68
-rw-r--r--source/blender/blenlib/intern/arithb.c20
2 files changed, 88 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h
index a4f49779ca1..bedde19e659 100644
--- a/source/blender/blenlib/BLI_arithb.h
+++ b/source/blender/blenlib/BLI_arithb.h
@@ -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 @@ extern "C" {
#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 @@ double Sqrt3d(double d);
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);
diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c
index f7313c8b37a..ce381a3ee7c 100644
--- a/source/blender/blenlib/intern/arithb.c
+++ b/source/blender/blenlib/intern/arithb.c
@@ -92,6 +92,26 @@ float sasqrt(float fac)
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;