Block.h 1.8 KB

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