Block.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #pragma once
  2. #include <Model3D.h>
  3. #include "Area.h"
  4. #include "BlockType.h"
  5. #include "FactoryCraftModel.h"
  6. #include "ModelInfo.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. bool passable;
  24. float speedModifier;
  25. ModelInfo* currentModelInfo;
  26. void beforeRender(
  27. GraphicsApi* api, Shader* zVertexShader, Shader* zPixelShader) override;
  28. public:
  29. Block(const BlockType* zType,
  30. Vec3<int> position,
  31. Model3DData* model,
  32. Model3DTextur* texture,
  33. int maxHp,
  34. bool transparent,
  35. bool needRequestModelInfo,
  36. float size,
  37. bool passable,
  38. float speedModifier);
  39. virtual ~Block();
  40. void setFlow(char flowOptions, char distanceToSource);
  41. void api(char* message);
  42. void copyLightTo(Block* zB);
  43. void setLightData(Direction dir, unsigned char* data, Chunk* zC);
  44. void setPartOfModel(int type, bool part);
  45. __int64 getMaxLight() const;
  46. const unsigned char* getLightData(Direction dir) const;
  47. bool isVisible() const;
  48. Vec3<int> getLocation() const;
  49. const BlockType* zBlockType() const;
  50. Skeleton* zSkeleton() const;
  51. Text printLightInfo();
  52. int getPartOfModels() const;
  53. char getFlowOptions() const;
  54. char getDistanceToSource() const;
  55. const ModelInfo& getCurrentModelInfo() const;
  56. friend Chunk;
  57. };