From b29e9487f43838c2f43a2d022d1682b035eccd5c Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 22 Jul 2012 18:48:59 +0000 Subject: [PATCH] Noise: made interpolation methods public static, so that they can be used by the outside world as well git-svn-id: http://mc-server.googlecode.com/svn/trunk@692 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cNoise.h | 8 +++++--- source/cNoise.inc | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/cNoise.h b/source/cNoise.h index ddee427ad..74c2cdd02 100644 --- a/source/cNoise.h +++ b/source/cNoise.h @@ -56,10 +56,12 @@ public: float CubicNoise3D( float a_X, float a_Y, float a_Z ) const; void SetSeed( unsigned int a_Seed ) { m_Seed = a_Seed; } + + __NOISE_INLINE__ static float CubicInterpolate( float a_A, float a_B, float a_C, float a_D, float a_Pct ); + __NOISE_INLINE__ static float CosineInterpolate( float a_A, float a_B, float a_Pct ); + __NOISE_INLINE__ static float LinearInterpolate( float a_A, float a_B, float a_Pct ); + private: - __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; diff --git a/source/cNoise.inc b/source/cNoise.inc index e80c1f268..60fd2f394 100644 --- a/source/cNoise.inc +++ b/source/cNoise.inc @@ -83,7 +83,7 @@ int cNoise::IntNoise3DInt( int a_X, int a_Y, int a_Z ) const * Interpolation functions **/ -float cNoise::CubicInterpolate( float a_A, float a_B, float a_C, float a_D, float a_Pct ) const +float cNoise::CubicInterpolate( float a_A, float a_B, float a_C, float a_D, float a_Pct ) { float P = (a_D - a_C) - (a_A - a_B); float Q = (a_A - a_B) - P; @@ -97,7 +97,7 @@ float cNoise::CubicInterpolate( float a_A, float a_B, float a_C, float a_D, floa -float cNoise::CosineInterpolate( float a_A, float a_B, float a_Pct ) const +float cNoise::CosineInterpolate( float a_A, float a_B, float a_Pct ) { const float ft = a_Pct * 3.1415927f; const float f = (1.f - cosf(ft)) * 0.5f; @@ -108,7 +108,7 @@ float cNoise::CosineInterpolate( float a_A, float a_B, float a_Pct ) const -float cNoise::LinearInterpolate( float a_A, float a_B, float a_Pct ) const +float cNoise::LinearInterpolate( float a_A, float a_B, float a_Pct ) { return a_A*(1.f-a_Pct) + a_B*a_Pct; }