Mgfractal: Move julia set selection into formula parameter
authorparamat <mat.gregory@virginmedia.com>
Sat, 21 Nov 2015 20:22:45 +0000 (20:22 +0000)
committerparamat <mat.gregory@virginmedia.com>
Mon, 23 Nov 2015 00:34:09 +0000 (00:34 +0000)
Improve default parameters
Update and improve documentation
Unhide mapgen, but is still unstable

builtin/settingtypes.txt
minetest.conf.example
src/emerge.cpp
src/mapgen_fractal.cpp
src/mapgen_fractal.h

index cb38ec118161c8e43ba15474ee1ae88f623b2016..2929b860bb81e6e99733677247480367b7a87b31 100644 (file)
@@ -970,29 +970,33 @@ mgflat_np_cave2 (Mapgen flat cave2 noise parameters) noise_params 0, 12, (128, 1
 
 [***Mapgen fractal]
 
-#    Map generation attributes specific to Mapgen fractal.
-#    The 'julia' flag results in the corresponding julia set being generated.
-#    Flags that are not specified in the flag string are not modified from the default.
-#    Flags starting with "no" are used to explicitly disable them.
-mgfractal_spflags (Mapgen fractal flags) flags nojulia julia,nojulia
-
-#    Choice of 4 mandelbrot set variations.
-#    1 = 4D "Roundy" mandelbrot set, 2 = 4D "Squarry" mandelbrot set,
-#    3 = 4D "Mandy Cousin" mandelbrot set, 4 = 4D mandelbrot set variation.
-mgfractal_formula (Mapgen fractal formula) int 1 1 4
+#    Choice of 8 4-dimensional fractals.
+#    1 = "Roundy" mandelbrot set.
+#    2 = "Roundy" julia set.
+#    3 = "Squarry" mandelbrot set.
+#    4 = "Squarry" julia set.
+#    5 = "Mandy Cousin" mandelbrot set.
+#    6 = "Mandy Cousin" julia set.
+#    7 = "Variation" mandelbrot set.
+#    8 = "Variation" julia set.
+mgfractal_formula (Mapgen fractal formula) int 1 1 8
 
 #    Iterations of the recursive function.
 #    Controls scale of finest detail.
-mgfractal_iterations (Mapgen fractal iterations) int 9
+mgfractal_iterations (Mapgen fractal iterations) int 11
 
-#    Approximate (X,Y,Z) scales in nodes.
-mgfractal_scale (Mapgen fractal scale) v3f (1024.0, 256.0, 1024.0)
+#    Approximate (X,Y,Z) scale of fractal in nodes.
+mgfractal_scale (Mapgen fractal scale) v3f (4096.0, 1024.0, 4096.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)
+#    (X,Y,Z) offset of fractal from world centre.
+#    Used to move a suitable spawn area of low land close to (0, 0).
+#    The default is suitable for mandelbrot sets, it needs to be edited for julia sets,
+#    do this by greatly reducing 'scale' and setting 'offset' initially to (0, 0, 0).
+#    Range roughly -2 to 2. Multiply by 'scale' for offset in nodes.
+mgfractal_offset (Mapgen fractal offset) v3f (1.79, 0.0, 0.0)
 
 #    W co-ordinate of the generated 3D slice of the 4D shape.
+#    Alters the generated 3D shape.
 #    Range roughly -2 to 2.
 mgfractal_slice_w (Mapgen fractal slice w) float 0.0
 
index d8534a0f57a07fef4dba29725b87683113ab89ed..37d622d3d15026d92e260039d59832fff5fee711 100644 (file)
 
 #### Mapgen fractal
 
-#    Map generation attributes specific to Mapgen fractal.
-#    The 'julia' flag results in the corresponding julia set being generated.
-#    Flags that are not specified in the flag string are not modified from the default.
-#    Flags starting with "no" are used to explicitly disable them.
-#    type: flags possible values: julia, nojulia
-# mgfractal_spflags = nojulia
-
-#    Choice of 4 mandelbrot set variations.
-#    1 = 4D "Roundy" mandelbrot set, 2 = 4D "Squarry" mandelbrot set,
-#    3 = 4D "Mandy Cousin" mandelbrot set, 4 = 4D mandelbrot set variation.
+#    Choice of 8 4-dimensional fractals.
+#    1 = "Roundy" mandelbrot set.
+#    2 = "Roundy" julia set.
+#    3 = "Squarry" mandelbrot set.
+#    4 = "Squarry" julia set.
+#    5 = "Mandy Cousin" mandelbrot set.
+#    6 = "Mandy Cousin" julia set.
+#    7 = "Variation" mandelbrot set.
+#    8 = "Variation" julia set.
 #    type: int
 # mgfractal_formula = 1
 
 #    Iterations of the recursive function.
 #    Controls scale of finest detail.
 #    type: int
-# mgfractal_iterations = 9
+# mgfractal_iterations = 11
 
-#    Approximate (X,Y,Z) scales in nodes.
+#    Approximate (X,Y,Z) scale of fractal in nodes.
 #    type: v3f
-# mgfractal_scale = (1024.0, 256.0, 1024.0)
+# mgfractal_scale = (4096.0, 1024.0, 4096.0)
 
-#    (X,Y,Z) offsets from world centre.
-#    Range roughly -2 to 2, multiply by 'scale' for offsets in nodes.
+#    (X,Y,Z) offset of fractal from world centre.
+#    Used to move a suitable spawn area of low land close to (0, 0).
+#    The default is suitable for mandelbrot sets, it needs to be edited for julia sets,
+#    do this by greatly reducing 'scale' and setting 'offset' initially to (0, 0, 0).
+#    Range roughly -2 to 2. Multiply by 'scale' for offset in nodes.
 #    type: v3f
-# mgfractal_offset = (1.75, 0.0, 0.0)
+# mgfractal_offset = (1.79, 0.0, 0.0)
 
 #    W co-ordinate of the generated 3D slice of the 4D shape.
+#    Alters the generated 3D shape.
 #    Range roughly -2 to 2.
 #    type: float
 # mgfractal_slice_w = 0.0
 
-#    Julia set only: 4 values determining the 4D shape.
+#    Julia set only: X value determining the 4D shape.
 #    Range roughly -2 to 2.
 #    type: float
 # mgfractal_julia_x = 0.33
+
+#    Julia set only: Y value determining the 4D shape.
+#    Range roughly -2 to 2.
+#    type: float
 # mgfractal_julia_y = 0.33
+
+#    Julia set only: Z value determining the 4D shape.
+#    Range roughly -2 to 2.
+#    type: float
 # mgfractal_julia_z = 0.33
+
+#    Julia set only: W value determining the 4D shape.
+#    Range roughly -2 to 2.
+#    type: float
 # mgfractal_julia_w = 0.33
 
 #    type: noise_params
index a60f67ac52166d3bc5e35b929a02c3f48594a431..6d4d84d7fad081ec33f5a816ca5607e5e749a0a7 100644 (file)
@@ -107,7 +107,7 @@ MapgenDesc g_reg_mapgens[] = {
        {"v6",         new MapgenFactoryV6,         true},
        {"v7",         new MapgenFactoryV7,         true},
        {"flat",       new MapgenFactoryFlat,       false},
-       {"fractal",    new MapgenFactoryFractal,    false},
+       {"fractal",    new MapgenFactoryFractal,    true},
        {"singlenode", new MapgenFactorySinglenode, false},
 };
 
index 26ebec353a5422083477938daa3ebb91cddfa9ee..676e2f446764e326e35cadd5eca5b7f975431ac5 100644 (file)
@@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "content_sao.h"
 #include "nodedef.h"
 #include "voxelalgorithms.h"
-#include "profiler.h" // For TimeTaker
+//#include "profiler.h" // For TimeTaker
 #include "settings.h" // For g_settings
 #include "emerge.h"
 #include "dungeongen.h"
@@ -41,7 +41,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 
 FlagDesc flagdesc_mapgen_fractal[] = {
-       {"julia", MGFRACTAL_JULIA},
        {NULL,    0}
 };
 
@@ -143,9 +142,9 @@ MapgenFractalParams::MapgenFractalParams()
        spflags = 0;
 
        formula = 1;
-       iterations = 9;
-       scale = v3f(1024.0, 256.0, 1024.0);
-       offset = v3f(1.75, 0.0, 0.0);
+       iterations = 11;
+       scale = v3f(4096.0, 1024.0, 4096.0);
+       offset = v3f(1.79, 0.0, 0.0);
        slice_w = 0.0;
 
        julia_x = 0.33;
@@ -236,7 +235,7 @@ void MapgenFractal::makeChunk(BlockMakeData *data)
        this->generating = true;
        this->vm   = data->vmanip;
        this->ndef = data->nodedef;
-       TimeTaker t("makeChunk");
+       //TimeTaker t("makeChunk");
 
        v3s16 blockpos_min = data->blockpos_min;
        v3s16 blockpos_max = data->blockpos_max;
@@ -319,7 +318,7 @@ void MapgenFractal::makeChunk(BlockMakeData *data)
        // Sprinkle some dust on top after everything else was generated
        dustTopNodes();
 
-       printf("makeChunk: %dms\n", t.stop());
+       //printf("makeChunk: %dms\n", t.stop());
 
        updateLiquid(&data->transforming_liquid, full_node_min, full_node_max);
 
@@ -369,7 +368,7 @@ bool MapgenFractal::getFractalAtPoint(s16 x, s16 y, s16 z)
 {
        float cx, cy, cz, cw, ox, oy, oz, ow;
 
-       if (spflags & MGFRACTAL_JULIA) {  // Julia set
+       if (formula % 2 == 0) {  // Julia sets, formula = 2, 4, 6, 8
                cx = julia_x;
                cy = julia_y;
                cz = julia_z;
@@ -378,7 +377,7 @@ bool MapgenFractal::getFractalAtPoint(s16 x, s16 y, s16 z)
                oy = (float)y / scale.Y - offset.Y;
                oz = (float)z / scale.Z - offset.Z;
                ow = slice_w;
-       } else {  // Mandelbrot set
+       } else {  // Mandelbrot sets, formula = 1, 3, 5, 7
                cx = (float)x / scale.X - offset.X;
                cy = (float)y / scale.Y - offset.Y;
                cz = (float)z / scale.Z - offset.Z;
@@ -395,22 +394,22 @@ bool MapgenFractal::getFractalAtPoint(s16 x, s16 y, s16 z)
                float nz = 0.0f;
                float nw = 0.0f;
 
-               if (formula == 1) {  // 4D "Roundy" Mandelbrot Set
+               if (formula == 1 || formula == 2) {  // 4D "Roundy" Mandelbrot/Julia Set
                        nx = ox * ox - oy * oy - oz * oz - ow * ow + cx;
                        ny = 2.0f * (ox * oy + oz * ow) + cy;
                        nz = 2.0f * (ox * oz + oy * ow) + cz;
                        nw = 2.0f * (ox * ow + oy * oz) + cw;
-               } else if (formula == 2) {  // 4D "Squarry" Mandelbrot Set
+               } else if (formula == 3 || formula == 4) {  // 4D "Squarry" Mandelbrot/Julia Set
                        nx = ox * ox - oy * oy - oz * oz - ow * ow + cx;
                        ny = 2.0f * (ox * oy + oz * ow) + cy;
                        nz = 2.0f * (ox * oz + oy * ow) + cz;
                        nw = 2.0f * (ox * ow - oy * oz) + cw;
-               } else if (formula == 3) {  // 4D "Mandy Cousin" Mandelbrot Set
+               } else if (formula == 5 || formula == 6) {  // 4D "Mandy Cousin" Mandelbrot/Julia Set
                        nx = ox * ox - oy * oy - oz * oz + ow * ow + cx;
                        ny = 2.0f * (ox * oy + oz * ow) + cy;
                        nz = 2.0f * (ox * oz + oy * ow) + cz;
                        nw = 2.0f * (ox * ow + oy * oz) + cw;
-               } else if (formula == 4) {  // 4D Mandelbrot Set Variation
+               } else if (formula == 7 || formula == 8) {  // 4D "Variation" Mandelbrot/Julia Set
                        nx = ox * ox - oy * oy - oz * oz - ow * ow + cx;
                        ny = 2.0f * (ox * oy + oz * ow) + cy;
                        nz = 2.0f * (ox * oz - oy * ow) + cz;
index 5800ae20dfe5db9d5ad8cfe51ef0885fb2945b0e..7d31a43b8241926bf7642746928c9013ecf735c6 100644 (file)
@@ -25,9 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #define MGFRACTAL_LARGE_CAVE_DEPTH -33
 
-/////////////////// Mapgen Fractal flags
-#define MGFRACTAL_JULIA 0x01
-
 class BiomeManager;
 
 extern FlagDesc flagdesc_mapgen_fractal[];