mirror of
https://github.com/Relintai/voxelman.git
synced 2025-04-13 21:00:47 +02:00
Clang format.
This commit is contained in:
parent
b559329212
commit
a67d0393ca
@ -3,8 +3,8 @@
|
||||
|
||||
#include "core/reference.h"
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "core/math/aabb.h"
|
||||
#include "core/ustring.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
class WorldArea : public Reference {
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "../meshers/voxel_mesher.h"
|
||||
#include "../../texture_packer/texture_packer.h"
|
||||
#include "../meshers/voxel_mesher.h"
|
||||
|
||||
class VoxelChunk;
|
||||
class VoxelMesher;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/// VMQUeue
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
void VMQueue<T>::enqueue(T obj) {
|
||||
_lock->write_lock();
|
||||
|
||||
@ -16,7 +16,7 @@ void VMQueue<T>::enqueue(T obj) {
|
||||
_lock->write_unlock();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
T VMQueue<T>::dequeue() {
|
||||
if (_size == 0)
|
||||
return T();
|
||||
@ -43,7 +43,7 @@ T VMQueue<T>::dequeue() {
|
||||
return obj;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
T VMQueue<T>::peek() {
|
||||
T obj;
|
||||
|
||||
@ -54,7 +54,7 @@ T VMQueue<T>::peek() {
|
||||
return obj;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
void VMQueue<T>::resize(int new_size) {
|
||||
_lock->write_lock();
|
||||
|
||||
@ -63,7 +63,7 @@ void VMQueue<T>::resize(int new_size) {
|
||||
_lock->write_unlock();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
void VMQueue<T>::_resize(int new_size) {
|
||||
if (new_size == _size)
|
||||
return;
|
||||
@ -86,7 +86,7 @@ void VMQueue<T>::_resize(int new_size) {
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
VMQueue<T>::VMQueue(int initial_size) {
|
||||
_items = NULL;
|
||||
_head = 0;
|
||||
@ -104,7 +104,7 @@ VMQueue<T>::VMQueue(int initial_size) {
|
||||
_items = memnew_arr(T, _size);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
VMQueue<T>::VMQueue() {
|
||||
_items = NULL;
|
||||
_head = 0;
|
||||
@ -116,7 +116,7 @@ VMQueue<T>::VMQueue() {
|
||||
_items = memnew_arr(T, _size);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
VMQueue<T>::~VMQueue() {
|
||||
if (_items)
|
||||
memdelete_arr(_items);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "core/os/rw_lock.h"
|
||||
#include "core/variant.h"
|
||||
|
||||
template<class T>
|
||||
template <class T>
|
||||
class VMQueue {
|
||||
|
||||
public:
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/// VMQUeue
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
void VMUBQueue<T>::enqueue(T obj) {
|
||||
_enqueue_lock->write_lock();
|
||||
|
||||
@ -14,7 +14,7 @@ void VMUBQueue<T>::enqueue(T obj) {
|
||||
_enqueue_lock->write_unlock();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
T VMUBQueue<T>::dequeue() {
|
||||
T result;
|
||||
|
||||
@ -37,12 +37,12 @@ T VMUBQueue<T>::dequeue() {
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
T VMUBQueue<T>::peek() {
|
||||
return _head->data;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
VMUBQueue<T>::VMUBQueue() {
|
||||
_head = memnew(UBQueueNode<T>);
|
||||
_tail = _head;
|
||||
@ -51,7 +51,7 @@ VMUBQueue<T>::VMUBQueue() {
|
||||
_dequeue_lock = RWLock::create();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
VMUBQueue<T>::~VMUBQueue() {
|
||||
memdelete(_enqueue_lock);
|
||||
memdelete(_dequeue_lock);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "core/os/rw_lock.h"
|
||||
#include "core/variant.h"
|
||||
|
||||
template<class T>
|
||||
template <class T>
|
||||
struct UBQueueNode {
|
||||
T data;
|
||||
UBQueueNode *next;
|
||||
@ -23,7 +23,7 @@ struct UBQueueNode {
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
template <class T>
|
||||
class VMUBQueue {
|
||||
|
||||
public:
|
||||
|
@ -11,7 +11,6 @@ _FORCE_INLINE_ int VoxelLight::get_world_position_z() const {
|
||||
}
|
||||
Vector3 VoxelLight::get_world_position() {
|
||||
return Vector3(_world_position_x, _world_position_y, _world_position_z);
|
||||
|
||||
}
|
||||
void VoxelLight::set_world_position(const int x, const int y, const int z) {
|
||||
_world_position_x = x;
|
||||
@ -21,11 +20,9 @@ void VoxelLight::set_world_position(const int x, const int y, const int z) {
|
||||
|
||||
_FORCE_INLINE_ Color VoxelLight::get_color() const {
|
||||
return _color;
|
||||
|
||||
}
|
||||
void VoxelLight::set_color(Color color) {
|
||||
_color = color;
|
||||
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ float VoxelLight::get_size() const {
|
||||
|
2
docs/_templates/layout.html
vendored
2
docs/_templates/layout.html
vendored
@ -1,4 +1,4 @@
|
||||
{% extends "!layout.html" %}
|
||||
{% block linktags %}
|
||||
{{ super() }}
|
||||
{{ super() }}
|
||||
{% endblock %}
|
@ -17,8 +17,6 @@ public:
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include "core/vector.h"
|
||||
#include "scene/resources/material.h"
|
||||
|
||||
#include "voxelman_library.h"
|
||||
#include "../clutter/ground_clutter.h"
|
||||
#include "voxelman_library.h"
|
||||
|
||||
class VoxelmanLibrary;
|
||||
class GroundClutter;
|
||||
|
@ -72,5 +72,4 @@ void VoxelSurfaceMerger::_bind_methods() {
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "texture_top", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture", VOXEL_SIDE_TOP);
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "texture_bottom", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture", VOXEL_SIDE_BOTTOM);
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "texture_side", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture", VOXEL_SIDE_SIDE);
|
||||
|
||||
}
|
||||
|
@ -317,7 +317,6 @@ void VoxelCubePoints::refresh_neighbours(VoxelChunk *chunk) {
|
||||
|
||||
_point_neighbours[P001] = neighbours;
|
||||
|
||||
|
||||
neighbours = 0;
|
||||
x = _x + 1;
|
||||
y = _y;
|
||||
@ -376,7 +375,6 @@ void VoxelCubePoints::refresh_neighbours(VoxelChunk *chunk) {
|
||||
|
||||
_point_neighbours[P011] = neighbours;
|
||||
|
||||
|
||||
neighbours = 0;
|
||||
x = _x + 1;
|
||||
y = _y + 1;
|
||||
@ -467,7 +465,6 @@ void VoxelCubePoints::setup(VoxelChunk *chunk, int x, int y, int z, int size) {
|
||||
refresh_points();
|
||||
}
|
||||
|
||||
|
||||
void VoxelCubePoints::reset() {
|
||||
for (int i = 0; i < POINT_COUNT; ++i) {
|
||||
_point_types[i] = 0;
|
||||
@ -557,7 +554,6 @@ Vector3 VoxelCubePoints::get_vertex_vector3_for_point(int face, int index) {
|
||||
vector.z -= num2;
|
||||
vector /= num;
|
||||
|
||||
|
||||
return vector;
|
||||
}
|
||||
|
||||
@ -744,7 +740,6 @@ VoxelCubePoints::VoxelCubePoints() {
|
||||
VoxelCubePoints::~VoxelCubePoints() {
|
||||
}
|
||||
|
||||
|
||||
void VoxelCubePoints::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_x"), &VoxelCubePoints::get_x);
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "voxel_mesher_cubic.h"
|
||||
|
||||
|
||||
void VoxelMesherCubic::_add_buffer(Node *p_chunk) {
|
||||
VoxelChunk *chunk = Object::cast_to<VoxelChunk>(p_chunk);
|
||||
|
||||
@ -85,7 +84,6 @@ void VoxelMesherCubic::_add_buffer(Node *p_chunk) {
|
||||
}
|
||||
|
||||
VoxelMesherCubic::VoxelMesherCubic() {
|
||||
|
||||
}
|
||||
|
||||
VoxelMesherCubic::~VoxelMesherCubic() {
|
||||
|
@ -2,8 +2,8 @@
|
||||
#define VOXEL_MESHER_CUBIC_H
|
||||
|
||||
#include "core/color.h"
|
||||
#include "core/math/vector3.h"
|
||||
#include "core/math/vector2.h"
|
||||
#include "core/math/vector3.h"
|
||||
|
||||
#include "../voxel_mesher.h"
|
||||
|
||||
@ -20,7 +20,6 @@ public:
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -64,5 +64,3 @@ void TransvoxelCellData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_triangle_count"), &TransvoxelCellData::get_triangle_count);
|
||||
ClassDB::bind_method(D_METHOD("set_triangle_count", "value"), &TransvoxelCellData::set_triangle_count);
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ namespace Transvoxel {
|
||||
// that the class index ranges from 0 to 15.
|
||||
|
||||
const unsigned char regularCellClass[256] = {
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
0x00, 0x01, 0x01, 0x03, 0x01, 0x03, 0x02, 0x04, 0x01, 0x02, 0x03, 0x04, 0x03, 0x04, 0x04, 0x03, // 0
|
||||
0x01, 0x03, 0x02, 0x04, 0x02, 0x04, 0x06, 0x0C, 0x02, 0x05, 0x05, 0x0B, 0x05, 0x0A, 0x07, 0x04, // 16
|
||||
0x01, 0x02, 0x03, 0x04, 0x02, 0x05, 0x05, 0x0A, 0x02, 0x06, 0x04, 0x0C, 0x05, 0x07, 0x0B, 0x04, // 32
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
#include "core/reference.h"
|
||||
#include "core/vector.h"
|
||||
#include "scene/resources/material.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "scene/resources/surface_tool.h"
|
||||
#include "scene/resources/material.h"
|
||||
|
||||
class VoxelMeshData : public Reference {
|
||||
GDCLASS(VoxelMeshData, Reference)
|
||||
|
@ -1,23 +1,23 @@
|
||||
#ifndef VOXEL_TOOLS_H
|
||||
#define VOXEL_TOOLS_H
|
||||
|
||||
#include "core/reference.h"
|
||||
#include "core/color.h"
|
||||
#include "core/math/rect2.h"
|
||||
#include "core/math/vector2.h"
|
||||
#include "core/math/vector3.h"
|
||||
#include "core/math/rect2.h"
|
||||
#include "core/reference.h"
|
||||
#include "core/vector.h"
|
||||
#include "scene/3d/mesh_instance.h"
|
||||
#include "scene/resources/material.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "scene/resources/surface_tool.h"
|
||||
#include "scene/3d/immediate_geometry.h"
|
||||
#include "scene/3d/mesh_instance.h"
|
||||
#include "scene/3d/spatial.h"
|
||||
#include "scene/main/node.h"
|
||||
#include "scene/resources/concave_polygon_shape.h"
|
||||
#include "scene/resources/material.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "scene/resources/surface_tool.h"
|
||||
|
||||
#include "../library/voxelman_library.h"
|
||||
#include "../../mesh_data_resource/mesh_data_resource.h"
|
||||
#include "../library/voxelman_library.h"
|
||||
|
||||
const double PI_2 = 3.141592653589793238463 / 2;
|
||||
const double PI = 3.141592653589793238463;
|
||||
|
@ -20,7 +20,7 @@ int VoxelMesherTransvoxel::get_regular_vertex_data(int index1, int index2) const
|
||||
}
|
||||
|
||||
//void VoxelMesherTransvoxel::set_regular_vertex_data(int index1, int index2, int value) {
|
||||
// ERR_FAIL_INDEX(index1, 256);
|
||||
// ERR_FAIL_INDEX(index1, 256);
|
||||
// ERR_FAIL_INDEX(index2, 13);
|
||||
|
||||
// regularVertexData[index1][index2] = value;
|
||||
@ -108,7 +108,6 @@ Vector3 VoxelMesherTransvoxel::get_transition_vertex_direction(int index1, int i
|
||||
return transvoxel_vertices[vert2] - transvoxel_vertices[vert1];
|
||||
}
|
||||
|
||||
|
||||
VoxelMesherTransvoxel::VoxelMesherTransvoxel() {
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
_regular_cell_datas[i] = Ref<TransvoxelCellData>(memnew(TransvoxelCellData(regularCellData[i])));
|
||||
@ -117,11 +116,9 @@ VoxelMesherTransvoxel::VoxelMesherTransvoxel() {
|
||||
for (int i = 0; i < 56; ++i) {
|
||||
_transition_cell_data[i] = Ref<TransvoxelCellData>(memnew(TransvoxelCellData(transitionCellData[i])));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
VoxelMesherTransvoxel::~VoxelMesherTransvoxel() {
|
||||
|
||||
}
|
||||
|
||||
void VoxelMesherTransvoxel::_bind_methods() {
|
||||
|
@ -166,7 +166,6 @@ void PropData::add_meshes_into(Ref<VoxelMesher> mesher, Ref<TexturePacker> textu
|
||||
else
|
||||
pdataprop->get_prop()->add_meshes_into(mesher, texture_packer, parent_transform * pmesh->get_transform(), snap_spatial);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
void PropData::add_meshes_into_bind(Ref<VoxelMesher> mesher, Ref<TexturePacker> texture_packer, Transform parent_transform, Node *snap_spatial) {
|
||||
|
@ -1,12 +1,12 @@
|
||||
#ifndef PROP_DATA_H
|
||||
#define PROP_DATA_H
|
||||
|
||||
#include "core/reference.h"
|
||||
#include "core/vector.h"
|
||||
#include "core/math/rect2.h"
|
||||
#include "core/math/transform.h"
|
||||
#include "core/math/vector2.h"
|
||||
#include "core/math/vector3.h"
|
||||
#include "core/math/rect2.h"
|
||||
#include "core/reference.h"
|
||||
#include "core/vector.h"
|
||||
|
||||
#include "servers/physics_server.h"
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "prop_data_entity.h"
|
||||
|
||||
|
||||
int PropDataEntity::get_entity_data_id() const {
|
||||
return _entity_data_id;
|
||||
}
|
||||
|
@ -8,10 +8,8 @@ void PropDataEntry::set_transform(const Transform value) {
|
||||
}
|
||||
|
||||
PropDataEntry::PropDataEntry() {
|
||||
|
||||
}
|
||||
PropDataEntry::~PropDataEntry() {
|
||||
|
||||
}
|
||||
|
||||
void PropDataEntry::_bind_methods() {
|
||||
|
@ -1,14 +1,13 @@
|
||||
#ifndef PROP_DATA_DATA_H
|
||||
#define PROP_DATA_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/math/transform.h"
|
||||
#include "core/resource.h"
|
||||
|
||||
class PropDataEntry : public Resource {
|
||||
GDCLASS(PropDataEntry, Resource);
|
||||
|
||||
public:
|
||||
|
||||
Transform get_transform() const;
|
||||
void set_transform(const Transform value);
|
||||
|
||||
@ -19,7 +18,6 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
|
||||
Transform _transform;
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "prop_data_light.h"
|
||||
|
||||
|
||||
Color PropDataLight::get_light_color() const {
|
||||
return _light_color;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef PROP_DATA_MESH_H
|
||||
#define PROP_DATA_MESH_H
|
||||
|
||||
#include "prop_data_entry.h"
|
||||
#include "core/math/vector3.h"
|
||||
#include "prop_data_entry.h"
|
||||
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef PROP_DATA_PROP_H
|
||||
#define PROP_DATA_PROP_H
|
||||
|
||||
#include "prop_data_entry.h"
|
||||
#include "core/math/vector3.h"
|
||||
#include "prop_data_entry.h"
|
||||
|
||||
#include "prop_data.h"
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef PROP_DATA_SCENE_H
|
||||
#define PROP_DATA_SCENE_H
|
||||
|
||||
#include "prop_data_entry.h"
|
||||
#include "core/math/vector3.h"
|
||||
#include "prop_data_entry.h"
|
||||
|
||||
#include "scene/resources/packed_scene.h"
|
||||
|
||||
|
@ -4,34 +4,34 @@
|
||||
#include "containers/voxelman_unbounded_queue.h"
|
||||
|
||||
#include "library/voxel_surface.h"
|
||||
#include "library/voxel_surface_simple.h"
|
||||
#include "library/voxel_surface_merger.h"
|
||||
#include "library/voxel_surface_simple.h"
|
||||
|
||||
#include "library/voxelman_library.h"
|
||||
#include "library/voxelman_library_simple.h"
|
||||
#include "library/voxelman_library_merger.h"
|
||||
#include "library/voxelman_library_simple.h"
|
||||
|
||||
#include "data/voxel_light.h"
|
||||
#include "meshers/voxel_mesher.h"
|
||||
#include "meshers/transvoxel_cell_data.h"
|
||||
#include "meshers/voxel_mesher.h"
|
||||
#include "meshers/voxel_mesher_transvoxel.h"
|
||||
|
||||
#include "world/voxel_world.h"
|
||||
#include "world/voxel_chunk.h"
|
||||
#include "world/voxel_structure.h"
|
||||
#include "world/environment_data.h"
|
||||
#include "world/voxel_chunk.h"
|
||||
#include "world/voxel_chunk_prop_data.h"
|
||||
#include "world/voxel_structure.h"
|
||||
#include "world/voxel_world.h"
|
||||
|
||||
#include "meshers/cubic_mesher/voxel_mesher_cubic.h"
|
||||
#include "meshers/cubic_mesher/voxel_cube_points.h"
|
||||
#include "meshers/cubic_mesher/voxel_mesher_cubic.h"
|
||||
|
||||
#include "props/prop_data.h"
|
||||
#include "props/prop_data_entry.h"
|
||||
#include "props/prop_data_scene.h"
|
||||
#include "props/prop_data_mesh.h"
|
||||
#include "props/prop_data_light.h"
|
||||
#include "props/prop_data_prop.h"
|
||||
#include "props/prop_data_entity.h"
|
||||
#include "props/prop_data_entry.h"
|
||||
#include "props/prop_data_light.h"
|
||||
#include "props/prop_data_mesh.h"
|
||||
#include "props/prop_data_prop.h"
|
||||
#include "props/prop_data_scene.h"
|
||||
|
||||
#include "level_generator/voxelman_level_generator.h"
|
||||
|
||||
@ -40,9 +40,8 @@
|
||||
#include "clutter/ground_clutter.h"
|
||||
#include "clutter/ground_clutter_foliage.h"
|
||||
|
||||
|
||||
void register_voxelman_types() {
|
||||
ClassDB::register_class<VoxelmanQueue>();\
|
||||
ClassDB::register_class<VoxelmanQueue>();
|
||||
ClassDB::register_class<VoxelmanUnboundedQueue>();
|
||||
|
||||
ClassDB::register_class<VoxelMesher>();
|
||||
@ -84,6 +83,4 @@ void register_voxelman_types() {
|
||||
}
|
||||
|
||||
void unregister_voxelman_types() {
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
#ifndef ENVIRONMENT_DATA_H
|
||||
#define ENVIRONMENT_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "core/color.h"
|
||||
#include "scene/main/node.h"
|
||||
#include "scene/3d/world_environment.h"
|
||||
#include "core/resource.h"
|
||||
#include "scene/3d/light.h"
|
||||
#include "scene/3d/world_environment.h"
|
||||
#include "scene/main/node.h"
|
||||
|
||||
class EnvironmentData : public Resource {
|
||||
GDCLASS(EnvironmentData, Resource);
|
||||
|
@ -216,7 +216,7 @@ void VoxelChunk::set_size(int size_x, int size_y, int size_z, int margin_start,
|
||||
}
|
||||
|
||||
for (int i = 0; i < _channels.size(); ++i) {
|
||||
uint8_t * ch = _channels[i];
|
||||
uint8_t *ch = _channels[i];
|
||||
|
||||
if (ch != NULL) {
|
||||
memdelete_arr(ch);
|
||||
@ -245,7 +245,7 @@ uint8_t VoxelChunk::get_voxel(int x, int y, int z, int channel_index) const {
|
||||
ERR_FAIL_INDEX_V(channel_index, _channels.size(), 0);
|
||||
ERR_FAIL_COND_V(!validate_channel_data_position(x, y, z), 0);
|
||||
|
||||
uint8_t * ch = _channels.get(channel_index);
|
||||
uint8_t *ch = _channels.get(channel_index);
|
||||
|
||||
if (!ch)
|
||||
return 0;
|
||||
@ -267,7 +267,7 @@ void VoxelChunk::set_channel_count(int count) {
|
||||
|
||||
if (_channels.size() >= count) {
|
||||
for (int i = count; i < _channels.size(); ++i) {
|
||||
uint8_t * ch = _channels[i];
|
||||
uint8_t *ch = _channels[i];
|
||||
|
||||
if (ch != NULL) {
|
||||
memdelete_arr(ch);
|
||||
@ -842,7 +842,6 @@ void VoxelChunk::allocate_prop_mesh() {
|
||||
VS::get_singleton()->instance_set_transform(_prop_mesh_instance_rid, Transform(Basis(), Vector3(_position_x * _size_x * _voxel_scale, _position_y * _size_y * _voxel_scale, _position_z * _size_z * _voxel_scale)));
|
||||
}
|
||||
|
||||
|
||||
void VoxelChunk::free_prop_mesh() {
|
||||
if (_prop_mesh_instance_rid != RID()) {
|
||||
VS::get_singleton()->free(_prop_mesh_instance_rid);
|
||||
@ -1117,7 +1116,7 @@ VoxelChunk::~VoxelChunk() {
|
||||
_props.clear();
|
||||
|
||||
for (int i = 0; i < _channels.size(); ++i) {
|
||||
uint8_t * ch = _channels[i];
|
||||
uint8_t *ch = _channels[i];
|
||||
|
||||
if (ch != NULL) {
|
||||
memdelete_arr(ch);
|
||||
@ -1186,7 +1185,6 @@ void VoxelChunk::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_size_z"), &VoxelChunk::get_size_z);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "size_z"), "", "get_size_z");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_data_size_x"), &VoxelChunk::get_data_size_x);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "data_size_x"), "", "get_data_size_x");
|
||||
|
||||
@ -1196,7 +1194,6 @@ void VoxelChunk::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_data_size_z"), &VoxelChunk::get_data_size_z);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "data_size_z"), "", "get_data_size_z");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_position"), &VoxelChunk::get_position);
|
||||
ClassDB::bind_method(D_METHOD("get_size"), &VoxelChunk::get_size);
|
||||
ClassDB::bind_method(D_METHOD("set_position", "x", "y", "z"), &VoxelChunk::set_position);
|
||||
@ -1204,7 +1201,6 @@ void VoxelChunk::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_margin_start"), &VoxelChunk::get_margin_start);
|
||||
ClassDB::bind_method(D_METHOD("get_margin_end"), &VoxelChunk::get_margin_end);
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_library"), &VoxelChunk::get_library);
|
||||
ClassDB::bind_method(D_METHOD("set_library", "value"), &VoxelChunk::set_library);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanLibrary"), "set_library", "get_library");
|
||||
@ -1385,5 +1381,4 @@ void VoxelChunk::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_LIQUID_FILL);
|
||||
BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_LIQUID_FLOW);
|
||||
BIND_ENUM_CONSTANT(MAX_DEFAULT_CHANNELS);
|
||||
|
||||
}
|
||||
|
@ -4,17 +4,17 @@
|
||||
#include "scene/3d/spatial.h"
|
||||
|
||||
#include "core/engine.h"
|
||||
#include "core/ustring.h"
|
||||
#include "core/os/thread.h"
|
||||
#include "core/os/thread_safe.h"
|
||||
#include "core/ustring.h"
|
||||
|
||||
#include "scene/3d/mesh_instance.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "core/array.h"
|
||||
#include "scene/3d/collision_shape.h"
|
||||
#include "scene/3d/mesh_instance.h"
|
||||
#include "scene/3d/physics_body.h"
|
||||
#include "scene/resources/concave_polygon_shape.h"
|
||||
#include "scene/3d/spatial.h"
|
||||
#include "scene/resources/concave_polygon_shape.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
|
||||
#include "voxel_world.h"
|
||||
|
||||
@ -29,9 +29,9 @@
|
||||
#include "../../mesh_data_resource/mesh_data_resource.h"
|
||||
#include "../props/prop_data.h"
|
||||
#include "../props/prop_data_entry.h"
|
||||
#include "../props/prop_data_scene.h"
|
||||
#include "../props/prop_data_mesh.h"
|
||||
#include "../props/prop_data_light.h"
|
||||
#include "../props/prop_data_mesh.h"
|
||||
#include "../props/prop_data_scene.h"
|
||||
#include "voxel_chunk_prop_data.h"
|
||||
|
||||
class VoxelWorld;
|
||||
|
@ -1,14 +1,14 @@
|
||||
#ifndef VOXEL_CHUNK_PROP_DATA_H
|
||||
#define VOXEL_CHUNK_PROP_DATA_H
|
||||
|
||||
#include "core/reference.h"
|
||||
#include "core/math/vector3.h"
|
||||
#include "core/reference.h"
|
||||
|
||||
#include "scene/resources/texture.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "../../mesh_data_resource/mesh_data_resource.h"
|
||||
#include "../props/prop_data.h"
|
||||
#include "../props/prop_data_light.h"
|
||||
#include "../../mesh_data_resource/mesh_data_resource.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
class VoxelChunkPropData : public Reference {
|
||||
GDCLASS(VoxelChunkPropData, Reference);
|
||||
|
@ -45,7 +45,7 @@ void VoxelStructure::set_world_position_z(const int value) {
|
||||
VoxelChunk *VoxelStructure::get_chunk_voxel_pos(int x, int y, int z) {
|
||||
|
||||
VoxelChunk *b = get_chunk(x / _chunk_size_x, y / _chunk_size_y, z / _chunk_size_z);
|
||||
/*
|
||||
/*
|
||||
if (!b.is_valid()) {
|
||||
b.instance();
|
||||
|
||||
@ -71,7 +71,6 @@ void VoxelStructure::set_voxel(int value, int x, int y, int z, unsigned int chan
|
||||
}
|
||||
|
||||
void add_chunk_bind(Node *chunk, const int x, const int y, const int z) {
|
||||
|
||||
}
|
||||
void VoxelStructure::add_chunk(VoxelChunk *chunk, const int x, const int y, const int z) {
|
||||
//_chunks.set(Vector3i(x, y, z), chunk);
|
||||
|
@ -19,7 +19,6 @@ public:
|
||||
int get_chunk_size_z() const;
|
||||
void set_chunk_size_z(const int value);
|
||||
|
||||
|
||||
int get_world_position_x() const;
|
||||
void set_world_position_x(const int value);
|
||||
|
||||
@ -74,8 +73,8 @@ private:
|
||||
int _world_position_y;
|
||||
int _world_position_z;
|
||||
|
||||
HashMap<IntPos, VoxelChunk*, IntPosHasher> _chunks;
|
||||
Vector<VoxelChunk*> _chunks_vector;
|
||||
HashMap<IntPos, VoxelChunk *, IntPosHasher> _chunks;
|
||||
Vector<VoxelChunk *> _chunks_vector;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -199,7 +199,6 @@ int VoxelWorld::get_generation_size() {
|
||||
return _generating.size();
|
||||
}
|
||||
|
||||
|
||||
void VoxelWorld::clear() {
|
||||
for (int i = 0; i < _chunks_vector.size(); ++i) {
|
||||
_chunks_vector.get(i)->queue_delete();
|
||||
@ -218,7 +217,7 @@ VoxelChunk *VoxelWorld::create_chunk(int x, int y, int z) {
|
||||
|
||||
Node *n = call("_create_chunk", x, y, z, np);
|
||||
|
||||
return(Object::cast_to<VoxelChunk>(n));
|
||||
return (Object::cast_to<VoxelChunk>(n));
|
||||
}
|
||||
VoxelChunk *VoxelWorld::_create_chunk(int x, int y, int z, Node *p_chunk) {
|
||||
VoxelChunk *chunk;
|
||||
@ -263,7 +262,6 @@ void VoxelWorld::generate_chunk(VoxelChunk *p_chunk) {
|
||||
if (has_method("_prepare_chunk_for_generation"))
|
||||
call("_prepare_chunk_for_generation", p_chunk);
|
||||
|
||||
|
||||
call("_generate_chunk", p_chunk);
|
||||
|
||||
p_chunk->build();
|
||||
|
@ -1,13 +1,13 @@
|
||||
#ifndef VOXEL_WORLD_H
|
||||
#define VOXEL_WORLD_H
|
||||
|
||||
#include "scene/3d/navigation.h"
|
||||
#include "core/hash_map.h"
|
||||
#include "core/engine.h"
|
||||
#include "core/hash_map.h"
|
||||
#include "scene/3d/navigation.h"
|
||||
|
||||
#include "../library/voxelman_library.h"
|
||||
#include "../level_generator/voxelman_level_generator.h"
|
||||
#include "../areas/world_area.h"
|
||||
#include "../level_generator/voxelman_level_generator.h"
|
||||
#include "../library/voxelman_library.h"
|
||||
|
||||
#include "core/os/os.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user