Block.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #include <Model3D.h>
  3. #include "Area.h"
  4. #include "BlockType.h"
  5. #include "Registries.h"
  6. #include "FactoryCraftModel.h"
  7. using namespace Framework;
  8. class BasicBlockItemType;
  9. class Chunk;
  10. class Block : public FactoryCraftModel
  11. {
  12. protected:
  13. float hp;
  14. float maxHP;
  15. const BlockType* zType;
  16. bool sideVisible[6];
  17. Vec3<int> location;
  18. unsigned char lightData[6 * 6];
  19. char needRequestModelInfo;
  20. int partOfModel;
  21. void beforeRender(
  22. GraphicsApi* api, Shader* zVertexShader, Shader* zPixelShader) override;
  23. public:
  24. Block(const BlockType* zType,
  25. Vec3<int> position,
  26. Model3DData* model,
  27. Model3DTextur* texture,
  28. int maxHp,
  29. bool transparent,
  30. bool needRequestModelInfo);
  31. virtual ~Block();
  32. void api(char* message);
  33. void copyLightTo(Block* zB);
  34. void setLightData(Direction dir, unsigned char* data);
  35. void setPartOfModel(int type, bool part);
  36. __int64 getMaxLight() const;
  37. const unsigned char* getLightData(Direction dir) const;
  38. bool isVisible() const;
  39. Vec3<int> getLocation() const;
  40. const BlockType* zBlockType() const;
  41. Skeleton* zSkeleton() const;
  42. friend Chunk;
  43. Text printLightInfo();
  44. int getPartOfModels() const;
  45. };