mirror of
https://github.com/Relintai/godot_voxel.git
synced 2024-12-25 16:27:16 +01:00
35 lines
756 B
C++
35 lines
756 B
C++
#ifndef VOXEL_BLOCK_H
|
|
#define VOXEL_BLOCK_H
|
|
|
|
#include "voxel_buffer.h"
|
|
|
|
#include <scene/3d/mesh_instance.h>
|
|
#include <scene/3d/physics_body.h>
|
|
|
|
// Internal structure holding a reference to mesh visuals, physics and a block of voxel data.
|
|
// TODO Voxel data should be separated from this
|
|
class VoxelBlock {
|
|
public:
|
|
Ref<VoxelBuffer> voxels; // SIZE*SIZE*SIZE voxels
|
|
Vector3i pos;
|
|
|
|
static VoxelBlock *create(Vector3i bpos, Ref<VoxelBuffer> buffer, unsigned int size);
|
|
|
|
void set_mesh(Ref<Mesh> mesh, Ref<World> world);
|
|
|
|
void enter_world(World *world);
|
|
void exit_world();
|
|
void set_visible(bool visible);
|
|
|
|
private:
|
|
VoxelBlock();
|
|
|
|
Vector3i _position_in_voxels;
|
|
|
|
Ref<Mesh> _mesh;
|
|
RID _mesh_instance;
|
|
int _mesh_update_count;
|
|
};
|
|
|
|
#endif // VOXEL_BLOCK_H
|