Mgfractal: Revert unnecessary duplication of parameters
authorparamat <mat.gregory@virginmedia.com>
Sat, 14 Nov 2015 09:18:01 +0000 (09:18 +0000)
committerparamat <mat.gregory@virginmedia.com>
Sun, 15 Nov 2015 08:13:36 +0000 (08:13 +0000)
builtin/settingtypes.txt
minetest.conf.example
src/mapgen_fractal.cpp
src/mapgen_fractal.h

index e5fe5cb95a517c51f4a64769e8ab359a4eed6f98..bf452915ad5063cb519aa9700dc0031dd96e6880 100644 (file)
@@ -980,49 +980,34 @@ mgfractal_spflags (Mapgen fractal flags) flags nojulia julia,nojulia
 #    3 = 4D "Mandy Cousin" mandelbrot set, 4 = 4D mandelbrot set variation.
 mgfractal_formula (Mapgen fractal formula) int 1 1 4
 
-#    Mandelbrot set: Iterations of the recursive function.
+#    Iterations of the recursive function.
 #    Controls scale of finest detail.
-mgfractal_m_iterations (Mapgen fractal mandelbrot iterations) int 9
+mgfractal_iterations (Mapgen fractal iterations) int 9
 
-#    Mandelbrot set: Approximate (X,Y,Z) scales in nodes.
-mgfractal_m_scale (Mapgen fractal mandelbrot scale) v3f (1024.0, 256.0, 1024.0)
+#    Approximate (X,Y,Z) scales in nodes.
+mgfractal_scale (Mapgen fractal scale) v3f (1024.0, 256.0, 1024.0)
 
-#    Mandelbrot set: (X,Y,Z) offsets from world centre.
-#    Range roughly -2 to 2, multiply by m_scale for offsets in nodes.
-mgfractal_m_offset (Mapgen fractal mandelbrot offset) v3f (1.75, 0.0, 0.0)
+#    (X,Y,Z) offsets from world centre.
+#    Range roughly -2 to 2, multiply by 'scale' for offsets in nodes.
+mgfractal_offset (Mapgen fractal offset) v3f (1.75, 0.0, 0.0)
 
-#    Mandelbrot set: W co-ordinate of the generated 3D slice of the 4D shape.
+#    W co-ordinate of the generated 3D slice of the 4D shape.
 #    Range roughly -2 to 2.
-mgfractal_m_slice_w (Mapgen fractal mandelbrot slice w) float 0.0
+mgfractal_slice_w (Mapgen fractal slice w) float 0.0
 
-#    Julia set: Iterations of the recursive function.
-#    Controls scale of finest detail.
-mgfractal_j_iterations (Mapgen fractal julia iterations) int 9
-
-#    Julia set: Approximate (X,Y,Z) scales in nodes.
-mgfractal_j_scale (Mapgen fractal julia scale) v3f (2048.0, 512.0, 2048.0)
-
-#    Julia set: (X,Y,Z) offsets from world centre.
-#    Range roughly -2 to 2, multiply by j_scale for offsets in nodes.
-mgfractal_j_offset (Mapgen fractal julia offset) v3f (0.0, 1.0, 0.0)
-
-#    Julia set: W co-ordinate of the generated 3D slice of the 4D shape.
-#    Range roughly -2 to 2.
-mgfractal_j_slice_w (Mapgen fractal julia slice w) float 0.0
-
-#    Julia set: X value determining the 4D shape.
+#    Julia set only: X value determining the 4D shape.
 #    Range roughly -2 to 2.
 mgfractal_julia_x (Mapgen fractal julia x) float 0.33
 
-#    Julia set: Y value determining the 4D shape.
+#    Julia set only: Y value determining the 4D shape.
 #    Range roughly -2 to 2.
 mgfractal_julia_y (Mapgen fractal julia y) float 0.33
 
-#    Julia set: Z value determining the 4D shape.
+#    Julia set only: Z value determining the 4D shape.
 #    Range roughly -2 to 2.
 mgfractal_julia_z (Mapgen fractal julia z) float 0.33
 
-#    Julia set: W value determining the 4D shape.
+#    Julia set only: W value determining the 4D shape.
 #    Range roughly -2 to 2.
 mgfractal_julia_w (Mapgen fractal julia w) float 0.33
 
index 74f7006f416477899d39544a5fdd18b18461fc55..39f80bf68301b21d2c1bce92f0b528274a6c7aa3 100644 (file)
 #    type: int
 # mgfractal_formula = 1
 
-#    Mandelbrot set: Iterations of the recursive function.
+#    Iterations of the recursive function.
 #    Controls scale of finest detail.
 #    type: int
-# mgfractal_m_iterations = 9
+# mgfractal_iterations = 9
 
-#    Mandelbrot set: Approximate (X,Y,Z) scales in nodes.
+#    Approximate (X,Y,Z) scales in nodes.
 #    type: v3f
-# mgfractal_m_scale = (1024.0, 256.0, 1024.0)
+# mgfractal_scale = (1024.0, 256.0, 1024.0)
 
