mirror of
https://github.com/Relintai/voxelman.git
synced 2025-01-25 15:09:18 +01:00
Added the meshers and liquid meshers api from VoxelChunk into VoxelTerrarinJob.
This commit is contained in:
parent
579e4263d0
commit
394214b758
@ -27,9 +27,51 @@ SOFTWARE.
|
||||
#include "../../library/voxel_surface.h"
|
||||
#include "../../library/voxelman_library.h"
|
||||
|
||||
#include "../../meshers/voxel_mesher.h"
|
||||
#include "../default/voxel_chunk_default.h"
|
||||
|
||||
void build_phase_setup() {
|
||||
Ref<VoxelMesher> VoxelTerrarinJob::get_mesher(int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _meshers.size(), Ref<VoxelMesher>());
|
||||
|
||||
return _meshers.get(index);
|
||||
}
|
||||
void VoxelTerrarinJob::set_mesher(int index, const Ref<VoxelMesher> &mesher) {
|
||||
ERR_FAIL_INDEX(index, _meshers.size());
|
||||
|
||||
_meshers.set(index, mesher);
|
||||
}
|
||||
void VoxelTerrarinJob::remove_mesher(const int index) {
|
||||
ERR_FAIL_INDEX(index, _meshers.size());
|
||||
|
||||
_meshers.remove(index);
|
||||
}
|
||||
void VoxelTerrarinJob::add_mesher(const Ref<VoxelMesher> &mesher) {
|
||||
_meshers.push_back(mesher);
|
||||
}
|
||||
int VoxelTerrarinJob::get_mesher_count() const {
|
||||
return _meshers.size();
|
||||
}
|
||||
|
||||
Ref<VoxelMesher> VoxelTerrarinJob::get_liquid_mesher(int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _liquid_meshers.size(), Ref<VoxelMesher>());
|
||||
|
||||
return _liquid_meshers.get(index);
|
||||
}
|
||||
void VoxelTerrarinJob::set_liquid_mesher(int index, const Ref<VoxelMesher> &mesher) {
|
||||
ERR_FAIL_INDEX(index, _liquid_meshers.size());
|
||||
|
||||
_liquid_meshers.set(index, mesher);
|
||||
}
|
||||
void VoxelTerrarinJob::remove_liquid_mesher(const int index) {
|
||||
ERR_FAIL_INDEX(index, _liquid_meshers.size());
|
||||
|
||||
_liquid_meshers.remove(index);
|
||||
}
|
||||
void VoxelTerrarinJob::add_liquid_mesher(const Ref<VoxelMesher> &mesher) {
|
||||
_liquid_meshers.push_back(mesher);
|
||||
}
|
||||
int VoxelTerrarinJob::get_liquid_mesher_count() const {
|
||||
return _liquid_meshers.size();
|
||||
}
|
||||
|
||||
void VoxelTerrarinJob::_execute() {
|
||||
@ -591,4 +633,15 @@ VoxelTerrarinJob::~VoxelTerrarinJob() {
|
||||
}
|
||||
|
||||
void VoxelTerrarinJob::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_mesher", "index"), &VoxelTerrarinJob::get_mesher);
|
||||
ClassDB::bind_method(D_METHOD("set_mesher", "index", "mesher"), &VoxelTerrarinJob::set_mesher);
|
||||
ClassDB::bind_method(D_METHOD("remove_mesher", "index"), &VoxelTerrarinJob::remove_mesher);
|
||||
ClassDB::bind_method(D_METHOD("add_mesher", "mesher"), &VoxelTerrarinJob::add_mesher);
|
||||
ClassDB::bind_method(D_METHOD("get_mesher_count"), &VoxelTerrarinJob::get_mesher_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_mesher", "index"), &VoxelTerrarinJob::get_liquid_mesher);
|
||||
ClassDB::bind_method(D_METHOD("set_liquid_mesher", "index", "mesher"), &VoxelTerrarinJob::set_liquid_mesher);
|
||||
ClassDB::bind_method(D_METHOD("remove_liquid_mesher", "index"), &VoxelTerrarinJob::remove_liquid_mesher);
|
||||
ClassDB::bind_method(D_METHOD("add_liquid_mesher", "mesher"), &VoxelTerrarinJob::add_liquid_mesher);
|
||||
ClassDB::bind_method(D_METHOD("get_liquid_mesher_count"), &VoxelTerrarinJob::get_liquid_mesher_count);
|
||||
}
|
||||
|
@ -25,10 +25,26 @@ SOFTWARE.
|
||||
|
||||
#include "voxel_job.h"
|
||||
|
||||
class VoxelMesher;
|
||||
|
||||
class VoxelTerrarinJob : public VoxelJob {
|
||||
GDCLASS(VoxelTerrarinJob, VoxelJob);
|
||||
|
||||
public:
|
||||
//Meshers
|
||||
Ref<VoxelMesher> get_mesher(const int index) const;
|
||||
void set_mesher(const int index, const Ref<VoxelMesher> &mesher);
|
||||
void remove_mesher(const int index);
|
||||
void add_mesher(const Ref<VoxelMesher> &mesher);
|
||||
int get_mesher_count() const;
|
||||
|
||||
//Liquid Meshers
|
||||
Ref<VoxelMesher> get_liquid_mesher(const int index) const;
|
||||
void set_liquid_mesher(const int index, const Ref<VoxelMesher> &mesher);
|
||||
void remove_liquid_mesher(const int index);
|
||||
void add_liquid_mesher(const Ref<VoxelMesher> &mesher);
|
||||
int get_liquid_mesher_count() const;
|
||||
|
||||
void _execute();
|
||||
|
||||
VoxelTerrarinJob();
|
||||
@ -37,6 +53,9 @@ public:
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
Vector<Ref<VoxelMesher> > _meshers;
|
||||
Vector<Ref<VoxelMesher> > _liquid_meshers;
|
||||
|
||||
PoolVector<Vector3> temp_arr_collider;
|
||||
PoolVector<Vector3> temp_arr_collider_liquid;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user