Browse Source

Code cleanup

Alex Szpakowski 12 years ago
parent
commit
f8c7e2cab8
2 changed files with 12 additions and 13 deletions
  1. 8 9
      src/modules/math/MathModule.h
  2. 4 4
      src/modules/math/wrap_Math.cpp

+ 8 - 9
src/modules/math/MathModule.h

@@ -27,7 +27,6 @@
 #include "common/Module.h"
 #include "common/Module.h"
 #include "common/math.h"
 #include "common/math.h"
 #include "common/int.h"
 #include "common/int.h"
-#include "common/StringMap.h"
 
 
 // Noise
 // Noise
 #include "libraries/noise1234/simplexnoise1234.h"
 #include "libraries/noise1234/simplexnoise1234.h"
@@ -115,10 +114,10 @@ public:
 	 *
 	 *
 	 * @return Noise value in the range of [0,1].
 	 * @return Noise value in the range of [0,1].
 	 **/
 	 **/
-	float simplexNoise1(float x) const;
-	float simplexNoise2(float x, float y) const;
-	float simplexNoise3(float x, float y, float z) const;
-	float simplexNoise4(float x, float y, float z, float w) const;
+	float noise(float x) const;
+	float noise(float x, float y) const;
+	float noise(float x, float y, float z) const;
+	float noise(float x, float y, float z, float w) const;
 
 
 	static Math instance;
 	static Math instance;
 
 
@@ -128,22 +127,22 @@ private:
 
 
 }; // Math
 }; // Math
 
 
-inline float Math::simplexNoise1(float x) const
+inline float Math::noise(float x) const
 {
 {
 	return SimplexNoise1234::noise(x);
 	return SimplexNoise1234::noise(x);
 }
 }
 
 
-inline float Math::simplexNoise2(float x, float y) const
+inline float Math::noise(float x, float y) const
 {
 {
 	return SimplexNoise1234::noise(x, y);
 	return SimplexNoise1234::noise(x, y);
 }
 }
 
 
-inline float Math::simplexNoise3(float x, float y, float z) const
+inline float Math::noise(float x, float y, float z) const
 {
 {
 	return SimplexNoise1234::noise(x, y, z);
 	return SimplexNoise1234::noise(x, y, z);
 }
 }
 
 
-inline float Math::simplexNoise4(float x, float y, float z, float w) const
+inline float Math::noise(float x, float y, float z, float w) const
 {
 {
 	return SimplexNoise1234::noise(x, y, z, w);
 	return SimplexNoise1234::noise(x, y, z, w);
 }
 }

+ 4 - 4
src/modules/math/wrap_Math.cpp

@@ -157,18 +157,18 @@ int w_noise(lua_State *L)
 	{
 	{
 	case 1:
 	case 1:
 		x = luaL_checknumber(L, 1);
 		x = luaL_checknumber(L, 1);
-		val = Math::instance.simplexNoise1(x);
+		val = Math::instance.noise(x);
 		break;
 		break;
 	case 2:
 	case 2:
 		x = luaL_checknumber(L, 1);
 		x = luaL_checknumber(L, 1);
 		y = luaL_checknumber(L, 2);
 		y = luaL_checknumber(L, 2);
-		val = Math::instance.simplexNoise2(x, y);
+		val = Math::instance.noise(x, y);
 		break;
 		break;
 	case 3:
 	case 3:
 		x = luaL_checknumber(L, 1);
 		x = luaL_checknumber(L, 1);
 		y = luaL_checknumber(L, 2);
 		y = luaL_checknumber(L, 2);
 		z = luaL_checknumber(L, 3);
 		z = luaL_checknumber(L, 3);
-		val = Math::instance.simplexNoise3(x, y, z);
+		val = Math::instance.noise(x, y, z);
 		break;
 		break;
 	case 4:
 	case 4:
 	default:
 	default:
@@ -176,7 +176,7 @@ int w_noise(lua_State *L)
 		y = luaL_checknumber(L, 2);
 		y = luaL_checknumber(L, 2);
 		z = luaL_checknumber(L, 3);
 		z = luaL_checknumber(L, 3);
 		w = luaL_checknumber(L, 4);
 		w = luaL_checknumber(L, 4);
-		val = Math::instance.simplexNoise4(x, y, z, w);
+		val = Math::instance.noise(x, y, z, w);
 		break;
 		break;
 	}
 	}