-#    Mandelbrot set: (X,Y,Z) offsets from world centre.
-#    Range roughly -2 to 2, multiply by m_scale for offsets in nodes.
+#    (X,Y,Z) offsets from world centre.
+#    Range roughly -2 to 2, multiply by 'scale' for offsets in nodes.
 #    type: v3f
-# mgfractal_m_offset = (1.75, 0.0, 0.0)
+# mgfractal_offset = (1.75, 0.0, 0.0)
 
-#    Mandelbrot set: W co-ordinate of the generated 3D slice of the 4D shape.
+#    W co-ordinate of the generated 3D slice of the 4D shape.
 #    Range roughly -2 to 2.
 #    type: float
-# mgfractal_m_slice_w = 0.0
+# mgfractal_slice_w = 0.0
 
-#    Julia set: Iterations of the recursive function.
-#    Controls scale of finest detail.
-#    type: int
-# mgfractal_j_iterations = 9
-
-#    Julia set: Approximate (X,Y,Z) scales in nodes.
-#    type: v3f
-# mgfractal_j_scale = (2048.0, 512.0, 2048.0)
-
-#    Julia set: (X,Y,Z) offsets from world centre.
-#    Range roughly -2 to 2, multiply by j_scale for offsets in nodes.
-#    type: v3f
-# mgfractal_j_offset = (0.0, 1.0, 0.0)
-
-#    Julia set: W co-ordinate of the generated 3D slice of the 4D shape.
-#    Range roughly -2 to 2.
-#    type: float
-# mgfractal_j_slice_w = 0.0
-
-#    Julia set: X value determining the 4D shape.
+#    Julia set only: 4 values determining the 4D shape.
 #    Range roughly -2 to 2.
 #    type: float
 # mgfractal_julia_x = 0.33
-
-#    Julia set: Y value determining the 4D shape.
-#    Range roughly -2 to 2.
-#    type: float
 # mgfractal_julia_y = 0.33
-
-#    Julia set: Z value determining the 4D shape.
-#    Range roughly -2 to 2.
-#    type: float
 # mgfractal_julia_z = 0.33
-
-#    Julia set: W value determining the 4D shape.
-#    Range roughly -2 to 2.
-#    type: float
 # mgfractal_julia_w = 0.33
 
 #    type: noise_params
