Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB

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