added stb, more binaryout changes"
[henge/apc.git] / stb / tests / caveview / caveview.h
1 #ifndef INCLUDE_CAVEVIEW_H
2 #define INCLUDE_CAVEVIEW_H
3
4 #include "stb.h"
5
6 #include "stb_voxel_render.h"
7
8 typedef struct
9 {
10 int cx,cy;
11
12 stbvox_mesh_maker mm;
13
14 uint8 *build_buffer;
15 uint8 *face_buffer;
16
17 int num_quads;
18 float transform[3][3];
19 float bounds[2][3];
20
21 uint8 sv_blocktype[34][34][18];
22 uint8 sv_lighting [34][34][18];
23 } raw_mesh;
24
25 // a 3D checkerboard of empty,solid would be: 32x32x255x6/2 ~= 800000
26 // an all-leaf qchunk would be: 32 x 32 x 255 x 6 ~= 1,600,000
27
28 #define BUILD_QUAD_MAX 400000
29 #define BUILD_BUFFER_SIZE (4*4*BUILD_QUAD_MAX) // 4 bytes per vertex, 4 vertices per quad
30 #define FACE_BUFFER_SIZE ( 4*BUILD_QUAD_MAX) // 4 bytes per quad
31
32
33 extern void mesh_init(void);
34 extern void render_init(void);
35 extern void world_init(void);
36 extern void ods(char *fmt, ...); // output debug string
37 extern void reset_cache_size(int size);
38
39
40 extern void render_caves(float pos[3]);
41
42
43 #include "cave_parse.h" // fast_chunk
44
45 extern fast_chunk *get_converted_fastchunk(int chunk_x, int chunk_y);
46 extern void build_chunk(int chunk_x, int chunk_y, fast_chunk *fc_table[4][4], raw_mesh *rm);
47 extern void reset_cache_size(int size);
48 extern void deref_fastchunk(fast_chunk *fc);
49
50 #endif