WormCaveGenerator.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #pragma once
  2. #include <Array.h>
  3. #include <Punkt.h>
  4. #include <Vec3.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,
  17. Noise* yaw,
  18. Noise* size,
  19. Framework::Vec3<int> startPos,
  20. int distant,
  21. int minRad,
  22. int maxRad);
  23. Framework::Punkt getStartChunkCenter();
  24. bool isChunkAffected(int x, int y);
  25. bool isInside(int x, int y, int z);
  26. };
  27. class WormCaveChunkGenerator : public CaveChunkGenerator
  28. {
  29. private:
  30. Framework::RCArray<NoiseWorm3D> worms;
  31. public:
  32. WormCaveChunkGenerator(Framework::RCArray<NoiseWorm3D> worms);
  33. bool isInCave(int x, int y, int z) override;
  34. };
  35. class WormCaveGenerator : public CaveGenerator
  36. {
  37. private:
  38. int maxDistant;
  39. int minDistant;
  40. int maxRadius;
  41. int minRadius;
  42. float cavePosibillity;
  43. Noise* wormStartNoise;
  44. Framework::RCArray<NoiseWorm3D> cache;
  45. Framework::Array<Framework::Punkt> noWormChunks;
  46. NoiseWorm3D* zWormOfChunk(int x, int y);
  47. public:
  48. WormCaveGenerator(int minDistant,
  49. int maxDistant,
  50. int minRadius,
  51. int maxRadius,
  52. float cavePosibillityPerChunk);
  53. ~WormCaveGenerator();
  54. void initialize(int seed) override;
  55. CaveChunkGenerator* getGeneratorForChunk(int x, int y) override;
  56. };