StructureCollection.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include <functional>
  3. #include "GeneratorTemplate.h"
  4. #include "JsonExpression.h"
  5. #include "Noise.h"
  6. class StructureTemplateCollection : public virtual Framework::ReferenceCounter
  7. {
  8. private:
  9. Noise* activeNoise;
  10. Framework::JSON::JSONObject* activeNoiseConfig;
  11. Noise* structureNoise;
  12. Framework::JSON::JSONObject* structureNoiseConfig;
  13. double threshold;
  14. Framework::RCArray<GeneratorTemplate> structures;
  15. Framework::Vec3<int> minAffected;
  16. Framework::Vec3<int> maxAffected;
  17. JBoolExpression* condition;
  18. public:
  19. StructureTemplateCollection();
  20. ~StructureTemplateCollection();
  21. void initialize(JExpressionMemory* zMemory);
  22. void generateStructures(int x,
  23. int y,
  24. int z,
  25. int dimensionId,
  26. JExpressionMemory* zMemory,
  27. Framework::Vec3<int> minPos,
  28. Framework::Vec3<int> maxPos,
  29. Framework::RCArray<GeneratedStructure>* zResult);
  30. void setThreshold(double threshold);
  31. double getThreshold() const;
  32. void setCondition(JBoolExpression* condition);
  33. JBoolExpression* zCondition() const;
  34. void setActiveNoiseConfig(Framework::JSON::JSONObject* activeNoiseConfig);
  35. Framework::JSON::JSONObject* zActiveNoiseConfig() const;
  36. void setStructureNoiseConfig(
  37. Framework::JSON::JSONObject* structureNoiseConfig);
  38. Framework::JSON::JSONObject* zStructureNoiseConfig() const;
  39. void addStructure(GeneratorTemplate* structure);
  40. const Framework::RCArray<GeneratorTemplate>& getStructures() const;
  41. Framework::Vec3<int> getMinAffected() const;
  42. Framework::Vec3<int> getMaxAffected() const;
  43. };
  44. class StructureTemplateCollectionFactory
  45. : public TypeFactory<StructureTemplateCollection>
  46. {
  47. public:
  48. StructureTemplateCollectionFactory();
  49. StructureTemplateCollection* createValue(
  50. Framework::JSON::JSONObject* zJson) const override;
  51. void fromJson(StructureTemplateCollection* zResult,
  52. Framework::JSON::JSONObject* zJson) const override;
  53. void toJson(StructureTemplateCollection* zObject,
  54. Framework::JSON::JSONObject* zResult) const override;
  55. JSONObjectValidationBuilder* addToValidator(
  56. JSONObjectValidationBuilder* builder) const override;
  57. };