mirror of
https://github.com/Relintai/godot_voxel.git
synced 2024-11-22 17:57:24 +01:00
Compilation fixes
This commit is contained in:
parent
07b7e083dd
commit
7319fa1c56
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
def can_build(platform):
|
||||
def can_build(env, platform):
|
||||
return True
|
||||
|
||||
|
||||
|
12
voxel.cpp
12
voxel.cpp
@ -264,11 +264,11 @@ void Voxel::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "material_id"), "set_material_id", "get_material_id");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_type", PROPERTY_HINT_ENUM, "None,Cube"), "set_geometry_type", "get_geometry_type");
|
||||
|
||||
BIND_CONSTANT(GEOMETRY_NONE);
|
||||
BIND_CONSTANT(GEOMETRY_CUBE);
|
||||
BIND_CONSTANT(GEOMETRY_MAX);
|
||||
BIND_ENUM_CONSTANT(GEOMETRY_NONE);
|
||||
BIND_ENUM_CONSTANT(GEOMETRY_CUBE);
|
||||
BIND_ENUM_CONSTANT(GEOMETRY_MAX);
|
||||
|
||||
BIND_CONSTANT(CHANNEL_TYPE)
|
||||
BIND_CONSTANT(CHANNEL_ISOLEVEL)
|
||||
BIND_CONSTANT(CHANNEL_DATA)
|
||||
BIND_ENUM_CONSTANT(CHANNEL_TYPE)
|
||||
BIND_ENUM_CONSTANT(CHANNEL_ISOLEVEL)
|
||||
BIND_ENUM_CONSTANT(CHANNEL_DATA)
|
||||
}
|
||||
|
@ -85,8 +85,17 @@ void VoxelBuffer::fill(int defval, unsigned int channel_index) {
|
||||
ERR_FAIL_INDEX(channel_index, MAX_CHANNELS);
|
||||
|
||||
Channel &channel = _channels[channel_index];
|
||||
if (channel.data == NULL && channel.defval == defval)
|
||||
return;
|
||||
if (channel.data == NULL) {
|
||||
// Channel is already optimized and uniform
|
||||
if(channel.defval == defval) {
|
||||
// No change
|
||||
return;
|
||||
} else {
|
||||
// Just change default value
|
||||
channel.defval = defval;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
create_channel_noinit(channel_index, _size);
|
||||
|
||||
@ -131,7 +140,7 @@ bool VoxelBuffer::is_uniform(unsigned int channel_index) const {
|
||||
// Channel isn't optimized, so must look at each voxel
|
||||
uint8_t voxel = channel.data[0];
|
||||
unsigned int volume = get_volume();
|
||||
for (unsigned int i = 0; i < volume; ++i) {
|
||||
for (unsigned int i = 1; i < volume; ++i) {
|
||||
if (channel.data[i] != voxel) {
|
||||
return false;
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ void VoxelMesherSmooth::build_mesh(const VoxelBuffer &voxels, unsigned int chann
|
||||
VoxelMesherSmooth::ReuseCell &VoxelMesherSmooth::get_reuse_cell(Vector3i pos) {
|
||||
int j = pos.z & 1;
|
||||
int i = pos.y * m_block_size.y + pos.x;
|
||||
return m_cache[j][i];
|
||||
return m_cache[j].write[i];
|
||||
}
|
||||
|
||||
void VoxelMesherSmooth::emit_vertex(Vector3 primary, Vector3 normal) {
|
||||
|
@ -123,8 +123,8 @@ void VoxelProviderTest::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "pattern_size"), "set_pattern_size", "get_pattern_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "pattern_offset"), "set_pattern_offset", "get_pattern_offset");
|
||||
|
||||
BIND_CONSTANT(MODE_FLAT);
|
||||
BIND_CONSTANT(MODE_WAVES);
|
||||
BIND_ENUM_CONSTANT(MODE_FLAT);
|
||||
BIND_ENUM_CONSTANT(MODE_WAVES);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
#include "voxel_raycast.h"
|
||||
#include <math_funcs.h>
|
||||
|
||||
const float g_infinite = 9999999;
|
||||
|
||||
bool voxel_raycast(
|
||||
Vector3 ray_origin,
|
||||
Vector3 ray_direction,
|
||||
@ -11,6 +9,9 @@ bool voxel_raycast(
|
||||
real_t max_distance,
|
||||
Vector3i &out_hit_pos,
|
||||
Vector3i &out_prev_pos) {
|
||||
|
||||
const float g_infinite = 9999999;
|
||||
|
||||
// Equation : p + v*t
|
||||
// p : ray start position (ray.pos)
|
||||
// v : ray orientation vector (ray.dir)
|
||||
|
@ -430,7 +430,7 @@ void VoxelTerrain::update_blocks() {
|
||||
const Vector3i bpos = _block_update_queue[i];
|
||||
if(!new_box.contains(bpos)) {
|
||||
int last = _block_update_queue.size() - 1;
|
||||
_block_update_queue[i] = _block_update_queue[last];
|
||||
_block_update_queue.write[i] = _block_update_queue[last];
|
||||
_block_update_queue.resize(last);
|
||||
--i;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user