Block.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. short fill;
  22. void beforeRender(
  23. GraphicsApi* api, Shader* zVertexShader, Shader* zPixelShader) override;
  24. public:
  25. Block(const BlockType* zType,
  26. Vec3<int> position,
  27. Model3DData* model,
  28. Model3DTextur* texture,
  29. int maxHp,
  30. bool transparent,
  31. bool needRequestModelInfo);
  32. virtual ~Block();
  33. void setFill(short fill);
  34. void api(char* message);
  35. void copyLightTo(Block* zB);
  36. void setLightData(Direction dir, unsigned char* data);
  37. void setPartOfModel(int type, bool part);
  38. __int64 getMaxLight() const;
  39. const unsigned char* getLightData(Direction dir) const;
  40. bool isVisible() const;
  41. Vec3<int> getLocation() const;
  42. const BlockType* zBlockType() const;
  43. Skeleton* zSkeleton() const;
  44. Text printLightInfo();
  45. int getPartOfModels() const;
  46. short getFill() const;
  47. friend Chunk;
  48. };