mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
#ifndef VOXELS_CHUNKS_H_
|
|
#define VOXELS_CHUNKS_H_
|
|
|
|
#include <stdlib.h>
|
|
#include <glm/glm.hpp>
|
|
|
|
using namespace glm;
|
|
|
|
class Mesh;
|
|
class VoxelRenderer;
|
|
|
|
class Chunk;
|
|
class voxel;
|
|
class WorldFiles;
|
|
|
|
class Chunks {
|
|
public:
|
|
Chunk** chunks;
|
|
Chunk** chunksSecond;
|
|
Mesh** meshes;
|
|
Mesh** meshesSecond;
|
|
size_t volume;
|
|
size_t chunksCount;
|
|
int w,d;
|
|
int ox,oz;
|
|
|
|
Chunks(int w, int d, int ox, int oz);
|
|
~Chunks();
|
|
|
|
bool putChunk(Chunk* chunk);
|
|
|
|
Chunk* getChunk(int x, int z);
|
|
Chunk* getChunkByVoxel(int x, int y, int z);
|
|
voxel* get(int x, int y, int z);
|
|
unsigned short getLight(int x, int y, int z);
|
|
unsigned char getLight(int x, int y, int z, int channel);
|
|
void set(int x, int y, int z, int id, uint8_t states);
|
|
voxel* rayCast(vec3 start, vec3 dir, float maxLength, vec3& end, vec3& norm, vec3& iend);
|
|
|
|
bool isObstacle(int x, int y, int z);
|
|
|
|
// does not move chunks inside
|
|
void _setOffset(int x, int z);
|
|
|
|
void setCenter(WorldFiles* worldFiles, int x, int z);
|
|
void translate(WorldFiles* worldFiles, int x, int z);
|
|
|
|
void clear(bool freeMemory);
|
|
};
|
|
|
|
#endif /* VOXELS_CHUNKS_H_ */
|