aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/SimplexNoise.h
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/SimplexNoise.h
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.World/SimplexNoise.h')
-rw-r--r--Minecraft.World/SimplexNoise.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/Minecraft.World/SimplexNoise.h b/Minecraft.World/SimplexNoise.h
new file mode 100644
index 00000000..e9547d4d
--- /dev/null
+++ b/Minecraft.World/SimplexNoise.h
@@ -0,0 +1,40 @@
+#pragma once
+
+class SimplexNoise
+{
+private:
+ static int grad3[12][3];
+
+ int *p;
+
+ static double F2;
+ static double G2;
+ static double F3;
+ static double G3;
+
+public:
+ double scale;
+ double xo, yo, zo;
+
+ SimplexNoise();
+ SimplexNoise(Random *random);
+ void init(Random *random);
+ ~SimplexNoise();
+
+ // This method is a *lot* faster than using (int)Math.floor(x)
+private:
+ static int fastfloor(double x);
+ static double dot(int *g, double x, double y);
+ static double dot(int *g, double x, double y, double z);
+
+ // 2D simplex noise
+public:
+ double getValue(double xin, double yin);
+
+ // 3D simplex noise
+ double getValue(double xin, double yin, double zin);
+
+ void add(doubleArray buffer, double _x, double _y, int xSize, int ySize, double xs, double ys, double pow);
+ void add(doubleArray buffer, double _x, double _y, double _z, int xSize, int ySize, int zSize, double xs, double ys, double zs, double pow);
+
+};