diff engine/core/util/math/fife_math.h @ 620:853d25234671

* Moved the GLEnable and GLDisable structures from opengl_gui_graphics.cpp to fife_opengl.h as they may prove to be useful elsewhere. * Fixed the color mask definitions in fife_stdint.h * Added the nextPow2() function to calculate the nearest (greater) power of 2 * Removed a bunch of re-definitions of RGB masks * Modified GLImage to only generate one "texture chunk". I hope this makes better use of memory and speeds things up a hair * Made use of the GLEnable structure when clearing the screen
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 30 Sep 2010 21:24:55 +0000
parents 90005975cdbb
children 356634098bd9
line wrap: on
line diff
--- a/engine/core/util/math/fife_math.h	Wed Sep 29 15:15:45 2010 +0000
+++ b/engine/core/util/math/fife_math.h	Thu Sep 30 21:24:55 2010 +0000
@@ -25,7 +25,7 @@
 // Standard C++ library includes
 #include <cmath>
 
-// Platform specific includes 
+// Platform specific includes
 
 // 3rd party library includes
 
@@ -38,7 +38,7 @@
 // Sort out the missing round function in MSVC:
 #if defined( WIN32 ) && defined( _MSC_VER )
 inline double round(const double x) {
-	return x < 0.0 ? ceil(x - 0.5) : floor(x + 0.5); 
+	return x < 0.0 ? ceil(x - 0.5) : floor(x + 0.5);
 }
 #endif
 
@@ -52,4 +52,16 @@
 
 #endif
 
+inline unsigned nextPow2(unsigned x)
+{
+	--x;
+	x |= x >> 1;
+	x |= x >> 2;
+	x |= x >> 4;
+	x |= x >> 8;
+	x |= x >> 16;
+	return ++x;
+}
+
+
 #endif // FIFE_UTIL_FIFE_MATH_H