forked from Mirrorlandia_minetest/minetest
Mgfractal: Independant offset and slice params for mandelbrot and julia
Player now spawns on julia set due to julia offset Add commented-out '#include profiler.h' for timetaker use Use v3fs to reduce number of parameters Tune tunnel width to match mgv7
This commit is contained in:
parent
3a4bcf35a1
commit
bda2f56503
@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "content_sao.h"
|
#include "content_sao.h"
|
||||||
#include "nodedef.h"
|
#include "nodedef.h"
|
||||||
#include "voxelalgorithms.h"
|
#include "voxelalgorithms.h"
|
||||||
|
//#include "profiler.h" // For TimeTaker
|
||||||
#include "settings.h" // For g_settings
|
#include "settings.h" // For g_settings
|
||||||
#include "emerge.h"
|
#include "emerge.h"
|
||||||
#include "dungeongen.h"
|
#include "dungeongen.h"
|
||||||
@ -65,14 +66,15 @@ MapgenFractal::MapgenFractal(int mapgenid, MapgenParams *params, EmergeManager *
|
|||||||
|
|
||||||
MapgenFractalParams *sp = (MapgenFractalParams *)params->sparams;
|
MapgenFractalParams *sp = (MapgenFractalParams *)params->sparams;
|
||||||
this->spflags = sp->spflags;
|
this->spflags = sp->spflags;
|
||||||
|
|
||||||
this->iterations = sp->iterations;
|
this->iterations = sp->iterations;
|
||||||
this->scale_x = sp->scale_x;
|
this->scale = sp->scale;
|
||||||
this->scale_y = sp->scale_y;
|
|
||||||
this->scale_z = sp->scale_z;
|
this->moffset = sp->moffset;
|
||||||
this->offset_x = sp->offset_x;
|
this->mslice_w = sp->mslice_w;
|
||||||
this->offset_y = sp->offset_y;
|
|
||||||
this->offset_z = sp->offset_z;
|
this->joffset = sp->joffset;
|
||||||
this->slice_w = sp->slice_w;
|
this->jslice_w = sp->jslice_w;
|
||||||
this->julia_x = sp->julia_x;
|
this->julia_x = sp->julia_x;
|
||||||
this->julia_y = sp->julia_y;
|
this->julia_y = sp->julia_y;
|
||||||
this->julia_z = sp->julia_z;
|
this->julia_z = sp->julia_z;
|
||||||
@ -142,13 +144,13 @@ MapgenFractalParams::MapgenFractalParams()
|
|||||||
spflags = 0;
|
spflags = 0;
|
||||||
|
|
||||||
iterations = 9;
|
iterations = 9;
|
||||||
scale_x = 1024.0;
|
scale = v3f(1024.0, 256.0, 1024.0);
|
||||||
scale_y = 256.0;
|
|
||||||
scale_z = 1024.0;
|
moffset = v3f(1.75, 0.0, 0.0); // Mandelbrot set only
|
||||||
offset_x = -1.75;
|
mslice_w = 0.0;
|
||||||
offset_y = 0.0;
|
|
||||||
offset_z = 0.0;
|
joffset = v3f(0.0, 1.0, 0.0); // Julia set only
|
||||||
slice_w = 0.0;
|
jslice_w = 0.0;
|
||||||
julia_x = 0.33;
|
julia_x = 0.33;
|
||||||
julia_y = 0.33;
|
julia_y = 0.33;
|
||||||
julia_z = 0.33;
|
julia_z = 0.33;
|
||||||
@ -165,13 +167,13 @@ void MapgenFractalParams::readParams(const Settings *settings)
|
|||||||
settings->getFlagStrNoEx("mgfractal_spflags", spflags, flagdesc_mapgen_fractal);
|
settings->getFlagStrNoEx("mgfractal_spflags", spflags, flagdesc_mapgen_fractal);
|
||||||
|
|
||||||
settings->getU16NoEx("mgfractal_iterations", iterations);
|
settings->getU16NoEx("mgfractal_iterations", iterations);
|
||||||
settings->getFloatNoEx("mgfractal_scale_x", scale_x);
|
settings->getV3FNoEx("mgfractal_scale", scale);
|
||||||
settings->getFloatNoEx("mgfractal_scale_y", scale_y);
|
|
||||||
settings->getFloatNoEx("mgfractal_scale_z", scale_z);
|
settings->getV3FNoEx("mgfractal_moffset", moffset);
|
||||||
settings->getFloatNoEx("mgfractal_offset_x", offset_x);
|
settings->getFloatNoEx("mgfractal_mslice_w", mslice_w);
|
||||||
settings->getFloatNoEx("mgfractal_offset_y", offset_y);
|
|
||||||
settings->getFloatNoEx("mgfractal_offset_z", offset_z);
|
settings->getV3FNoEx("mgfractal_joffset", joffset);
|
||||||
settings->getFloatNoEx("mgfractal_slice_w", slice_w);
|
settings->getFloatNoEx("mgfractal_jslice_w", jslice_w);
|
||||||
settings->getFloatNoEx("mgfractal_julia_x", julia_x);
|
settings->getFloatNoEx("mgfractal_julia_x", julia_x);
|
||||||
settings->getFloatNoEx("mgfractal_julia_y", julia_y);
|
settings->getFloatNoEx("mgfractal_julia_y", julia_y);
|
||||||
settings->getFloatNoEx("mgfractal_julia_z", julia_z);
|
settings->getFloatNoEx("mgfractal_julia_z", julia_z);
|
||||||
@ -188,13 +190,13 @@ void MapgenFractalParams::writeParams(Settings *settings) const
|
|||||||
settings->setFlagStr("mgfractal_spflags", spflags, flagdesc_mapgen_fractal, U32_MAX);
|
settings->setFlagStr("mgfractal_spflags", spflags, flagdesc_mapgen_fractal, U32_MAX);
|
||||||
|
|
||||||
settings->setU16("mgfractal_iterations", iterations);
|
settings->setU16("mgfractal_iterations", iterations);
|
||||||
settings->setFloat("mgfractal_scale_x", scale_x);
|
settings->setV3F("mgfractal_scale", scale);
|
||||||
settings->setFloat("mgfractal_scale_y", scale_y);
|
|
||||||
settings->setFloat("mgfractal_scale_z", scale_z);
|
settings->setV3F("mgfractal_moffset", moffset);
|
||||||
settings->setFloat("mgfractal_offset_x", offset_x);
|
settings->setFloat("mgfractal_mslice_w", mslice_w);
|
||||||
settings->setFloat("mgfractal_offset_y", offset_y);
|
|
||||||
settings->setFloat("mgfractal_offset_z", offset_z);
|
settings->setV3F("mgfractal_joffset", joffset);
|
||||||
settings->setFloat("mgfractal_slice_w", slice_w);
|
settings->setFloat("mgfractal_jslice_w", jslice_w);
|
||||||
settings->setFloat("mgfractal_julia_x", julia_x);
|
settings->setFloat("mgfractal_julia_x", julia_x);
|
||||||
settings->setFloat("mgfractal_julia_y", julia_y);
|
settings->setFloat("mgfractal_julia_y", julia_y);
|
||||||
settings->setFloat("mgfractal_julia_z", julia_z);
|
settings->setFloat("mgfractal_julia_z", julia_z);
|
||||||
@ -374,15 +376,15 @@ bool MapgenFractal::getFractalAtPoint(s16 x, s16 y, s16 z)
|
|||||||
cy = julia_y;
|
cy = julia_y;
|
||||||
cz = julia_z;
|
cz = julia_z;
|
||||||
cw = julia_w;
|
cw = julia_w;
|
||||||
ox = (float)x / scale_x + offset_x;
|
ox = (float)x / scale.X - joffset.X;
|
||||||
oy = (float)y / scale_y + offset_y;
|
oy = (float)y / scale.Y - joffset.Y;
|
||||||
oz = (float)z / scale_z + offset_z;
|
oz = (float)z / scale.Z - joffset.Z;
|
||||||
ow = slice_w;
|
ow = jslice_w;
|
||||||
} else { // Mandelbrot set
|
} else { // Mandelbrot set
|
||||||
cx = (float)x / scale_x + offset_x;
|
cx = (float)x / scale.X - moffset.X;
|
||||||
cy = (float)y / scale_y + offset_y;
|
cy = (float)y / scale.Y - moffset.Y;
|
||||||
cz = (float)z / scale_z + offset_z;
|
cz = (float)z / scale.Z - moffset.Z;
|
||||||
cw = slice_w;
|
cw = mslice_w;
|
||||||
ox = 0.0f;
|
ox = 0.0f;
|
||||||
oy = 0.0f;
|
oy = 0.0f;
|
||||||
oz = 0.0f;
|
oz = 0.0f;
|
||||||
@ -603,7 +605,7 @@ void MapgenFractal::generateCaves(s16 max_stone_y)
|
|||||||
for (s16 x = node_min.X; x <= node_max.X; x++, vi++, index++) {
|
for (s16 x = node_min.X; x <= node_max.X; x++, vi++, index++) {
|
||||||
float d1 = contour(noise_cave1->result[index]);
|
float d1 = contour(noise_cave1->result[index]);
|
||||||
float d2 = contour(noise_cave2->result[index]);
|
float d2 = contour(noise_cave2->result[index]);
|
||||||
if (d1 * d2 > 0.3) {
|
if (d1 * d2 > 0.4f) {
|
||||||
content_t c = vm->m_data[vi].getContent();
|
content_t c = vm->m_data[vi].getContent();
|
||||||
if (!ndef->get(c).is_ground_content || c == CONTENT_AIR)
|
if (!ndef->get(c).is_ground_content || c == CONTENT_AIR)
|
||||||
continue;
|
continue;
|
||||||
|
@ -37,13 +37,13 @@ struct MapgenFractalParams : public MapgenSpecificParams {
|
|||||||
u32 spflags;
|
u32 spflags;
|
||||||
|
|
||||||
u16 iterations;
|
u16 iterations;
|
||||||
float scale_x;
|
v3f scale;
|
||||||
float scale_y;
|
|
||||||
float scale_z;
|
v3f moffset;
|
||||||
float offset_x;
|
float mslice_w;
|
||||||
float offset_y;
|
|
||||||
float offset_z;
|
v3f joffset;
|
||||||
float slice_w;
|
float jslice_w;
|
||||||
float julia_x;
|
float julia_x;
|
||||||
float julia_y;
|
float julia_y;
|
||||||
float julia_z;
|
float julia_z;
|
||||||
@ -75,13 +75,13 @@ public:
|
|||||||
v3s16 full_node_max;
|
v3s16 full_node_max;
|
||||||
|
|
||||||
u16 iterations;
|
u16 iterations;
|
||||||
float scale_x;
|
v3f scale;
|
||||||
float scale_y;
|
|
||||||
float scale_z;
|
v3f moffset;
|
||||||
float offset_x;
|
float mslice_w;
|
||||||
float offset_y;
|
|
||||||
float offset_z;
|
v3f joffset;
|
||||||
float slice_w;
|
float jslice_w;
|
||||||
float julia_x;
|
float julia_x;
|
||||||
float julia_y;
|
float julia_y;
|
||||||
float julia_z;
|
float julia_z;
|
||||||
|
Loading…
Reference in New Issue
Block a user