summaryrefslogtreecommitdiffstats
path: root/src/VoronoiMap.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-27 22:35:13 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-27 22:35:13 +0100
commita6630d32394120a78af56bc612fa3c3449283248 (patch)
tree2c791266b0f213cd56961299da8d2258b8f85d8e /src/VoronoiMap.h
parentFixed spawn point being generally in an ocean (diff)
parentVoronoi-related biomegens use the new cVoronoiMap class. (diff)
downloadcuberite-a6630d32394120a78af56bc612fa3c3449283248.tar
cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.gz
cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.bz2
cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.lz
cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.xz
cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.zst
cuberite-a6630d32394120a78af56bc612fa3c3449283248.zip
Diffstat (limited to 'src/VoronoiMap.h')
-rw-r--r--src/VoronoiMap.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/VoronoiMap.h b/src/VoronoiMap.h
new file mode 100644
index 000000000..bcd37f9cf
--- /dev/null
+++ b/src/VoronoiMap.h
@@ -0,0 +1,45 @@
+
+// VoronoiMap.h
+
+// Declares the cVoronoiMap class that implements a Voronoi algorithm over a noise to produce a map
+
+
+
+
+
+#pragma once
+
+#include "Noise.h"
+
+
+
+
+
+class cVoronoiMap
+{
+public:
+ cVoronoiMap(int a_Seed, int a_CellSize = 128);
+
+ /// Sets the cell size used for generating the Voronoi seeds
+ void SetCellSize(int a_CellSize);
+
+ /// Returns the value in the cell into which the specified point lies
+ int GetValueAt(int a_X, int a_Y);
+
+ /// Returns the value in the cell into which the specified point lies, and the distance to the nearest Voronoi seed
+ int GetValueAt(int a_X, int a_Y, int & a_MinDistance);
+
+ /// Returns the value in the cell into which the specified point lies, and the distances to the 2 nearest Voronoi seeds
+ int GetValueAt(int a_X, int a_Y, int & a_MinDistance1, int & a_MinDistance2);
+
+protected:
+ /// The noise used for generating Voronoi seeds
+ cNoise m_Noise;
+
+ /// Size of the Voronoi cells (avg X/Y distance between the seeds)
+ int m_CellSize;
+} ;
+
+
+
+