Block.h 1.6 KB

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