123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- #include <AsynchronCall.h>
- #include <Bild.h>
- #include <Bildschirm.h>
- #include <Fenster.h>
- #include <Globals.h>
- #include <iostream>
- #include <RenderThread.h>
- #include <string.h>
- #include "FactorizeNoise.h"
- #include "FastNoiseLite.h"
- #include "FastNoiseWrapper.h"
- #include "MultiplyNoise.h"
- #include "NoiseCombiner.h"
- #include "RandNoise.h"
- #include "ShapedNoise.h"
- using namespace Framework;
- WFenster* window;
- Bild* img;
- Vec3<int> position(0, 0, 0);
- float zoom = 1;
- bool exitF = 0;
- Noise* wrapper;
- float border = 0.5;
- float border2 = -1;
- bool showValue = 1;
- class A
- {
- virtual void f(){};
- };
- class B : public A
- {
- virtual void f() override{};
- };
- class C : public B
- {
- virtual void f() override{};
- };
- void updateView()
- {
- Vec3<int> minP
- = position
- - (Vec3<int>)Vec3<float>(
- (float)img->getBreite() / 2.f, (float)img->getHeight() / 2.f, 0.f)
- / zoom;
- Vec3<int> maxP
- = position
- + (Vec3<int>)Vec3<float>(
- (float)img->getBreite() / 2.f, (float)img->getHeight() / 2.f, 0.f)
- / zoom;
- int counter = 0;
- double min = INFINITY;
- double max = -INFINITY;
- for (int i = 0; i < img->getBreite(); i++)
- {
- for (int j = 0; j < img->getHeight(); j++)
- {
- Vec3<float> pos(i, j, 0);
- pos -= Vec3<int>(img->getBreite() / 2, img->getHeight() / 2, 0);
- pos /= zoom;
- pos += position;
- double noise = wrapper->getNoise(pos.x, pos.y, pos.z);
- if (noise > max)
- {
- max = noise;
- }
- if (noise < min)
- {
- min = noise;
- }
- if (showValue)
- {
- int value = (int)(noise * 255);
- img->setPixelDP(
- i, j, 0xFF000000 | (value << 16) | (value << 8) | value);
- }
- else
- {
- 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. Min: " << min << " Max: " << max << std::endl;
- }
- int main()
- {
- A* c = new C();
- A* b = new B();
- A* a = new A();
- std::cout << typeid(*c).name() << std::endl;
- std::cout << typeid(*b).name() << std::endl;
- std::cout << typeid(*a).name() << std::endl;
- delete a;
- delete b;
- delete c;
-
- return 0;
- }
|