6 #include <dragontype/queue.h>
8 #include "client/object.h"
12 MBS_RECIEVING, // currently deserializing
13 MBS_FRESH, // first deserialisation finished, not processed by sync thread yet
14 MBS_READY, // ready to use and processed by sync thread
19 MapBlockState state; // keep track of the deserialisation and sync processing state
20 bool queue; // whether the block is in meshgen queue
21 u64 last_synced; // keep track of when a block was synced the last time (used to detect when a block got out of and then back into range)
22 Object *obj; // mesh object, generated by blockmesh file
25 extern struct ClientMap
27 Map *map; // map object
28 Queue *queue; // MapBlock * queue (thread safe)
29 bool cancel; // used to notify meshgen and sync thread about quit
30 pthread_t meshgen_thread; // consumer thread for meshgen queue
31 pthread_t sync_thread; // this thread requests new / changed blocks from server
32 u32 simulation_distance; // simulation distance sent by server
33 size_t blocks_count; // cached number of facecache positions to process every sync step (matches simulation distance)
36 void client_map_init(); // ClientMap singleton constructor
37 void client_map_deinit(); // ClientMap singleton destructor
38 void client_map_set_simulation_distance(u32 simulation_distance); // update simulation distance
39 void client_map_start(); // start meshgen and sync threads
40 void client_map_stop(); // stop meshgen and sync threads
41 void client_map_block_received(MapBlock *block); // called when a block was actually recieved from server