EntityGenerator.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 TypeFactory<EntityGenerator>
  28. {
  29. public:
  30. EntityGeneratorFactory();
  31. EntityGenerator* createValue(
  32. Framework::JSON::JSONObject* zJson) const override;
  33. void fromJson(EntityGenerator* zResult,
  34. Framework::JSON::JSONObject* zJson) const override;
  35. void toJson(EntityGenerator* zObject,
  36. Framework::JSON::JSONObject* zResult) const override;
  37. JSONObjectValidationBuilder* addToValidator(
  38. JSONObjectValidationBuilder* builder) const override;
  39. };