summaryrefslogtreecommitdiffstats
path: root/source/BioGen.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-07-29 22:15:03 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-07-29 22:15:03 +0200
commite49313202c759f70f6cf1113c8b53471122eb7da (patch)
treebf2016820ab3715c7a7dfcf06f1e99bc93c48cac /source/BioGen.cpp
parentChunk generator outputs its performance in chunks per second (diff)
downloadcuberite-e49313202c759f70f6cf1113c8b53471122eb7da.tar
cuberite-e49313202c759f70f6cf1113c8b53471122eb7da.tar.gz
cuberite-e49313202c759f70f6cf1113c8b53471122eb7da.tar.bz2
cuberite-e49313202c759f70f6cf1113c8b53471122eb7da.tar.lz
cuberite-e49313202c759f70f6cf1113c8b53471122eb7da.tar.xz
cuberite-e49313202c759f70f6cf1113c8b53471122eb7da.tar.zst
cuberite-e49313202c759f70f6cf1113c8b53471122eb7da.zip
Diffstat (limited to 'source/BioGen.cpp')
-rw-r--r--source/BioGen.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/source/BioGen.cpp b/source/BioGen.cpp
index 73529abb6..a43d995df 100644
--- a/source/BioGen.cpp
+++ b/source/BioGen.cpp
@@ -258,14 +258,25 @@ void cBioGenDistortedVoronoi::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::B
{
int BaseZ = cChunkDef::Width * a_ChunkZ;
int BaseX = cChunkDef::Width * a_ChunkX;
+
+ // Distortions for linear interpolation:
+ int DistortX[cChunkDef::Width + 1][cChunkDef::Width + 1];
+ int DistortZ[cChunkDef::Width + 1][cChunkDef::Width + 1];
+ for (int x = 0; x <= 4; x++) for (int z = 0; z <= 4; z++)
+ {
+ Distort(BaseX + x * 4, BaseZ + z * 4, DistortX[4 * x][4 * z], DistortZ[4 * x][4 * z]);
+ }
+
+ IntArrayLinearInterpolate2D(&DistortX[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4);
+ IntArrayLinearInterpolate2D(&DistortZ[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4);
+
for (int z = 0; z < cChunkDef::Width; z++)
{
int AbsoluteZ = BaseZ + z;
for (int x = 0; x < cChunkDef::Width; x++)
{
- int DistX, DistZ;
- Distort(BaseX + x, AbsoluteZ, DistX, DistZ);
- cChunkDef::SetBiome(a_BiomeMap, x, z, VoronoiBiome(DistX, DistZ));
+ // Distort(BaseX + x, AbsoluteZ, DistX, DistZ);
+ cChunkDef::SetBiome(a_BiomeMap, x, z, VoronoiBiome(DistortX[x][z], DistortZ[x][z]));
} // for x
} // for z
}