|
@@ -10,6 +10,7 @@
|
|
|
#include "FastNoiseLite.h"
|
|
|
#include "FastNoiseWrapper.h"
|
|
|
#include "RandNoise.h"
|
|
|
+#include "ShapedNoise.h"
|
|
|
|
|
|
using namespace Framework;
|
|
|
|
|
@@ -20,6 +21,8 @@ int zoom = 1;
|
|
|
bool exitF = 0;
|
|
|
Noise* wrapper;
|
|
|
float border = 0.5;
|
|
|
+float border2 = -1;
|
|
|
+bool showValue = 1;
|
|
|
|
|
|
void updateView()
|
|
|
{
|
|
@@ -38,20 +41,31 @@ void updateView()
|
|
|
pos -= Vec3<int>(img->getBreite() / 2, img->getHeight() / 2, 0);
|
|
|
pos /= zoom;
|
|
|
pos += position;
|
|
|
- if (wrapper->getNoise(pos.x, pos.y, pos.z) < border)
|
|
|
+ double noise = wrapper->getNoise(pos.x, pos.y, pos.z);
|
|
|
+ if (showValue)
|
|
|
{
|
|
|
- img->setPixelDP(i, j, 0xFFFFFFFF);
|
|
|
- counter++;
|
|
|
+ int value = (int)(noise * 255);
|
|
|
+ img->setPixelDP(
|
|
|
+ i, j, 0xFF000000 | (value << 16) | (value << 8) | value);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- img->setPixelDP(i, j, 0xFF000000);
|
|
|
+ if (noise < border && noise > border2)
|
|
|
+ {
|
|
|
+ img->setPixelDP(i, j, 0xFFFFFFFF);
|
|
|
+ counter++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ img->setPixelDP(i, j, 0xFF000000);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
float percentage = ((float)counter / (img->getBreite() * img->getHeight())) * 100;
|
|
|
std::cout << "Showing " << minP.x << " " << minP.y << " to " << maxP.x
|
|
|
<< " " << maxP.y << " at height " << position.z << " with border "
|
|
|
+ << border2 << " to "
|
|
|
<< border << " true for " << percentage << "% of "
|
|
|
<< (img->getBreite() / zoom) * (img->getHeight() / zoom) << " blocks"
|
|
|
<< std::endl;
|
|
@@ -64,15 +78,26 @@ int main()
|
|
|
noise->SetNoiseType(FastNoiseLite::NoiseType::NoiseType_ValueCubic);
|
|
|
noise->SetFrequency(3.f);
|
|
|
wrapper = new FastNoiseWrapper(noise, 0);*/
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- wrapper = new RandNoise(0);
|
|
|
+ FastNoiseLite* n = new FastNoiseLite(0);
|
|
|
+ n->SetNoiseType(FastNoiseLite::NoiseType::NoiseType_Cellular);
|
|
|
+ n->SetFrequency(0.005f);
|
|
|
+ n->SetRotationType3D(FastNoiseLite::RotationType3D::RotationType3D_None);
|
|
|
+ n->SetCellularDistanceFunction(FastNoiseLite::CellularDistanceFunction::
|
|
|
+ CellularDistanceFunction_Hybrid);
|
|
|
+ n->SetCellularJitter(1.f);
|
|
|
+ n->SetCellularReturnType(
|
|
|
+ FastNoiseLite::CellularReturnType::CellularReturnType_CellValue);
|
|
|
+ n->SetFractalType(
|
|
|
+ FastNoiseLite::FractalType::FractalType_DomainWarpIndependent);
|
|
|
+ n->SetDomainWarpType(
|
|
|
+ FastNoiseLite::DomainWarpType::DomainWarpType_OpenSimplex2);
|
|
|
+ n->SetDomainWarpAmp(100.f);
|
|
|
+ n->SetFractalOctaves(3.f);
|
|
|
+ n->SetFractalLacunarity(2.f);
|
|
|
+ n->SetFractalGain(0.5f);
|
|
|
+ wrapper = new FastNoiseWrapper(n, 0);
|
|
|
+ wrapper = new ShapedNoise(wrapper);
|
|
|
+ ((ShapedNoise*)wrapper)->setNeighborOffset(4.f);
|
|
|
|
|
|
|
|
|
img = new Bild();
|
|
@@ -137,6 +162,13 @@ int main()
|
|
|
border = (float)*x;
|
|
|
updateView();
|
|
|
x->release();
|
|
|
+ }
|
|
|
+ if (txt.positionVon("border2 ") == 0)
|
|
|
+ {
|
|
|
+ Text* x = txt.getTeilText(7);
|
|
|
+ border2 = (float)*x;
|
|
|
+ updateView();
|
|
|
+ x->release();
|
|
|
}
|
|
|
if (txt.positionVon("zoom ") == 0)
|
|
|
{
|
|
@@ -144,7 +176,17 @@ int main()
|
|
|
zoom = (int)*x;
|
|
|
updateView();
|
|
|
x->release();
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (txt.positionVon("show value") == 0)
|
|
|
+ {
|
|
|
+ showValue = 1;
|
|
|
+ updateView();
|
|
|
+ }
|
|
|
+ if (txt.positionVon("show border") == 0)
|
|
|
+ {
|
|
|
+ showValue = 0;
|
|
|
+ updateView();
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -155,7 +197,6 @@ int main()
|
|
|
rth->beenden();
|
|
|
window->setBildschirm(0);
|
|
|
rth->release();
|
|
|
- img->release();
|
|
|
Framework::releaseFramework();
|
|
|
return 0;
|
|
|
}
|