From b691c43c44ff180d10e7d4a9afc83b98551ff586 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 1 Mar 2026 12:16:08 +0800 Subject: Initial commit --- Minecraft.World/SimplexNoise.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Minecraft.World/SimplexNoise.h (limited to 'Minecraft.World/SimplexNoise.h') 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); + +}; -- cgit v1.2.3