EntityGenerator.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include <Vec3.h>
  3. #include "TypeRegistry.h"
  4. class EntityType;
  5. class Entity;
  6. class JBoolExpression;
  7. class JExpressionMemory;
  8. class Noise;
  9. class EntityGeneratorFactory;
  10. class EntityGenerator : public Framework::ReferenceCounter
  11. {
  12. private:
  13. Noise* noise;
  14. Framework::JSON::JSONObject* noiseConfig;
  15. double threshold;
  16. const EntityType* zType;
  17. JBoolExpression* condition;
  18. public:
  19. EntityGenerator();
  20. ~EntityGenerator();
  21. void initialize(JExpressionMemory* zMemory);
  22. bool isGenerated(
  23. int x, int y, int z, int dimensionId, JExpressionMemory* zMemory);
  24. Entity* generate(Framework::Vec3<float> pos, int dimesnionId);
  25. friend EntityGeneratorFactory;
  26. };
  27. class EntityGeneratorFactory : public ObjectTypeFactory<EntityGenerator>
  28. {
  29. public:
  30. EntityGeneratorFactory();
  31. EntityGenerator* fromJson(
  32. Framework::JSON::JSONObject* zJson) const override;
  33. Framework::JSON::JSONObject* toJsonObject(
  34. EntityGenerator* zObject) const override;
  35. JSONObjectValidationBuilder* addToValidator(
  36. JSONObjectValidationBuilder* builder) const override;
  37. };