Block.h 1.5 KB

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