32 void Serialize(uint8_t * buffer)
const override;
34 uint32_t
Size()
const override;
38 std::shared_ptr<IPacket>
Clone()
const override;
43 std::shared_ptr<Chunk>
GetChunk()
const;
Definition: ChunkPacket.hpp:8
ChunkPacket()
Definition: ChunkPacket.cpp:3
ChunkPacket & operator=(ChunkPacket &other)
Definition: ChunkPacket.cpp:27
bool HasDynamicSize() const override
Tell if the packet has a dynamic size.
Definition: ChunkPacket.cpp:74
~ChunkPacket()
Definition: ChunkPacket.cpp:13
IPacket::Type GetType() const override
Get the Type of the packet.
Definition: ChunkPacket.cpp:79
std::shared_ptr< Chunk > GetChunk() const
Definition: ChunkPacket.cpp:89
void Serialize(uint8_t *buffer) const override
will write the packet in the buffer, the buffer must at least be of size Size()
Definition: ChunkPacket.cpp:47
std::shared_ptr< IPacket > Clone() const override
Create a new instance of the packet.
Definition: ChunkPacket.cpp:84
void SetChunk(const Chunk &chunk)
Definition: ChunkPacket.cpp:94
uint32_t Size() const override
return the size of the packet in bytes, usually used to reserve the right amount of memory in the sen...
Definition: ChunkPacket.cpp:69
void Deserialize(const uint8_t *buffer) override
read the packet from the buffer, the buffer must at least be of size Size()
Definition: ChunkPacket.cpp:59
std::array< uint8_t, BLOCKS_PER_CHUNK > LightArray
Definition: Chunk.hpp:69
std::array< biomeInfo, CHUNK_X_SIZE *CHUNK_Z_SIZE > BiomeArray
Definition: Chunk.hpp:73
std::array< BlockInfo::Type, BLOCKS_PER_CHUNK > BlockArray
Definition: Chunk.hpp:68
an abstract class that servers as a base for all network packets
Definition: IPacket.hpp:40
Type
Definition: IPacket.hpp:48
Definition: ChunkPacket.hpp:11
Chunk::BiomeArray biomes
Definition: ChunkPacket.hpp:20
Chunk::LightArray light
Definition: ChunkPacket.hpp:19
glm::ivec3 chunk_pos
Definition: ChunkPacket.hpp:17
Chunk::BlockArray blocks
Definition: ChunkPacket.hpp:18
ChunkData(const glm::ivec3 &chunk_pos, const Chunk::BlockArray &blocks, const Chunk::LightArray &light, const Chunk::BiomeArray &biomes)
Definition: ChunkPacket.hpp:13