Block.h 1.2 KB

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