World.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #pragma once
  2. #include <Bildschirm.h>
  3. #include <Kam3D.h>
  4. #include <Thread.h>
  5. #include <Welt3D.h>
  6. #include "Dimension.h"
  7. #include "FactoryClient.h"
  8. #include "PlayerKam.h"
  9. class World : public Framework::Thread
  10. {
  11. public:
  12. static World* INSTANCE;
  13. private:
  14. Dimension* currentDimension;
  15. Framework::Welt3D* renderedWorld;
  16. Framework::Bildschirm3D* zScreenPtr;
  17. PlayerKam* kam;
  18. bool firstMessage;
  19. int ownEntityId;
  20. Framework::Model3D* currentTarget;
  21. Array<Punkt> subscriptions;
  22. FactoryClient* client;
  23. FactoryCraftModel* selectionModel;
  24. Critical subLock;
  25. Critical targetLock;
  26. float dayLightFactor;
  27. double time;
  28. double dayLength;
  29. double transitionLength;
  30. double nightLength;
  31. Framework::DXBuffer* fallbackVertexLightBuffer;
  32. public:
  33. World(Framework::Bildschirm3D* zScreen, FactoryClient* client);
  34. ~World();
  35. void update(bool background);
  36. void onTick(double time);
  37. void setChunk(Chunk* chunk);
  38. void thread() override;
  39. Block* zBlockAt(Framework::Vec3<int> location) const;
  40. Block* getBlockAt(Framework::Vec3<int> location) const;
  41. Dimension* zDimension() const;
  42. void setVisibility(Entity* zEntity, bool visible);
  43. Framework::Punkt getChunkCenter(int x, int y) const;
  44. Entity* zEntity(int id) const;
  45. Entity* getEntity(int id) const;
  46. void removeEntity(int id);
  47. PlayerKam* zKamera() const;
  48. int getCurrentPlayerId() const;
  49. Entity* getCurrentPlayerEntity() const;
  50. void setTarget(Framework::Model3D* zTarget);
  51. void lockWorld();
  52. void unlockWorld();
  53. void onChunkAdded(Punkt pos);
  54. Chunk* zChunk(Punkt center);
  55. Framework::Model3D* getCurrentTarget() const;
  56. FactoryCraftModel* zSelectedEffectModel() const;
  57. FactoryClient* zClient() const;
  58. float getDayLightFactor() const;
  59. Framework::DXBuffer* zFallbackVertexLightBuffer();
  60. };