index 37ed0d86ae2e1846cbdcda07feff7ddae978b482..89d4e53d380af4aeb7ce1e74a447f51e932526e9 100644 (file)
@@ -59,25 +59,20 @@ MapgenFractal::MapgenFractal(int mapgenid, MapgenParams *params, EmergeManager *
        this->ystride = csize.X;
        this->zstride = csize.X * (csize.Y + 2);
 
-       this->biomemap        = new u8[csize.X * csize.Z];
-       this->heightmap       = new s16[csize.X * csize.Z];
-       this->heatmap         = NULL;
-       this->humidmap        = NULL;
+       this->biomemap  = new u8[csize.X * csize.Z];
+       this->heightmap = new s16[csize.X * csize.Z];
+       this->heatmap   = NULL;
+       this->humidmap  = NULL;
 
        MapgenFractalParams *sp = (MapgenFractalParams *)params->sparams;
        this->spflags = sp->spflags;
 
-       this->formula = sp->formula;
+       this->formula    = sp->formula;
+       this->iterations = sp->iterations;
+       this->scale      = sp->scale;
+       this->offset     = sp->offset;
+       this->slice_w    = sp->slice_w;
 
-       this->m_iterations = sp->m_iterations;
-       this->m_scale = sp->m_scale;
-       this->m_offset = sp->m_offset;
-       this->m_slice_w = sp->m_slice_w;
-
-       this->j_iterations = sp->j_iterations;
-       this->j_scale = sp->j_scale;
-       this->j_offset = sp->j_offset;
-       this->j_slice_w = sp->j_slice_w;
        this->julia_x = sp->julia_x;
        this->julia_y = sp->julia_y;
        this->julia_z = sp->julia_z;
@@ -148,16 +143,11 @@ MapgenFractalParams::MapgenFractalParams()
        spflags = 0;
 
        formula = 1;
+       iterations = 9;
+       scale = v3f(1024.0, 256.0, 1024.0);
+       offset = v3f(1.75, 0.0, 0.0);
+       slice_w = 0.0;
 
-       m_iterations = 9;  // Mandelbrot set only
-       m_scale = v3f(1024.0, 256.0, 1024.0);
-       m_offset = v3f(1.75, 0.0, 0.0);
-       m_slice_w = 0.0;
-
-       j_iterations = 9;  // Julia set only
-       j_scale = v3f(2048.0, 512.0, 2048.0);
-       j_offset = v3f(0.0, 1.0, 0.0);
-       j_slice_w = 0.0;
        julia_x = 0.33;
        julia_y = 0.33;
        julia_z = 0.33;
@@ -175,16 +165,11 @@ void MapgenFractalParams::readParams(const Settings *settings)
        settings->getFlagStrNoEx("mgfractal_spflags", spflags, flagdesc_mapgen_fractal);
 
        settings->getU16NoEx("mgfractal_formula", formula);
+       settings->getU16NoEx("mgfractal_iterations", iterations);
+       settings->getV3FNoEx("mgfractal_scale", scale);
+       settings->getV3FNoEx("mgfractal_offset", offset);
+       settings->getFloatNoEx("mgfractal_slice_w", slice_w);
 
-       settings->getU16NoEx("mgfractal_m_iterations", m_iterations);
-       settings->getV3FNoEx("mgfractal_m_scale", m_scale);
-       settings->getV3FNoEx("mgfractal_m_offset", m_offset);
-       settings->getFloatNoEx("mgfractal_m_slice_w", m_slice_w);
-
-       settings->getU16NoEx("mgfractal_j_iterations", j_iterations);
-       settings->getV3FNoEx("mgfractal_j_scale", j_scale);
-       settings->getV3FNoEx("mgfractal_j_offset", j_offset);
-       settings->getFloatNoEx("mgfractal_j_slice_w", j_slice_w);
        settings->getFloatNoEx("mgfractal_julia_x", julia_x);
        settings->getFloatNoEx("mgfractal_julia_y", julia_y);
        settings->getFloatNoEx("mgfractal_julia_z", julia_z);
@@ -202,16 +187,11 @@ void MapgenFractalParams::writeParams(Settings *settings) const
        settings->setFlagStr("mgfractal_spflags", spflags, flagdesc_mapgen_fractal, U32_MAX);
 
        settings->setU16("mgfractal_formula", formula);
+       settings->setU16("mgfractal_iterations", iterations);
+       settings->setV3F("mgfractal_scale", scale);
+       settings->setV3F("mgfractal_offset", offset);
+       settings->setFloat("mgfractal_slice_w", slice_w);
 
-       settings->setU16("mgfractal_m_iterations", m_iterations);
-       settings->setV3F("mgfractal_m_scale", m_scale);
-       settings->setV3F("mgfractal_m_offset", m_offset);
-       settings->setFloat("mgfractal_m_slice_w", m_slice_w);
-
-       settings->setU16("mgfractal_j_iterations", j_iterations);
-       settings->setV3F("mgfractal_j_scale", j_scale);
-       settings->setV3F("mgfractal_j_offset", j_offset);
-       settings->setFloat("mgfractal_j_slice_w", j_slice_w);
        settings->setFloat("mgfractal_julia_x", julia_x);
        settings->setFloat("mgfractal_julia_y", julia_y);
        settings->setFloat("mgfractal_julia_z", julia_z);
@@ -393,23 +373,21 @@ bool MapgenFractal::getFractalAtPoint(s16 x, s16 y, s16 z)
                cy = julia_y;
                cz = julia_z;
                cw = julia_w;
-               ox = (float)x / j_scale.X - j_offset.X;
-               oy = (float)y / j_scale.Y - j_offset.Y;
-               oz = (float)z / j_scale.Z - j_offset.Z;
-               ow = j_slice_w;
+               ox = (float)x / scale.X - offset.X;
+               oy = (float)y / scale.Y - offset.Y;
+               oz = (float)z / scale.Z - offset.Z;
+               ow = slice_w;
        } else {  // Mandelbrot set
-               cx = (float)x / m_scale.X - m_offset.X;
-               cy = (float)y / m_scale.Y - m_offset.Y;
-               cz = (float)z / m_scale.Z - m_offset.Z;
-               cw = m_slice_w;
+               cx = (float)x / scale.X - offset.X;
+               cy = (float)y / scale.Y - offset.Y;
+               cz = (float)z / scale.Z - offset.Z;
+               cw = slice_w;
                ox = 0.0f;
                oy = 0.0f;
                oz = 0.0f;
                ow = 0.0f;
        }
 
-       u16 iterations = spflags & MGFRACTAL_JULIA ? j_iterations : m_iterations;
-
        for (u16 iter = 0; iter < iterations; iter++) {
                float nx = 0.0f;
                float ny = 0.0f;
index 1b6683f1f218c2684c6fad9f81985433fdc195f6..5800ae20dfe5db9d5ad8cfe51ef0885fb2945b0e 100644 (file)
@@ -37,16 +37,11 @@ struct MapgenFractalParams : public MapgenSpecificParams {
        u32 spflags;
 
        u16 formula;
+       u16 iterations;
+       v3f scale;
+       v3f offset;
+       float slice_w;
 
-       u16 m_iterations;
-       v3f m_scale;
-       v3f m_offset;
-       float m_slice_w;
-
-       u16 j_iterations;
-       v3f j_scale;
-       v3f j_offset;
-       float j_slice_w;
        float julia_x;
        float julia_y;
        float julia_z;
@@ -79,16 +74,11 @@ public:
        v3s16 full_node_max;
 
        u16 formula;
+       u16 iterations;
+       v3f scale;
+       v3f offset;
+       float slice_w;
 
-       u16 m_iterations;
-       v3f m_scale;
-       v3f m_offset;
-       float m_slice_w;
-
-       u16 j_iterations;
-       v3f j_scale;
-       v3f j_offset;
-       float j_slice_w;
        float julia_x;
        float julia_y;
        float julia_z;