WormCaveGenerator.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. 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. NoiseWorm3D* getPartAffectedByChunk(int x, int y);
  26. bool isInside(int x, int y, int z);
  27. };
  28. class WormCaveChunkGenerator : public CaveChunkGenerator
  29. {
  30. private:
  31. Framework::RCArray<NoiseWorm3D> worms;
  32. public:
  33. WormCaveChunkGenerator(Framework::RCArray<NoiseWorm3D> worms);
  34. bool isInCave(int x, int y, int z) override;
  35. };
  36. class WormCaveGenerator : public CaveGenerator
  37. {
  38. private:
  39. int maxDistant;
  40. int minDistant;
  41. int maxRadius;
  42. int minRadius;
  43. float cavePosibillity;
  44. Noise* wormStartNoise;
  45. Framework::RCArray<NoiseWorm3D> cache;
  46. Framework::Array<Framework::Punkt> noWormChunks;
  47. NoiseWorm3D* zWormOfChunk(int x, int y);
  48. public:
  49. WormCaveGenerator(int minDistant,
  50. int maxDistant,
  51. int minRadius,
  52. int maxRadius,
  53. float cavePosibillityPerChunk);
  54. ~WormCaveGenerator();
  55. void initialize(int seed) override;
  56. CaveChunkGenerator* getGeneratorForChunk(int x, int y) override;
  57. };