[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48300] branches/soc-2012-swiss_cheese/ source/blender/blenlib: Reverted r47493 and r47494 because they are too much trouble to merge for now .
Jason Wilkins
Jason.A.Wilkins at gmail.com
Tue Jun 26 09:27:34 CEST 2012
Revision: 48300
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48300
Author: jwilkins
Date: 2012-06-26 07:27:17 +0000 (Tue, 26 Jun 2012)
Log Message:
-----------
Reverted r47493 and r47494 because they are too much trouble to merge for now. (Also re-applied r48249)
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47493
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47494
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48249
Modified Paths:
--------------
branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_base.h
branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_color.h
branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_geom.h
branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_inline.h
branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_vector.h
branches/soc-2012-swiss_cheese/source/blender/blenlib/CMakeLists.txt
Added Paths:
-----------
branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_base_inline.c
branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_color_inline.c
branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_geom_inline.c
branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_vector_inline.c
Removed Paths:
-------------
branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_base_inline.h
branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_color_inline.h
branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_geom_inline.h
branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_vector_inline.h
Modified: branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_base.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_base.h 2012-06-26 07:09:49 UTC (rev 48299)
+++ branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_base.h 2012-06-26 07:27:17 UTC (rev 48300)
@@ -142,7 +142,9 @@
# define CLAMP(a, b, c) if ((a) < (b)) (a) = (b); else if ((a) > (c)) (a) = (c)
#endif
-#include "intern/math_base_inline.h"
+#ifdef __BLI_MATH_INLINE_H__
+#include "intern/math_base_inline.c"
+#endif
/******************************* Float ******************************/
Modified: branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_color.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_color.h 2012-06-26 07:09:49 UTC (rev 48299)
+++ branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_color.h 2012-06-26 07:27:17 UTC (rev 48300)
@@ -116,7 +116,9 @@
void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power);
-#include "intern/math_color_inline.h"
+#ifdef __BLI_MATH_INLINE_H__
+#include "intern/math_color_inline.c"
+#endif
#ifdef __cplusplus
}
Modified: branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_geom.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_geom.h 2012-06-26 07:09:49 UTC (rev 48299)
+++ branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_geom.h 2012-06-26 07:27:17 UTC (rev 48300)
@@ -36,7 +36,9 @@
#include "BLI_math_inline.h"
-#include "intern/math_geom_inline.h"
+#ifdef __BLI_MATH_INLINE_H__
+#include "intern/math_geom_inline.c"
+#endif
/********************************** Polygons *********************************/
Modified: branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_inline.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_inline.h 2012-06-26 07:09:49 UTC (rev 48299)
+++ branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_inline.h 2012-06-26 07:27:17 UTC (rev 48300)
@@ -35,18 +35,24 @@
#endif
/* add platform/compiler checks here if it is not supported */
+#define __BLI_MATH_INLINE_H__
-#ifdef _MSC_VER
-# define MINLINE static __forceinline
-# define MALWAYS_INLINE MINLINE
-#else
-# define MINLINE static inline
-# if (defined(__APPLE__) && defined(__ppc__))
- /* static inline __attribute__ here breaks osx ppc gcc42 build */
-# define MALWAYS_INLINE static __attribute__((always_inline))
+#ifdef __BLI_MATH_INLINE_H__
+# ifdef _MSC_VER
+# define MINLINE static __forceinline
+# define MALWAYS_INLINE MINLINE
# else
-# define MALWAYS_INLINE static inline __attribute__((always_inline))
+# define MINLINE static inline
+# if (defined(__APPLE__) && defined(__ppc__))
+ /* static inline __attribute__ here breaks osx ppc gcc42 build */
+# define MALWAYS_INLINE static __attribute__((always_inline))
+# else
+# define MALWAYS_INLINE static inline __attribute__((always_inline))
+# endif
# endif
+#else
+# define MINLINE
+# define MALWAYS_INLINE
#endif
#ifdef __cplusplus
Modified: branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_vector.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_vector.h 2012-06-26 07:09:49 UTC (rev 48299)
+++ branches/soc-2012-swiss_cheese/source/blender/blenlib/BLI_math_vector.h 2012-06-26 07:27:17 UTC (rev 48300)
@@ -36,7 +36,9 @@
#include "BLI_math_inline.h"
-#include "intern/math_vector_inline.h"
+#ifdef __BLI_MATH_INLINE_H__
+#include "intern/math_vector_inline.c"
+#endif
/************************************* Init ***********************************/
Modified: branches/soc-2012-swiss_cheese/source/blender/blenlib/CMakeLists.txt
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/blenlib/CMakeLists.txt 2012-06-26 07:09:49 UTC (rev 48299)
+++ branches/soc-2012-swiss_cheese/source/blender/blenlib/CMakeLists.txt 2012-06-26 07:27:17 UTC (rev 48300)
@@ -64,11 +64,15 @@
intern/lasso.c
intern/listbase.c
intern/math_base.c
+ intern/math_base_inline.c
intern/math_color.c
+ intern/math_color_inline.c
intern/math_geom.c
+ intern/math_geom_inline.c
intern/math_matrix.c
intern/math_rotation.c
intern/math_vector.c
+ intern/math_vector_inline.c
intern/md5.c
intern/noise.c
intern/path_util.c
@@ -87,11 +91,6 @@
intern/voxel.c
intern/winstuff.c
- intern/math_base_inline.h
- intern/math_color_inline.h
- intern/math_geom_inline.h
- intern/math_vector_inline.h
-
BLI_args.h
BLI_array.h
BLI_bitmap.h
Copied: branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_base_inline.c (from rev 47492, branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_base_inline.c)
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_base_inline.c (rev 0)
+++ branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_base_inline.c 2012-06-26 07:27:17 UTC (rev 48300)
@@ -0,0 +1,158 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: some of this file.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ * */
+
+/** \file blender/blenlib/intern/math_base_inline.c
+ * \ingroup bli
+ */
+
+
+#include <float.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "BLI_math.h"
+
+#ifndef __MATH_BASE_INLINE_C__
+#define __MATH_BASE_INLINE_C__
+
+/* A few small defines. Keep'em local! */
+#define SMALL_NUMBER 1.e-8f
+
+MINLINE float sqrt3f(float f)
+{
+ if (f == 0.0f) return 0.0f;
+ if (f < 0) return (float)(-exp(log(-f) / 3));
+ else return (float)(exp(log(f) / 3));
+}
+
+MINLINE double sqrt3d(double d)
+{
+ if (d == 0.0) return 0;
+ if (d < 0) return -exp(log(-d) / 3);
+ else return exp(log(d) / 3);
+}
+
+MINLINE float saacos(float fac)
+{
+ if (fac <= -1.0f) return (float)M_PI;
+ else if (fac >= 1.0f) return 0.0;
+ else return (float)acos(fac);
+}
+
+MINLINE float saasin(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)asin(fac);
+}
+
+MINLINE float sasqrt(float fac)
+{
+ if (fac <= 0.0f) return 0.0f;
+ return (float)sqrt(fac);
+}
+
+MINLINE 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);
+}
+
+MINLINE 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);
+}
+
+MINLINE float sasqrtf(float fac)
+{
+ if (fac <= 0.0f) return 0.0f;
+ return sqrtf(fac);
+}
+
+MINLINE float interpf(float target, float origin, float fac)
+{
+ return (fac * target) + (1.0f - fac) * origin;
+}
+
+/* useful to calculate an even width shell, by taking the angle between 2 planes.
+ * The return value is a scale on the offset.
+ * no angle between planes is 1.0, as the angle between the 2 planes approaches 180d
+ * the distance gets very high, 180d would be inf, but this case isn't valid */
+MINLINE float shell_angle_to_dist(const float angle)
+{
+ return (angle < SMALL_NUMBER) ? 1.0f : fabsf(1.0f / cosf(angle));
+}
+
+/* used for zoom values*/
+MINLINE float power_of_2(float val)
+{
+ return (float)pow(2.0, ceil(log((double)val) / M_LN2));
+}
+
+MINLINE int is_power_of_2_i(int n)
+{
+ return (n & (n - 1)) == 0;
+}
+
+MINLINE int power_of_2_max_i(int n)
+{
+ if (is_power_of_2_i(n))
+ return n;
+
+ while (!is_power_of_2_i(n))
+ n = n & (n - 1);
+
+ return n * 2;
+}
+
+MINLINE int power_of_2_min_i(int n)
+{
+ while (!is_power_of_2_i(n))
+ n = n & (n - 1);
+
+ return n;
+}
+
+MINLINE float minf(float a, float b)
+{
+ return (a < b) ? a : b;
+}
+
+MINLINE float maxf(float a, float b)
+{
+ return (a > b) ? a : b;
+}
+
+MINLINE float signf(float f)
+{
+ return (f < 0.f) ? -1.f : 1.f;
+}
+
+
+#endif /* __MATH_BASE_INLINE_C__ */
Deleted: branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_base_inline.h
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_base_inline.h 2012-06-26 07:09:49 UTC (rev 48299)
+++ branches/soc-2012-swiss_cheese/source/blender/blenlib/intern/math_base_inline.h 2012-06-26 07:27:17 UTC (rev 48300)
@@ -1,158 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: some of this file.
- *
- * ***** END GPL LICENSE BLOCK *****
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list