]> git.lizzy.rs Git - minetest.git/blobdiff - src/noise.h
Remove no virtual dtor warnings, make MapgenParams contain actual NoiseParams
[minetest.git] / src / noise.h
index c2a85771ccdf9a3e2ad74da1417ff643ef468556..0bf1a2f13297ef85effe9d7620472138e410c52c 100644 (file)
@@ -1,6 +1,7 @@
 /*
 Minetest
 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
@@ -71,8 +72,8 @@ struct NoiseParams {
 
 
 // Convenience macros for getting/setting NoiseParams in Settings
-#define getNoiseParams(x) getStruct<NoiseParams>((x), "f,f,v3,s32,s32,f")
-#define setNoiseParams(x, y) setStruct((x), "f,f,v3,s32,s32,f", (y))
+#define getNoiseParams(x, y) getStruct((x), "f,f,v3,s32,s32,f", &(y), sizeof(y))
+#define setNoiseParams(x, y) setStruct((x), "f,f,v3,s32,s32,f", &(y))
 
 class Noise {
 public:
@@ -87,9 +88,9 @@ class Noise {
 
        Noise(NoiseParams *np, int seed, int sx, int sy);
        Noise(NoiseParams *np, int seed, int sx, int sy, int sz);
-       ~Noise();
+       virtual ~Noise();
 
-       void init(NoiseParams *np, int seed, int sx, int sy, int sz);
+       virtual void init(NoiseParams *np, int seed, int sx, int sy, int sz);
        void setSize(int sx, int sy);
        void setSize(int sx, int sy, int sz);
        void setSpreadFactor(v3f spread);
@@ -105,6 +106,7 @@ class Noise {
                float step_x, float step_y, float step_z,
                int seed);
        float *perlinMap2D(float x, float y);
+       float *perlinMap2DModulated(float x, float y, float *persist_map);
        float *perlinMap3D(float x, float y, float z);
        void transformNoiseMap();
 };
@@ -157,7 +159,7 @@ inline float easeCurve(float t) {
                (s) + (np)->seed, (np)->octaves, (np)->persist))
 
 #define NoisePerlin3D(np, x, y, z, s) ((np)->offset + (np)->scale * \
-               noise2d_perlin((float)(x) / (np)->spread.X, (float)(y) / (np)->spread.Y, \
+               noise3d_perlin((float)(x) / (np)->spread.X, (float)(y) / (np)->spread.Y, \
                (float)(z) / (np)->spread.Z, (s) + (np)->seed, (np)->octaves, (np)->persist))
 
 #endif