Skip to content
Myr

cave_parse.h

This file

Path

tests/caveview/cave_parse.h

41 lines · 973 bytes · C

Last changed by

Not known.

History of this file

Take it

1#ifndef INCLUDE_CAVE_PARSE_H2#define INCLUDE_CAVE_PARSE_H34typedef struct5{6   unsigned char block;7   unsigned char data;8   unsigned char light:4;9   unsigned char skylight:4;10} raw_block;1112// this is the old fully-decoded chunk13typedef struct14{15   int xpos, zpos, max_y;16   int height[16][16];17   raw_block rb[16][16][256]; // [z][x][y] which becomes [y][x][z] in stb18} chunk;1920chunk *get_decoded_chunk(int chunk_x, int chunk_z);2122#define NUM_SEGMENTS  1623typedef struct24{25   int max_y, xpos, zpos;2627   unsigned char *blockdata[NUM_SEGMENTS];28   unsigned char *data[NUM_SEGMENTS];29   unsigned char *skylight[NUM_SEGMENTS];30   unsigned char *light[NUM_SEGMENTS];31   32   void *pointer_to_free;   3334   int refcount; // this allows multi-threaded building without wrapping in ANOTHER struct35} fast_chunk;3637fast_chunk *get_decoded_fastchunk(int chunk_x, int chunk_z); // cache, never call free()3839fast_chunk *get_decoded_fastchunk_uncached(int chunk_x, int chunk_z);4041#endif