diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-22 18:04:04 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-22 18:04:04 +0100 |
commit | 1cb756cbf2611693ec21eec9fd98e4367bb7d918 (patch) | |
tree | aee6ec88277f768365d02727a61e4cd925584ba3 /source/cNoise.cpp | |
parent | WorldGenerator: fixed small foliage - cacti now generate only at beaches, not underwater. (diff) | |
download | cuberite-1cb756cbf2611693ec21eec9fd98e4367bb7d918.tar cuberite-1cb756cbf2611693ec21eec9fd98e4367bb7d918.tar.gz cuberite-1cb756cbf2611693ec21eec9fd98e4367bb7d918.tar.bz2 cuberite-1cb756cbf2611693ec21eec9fd98e4367bb7d918.tar.lz cuberite-1cb756cbf2611693ec21eec9fd98e4367bb7d918.tar.xz cuberite-1cb756cbf2611693ec21eec9fd98e4367bb7d918.tar.zst cuberite-1cb756cbf2611693ec21eec9fd98e4367bb7d918.zip |
Diffstat (limited to 'source/cNoise.cpp')
-rw-r--r-- | source/cNoise.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/source/cNoise.cpp b/source/cNoise.cpp index 4221d9218..653b9e95c 100644 --- a/source/cNoise.cpp +++ b/source/cNoise.cpp @@ -129,18 +129,21 @@ float cNoise::CosineNoise2D( float a_X, float a_Y ) const return CosineInterpolate( interp1, interp2, FracY );
}
+
+
+
+
float cNoise::CubicNoise2D( float a_X, float a_Y ) const
{
const int BaseX = FAST_FLOOR( a_X );
const int BaseY = FAST_FLOOR( a_Y );
- const float points[4][4] = {
-
- IntNoise2D( BaseX-1, BaseY-1 ), IntNoise2D( BaseX, BaseY-1 ), IntNoise2D( BaseX+1, BaseY-1 ), IntNoise2D( BaseX+2, BaseY-1 ),
- IntNoise2D( BaseX-1, BaseY ), IntNoise2D( BaseX, BaseY ), IntNoise2D( BaseX+1, BaseY ), IntNoise2D( BaseX+2, BaseY ),
- IntNoise2D( BaseX-1, BaseY+1 ), IntNoise2D( BaseX, BaseY+1 ), IntNoise2D( BaseX+1, BaseY+1 ), IntNoise2D( BaseX+2, BaseY+1 ),
- IntNoise2D( BaseX-1, BaseY+2 ), IntNoise2D( BaseX, BaseY+2 ), IntNoise2D( BaseX+1, BaseY+2 ), IntNoise2D( BaseX+2, BaseY+2 ),
-
+ const float points[4][4] =
+ {
+ IntNoise2D( BaseX-1, BaseY-1 ), IntNoise2D( BaseX, BaseY-1 ), IntNoise2D( BaseX+1, BaseY-1 ), IntNoise2D( BaseX+2, BaseY-1 ),
+ IntNoise2D( BaseX-1, BaseY ), IntNoise2D( BaseX, BaseY ), IntNoise2D( BaseX+1, BaseY ), IntNoise2D( BaseX+2, BaseY ),
+ IntNoise2D( BaseX-1, BaseY+1 ), IntNoise2D( BaseX, BaseY+1 ), IntNoise2D( BaseX+1, BaseY+1 ), IntNoise2D( BaseX+2, BaseY+1 ),
+ IntNoise2D( BaseX-1, BaseY+2 ), IntNoise2D( BaseX, BaseY+2 ), IntNoise2D( BaseX+1, BaseY+2 ), IntNoise2D( BaseX+2, BaseY+2 ),
};
const float FracX = (a_X) - BaseX;
@@ -154,6 +157,10 @@ float cNoise::CubicNoise2D( float a_X, float a_Y ) const return CubicInterpolate( interp1, interp2, interp3, interp4, FracY );
}
+
+
+
+
#if NOISE_USE_SSE
float cNoise::SSE_CubicNoise2D( float a_X, float a_Y ) const
{
|