Block.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include <Model3D.h>
  3. #include "BlockType.h"
  4. #include "Registries.h"
  5. #include "Area.h"
  6. using namespace Framework;
  7. class BasicBlockItemType;
  8. class Chunk;
  9. class Block : public Model3D
  10. {
  11. protected:
  12. bool transparent;
  13. float hp;
  14. float maxHP;
  15. const BlockType* zType;
  16. bool sideVisible[6];
  17. Vec3<int> location;
  18. Framework::Textur* breakTextur;
  19. unsigned char lightData[6 * 6];
  20. char lightBuffer[24 * 4];
  21. void beforeRender(GraphicsApi* api, Shader* zVertexShader, Shader* zPixelShader) override;
  22. void afterRender(GraphicsApi* api, Shader* zVertexShader, Shader* zPixelShader) override;
  23. public:
  24. Block(const BlockType* zType, Vec3<int> position, Model3DData* model, Model3DTextur* texture, int maxHp);
  25. virtual ~Block();
  26. void api(char* message);
  27. bool isTransparent() const;
  28. void setLightData(Direction dir, unsigned char* data);
  29. bool isVisible() const;
  30. Vec3<int> getLocation() const;
  31. const BlockType* zBlockType() const;
  32. Textur* zEffectTextur() override;
  33. float getEffectPercentage() override;
  34. friend Chunk;
  35. Text printLightInfo();
  36. };