World.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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(Chunk* zChunk, bool visible);
  43. void setVisibility(Entity* zEntity, bool visible);
  44. Framework::Punkt getChunkCenter(int x, int y) const;
  45. Entity* zEntity(int id) const;
  46. Entity* getEntity(int id) const;
  47. void removeEntity(int id);
  48. PlayerKam* zKamera() const;
  49. int getCurrentPlayerId() const;
  50. Entity* getCurrentPlayerEntity() const;
  51. void setTarget(Framework::Model3D* zTarget);
  52. void lockWorld();
  53. void unlockWorld();
  54. void onChunkAdded(Punkt pos);
  55. Chunk* zChunk(Punkt center);
  56. Framework::Model3D* getCurrentTarget() const;
  57. FactoryCraftModel* zSelectedEffectModel() const;
  58. FactoryClient* zClient() const;
  59. float getDayLightFactor() const;
  60. Framework::DXBuffer* zFallbackVertexLightBuffer();
  61. };