WormCaveGenerator.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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::Vec3<int> minAffected;
  12. Framework::Vec3<int> maxAffected;
  13. Framework::Array<Framework::Vec3<float>> keyPoints;
  14. Framework::Array<float> size;
  15. NoiseWorm3D();
  16. public:
  17. NoiseWorm3D(Noise* pitch,
  18. Noise* yaw,
  19. Noise* size,
  20. Framework::Vec3<int> startPos,
  21. int distant,
  22. int minRad,
  23. int maxRad);
  24. Framework::Punkt getStartChunkCenter();
  25. void getPartAffectedByChunk(
  26. int x, int y, Framework::RCArray<NoiseWorm3D>* zResult);
  27. bool isInside(int x, int y, int z);
  28. };
  29. class WormCaveChunkGenerator : public CaveChunkGenerator
  30. {
  31. private:
  32. Framework::RCArray<NoiseWorm3D> worms;
  33. public:
  34. WormCaveChunkGenerator(Framework::RCArray<NoiseWorm3D> worms);
  35. bool isInCave(int x, int y, int z) override;
  36. };
  37. class WormCaveGenerator : public CaveGenerator
  38. {
  39. private:
  40. int maxDistant;
  41. int minDistant;
  42. int maxRadius;
  43. int minRadius;
  44. float cavePosibillity;
  45. Noise* wormStartNoise;
  46. Framework::RCArray<NoiseWorm3D> cache;
  47. Framework::Array<Framework::Punkt> noWormChunks;
  48. NoiseWorm3D* zWormOfChunk(int x, int y);
  49. public:
  50. WormCaveGenerator(int minDistant,
  51. int maxDistant,
  52. int minRadius,
  53. int maxRadius,
  54. float cavePosibillityPerChunk,
  55. int seed);
  56. ~WormCaveGenerator();
  57. CaveChunkGenerator* getGeneratorForChunk(int x, int y) override;
  58. };