voxel-test/cubes.h
2024-07-17 20:17:49 -04:00

45 lines
No EOL
937 B
C

#ifndef V_CUBES_H
#define V_CUBES_H
#include "linmath.h"
#define CHUNK_LENGTH 16
#define CHUNK_RADIUS_H 4 // 8
#define CHUNK_RADIUS_V 4 // 4
#define TEXT_GAP_H 1 / 6.0
#define TEXT_GAP_V 1 / 6.0
#define CHUNK_DIAMETER_H (CHUNK_RADIUS_H * 2 + 1)
#define CHUNK_DIAMETER_V (CHUNK_RADIUS_V * 2 + 1)
#define CHUNK_ALL CHUNK_DIAMETER_H *CHUNK_DIAMETER_H *CHUNK_DIAMETER_V
#define BLOCK_ALL CHUNK_LENGTH *CHUNK_LENGTH *CHUNK_LENGTH
#define CBLOCK_ALL BLOCK_ALL *CHUNK_ALL
#define CBUF_ALL 2
#define CTRI_ALL CBLOCK_ALL * 18 * sizeof(struct v3f)
struct chunk {
unsigned char exists;
unsigned int x;
unsigned int y;
unsigned int z;
unsigned int blocks[BLOCK_ALL];
};
struct v3f {
vec3 pos;
};
struct v3i {
int pos[3];
};
struct v2f {
vec2 pos;
};
int cubes_vert(struct v3f *cube, struct v3f *text, struct v3f *cubeO,
struct v3f *textO, int x, int y, int z, int is_purge, int *i2);
void cubes_free();
#endif