Block.h 1.6 KB

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