voxel-test/cubes.h
2024-07-21 23:05:04 -04:00

49 lines
No EOL
1.1 KiB
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 / 7.0
#define TEXT_GAP_V 1 / 9.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 UI_ALL 20480
#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();
void cubes_refresh(int x, int y, int z, struct chunk dat, int state);
void cubes_rect(struct v3f *cube, int *i, double x1, double x2, double y1,
double y2, int is_text, int text_x, int text_y);
#endif