Fixed compile.

This commit is contained in:
Relintai 2019-11-18 22:35:08 +01:00
parent d5acb28a90
commit de103a3fdf
5 changed files with 21 additions and 12 deletions

View File

@ -168,7 +168,9 @@ void VoxelCubePoints::recalculate_point(int point) {
_points[point] = dynamic_offset;
}
void VoxelCubePoints::refresh_neighbours(const VoxelChunk *chunk) {
void VoxelCubePoints::refresh_neighbours(VoxelChunk *chunk) {
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
int neighbours = 0;
int x = _x;
@ -405,7 +407,12 @@ void VoxelCubePoints::refresh_neighbours(const VoxelChunk *chunk) {
_point_neighbours[P111] = neighbours;
}
void VoxelCubePoints::setup(const VoxelChunk *chunk, int x, int y, int z, int size) {
void VoxelCubePoints::setup_bind(Node *chunk, int x, int y, int z, int size) {
setup(Object::cast_to<VoxelChunk>(chunk), x, y, z, size);
}
void VoxelCubePoints::setup(VoxelChunk *chunk, int x, int y, int z, int size) {
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
ERR_FAIL_COND(size <= 0);
ERR_FAIL_COND(!chunk->validate_channel_position(x + size, y + size, z + size) || !chunk->validate_channel_position(x, y, z));
@ -757,7 +764,7 @@ void VoxelCubePoints::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "size"), "set_size", "get_size");
ClassDB::bind_method(D_METHOD("refresh_points"), &VoxelCubePoints::refresh_points);
ClassDB::bind_method(D_METHOD("setup", "chunk", "x", "y", "z", "size"), &VoxelCubePoints::setup, DEFVAL(1));
ClassDB::bind_method(D_METHOD("setup", "chunk", "x", "y", "z", "size"), &VoxelCubePoints::setup_bind, DEFVAL(1));
ClassDB::bind_method(D_METHOD("get_point_index", "face", "index"), &VoxelCubePoints::get_point_index);
ClassDB::bind_method(D_METHOD("get_point_uv_direction", "face", "index"), &VoxelCubePoints::get_point_uv_direction);

View File

@ -91,8 +91,9 @@ public:
void refresh_points();
void recalculate_point(int point);
void refresh_neighbours(const VoxelChunk *buffer);
void setup(const VoxelChunk *buffer, int x, int y, int z, int size = 1);
void refresh_neighbours(VoxelChunk *chunk);
void setup_bind(Node *chunk, int x, int y, int z, int size = 1);
void setup(VoxelChunk *chunk, int x, int y, int z, int size = 1);
void reset();

View File

@ -1,7 +1,11 @@
#include "voxel_mesher_cubic.h"
void VoxelMesherCubic::_add_buffer(VoxelChunk *chunk) {
void VoxelMesherCubic::_add_buffer(Node *p_chunk) {
VoxelChunk *chunk = Object::cast_to<VoxelChunk>(p_chunk);
ERR_FAIL_COND(!ObjectDB::instance_validate(chunk));
chunk->generate_ao();
int x_size = chunk->get_size_x() - 1;

View File

@ -13,7 +13,7 @@ class VoxelMesherCubic : public VoxelMesher {
GDCLASS(VoxelMesherCubic, VoxelMesher);
public:
void _add_buffer(VoxelChunk *chunk);
void _add_buffer(Node *p_chunk);
VoxelMesherCubic();
~VoxelMesherCubic();

View File

@ -88,13 +88,10 @@ void PropData::add_prop_lights_into(VoxelChunk *chunk, Transform parent_transfor
Transform t = parent_transform * pl->get_transform();
Vector3 px = t.origin / chunk->get_voxel_scale();
Vector3i cp = chunk->get_chunk_position();
Vector3i cs = chunk->get_chunk_size();
Ref<VoxelLight> vl;
vl.instance();
vl->set_world_position(px.x + cp.x * cs.x, px.y + cp.y * cs.y, px.z + cp.z * cs.z);
vl->set_world_position(px.x + chunk->get_position_x() * chunk->get_size_x(), px.y + chunk->get_position_y() * chunk->get_size_y(), px.z + chunk->get_position_z() * chunk->get_size_z());
vl->set_color(pl->get_light_color());
vl->set_size(pl->get_light_size());