VOX
A little voxel engine
Loading...
Searching...
No Matches
ChunkUnloadPacket.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "IPacket.hpp"
4#include "glm/vec3.hpp"
5
7{
8public:
10 ChunkUnloadPacket(const glm::ivec3 & chunk_position);
12
17
18 void Serialize(uint8_t * buffer) const override;
19 void Deserialize(const uint8_t * buffer) override;
20 uint32_t Size() const override;
21 bool HasDynamicSize() const override;
22 IPacket::Type GetType() const override;
23
24 std::shared_ptr<IPacket> Clone() const override;
25
26 /*******************************
27 * ATTRIBUTES
28 * ****************************/
29 glm::ivec3 GetChunkPosition() const;
30
31 void SetChunkPosition(const glm::ivec3 & chunk_position);
32private:
33 glm::ivec3 m_chunk_pos;
34};
Definition: ChunkUnloadPacket.hpp:7
std::shared_ptr< IPacket > Clone() const override
Create a new instance of the packet.
Definition: ChunkUnloadPacket.cpp:80
void Deserialize(const uint8_t *buffer) override
read the packet from the buffer, the buffer must at least be of size Size()
Definition: ChunkUnloadPacket.cpp:57
void SetChunkPosition(const glm::ivec3 &chunk_position)
Definition: ChunkUnloadPacket.cpp:90
glm::ivec3 GetChunkPosition() const
Definition: ChunkUnloadPacket.cpp:85
ChunkUnloadPacket()
Definition: ChunkUnloadPacket.cpp:3
bool HasDynamicSize() const override
Tell if the packet has a dynamic size.
Definition: ChunkUnloadPacket.cpp:70
void Serialize(uint8_t *buffer) const override
will write the packet in the buffer, the buffer must at least be of size Size()
Definition: ChunkUnloadPacket.cpp:47
ChunkUnloadPacket & operator=(const ChunkUnloadPacket &other)
Definition: ChunkUnloadPacket.cpp:27
~ChunkUnloadPacket()
Definition: ChunkUnloadPacket.cpp:13
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: ChunkUnloadPacket.cpp:65
IPacket::Type GetType() const override
Get the Type of the packet.
Definition: ChunkUnloadPacket.cpp:75
an abstract class that servers as a base for all network packets
Definition: IPacket.hpp:40
Type
Definition: IPacket.hpp:48