WormCaveGenerator.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #pragma once
  2. #include <Vec3.h>
  3. #include <Array.h>
  4. #include <Punkt.h>
  5. #include "CaveGenerator.h"
  6. #include "Noise.h"
  7. class NoiseWorm3D : public Framework::ReferenceCounter
  8. {
  9. private:
  10. Framework::Punkt startChunk;
  11. Framework::Punkt minAffected;
  12. Framework::Punkt maxAffected;
  13. Framework::Array<Framework::Vec3<float>> keyPoints;
  14. Framework::Array<float> size;
  15. public:
  16. NoiseWorm3D(Noise* pitch, Noise* yaw, Noise* size, Framework::Vec3<int> startPos, int distant, int minRad, int maxRad);
  17. Framework::Punkt getStartChunkCenter();
  18. bool isChunkAffected(int x, int y);
  19. bool isInside(int x, int y, int z);
  20. };
  21. class WormCaveChunkGenerator : public CaveChunkGenerator
  22. {
  23. private:
  24. Framework::RCArray<NoiseWorm3D> worms;
  25. public:
  26. WormCaveChunkGenerator(Framework::RCArray<NoiseWorm3D> worms);
  27. bool isInCave(int x, int y, int z) override;
  28. };
  29. class WormCaveGenerator : public CaveGenerator
  30. {
  31. private:
  32. int maxDistant;
  33. int minDistant;
  34. int maxRadius;
  35. int minRadius;
  36. float cavePosibillity;
  37. Noise* wormStartNoise;
  38. Framework::RCArray<NoiseWorm3D> cache;
  39. Framework::Array<Framework::Punkt > noWormChunks;
  40. NoiseWorm3D* zWormOfChunk(int x, int y);
  41. public:
  42. WormCaveGenerator(int minDistant, int maxDistant, int minRadius, int maxRadius, float cavePosibillityPerChunk);
  43. ~WormCaveGenerator();
  44. void initialize(int seed) override;
  45. CaveChunkGenerator* getGeneratorForChunk(int x, int y) override;
  46. };