diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /thirdparty/stb/tests/caveview/cave_parse.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'thirdparty/stb/tests/caveview/cave_parse.h')
| -rw-r--r-- | thirdparty/stb/tests/caveview/cave_parse.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/thirdparty/stb/tests/caveview/cave_parse.h b/thirdparty/stb/tests/caveview/cave_parse.h new file mode 100644 index 0000000..4cdfe2a --- /dev/null +++ b/thirdparty/stb/tests/caveview/cave_parse.h @@ -0,0 +1,41 @@ +#ifndef INCLUDE_CAVE_PARSE_H +#define INCLUDE_CAVE_PARSE_H + +typedef struct +{ + unsigned char block; + unsigned char data; + unsigned char light:4; + unsigned char skylight:4; +} raw_block; + +// this is the old fully-decoded chunk +typedef struct +{ + int xpos, zpos, max_y; + int height[16][16]; + raw_block rb[16][16][256]; // [z][x][y] which becomes [y][x][z] in stb +} chunk; + +chunk *get_decoded_chunk(int chunk_x, int chunk_z); + +#define NUM_SEGMENTS 16 +typedef struct +{ + int max_y, xpos, zpos; + + unsigned char *blockdata[NUM_SEGMENTS]; + unsigned char *data[NUM_SEGMENTS]; + unsigned char *skylight[NUM_SEGMENTS]; + unsigned char *light[NUM_SEGMENTS]; + + void *pointer_to_free; + + int refcount; // this allows multi-threaded building without wrapping in ANOTHER struct +} fast_chunk; + +fast_chunk *get_decoded_fastchunk(int chunk_x, int chunk_z); // cache, never call free() + +fast_chunk *get_decoded_fastchunk_uncached(int chunk_x, int chunk_z); + +#endif |