summaryrefslogtreecommitdiffstats
path: root/source/cNoise.h
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-26 03:13:40 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-26 03:13:40 +0100
commitc35db25269ea9549b996cd18c65b05a9f8d43387 (patch)
tree87c8ef140849ed116d59fdfdc88ac4385d3ce5b7 /source/cNoise.h
parent - Ignoring Debug and Release makes it easier to check what should be committed (diff)
downloadcuberite-c35db25269ea9549b996cd18c65b05a9f8d43387.tar
cuberite-c35db25269ea9549b996cd18c65b05a9f8d43387.tar.gz
cuberite-c35db25269ea9549b996cd18c65b05a9f8d43387.tar.bz2
cuberite-c35db25269ea9549b996cd18c65b05a9f8d43387.tar.lz
cuberite-c35db25269ea9549b996cd18c65b05a9f8d43387.tar.xz
cuberite-c35db25269ea9549b996cd18c65b05a9f8d43387.tar.zst
cuberite-c35db25269ea9549b996cd18c65b05a9f8d43387.zip
Diffstat (limited to '')
-rw-r--r--source/cNoise.h36
1 files changed, 29 insertions, 7 deletions
diff --git a/source/cNoise.h b/source/cNoise.h
index 9511ab6e4..d4da677f3 100644
--- a/source/cNoise.h
+++ b/source/cNoise.h
@@ -1,6 +1,19 @@
#pragma once
-#include <emmintrin.h>
+// Some settings
+#define NOISE_USE_INLINE 1
+#define NOISE_USE_SSE 0
+
+// Do not touch
+#if NOISE_USE_INLINE
+# define __NOISE_INLINE__ inline
+#else
+# define __NOISE_INLINE__
+#endif
+
+#if NOISE_USE_SSE
+# include <emmintrin.h>
+#endif
class cNoise
{
@@ -8,10 +21,13 @@ public:
cNoise( unsigned int a_Seed );
~cNoise();
- float IntNoise( int a_X ) const;
- float IntNoise2D( int a_X, int a_Y ) const;
+#if NOISE_USE_SSE
__m128 SSE_IntNoise2D( int a_X1, int a_Y1, int a_X2, int a_Y2, int a_X3, int a_Y3, int a_X4, int a_Y4 ) const;
- float IntNoise3D( int a_X, int a_Y, int a_Z ) const;
+#endif
+
+ __NOISE_INLINE__ float IntNoise( int a_X ) const;
+ __NOISE_INLINE__ float IntNoise2D( int a_X, int a_Y ) const;
+ __NOISE_INLINE__ float IntNoise3D( int a_X, int a_Y, int a_Z ) const;
float LinearNoise1D( float a_X ) const;
float CosineNoise1D( float a_X ) const;
@@ -28,11 +44,17 @@ public:
void SetSeed( unsigned int a_Seed ) { m_Seed = a_Seed; }
private:
- float CubicInterpolate( float a_A, float a_B, float a_C, float a_D, float a_Pct ) const;
+ __NOISE_INLINE__ float CubicInterpolate( float a_A, float a_B, float a_C, float a_D, float a_Pct ) const;
+ __NOISE_INLINE__ float CosineInterpolate( float a_A, float a_B, float a_Pct ) const;
+ __NOISE_INLINE__ float LinearInterpolate( float a_A, float a_B, float a_Pct ) const;
+
+#if NOISE_USE_SSE
__m128 CubicInterpolate4( const __m128 & a_A, const __m128 & a_B, const __m128 & a_C, const __m128 & a_D, float a_Pct ) const;
- float CosineInterpolate( float a_A, float a_B, float a_Pct ) const;
- float LinearInterpolate( float a_A, float a_B, float a_Pct ) const;
+#endif
unsigned int m_Seed;
};
+#if NOISE_USE_INLINE
+# include "cNoise.inc"
+#endif