37 lines
783 B
C
37 lines
783 B
C
// chunkStructures.h
|
|
|
|
#ifndef CHUNK_STRUCTURES_H
|
|
#define CHUNK_STRUCTURES_H
|
|
|
|
#include "raylib.h"
|
|
|
|
#define CHUNK_SIZE_X 16
|
|
#define CHUNK_SIZE_Y 16
|
|
#define CHUNK_SIZE_Z 16
|
|
|
|
|
|
typedef struct {
|
|
int type; // 0 = air, 1 = dirt, etc.
|
|
} Block;
|
|
|
|
// 6 directions for checking neighbors: +/-X, +/-Y, +/-Z
|
|
static const int faceOffsets[6][3] = {
|
|
{ -1, 0, 0 }, // left
|
|
{ 1, 0, 0 }, // right
|
|
{ 0, -1, 0 }, // bottom
|
|
{ 0, 1, 0 }, // top
|
|
{ 0, 0, -1 }, // back
|
|
{ 0, 0, 1 } // front
|
|
};
|
|
|
|
typedef struct {
|
|
Block blocks[CHUNK_SIZE_X][CHUNK_SIZE_Y][CHUNK_SIZE_Z];
|
|
} Chunk;
|
|
|
|
// Function to check if a face of a block is exposed.
|
|
int IsBlockFaceExposed(Chunk *chunk, int x, int y, int z, int dir);
|
|
|
|
void PlaceTreeAt(Chunk *chunk, int x, int y, int z) ;
|
|
|
|
#endif
|