mirror of
https://github.com/Relintai/voxelman.git
synced 2025-01-10 14:59:36 +01:00
Clang format.
This commit is contained in:
parent
b559329212
commit
a67d0393ca
@ -28,10 +28,10 @@ void WorldArea::set_name(const String value) {
|
||||
_name = value;
|
||||
}
|
||||
|
||||
int WorldArea::get_level() const {
|
||||
return _level;
|
||||
int WorldArea::get_level() const {
|
||||
return _level;
|
||||
}
|
||||
void WorldArea::set_level(const int level) {
|
||||
void WorldArea::set_level(const int level) {
|
||||
_level = level;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ WorldArea::~WorldArea() {
|
||||
void WorldArea::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_aabb"), &WorldArea::get_aabb);
|
||||
ClassDB::bind_method(D_METHOD("set_aabb"), &WorldArea::set_aabb);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::AABB, "aabb"), "set_aabb", "get_aabb");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::AABB, "aabb"), "set_aabb", "get_aabb");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_map_texture"), &WorldArea::get_map_texture);
|
||||
ClassDB::bind_method(D_METHOD("set_map_texture"), &WorldArea::set_map_texture);
|
||||
|
@ -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,142 +2,142 @@
|
||||
|
||||
/// VMQUeue
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
void VMQueue<T>::enqueue(T obj) {
|
||||
_lock->write_lock();
|
||||
_lock->write_lock();
|
||||
|
||||
if (_size == _count) {
|
||||
_resize(_size + 10);
|
||||
}
|
||||
if (_size == _count) {
|
||||
_resize(_size + 10);
|
||||
}
|
||||
|
||||
_items[(_head + _count) % _size] = obj;
|
||||
++_count;
|
||||
_items[(_head + _count) % _size] = obj;
|
||||
++_count;
|
||||
|
||||
_lock->write_unlock();
|
||||
_lock->write_unlock();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
T VMQueue<T>::dequeue() {
|
||||
if (_size == 0)
|
||||
return T();
|
||||
if (_size == 0)
|
||||
return T();
|
||||
|
||||
if (_count == 0)
|
||||
return T();
|
||||
if (_count == 0)
|
||||
return T();
|
||||
|
||||
T obj;
|
||||
T obj;
|
||||
|
||||
_lock->write_lock();
|
||||
_lock->write_lock();
|
||||
|
||||
obj = _items[_head];
|
||||
obj = _items[_head];
|
||||
|
||||
_items[_head] = T();
|
||||
_items[_head] = T();
|
||||
|
||||
++_head;
|
||||
--_count;
|
||||
++_head;
|
||||
--_count;
|
||||
|
||||
if (_head >= _size)
|
||||
_head -= _size;
|
||||
if (_head >= _size)
|
||||
_head -= _size;
|
||||
|
||||
_lock->write_unlock();
|
||||
_lock->write_unlock();
|
||||
|
||||
return obj;
|
||||
return obj;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
T VMQueue<T>::peek() {
|
||||
T obj;
|
||||
T obj;
|
||||
|
||||
_lock->read_lock();
|
||||
obj = _items[_head];
|
||||
_lock->read_unlock();
|
||||
_lock->read_lock();
|
||||
obj = _items[_head];
|
||||
_lock->read_unlock();
|
||||
|
||||
return obj;
|
||||
return obj;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
void VMQueue<T>::resize(int new_size) {
|
||||
_lock->write_lock();
|
||||
_lock->write_lock();
|
||||
|
||||
_resize(new_size);
|
||||
_resize(new_size);
|
||||
|
||||
_lock->write_unlock();
|
||||
_lock->write_unlock();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
void VMQueue<T>::_resize(int new_size) {
|
||||
if (new_size == _size)
|
||||
return;
|
||||
if (new_size == _size)
|
||||
return;
|
||||
|
||||
if (new_size > _size) {
|
||||
if (new_size > _size) {
|
||||
|
||||
T *narr = memnew_arr(T, new_size);
|
||||
//copymem(narr, _items, sizeof(T) * _size);
|
||||
T *narr = memnew_arr(T, new_size);
|
||||
//copymem(narr, _items, sizeof(T) * _size);
|
||||
|
||||
for (int i = 0; i < _size; ++i) {
|
||||
narr[i] = _items[i];
|
||||
}
|
||||
for (int i = 0; i < _size; ++i) {
|
||||
narr[i] = _items[i];
|
||||
}
|
||||
|
||||
memdelete_arr(_items);
|
||||
_items = narr;
|
||||
memdelete_arr(_items);
|
||||
_items = narr;
|
||||
|
||||
_size = new_size;
|
||||
_size = new_size;
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
VMQueue<T>::VMQueue(int initial_size) {
|
||||
_items = NULL;
|
||||
_head = 0;
|
||||
_count = 0;
|
||||
_size = initial_size;
|
||||
_items = NULL;
|
||||
_head = 0;
|
||||
_count = 0;
|
||||
_size = initial_size;
|
||||
|
||||
if (unlikely(initial_size <= 0)) {
|
||||
_size = 10;
|
||||
|
||||
print_error("initial_size <= 0");
|
||||
}
|
||||
if (unlikely(initial_size <= 0)) {
|
||||
_size = 10;
|
||||
|
||||
_lock = RWLock::create();
|
||||
print_error("initial_size <= 0");
|
||||
}
|
||||
|
||||
_items = memnew_arr(T, _size);
|
||||
_lock = RWLock::create();
|
||||
|
||||
_items = memnew_arr(T, _size);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
VMQueue<T>::VMQueue() {
|
||||
_items = NULL;
|
||||
_head = 0;
|
||||
_count = 0;
|
||||
_size = 10;
|
||||
_items = NULL;
|
||||
_head = 0;
|
||||
_count = 0;
|
||||
_size = 10;
|
||||
|
||||
_lock = RWLock::create();
|
||||
_lock = RWLock::create();
|
||||
|
||||
_items = memnew_arr(T, _size);
|
||||
_items = memnew_arr(T, _size);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
VMQueue<T>::~VMQueue() {
|
||||
if (_items)
|
||||
memdelete_arr(_items);
|
||||
if (_items)
|
||||
memdelete_arr(_items);
|
||||
|
||||
memdelete(_lock);
|
||||
memdelete(_lock);
|
||||
}
|
||||
|
||||
///VoxelmanQueue
|
||||
|
||||
void VoxelmanQueue::enqueue(Variant obj) {
|
||||
_queue.enqueue(obj);
|
||||
_queue.enqueue(obj);
|
||||
}
|
||||
Variant VoxelmanQueue::dequeue() {
|
||||
return _queue.dequeue();
|
||||
return _queue.dequeue();
|
||||
}
|
||||
Variant VoxelmanQueue::peek() {
|
||||
return _queue.peek();
|
||||
return _queue.peek();
|
||||
}
|
||||
|
||||
void VoxelmanQueue::resize(int new_size) {
|
||||
_queue.resize(new_size);
|
||||
_queue.resize(new_size);
|
||||
}
|
||||
|
||||
VoxelmanQueue::VoxelmanQueue() {
|
||||
@ -147,8 +147,8 @@ VoxelmanQueue::~VoxelmanQueue() {
|
||||
}
|
||||
|
||||
void VoxelmanQueue::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("enqueue", "obj"), &VoxelmanQueue::enqueue);
|
||||
ClassDB::bind_method(D_METHOD("dequeue"), &VoxelmanQueue::dequeue);
|
||||
ClassDB::bind_method(D_METHOD("peek"), &VoxelmanQueue::peek);
|
||||
ClassDB::bind_method(D_METHOD("resize", "new_size"), &VoxelmanQueue::resize);
|
||||
ClassDB::bind_method(D_METHOD("enqueue", "obj"), &VoxelmanQueue::enqueue);
|
||||
ClassDB::bind_method(D_METHOD("dequeue"), &VoxelmanQueue::dequeue);
|
||||
ClassDB::bind_method(D_METHOD("peek"), &VoxelmanQueue::peek);
|
||||
ClassDB::bind_method(D_METHOD("resize", "new_size"), &VoxelmanQueue::resize);
|
||||
}
|
||||
|
@ -8,50 +8,50 @@
|
||||
#include "core/os/rw_lock.h"
|
||||
#include "core/variant.h"
|
||||
|
||||
template<class T>
|
||||
template <class T>
|
||||
class VMQueue {
|
||||
|
||||
public:
|
||||
void enqueue(T obj);
|
||||
T dequeue();
|
||||
T peek();
|
||||
void enqueue(T obj);
|
||||
T dequeue();
|
||||
T peek();
|
||||
|
||||
void resize(int new_size);
|
||||
void resize(int new_size);
|
||||
|
||||
VMQueue(int initial_size);
|
||||
VMQueue();
|
||||
~VMQueue();
|
||||
VMQueue(int initial_size);
|
||||
VMQueue();
|
||||
~VMQueue();
|
||||
|
||||
protected:
|
||||
void _resize(int new_size);
|
||||
void _resize(int new_size);
|
||||
|
||||
private:
|
||||
RWLock *_lock;
|
||||
RWLock *_lock;
|
||||
|
||||
int _head;
|
||||
int _count;
|
||||
int _size;
|
||||
T *_items;
|
||||
int _head;
|
||||
int _count;
|
||||
int _size;
|
||||
T *_items;
|
||||
};
|
||||
|
||||
class VoxelmanQueue : public Reference {
|
||||
GDCLASS(VoxelmanQueue, Reference);
|
||||
GDCLASS(VoxelmanQueue, Reference);
|
||||
|
||||
public:
|
||||
void enqueue(Variant obj);
|
||||
Variant dequeue();
|
||||
Variant peek();
|
||||
void enqueue(Variant obj);
|
||||
Variant dequeue();
|
||||
Variant peek();
|
||||
|
||||
void resize(int new_size);
|
||||
void resize(int new_size);
|
||||
|
||||
VoxelmanQueue();
|
||||
~VoxelmanQueue();
|
||||
VoxelmanQueue();
|
||||
~VoxelmanQueue();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
VMQueue<Variant> _queue;
|
||||
VMQueue<Variant> _queue;
|
||||
};
|
||||
|
||||
#endif
|
@ -2,81 +2,81 @@
|
||||
|
||||
/// VMQUeue
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
void VMUBQueue<T>::enqueue(T obj) {
|
||||
_enqueue_lock->write_lock();
|
||||
_enqueue_lock->write_lock();
|
||||
|
||||
UBQueueNode<T> *n = memnew(UBQueueNode<T>(obj));
|
||||
UBQueueNode<T> *n = memnew(UBQueueNode<T>(obj));
|
||||
|
||||
_tail->next = n;
|
||||
_tail = n;
|
||||
_tail->next = n;
|
||||
_tail = n;
|
||||
|
||||
_enqueue_lock->write_unlock();
|
||||
_enqueue_lock->write_unlock();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
T VMUBQueue<T>::dequeue() {
|
||||
T result;
|
||||
T result;
|
||||
|
||||
_dequeue_lock->write_lock();
|
||||
_dequeue_lock->write_lock();
|
||||
|
||||
if (_head->next == NULL) {
|
||||
return result;
|
||||
}
|
||||
if (_head->next == NULL) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = _head->next->data;
|
||||
|
||||
UBQueueNode<T> *h = _head;
|
||||
result = _head->next->data;
|
||||
|
||||
_head = _head->next;
|
||||
UBQueueNode<T> *h = _head;
|
||||
|
||||
memdelete(h);
|
||||
_head = _head->next;
|
||||
|
||||
_dequeue_lock->write_unlock();
|
||||
memdelete(h);
|
||||
|
||||
return result;
|
||||
_dequeue_lock->write_unlock();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
T VMUBQueue<T>::peek() {
|
||||
return _head->data;
|
||||
return _head->data;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
VMUBQueue<T>::VMUBQueue() {
|
||||
_head = memnew(UBQueueNode<T>);
|
||||
_tail = _head;
|
||||
_head = memnew(UBQueueNode<T>);
|
||||
_tail = _head;
|
||||
|
||||
_enqueue_lock = RWLock::create();
|
||||
_dequeue_lock = RWLock::create();
|
||||
_enqueue_lock = RWLock::create();
|
||||
_dequeue_lock = RWLock::create();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
VMUBQueue<T>::~VMUBQueue() {
|
||||
memdelete(_enqueue_lock);
|
||||
memdelete(_dequeue_lock);
|
||||
memdelete(_enqueue_lock);
|
||||
memdelete(_dequeue_lock);
|
||||
|
||||
UBQueueNode<T> *h = _head;
|
||||
UBQueueNode<T> *h = _head;
|
||||
|
||||
while (h) {
|
||||
UBQueueNode<T> *n = h->next;
|
||||
while (h) {
|
||||
UBQueueNode<T> *n = h->next;
|
||||
|
||||
memdelete(h);
|
||||
memdelete(h);
|
||||
|
||||
h = n;
|
||||
}
|
||||
h = n;
|
||||
}
|
||||
}
|
||||
|
||||
///VoxelmanUnboundedQueue
|
||||
|
||||
void VoxelmanUnboundedQueue::enqueue(Variant obj) {
|
||||
_queue.enqueue(obj);
|
||||
_queue.enqueue(obj);
|
||||
}
|
||||
Variant VoxelmanUnboundedQueue::dequeue() {
|
||||
return _queue.dequeue();
|
||||
return _queue.dequeue();
|
||||
}
|
||||
Variant VoxelmanUnboundedQueue::peek() {
|
||||
return _queue.peek();
|
||||
return _queue.peek();
|
||||
}
|
||||
|
||||
VoxelmanUnboundedQueue::VoxelmanUnboundedQueue() {
|
||||
@ -86,7 +86,7 @@ VoxelmanUnboundedQueue::~VoxelmanUnboundedQueue() {
|
||||
}
|
||||
|
||||
void VoxelmanUnboundedQueue::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("enqueue", "obj"), &VoxelmanUnboundedQueue::enqueue);
|
||||
ClassDB::bind_method(D_METHOD("dequeue"), &VoxelmanUnboundedQueue::dequeue);
|
||||
ClassDB::bind_method(D_METHOD("peek"), &VoxelmanUnboundedQueue::peek);
|
||||
ClassDB::bind_method(D_METHOD("enqueue", "obj"), &VoxelmanUnboundedQueue::enqueue);
|
||||
ClassDB::bind_method(D_METHOD("dequeue"), &VoxelmanUnboundedQueue::dequeue);
|
||||
ClassDB::bind_method(D_METHOD("peek"), &VoxelmanUnboundedQueue::peek);
|
||||
}
|
||||
|
@ -8,56 +8,56 @@
|
||||
#include "core/os/rw_lock.h"
|
||||
#include "core/variant.h"
|
||||
|
||||
template<class T>
|
||||
template <class T>
|
||||
struct UBQueueNode {
|
||||
T data;
|
||||
UBQueueNode *next;
|
||||
T data;
|
||||
UBQueueNode *next;
|
||||
|
||||
UBQueueNode() {
|
||||
next = NULL;
|
||||
}
|
||||
UBQueueNode() {
|
||||
next = NULL;
|
||||
}
|
||||
|
||||
UBQueueNode(T value) {
|
||||
data = value;
|
||||
next = NULL;
|
||||
}
|
||||
UBQueueNode(T value) {
|
||||
data = value;
|
||||
next = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
template <class T>
|
||||
class VMUBQueue {
|
||||
|
||||
public:
|
||||
void enqueue(T obj);
|
||||
T dequeue();
|
||||
T peek();
|
||||
void enqueue(T obj);
|
||||
T dequeue();
|
||||
T peek();
|
||||
|
||||
VMUBQueue();
|
||||
~VMUBQueue();
|
||||
VMUBQueue();
|
||||
~VMUBQueue();
|
||||
|
||||
private:
|
||||
RWLock *_enqueue_lock;
|
||||
RWLock *_dequeue_lock;
|
||||
RWLock *_enqueue_lock;
|
||||
RWLock *_dequeue_lock;
|
||||
|
||||
UBQueueNode<T> *_head;
|
||||
UBQueueNode<T> *_tail;
|
||||
UBQueueNode<T> *_head;
|
||||
UBQueueNode<T> *_tail;
|
||||
};
|
||||
|
||||
class VoxelmanUnboundedQueue : public Reference {
|
||||
GDCLASS(VoxelmanUnboundedQueue, Reference);
|
||||
GDCLASS(VoxelmanUnboundedQueue, Reference);
|
||||
|
||||
public:
|
||||
void enqueue(Variant obj);
|
||||
Variant dequeue();
|
||||
Variant peek();
|
||||
void enqueue(Variant obj);
|
||||
Variant dequeue();
|
||||
Variant peek();
|
||||
|
||||
VoxelmanUnboundedQueue();
|
||||
~VoxelmanUnboundedQueue();
|
||||
VoxelmanUnboundedQueue();
|
||||
~VoxelmanUnboundedQueue();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
VMUBQueue<Variant> _queue;
|
||||
VMUBQueue<Variant> _queue;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,58 +1,55 @@
|
||||
#include "voxel_light.h"
|
||||
|
||||
_FORCE_INLINE_ int VoxelLight::get_world_position_x() const {
|
||||
return _world_position_x;
|
||||
return _world_position_x;
|
||||
}
|
||||
_FORCE_INLINE_ int VoxelLight::get_world_position_y() const {
|
||||
return _world_position_y;
|
||||
return _world_position_y;
|
||||
}
|
||||
_FORCE_INLINE_ int VoxelLight::get_world_position_z() const {
|
||||
return _world_position_z;
|
||||
return _world_position_z;
|
||||
}
|
||||
Vector3 VoxelLight::get_world_position() {
|
||||
return Vector3(_world_position_x, _world_position_y, _world_position_z);
|
||||
|
||||
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;
|
||||
_world_position_y = y;
|
||||
_world_position_z = z;
|
||||
_world_position_x = x;
|
||||
_world_position_y = y;
|
||||
_world_position_z = z;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Color VoxelLight::get_color() const {
|
||||
return _color;
|
||||
|
||||
_FORCE_INLINE_ Color VoxelLight::get_color() const {
|
||||
return _color;
|
||||
}
|
||||
void VoxelLight::set_color(Color color) {
|
||||
_color = color;
|
||||
|
||||
void VoxelLight::set_color(Color color) {
|
||||
_color = color;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ float VoxelLight::get_size() const {
|
||||
return _size;
|
||||
_FORCE_INLINE_ float VoxelLight::get_size() const {
|
||||
return _size;
|
||||
}
|
||||
void VoxelLight::set_size(const float size) {
|
||||
_size = size;
|
||||
void VoxelLight::set_size(const float size) {
|
||||
_size = size;
|
||||
}
|
||||
|
||||
VoxelLight::VoxelLight() {
|
||||
_size = 0;
|
||||
_size = 0;
|
||||
}
|
||||
|
||||
VoxelLight::~VoxelLight() {
|
||||
}
|
||||
|
||||
void VoxelLight::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_world_position_x"), &VoxelLight::get_world_position_x);
|
||||
ClassDB::bind_method(D_METHOD("get_world_position_y"), &VoxelLight::get_world_position_y);
|
||||
ClassDB::bind_method(D_METHOD("get_world_position_z"), &VoxelLight::get_world_position_z);
|
||||
ClassDB::bind_method(D_METHOD("set_world_position", "x", "y", "z"), &VoxelLight::set_world_position);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_color"), &VoxelLight::get_color);
|
||||
ClassDB::bind_method(D_METHOD("set_color"), &VoxelLight::set_color);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_size"), &VoxelLight::get_size);
|
||||
ClassDB::bind_method(D_METHOD("set_size"), &VoxelLight::set_size);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "size"), "set_size", "get_size");
|
||||
ClassDB::bind_method(D_METHOD("get_world_position_x"), &VoxelLight::get_world_position_x);
|
||||
ClassDB::bind_method(D_METHOD("get_world_position_y"), &VoxelLight::get_world_position_y);
|
||||
ClassDB::bind_method(D_METHOD("get_world_position_z"), &VoxelLight::get_world_position_z);
|
||||
ClassDB::bind_method(D_METHOD("set_world_position", "x", "y", "z"), &VoxelLight::set_world_position);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_color"), &VoxelLight::get_color);
|
||||
ClassDB::bind_method(D_METHOD("set_color"), &VoxelLight::set_color);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_size"), &VoxelLight::get_size);
|
||||
ClassDB::bind_method(D_METHOD("set_size"), &VoxelLight::set_size);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "size"), "set_size", "get_size");
|
||||
}
|
||||
|
2
docs/_templates/breadcrumbs.html
vendored
2
docs/_templates/breadcrumbs.html
vendored
@ -4,4 +4,4 @@
|
||||
{% if not meta or meta.get('github_url') != 'hide' %}
|
||||
{{ super() }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
4
docs/_templates/layout.html
vendored
4
docs/_templates/layout.html
vendored
@ -1,4 +1,4 @@
|
||||
{% extends "!layout.html" %}
|
||||
{% block linktags %}
|
||||
{{ super() }}
|
||||
{% endblock %}
|
||||
{{ super() }}
|
||||
{% endblock %}
|
@ -3,12 +3,12 @@
|
||||
#include "../world/voxel_chunk.h"
|
||||
|
||||
void VoxelmanLevelGenerator::generate_chunk_bind(Node *chunk) {
|
||||
generate_chunk(Object::cast_to<VoxelChunk>(chunk));
|
||||
generate_chunk(Object::cast_to<VoxelChunk>(chunk));
|
||||
}
|
||||
void VoxelmanLevelGenerator::generate_chunk(VoxelChunk *chunk) {
|
||||
if (has_method("_generate_chunk")) {
|
||||
call("_generate_chunk", chunk);
|
||||
}
|
||||
if (has_method("_generate_chunk")) {
|
||||
call("_generate_chunk", chunk);
|
||||
}
|
||||
}
|
||||
|
||||
VoxelmanLevelGenerator::VoxelmanLevelGenerator() {
|
||||
@ -18,7 +18,7 @@ VoxelmanLevelGenerator::~VoxelmanLevelGenerator() {
|
||||
}
|
||||
|
||||
void VoxelmanLevelGenerator::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &VoxelmanLevelGenerator::generate_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("generate_chunk", "chunk"), &VoxelmanLevelGenerator::generate_chunk_bind);
|
||||
}
|
||||
|
@ -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;
|
||||
@ -47,22 +47,22 @@ public:
|
||||
int get_id() const;
|
||||
void set_id(const int value);
|
||||
|
||||
bool is_transparent() const;
|
||||
bool is_transparent() const;
|
||||
void set_transparent(const bool transparent);
|
||||
|
||||
|
||||
Rect2 get_rect(const VoxelSurfaceSides side) const;
|
||||
void set_rect(const VoxelSurfaceSides side, const Rect2 rect);
|
||||
|
||||
Ref<GroundClutter> get_clutter();
|
||||
void set_clutter(Ref<GroundClutter> clutter);
|
||||
|
||||
Ref<VoxelmanLibrary> get_library() const;
|
||||
Ref<VoxelmanLibrary> get_library() const;
|
||||
void set_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
Vector2 transform_uv(const VoxelSurfaceSides side, const Vector2 uv) const;
|
||||
|
||||
virtual void refresh_rects();
|
||||
|
||||
|
||||
VoxelSurface();
|
||||
~VoxelSurface();
|
||||
|
||||
|
@ -36,7 +36,7 @@ void VoxelSurfaceMerger::refresh_rects() {
|
||||
}
|
||||
|
||||
Rect2 region = at->get_region();
|
||||
float w = tex->get_width();
|
||||
float w = tex->get_width();
|
||||
float h = tex->get_height();
|
||||
|
||||
Rect2 r;
|
||||
@ -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);
|
||||
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ VoxelSurfaceSimple::~VoxelSurfaceSimple() {
|
||||
void VoxelSurfaceSimple::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_atlas_x", "side"), &VoxelSurfaceSimple::get_atlas_x);
|
||||
ClassDB::bind_method(D_METHOD("set_atlas_x", "side", "value"), &VoxelSurfaceSimple::set_atlas_x);
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_atlas_y", "side"), &VoxelSurfaceSimple::get_atlas_y);
|
||||
ClassDB::bind_method(D_METHOD("set_atlas_y", "side", "value"), &VoxelSurfaceSimple::set_atlas_y);
|
||||
|
||||
|
@ -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;
|
||||
@ -444,7 +442,7 @@ void VoxelCubePoints::setup(VoxelChunk *chunk, int x, int y, int z, int size) {
|
||||
_point_fills[P101] = chunk->get_voxel(x + size, y, z + size, VoxelChunk::DEFAULT_CHANNEL_ISOLEVEL);
|
||||
_point_fills[P111] = chunk->get_voxel(x + size, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_ISOLEVEL);
|
||||
|
||||
_point_aos[P000] = chunk->get_voxel(x, y, z, VoxelChunk::DEFAULT_CHANNEL_AO);
|
||||
_point_aos[P000] = chunk->get_voxel(x, y, z, VoxelChunk::DEFAULT_CHANNEL_AO);
|
||||
_point_aos[P100] = chunk->get_voxel(x + size, y, z, VoxelChunk::DEFAULT_CHANNEL_AO);
|
||||
_point_aos[P010] = chunk->get_voxel(x, y + size, z, VoxelChunk::DEFAULT_CHANNEL_AO);
|
||||
_point_aos[P001] = chunk->get_voxel(x, y, z + size, VoxelChunk::DEFAULT_CHANNEL_AO);
|
||||
@ -461,13 +459,12 @@ void VoxelCubePoints::setup(VoxelChunk *chunk, int x, int y, int z, int size) {
|
||||
_point_colors[P011] = Color(chunk->get_voxel(x, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_R) / 255.0, chunk->get_voxel(x, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_G) / 255.0, chunk->get_voxel(x, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_B) / 255.0);
|
||||
_point_colors[P101] = Color(chunk->get_voxel(x + size, y, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_R) / 255.0, chunk->get_voxel(x + size, y, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_G) / 255.0, chunk->get_voxel(x + size, y, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_B) / 255.0);
|
||||
_point_colors[P111] = Color(chunk->get_voxel(x + size, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_R) / 255.0, chunk->get_voxel(x + size, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_G) / 255.0, chunk->get_voxel(x + size, y + size, z + size, VoxelChunk::DEFAULT_CHANNEL_LIGHT_COLOR_B) / 255.0);
|
||||
|
||||
|
||||
refresh_neighbours(chunk);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -580,19 +576,19 @@ int VoxelCubePoints::get_point_neighbours(int index) {
|
||||
}
|
||||
|
||||
int VoxelCubePoints::get_point_ao(int index) {
|
||||
ERR_FAIL_INDEX_V(index, POINT_COUNT, 0);
|
||||
|
||||
return _point_aos[index];
|
||||
ERR_FAIL_INDEX_V(index, POINT_COUNT, 0);
|
||||
|
||||
return _point_aos[index];
|
||||
}
|
||||
|
||||
int VoxelCubePoints::get_face_point_ao(int face, int index) {
|
||||
int indx = get_point_index(face, index);
|
||||
int indx = get_point_index(face, index);
|
||||
|
||||
return _point_aos[indx];
|
||||
}
|
||||
|
||||
Color VoxelCubePoints::get_face_point_ao_color(int face, int index) {
|
||||
int indx = get_point_index(face, index);
|
||||
int indx = get_point_index(face, index);
|
||||
|
||||
float ao_value = (_point_aos[indx] / 255.0) * 0.75;
|
||||
|
||||
@ -744,7 +740,6 @@ VoxelCubePoints::VoxelCubePoints() {
|
||||
VoxelCubePoints::~VoxelCubePoints() {
|
||||
}
|
||||
|
||||
|
||||
void VoxelCubePoints::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_x"), &VoxelCubePoints::get_x);
|
||||
@ -783,9 +778,9 @@ void VoxelCubePoints::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_point_type", "index"), &VoxelCubePoints::get_point_type);
|
||||
ClassDB::bind_method(D_METHOD("get_point_fill", "index"), &VoxelCubePoints::get_point_fill);
|
||||
ClassDB::bind_method(D_METHOD("get_point_neighbours", "index"), &VoxelCubePoints::get_point_neighbours);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_point_ao", "index"), &VoxelCubePoints::get_point_ao);
|
||||
ClassDB::bind_method(D_METHOD("get_face_point_ao", "face", "index"), &VoxelCubePoints::get_face_point_ao);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_point_ao", "index"), &VoxelCubePoints::get_point_ao);
|
||||
ClassDB::bind_method(D_METHOD("get_face_point_ao", "face", "index"), &VoxelCubePoints::get_face_point_ao);
|
||||
ClassDB::bind_method(D_METHOD("get_face_point_ao_color", "face", "index"), &VoxelCubePoints::get_face_point_ao_color);
|
||||
ClassDB::bind_method(D_METHOD("get_face_point_light_color", "face", "index"), &VoxelCubePoints::get_face_point_light_color);
|
||||
ClassDB::bind_method(D_METHOD("get_face_point_color_mixed", "face", "index"), &VoxelCubePoints::get_face_point_color_mixed);
|
||||
|
@ -113,8 +113,8 @@ public:
|
||||
int get_point_fill(int index);
|
||||
int get_point_neighbours(int index);
|
||||
|
||||
int get_point_ao(int index);
|
||||
int get_face_point_ao(int face, int index);
|
||||
int get_point_ao(int index);
|
||||
int get_face_point_ao(int face, int index);
|
||||
Color get_face_point_ao_color(int face, int index);
|
||||
Color get_face_point_light_color(int face, int index);
|
||||
Color get_face_point_color_mixed(int face, int index);
|
||||
@ -148,8 +148,8 @@ private:
|
||||
|
||||
uint8_t _point_types[POINT_COUNT];
|
||||
uint8_t _point_fills[POINT_COUNT];
|
||||
uint8_t _point_aos[POINT_COUNT];
|
||||
Color _point_colors[POINT_COUNT];
|
||||
uint8_t _point_aos[POINT_COUNT];
|
||||
Color _point_colors[POINT_COUNT];
|
||||
unsigned int _point_neighbours[POINT_COUNT];
|
||||
|
||||
int _size;
|
||||
|
@ -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"
|
||||
|
||||
@ -14,13 +14,12 @@ class VoxelMesherCubic : public VoxelMesher {
|
||||
|
||||
public:
|
||||
void _add_buffer(Node *p_chunk);
|
||||
|
||||
|
||||
VoxelMesherCubic();
|
||||
~VoxelMesherCubic();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -4,8 +4,8 @@ int TransvoxelCellData::get_vertex_index(int index) const {
|
||||
return static_cast<int>(vertexIndex[index]);
|
||||
}
|
||||
void TransvoxelCellData::set_vertex_index(int index, int value) {
|
||||
ERR_FAIL_INDEX(index, 36);
|
||||
|
||||
ERR_FAIL_INDEX(index, 36);
|
||||
|
||||
vertexIndex[index] = static_cast<unsigned char>(value);
|
||||
}
|
||||
|
||||
@ -13,8 +13,8 @@ int TransvoxelCellData::get_vertex_count() const {
|
||||
return (geometryCounts >> 4);
|
||||
}
|
||||
void TransvoxelCellData::set_vertex_count(int value) {
|
||||
geometryCounts &= 0xFF0F;
|
||||
|
||||
geometryCounts &= 0xFF0F;
|
||||
|
||||
geometryCounts |= value << 4;
|
||||
}
|
||||
|
||||
@ -23,32 +23,32 @@ int TransvoxelCellData::get_triangle_count() const {
|
||||
}
|
||||
void TransvoxelCellData::set_triangle_count(int value) {
|
||||
geometryCounts &= 0xFFF0;
|
||||
|
||||
|
||||
geometryCounts |= value;
|
||||
}
|
||||
|
||||
TransvoxelCellData::TransvoxelCellData() {
|
||||
geometryCounts = 0;
|
||||
|
||||
for (int i = 0; i < 36; ++i) {
|
||||
vertexIndex[i] = 0;
|
||||
}
|
||||
geometryCounts = 0;
|
||||
|
||||
for (int i = 0; i < 36; ++i) {
|
||||
vertexIndex[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
TransvoxelCellData::TransvoxelCellData(const RegularCellData &cell_data) {
|
||||
geometryCounts = cell_data.geometryCounts;
|
||||
|
||||
for (int i = 0; i < 15; ++i) {
|
||||
vertexIndex[i] = cell_data.vertexIndex[i];
|
||||
}
|
||||
|
||||
for (int i = 0; i < 15; ++i) {
|
||||
vertexIndex[i] = cell_data.vertexIndex[i];
|
||||
}
|
||||
}
|
||||
|
||||
TransvoxelCellData::TransvoxelCellData(const TransitionCellData &cell_data) {
|
||||
geometryCounts = cell_data.geometryCounts;
|
||||
|
||||
for (int i = 0; i < 36; ++i) {
|
||||
vertexIndex[i] = cell_data.vertexIndex[i];
|
||||
}
|
||||
geometryCounts = cell_data.geometryCounts;
|
||||
|
||||
for (int i = 0; i < 36; ++i) {
|
||||
vertexIndex[i] = cell_data.vertexIndex[i];
|
||||
}
|
||||
}
|
||||
|
||||
TransvoxelCellData::~TransvoxelCellData() {
|
||||
@ -56,13 +56,11 @@ TransvoxelCellData::~TransvoxelCellData() {
|
||||
|
||||
void TransvoxelCellData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_vertex_index", "index"), &TransvoxelCellData::get_vertex_index);
|
||||
ClassDB::bind_method(D_METHOD("set_vertex_index", "index", "value"), &TransvoxelCellData::set_vertex_index);
|
||||
ClassDB::bind_method(D_METHOD("set_vertex_index", "index", "value"), &TransvoxelCellData::set_vertex_index);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_vertex_count"), &TransvoxelCellData::get_vertex_count);
|
||||
ClassDB::bind_method(D_METHOD("set_vertex_count", "value"), &TransvoxelCellData::set_vertex_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_vertex_count", "value"), &TransvoxelCellData::set_vertex_count);
|
||||
|
||||
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);
|
||||
ClassDB::bind_method(D_METHOD("set_triangle_count", "value"), &TransvoxelCellData::set_triangle_count);
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,15 +12,15 @@ class TransvoxelCellData : public Reference {
|
||||
|
||||
public:
|
||||
int get_vertex_index(int index) const;
|
||||
void set_vertex_index(int index, int value);
|
||||
void set_vertex_index(int index, int value);
|
||||
int get_vertex_count() const;
|
||||
void set_vertex_count(int value);
|
||||
void set_vertex_count(int value);
|
||||
int get_triangle_count() const;
|
||||
void set_triangle_count(int value);
|
||||
void set_triangle_count(int value);
|
||||
|
||||
TransvoxelCellData();
|
||||
TransvoxelCellData(const RegularCellData &cell_data);
|
||||
TransvoxelCellData(const TransitionCellData &cell_data);
|
||||
TransvoxelCellData(const TransitionCellData &cell_data);
|
||||
~TransvoxelCellData();
|
||||
|
||||
protected:
|
||||
|
@ -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
|
||||
@ -57,7 +57,7 @@ const unsigned char regularCellClass[256] = {
|
||||
0x03, 0x05, 0x05, 0x08, 0x04, 0x0A, 0x07, 0x0E, 0x04, 0x07, 0x0B, 0x0E, 0x03, 0x04, 0x04, 0x03, // 192
|
||||
0x04, 0x0B, 0x07, 0x0E, 0x0C, 0x04, 0x0F, 0x0D, 0x0A, 0x0E, 0x0E, 0x02, 0x04, 0x03, 0x0D, 0x01, // 208
|
||||
0x04, 0x07, 0x0A, 0x0E, 0x0B, 0x0E, 0x0E, 0x02, 0x0C, 0x0F, 0x04, 0x0D, 0x04, 0x0D, 0x03, 0x01, // 224
|
||||
0x03, 0x04, 0x04, 0x03, 0x04, 0x03, 0x0D, 0x01, 0x04, 0x0D, 0x03, 0x01, 0x03, 0x01, 0x01, 0x00 // 240
|
||||
0x03, 0x04, 0x04, 0x03, 0x04, 0x03, 0x0D, 0x01, 0x04, 0x0D, 0x03, 0x01, 0x03, 0x01, 0x01, 0x00 // 240
|
||||
};
|
||||
|
||||
// The regularCellData table holds the triangulation data for all 16 distinct classes to
|
||||
@ -66,20 +66,20 @@ const unsigned char regularCellClass[256] = {
|
||||
const RegularCellData regularCellData[16] = {
|
||||
{ 0x00, {} },
|
||||
{ 0x31, { 0, 1, 2 } },
|
||||
{ 0x62, { 0, 1, 2, 3, 4, 5 } },
|
||||
{ 0x62, { 0, 1, 2, 4, 5, 3 } }, //{ 0x42, { 0, 1, 2, 0, 2, 3 } }
|
||||
{ 0x93, { 0, 1, 4, 5, 3, 6, 7, 2, 8 } }, //{ 0x53, { 0, 1, 4, 1, 3, 4, 1, 2, 3 } }
|
||||
{ 0x73, { 0, 1, 2, 0, 2, 3, 4, 5, 6 } },
|
||||
{ 0x93, { 0, 1, 2, 3, 4, 5, 6, 7, 8 } },
|
||||
{ 0xC4, { 0, 1, 4, 8, 3, 9, 10, 2, 11, 5, 6, 7 } }, //7 { 0x84, { 0, 1, 4, 1, 3, 4, 1, 2, 3, 5, 6, 7 } },
|
||||
{ 0x84, { 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7 } },
|
||||
{ 0xC4, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 } },
|
||||
{ 0xC4, { 0, 4, 5, 6, 7, 8, 9, 10, 11, 1, 2, 3 } }, //A { 0x64, { 0, 4, 5, 0, 1, 4, 1, 3, 4, 1, 2, 3 } },
|
||||
{ 0xC4, { 0, 5, 4, 6, 8, 7, 9, 11, 10, 1, 3, 2 } }, //B { 0x64, { 0, 5, 4, 0, 4, 1, 1, 4, 3, 1, 3, 2 } },
|
||||
{ 0xC4, { 0, 4, 5, 6, 7, 8, 9, 10, 11, 1, 2, 3 } }, //C { 0x64, { 0, 4, 5, 0, 3, 4, 0, 1, 3, 1, 2, 3 } },
|
||||
{ 0xC4, { 0, 1, 2, 6, 7, 3, 8, 9, 4, 10, 11, 5 } }, //D { 0x64, { 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5 } },
|
||||
{ 0xF5, { 0, 1, 2, 7, 8, 3, 9, 10, 4, 11, 12, 5, 13, 14, 6 } }, //E { 0x75, { 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5, 0, 5, 6 } },
|
||||
{ 0xF5, { 0, 4, 5, 9, 3, 10, 11, 1, 12, 13, 2, 14, 6, 7, 8 } } //F { 0x95, { 0, 4, 5, 0, 3, 4, 0, 1, 3, 1, 2, 3, 6, 7, 8 } }
|
||||
{ 0x62, { 0, 1, 2, 3, 4, 5 } },
|
||||
{ 0x62, { 0, 1, 2, 4, 5, 3 } }, //{ 0x42, { 0, 1, 2, 0, 2, 3 } }
|
||||
{ 0x93, { 0, 1, 4, 5, 3, 6, 7, 2, 8 } }, //{ 0x53, { 0, 1, 4, 1, 3, 4, 1, 2, 3 } }
|
||||
{ 0x73, { 0, 1, 2, 0, 2, 3, 4, 5, 6 } },
|
||||
{ 0x93, { 0, 1, 2, 3, 4, 5, 6, 7, 8 } },
|
||||
{ 0xC4, { 0, 1, 4, 8, 3, 9, 10, 2, 11, 5, 6, 7 } }, //7 { 0x84, { 0, 1, 4, 1, 3, 4, 1, 2, 3, 5, 6, 7 } },
|
||||
{ 0x84, { 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7 } },
|
||||
{ 0xC4, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 } },
|
||||
{ 0xC4, { 0, 4, 5, 6, 7, 8, 9, 10, 11, 1, 2, 3 } }, //A { 0x64, { 0, 4, 5, 0, 1, 4, 1, 3, 4, 1, 2, 3 } },
|
||||
{ 0xC4, { 0, 5, 4, 6, 8, 7, 9, 11, 10, 1, 3, 2 } }, //B { 0x64, { 0, 5, 4, 0, 4, 1, 1, 4, 3, 1, 3, 2 } },
|
||||
{ 0xC4, { 0, 4, 5, 6, 7, 8, 9, 10, 11, 1, 2, 3 } }, //C { 0x64, { 0, 4, 5, 0, 3, 4, 0, 1, 3, 1, 2, 3 } },
|
||||
{ 0xC4, { 0, 1, 2, 6, 7, 3, 8, 9, 4, 10, 11, 5 } }, //D { 0x64, { 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5 } },
|
||||
{ 0xF5, { 0, 1, 2, 7, 8, 3, 9, 10, 4, 11, 12, 5, 13, 14, 6 } }, //E { 0x75, { 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5, 0, 5, 6 } },
|
||||
{ 0xF5, { 0, 4, 5, 9, 3, 10, 11, 1, 12, 13, 2, 14, 6, 7, 8 } } //F { 0x95, { 0, 4, 5, 0, 3, 4, 0, 1, 3, 1, 2, 3, 6, 7, 8 } }
|
||||
};
|
||||
|
||||
// The regularVertexData table gives the vertex locations for every one of the 256 possible
|
||||
@ -105,7 +105,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x4113, 0x8337, 0x1326, 0x3304, 0x6201, 0x8337, 0x6201, 0x8337, 0x3304 },
|
||||
{ 0x6201, 0x2315, 0x8337, 0x1326, 0x5102, 0x2315, 0x5102, 0x2315, 0x1326 },
|
||||
{ 0x3304, 0x2315, 0x8337, 0x1326, 0x3304, 0x8337 },
|
||||
//16 3 5 15
|
||||
//16 3 5 15
|
||||
{ 0x3304, 0x1146, 0x2245 },
|
||||
{ 0x6201, 0x5102, 0x1146, 0x2245, 0x6201, 0x1146 },
|
||||
{ 0x6201, 0x2315, 0x4113, 0x3304, 0x1146, 0x2245 },
|
||||
@ -122,7 +122,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x4113, 0x8337, 0x1326, 0x1146, 0x2245, 0x6201, 0x4113, 0x8337, 0x2245, 0x8337, 0x1146, 0x2245 },
|
||||
{ 0x6201, 0x2315, 0x8337, 0x1326, 0x5102, 0x3304, 0x1146, 0x2245, 0x2315, 0x5102, 0x2315, 0x1326 },
|
||||
{ 0x2245, 0x2315, 0x8337, 0x1326, 0x1146, 0x2315, 0x1146, 0x2315, 0x1326 },
|
||||
//32 3 10 15
|
||||
//32 3 10 15
|
||||
{ 0x2315, 0x2245, 0x8157 },
|
||||
{ 0x6201, 0x5102, 0x3304, 0x2315, 0x2245, 0x8157 },
|
||||
{ 0x4113, 0x6201, 0x2245, 0x8157, 0x4113, 0x2245 },
|
||||
@ -139,7 +139,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x4113, 0x8337, 0x1326, 0x3304, 0x6201, 0x2315, 0x2245, 0x8157, 0x8337, 0x6201, 0x8337, 0x3304 },
|
||||
{ 0x5102, 0x1326, 0x8337, 0x8157, 0x2245, 0x6201, 0x5102, 0x1326, 0x2245, 0x1326, 0x8157, 0x2245 },
|
||||
{ 0x8157, 0x8337, 0x1326, 0x3304, 0x2245, 0x8337, 0x2245, 0x8337, 0x3304 },
|
||||
//48 1 2 7 11
|
||||
//48 1 2 7 11
|
||||
{ 0x2315, 0x3304, 0x1146, 0x8157, 0x2315, 0x1146 },
|
||||
{ 0x6201, 0x5102, 0x1146, 0x8157, 0x2315, 0x5102, 0x2315, 0x5102, 0x8157 },
|
||||
{ 0x3304, 0x1146, 0x8157, 0x4113, 0x6201, 0x1146, 0x6201, 0x1146, 0x4113 },
|
||||
@ -156,7 +156,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x6201, 0x4113, 0x8337, 0x1326, 0x1146, 0x8157, 0x2315, 0x6201, 0x8337, 0x6201, 0x1326, 0x6201, 0x1146, 0x6201, 0x8157 },
|
||||
{ 0x6201, 0x3304, 0x1146, 0x8157, 0x8337, 0x1326, 0x5102, 0x6201, 0x1146, 0x6201, 0x8157, 0x6201, 0x8337, 0x6201, 0x1326 },
|
||||
{ 0x1326, 0x1146, 0x8157, 0x8337, 0x1326, 0x8157 },
|
||||
//64 5 12 15
|
||||
//64 5 12 15
|
||||
{ 0x1326, 0x8267, 0x1146 },
|
||||
{ 0x6201, 0x5102, 0x3304, 0x1326, 0x8267, 0x1146 },
|
||||
{ 0x6201, 0x2315, 0x4113, 0x1326, 0x8267, 0x1146 },
|
||||
@ -173,7 +173,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x6201, 0x4113, 0x8337, 0x8267, 0x1146, 0x3304, 0x6201, 0x8267, 0x1146, 0x6201, 0x4113, 0x8267 },
|
||||
{ 0x6201, 0x2315, 0x8337, 0x8267, 0x1146, 0x5102, 0x6201, 0x2315, 0x1146, 0x2315, 0x8267, 0x1146 },
|
||||
{ 0x1146, 0x3304, 0x2315, 0x8337, 0x8267, 0x3304, 0x8267, 0x3304, 0x8337 },
|
||||
//80 1 4 7 13
|
||||
//80 1 4 7 13
|
||||
{ 0x3304, 0x1326, 0x8267, 0x2245, 0x3304, 0x8267 },
|
||||
{ 0x1326, 0x8267, 0x2245, 0x6201, 0x5102, 0x8267, 0x5102, 0x8267, 0x6201 },
|
||||
{ 0x3304, 0x1326, 0x8267, 0x2245, 0x6201, 0x2315, 0x4113 },
|
||||
@ -190,7 +190,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x8337, 0x8267, 0x2245, 0x6201, 0x4113, 0x8267, 0x4113, 0x8267, 0x6201 },
|
||||
{ 0x5102, 0x6201, 0x2315, 0x8337, 0x8267, 0x2245, 0x3304, 0x5102, 0x2315, 0x5102, 0x8337, 0x5102, 0x8267, 0x5102, 0x2245 },
|
||||
{ 0x2315, 0x8337, 0x8267, 0x2245, 0x2315, 0x8267 },
|
||||
//96 -
|
||||
//96 -
|
||||
{ 0x2315, 0x2245, 0x8157, 0x1326, 0x8267, 0x1146 },
|
||||
{ 0x6201, 0x5102, 0x3304, 0x2315, 0x2245, 0x8157, 0x1326, 0x8267, 0x1146 },
|
||||
{ 0x6201, 0x2245, 0x8157, 0x4113, 0x1326, 0x8267, 0x1146 },
|
||||
@ -207,7 +207,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x6201, 0x4113, 0x8337, 0x8267, 0x1146, 0x3304, 0x2315, 0x2245, 0x8157, 0x6201, 0x1146, 0x6201, 0x8267, 0x4113, 0x8267 },
|
||||
{ 0x8337, 0x8267, 0x1146, 0x5102, 0x6201, 0x2245, 0x8157, 0x8337, 0x1146, 0x8337, 0x5102, 0x8337, 0x6201, 0x8337, 0x2245 },
|
||||
{ 0x3304, 0x2245, 0x8157, 0x8337, 0x8267, 0x1146, 0x3304, 0x8157, 0x3304, 0x8337, 0x3304, 0x8267 },
|
||||
//112 0 3 5
|
||||
//112 0 3 5
|
||||
{ 0x8157, 0x2315, 0x3304, 0x1326, 0x8267, 0x2315, 0x8267, 0x2315, 0x1326 },
|
||||
{ 0x8267, 0x8157, 0x2315, 0x6201, 0x5102, 0x1326, 0x8267, 0x6201, 0x5102, 0x8267, 0x8157, 0x6201 },
|
||||
{ 0x8267, 0x1326, 0x3304, 0x6201, 0x4113, 0x8157, 0x8267, 0x1326, 0x4113, 0x1326, 0x6201, 0x4113 },
|
||||
@ -224,7 +224,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x6201, 0x4113, 0x8337, 0x8267, 0x8157, 0x2315, 0x6201, 0x8337, 0x6201, 0x8267, 0x6201, 0x8157 },
|
||||
{ 0x6201, 0x3304, 0x5102, 0x8337, 0x8267, 0x8157 },
|
||||
{ 0x8337, 0x8267, 0x8157 },
|
||||
//128 10 12 15
|
||||
//128 10 12 15
|
||||
{ 0x8337, 0x8157, 0x8267 },
|
||||
{ 0x6201, 0x5102, 0x3304, 0x8337, 0x8157, 0x8267 },
|
||||
{ 0x6201, 0x2315, 0x4113, 0x8337, 0x8157, 0x8267 },
|
||||
@ -241,7 +241,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x8157, 0x4113, 0x6201, 0x3304, 0x1326, 0x8267, 0x8157, 0x4113, 0x1326, 0x4113, 0x3304, 0x1326 },
|
||||
{ 0x1326, 0x5102, 0x6201, 0x2315, 0x8157, 0x8267, 0x1326, 0x2315, 0x8157, 0x1326, 0x5102, 0x2315 },
|
||||
{ 0x8267, 0x1326, 0x3304, 0x2315, 0x8157, 0x1326, 0x8157, 0x1326, 0x2315 },
|
||||
//144 -
|
||||
//144 -
|
||||
{ 0x3304, 0x1146, 0x2245, 0x8337, 0x8157, 0x8267 },
|
||||
{ 0x6201, 0x5102, 0x1146, 0x2245, 0x8337, 0x8157, 0x8267 },
|
||||
{ 0x6201, 0x2315, 0x4113, 0x3304, 0x1146, 0x2245, 0x8337, 0x8157, 0x8267 },
|
||||
@ -258,7 +258,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x1326, 0x1146, 0x2245, 0x6201, 0x4113, 0x8157, 0x8267, 0x1326, 0x2245, 0x1326, 0x6201, 0x1326, 0x4113, 0x1326, 0x8157 },
|
||||
{ 0x5102, 0x6201, 0x2315, 0x8157, 0x8267, 0x1326, 0x3304, 0x1146, 0x2245, 0x5102, 0x8267, 0x5102, 0x8157, 0x6201, 0x8157 },
|
||||
{ 0x1326, 0x1146, 0x2245, 0x2315, 0x8157, 0x8267, 0x1326, 0x2245, 0x1326, 0x2315, 0x1326, 0x8157 },
|
||||
//160 2 8 11 14
|
||||
//160 2 8 11 14
|
||||
{ 0x2315, 0x2245, 0x8267, 0x8337, 0x2315, 0x8267 },
|
||||
{ 0x2315, 0x2245, 0x8267, 0x8337, 0x6201, 0x5102, 0x3304 },
|
||||
{ 0x4113, 0x6201, 0x2245, 0x8267, 0x8337, 0x6201, 0x8337, 0x6201, 0x8267 },
|
||||
@ -275,7 +275,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x4113, 0x2315, 0x2245, 0x8267, 0x1326, 0x3304, 0x6201, 0x4113, 0x2245, 0x4113, 0x8267, 0x4113, 0x1326, 0x4113, 0x3304 },
|
||||
{ 0x5102, 0x6201, 0x2245, 0x8267, 0x1326, 0x6201, 0x1326, 0x6201, 0x8267 },
|
||||
{ 0x3304, 0x2245, 0x8267, 0x1326, 0x3304, 0x8267 },
|
||||
//176 0 3 10
|
||||
//176 0 3 10
|
||||
{ 0x8267, 0x8337, 0x2315, 0x3304, 0x1146, 0x8337, 0x1146, 0x8337, 0x3304 },
|
||||
{ 0x5102, 0x1146, 0x8267, 0x8337, 0x2315, 0x6201, 0x5102, 0x1146, 0x2315, 0x1146, 0x8337, 0x2315 },
|
||||
{ 0x3304, 0x1146, 0x8267, 0x8337, 0x4113, 0x6201, 0x3304, 0x8337, 0x4113, 0x3304, 0x1146, 0x8337 },
|
||||
@ -292,7 +292,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x6201, 0x4113, 0x2315, 0x1326, 0x1146, 0x8267 },
|
||||
{ 0x6201, 0x3304, 0x1146, 0x8267, 0x1326, 0x5102, 0x6201, 0x1146, 0x6201, 0x8267, 0x6201, 0x1326 },
|
||||
{ 0x1326, 0x1146, 0x8267 },
|
||||
//192 4 8 13 14
|
||||
//192 4 8 13 14
|
||||
{ 0x1326, 0x8337, 0x8157, 0x1146, 0x1326, 0x8157 },
|
||||
{ 0x8337, 0x8157, 0x1146, 0x1326, 0x6201, 0x5102, 0x3304 },
|
||||
{ 0x8337, 0x8157, 0x1146, 0x1326, 0x6201, 0x2315, 0x4113 },
|
||||
@ -309,7 +309,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x6201, 0x4113, 0x8157, 0x1146, 0x3304, 0x4113, 0x3304, 0x4113, 0x1146 },
|
||||
{ 0x2315, 0x8157, 0x1146, 0x5102, 0x6201, 0x8157, 0x6201, 0x8157, 0x5102 },
|
||||
{ 0x2315, 0x8157, 0x1146, 0x3304, 0x2315, 0x1146 },
|
||||
//208 0 5 12
|
||||
//208 0 5 12
|
||||
{ 0x2245, 0x3304, 0x1326, 0x8337, 0x8157, 0x3304, 0x8157, 0x3304, 0x8337 },
|
||||
{ 0x6201, 0x2245, 0x8157, 0x8337, 0x1326, 0x5102, 0x6201, 0x2245, 0x1326, 0x2245, 0x8337, 0x1326 },
|
||||
{ 0x2245, 0x3304, 0x1326, 0x8337, 0x8157, 0x6201, 0x2315, 0x4113, 0x3304, 0x8157, 0x3304, 0x8337 },
|
||||
@ -326,7 +326,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x4113, 0x8157, 0x2245, 0x6201, 0x4113, 0x2245 },
|
||||
{ 0x5102, 0x6201, 0x2315, 0x8157, 0x2245, 0x3304, 0x5102, 0x2315, 0x5102, 0x8157, 0x5102, 0x2245 },
|
||||
{ 0x2315, 0x8157, 0x2245 },
|
||||
//224 0 10 12
|
||||
//224 0 10 12
|
||||
{ 0x1146, 0x1326, 0x8337, 0x2315, 0x2245, 0x1326, 0x2245, 0x1326, 0x2315 },
|
||||
{ 0x1146, 0x1326, 0x8337, 0x2315, 0x2245, 0x6201, 0x5102, 0x3304, 0x1326, 0x2245, 0x1326, 0x2315 },
|
||||
{ 0x6201, 0x2245, 0x1146, 0x1326, 0x8337, 0x4113, 0x6201, 0x2245, 0x8337, 0x2245, 0x1326, 0x8337 },
|
||||
@ -343,7 +343,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x4113, 0x2315, 0x2245, 0x1146, 0x3304, 0x6201, 0x4113, 0x2245, 0x4113, 0x1146, 0x4113, 0x3304 },
|
||||
{ 0x6201, 0x2245, 0x1146, 0x5102, 0x6201, 0x1146 },
|
||||
{ 0x3304, 0x2245, 0x1146 },
|
||||
//240 1 2 4 8
|
||||
//240 1 2 4 8
|
||||
{ 0x3304, 0x1326, 0x8337, 0x2315, 0x3304, 0x8337 },
|
||||
{ 0x5102, 0x1326, 0x8337, 0x2315, 0x6201, 0x1326, 0x6201, 0x1326, 0x2315 },
|
||||
{ 0x6201, 0x3304, 0x1326, 0x8337, 0x4113, 0x3304, 0x4113, 0x3304, 0x8337 },
|
||||
@ -359,7 +359,7 @@ const unsigned short regularVertexData[256][15] = {
|
||||
{ 0x5102, 0x4113, 0x2315, 0x3304, 0x5102, 0x2315 },
|
||||
{ 0x6201, 0x4113, 0x2315 },
|
||||
{ 0x6201, 0x3304, 0x5102 },
|
||||
{}
|
||||
{}
|
||||
//256
|
||||
};
|
||||
|
||||
|
@ -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)
|
||||
|
@ -702,7 +702,7 @@ void VoxelMesher::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("add_chunk", "chunk"), &VoxelMesher::add_chunk_bind);
|
||||
ClassDB::bind_method(D_METHOD("add_chunk_liquid", "chunk"), &VoxelMesher::add_chunk_liquid_bind);
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource", "mesh", "position", "rotation", "scale", "uv_rect"), &VoxelMesher::add_mesh_data_resource, DEFVAL(Rect2(0, 0, 1, 1)), DEFVAL(Vector3(1.0, 1.0, 1.0)), DEFVAL(Vector3()), DEFVAL(Vector3()));
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource_transform", "mesh", "transform", "uv_rect"), &VoxelMesher::add_mesh_data_resource_transform, DEFVAL(Rect2(0, 0, 1, 1)));
|
||||
|
||||
|
@ -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,9 +20,9 @@ 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() {
|
||||
@ -130,7 +127,7 @@ void VoxelMesherTransvoxel::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_regular_cell_class", "index"), &VoxelMesherTransvoxel::get_regular_cell_class);
|
||||
ClassDB::bind_method(D_METHOD("get_regular_cell_data", "index"), &VoxelMesherTransvoxel::get_regular_cell_data);
|
||||
ClassDB::bind_method(D_METHOD("get_regular_vertex_data", "index1", "index2"), &VoxelMesherTransvoxel::get_regular_vertex_data);
|
||||
// ClassDB::bind_method(D_METHOD("set_regular_vertex_data", "index1", "index2", "value"), &VoxelMesherTransvoxel::set_regular_vertex_data);
|
||||
// ClassDB::bind_method(D_METHOD("set_regular_vertex_data", "index1", "index2", "value"), &VoxelMesherTransvoxel::set_regular_vertex_data);
|
||||
ClassDB::bind_method(D_METHOD("get_regular_vertex_data_first_vertex", "index1", "index2"), &VoxelMesherTransvoxel::get_regular_vertex_data_first_vertex);
|
||||
ClassDB::bind_method(D_METHOD("get_regular_vertex_data_second_vertex", "index1", "index2"), &VoxelMesherTransvoxel::get_regular_vertex_data_second_vertex);
|
||||
ClassDB::bind_method(D_METHOD("get_regular_vertex_first_position", "index1", "index2"), &VoxelMesherTransvoxel::get_regular_vertex_first_position);
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
|
||||
Ref<TransvoxelCellData> get_regular_cell_data(int index) const;
|
||||
int get_regular_vertex_data(int index10, int index2) const;
|
||||
// void set_regular_vertex_data(int index1, int index2, int value);
|
||||
// void set_regular_vertex_data(int index1, int index2, int value);
|
||||
int get_regular_vertex_data_first_vertex(int index1, int index2) const;
|
||||
int get_regular_vertex_data_second_vertex(int index1, int index2) const;
|
||||
Vector3 get_regular_vertex_first_position(int index1, int index2) const;
|
||||
|
@ -88,7 +88,7 @@ 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();
|
||||
|
||||
|
||||
Ref<VoxelLight> vl;
|
||||
vl.instance();
|
||||
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());
|
||||
@ -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"
|
||||
|
||||
@ -39,8 +39,8 @@ public:
|
||||
|
||||
Vector<Variant> get_props();
|
||||
void set_props(const Vector<Variant> &props);
|
||||
|
||||
void add_textures_into(Ref<TexturePacker> texture_packer);
|
||||
|
||||
void add_textures_into(Ref<TexturePacker> texture_packer);
|
||||
void add_prop_lights_into(VoxelChunk *chunk, Transform parent_transform, bool allow_snap);
|
||||
void add_prop_lights_into_bind(Node *chunk, Transform parent_transform, bool allow_snap);
|
||||
void add_meshes_into(Ref<VoxelMesher> mesher, Ref<TexturePacker> texture_packer, Transform parent_transform, Spatial *snap_spatial = NULL);
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "prop_data_entity.h"
|
||||
|
||||
|
||||
int PropDataEntity::get_entity_data_id() const {
|
||||
return _entity_data_id;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
class PropDataEntity : public PropDataEntry {
|
||||
GDCLASS(PropDataEntity, PropDataEntry);
|
||||
|
||||
|
||||
public:
|
||||
int get_entity_data_id() const;
|
||||
void set_entity_data_id(const int value);
|
||||
|
@ -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:
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
class PropDataLight : public PropDataEntry {
|
||||
GDCLASS(PropDataLight, PropDataEntry);
|
||||
|
||||
|
||||
public:
|
||||
Color get_light_color() const;
|
||||
void set_light_color(const Color value);
|
||||
|
@ -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"
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
class PropDataMesh : public PropDataEntry {
|
||||
GDCLASS(PropDataMesh, PropDataEntry);
|
||||
|
||||
|
||||
public:
|
||||
Ref<MeshDataResource> get_mesh() const;
|
||||
void set_mesh(const Ref<MeshDataResource> mesh);
|
||||
|
@ -1,14 +1,14 @@
|
||||
#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"
|
||||
|
||||
class PropDataProp : public PropDataEntry {
|
||||
GDCLASS(PropDataProp, PropDataEntry);
|
||||
|
||||
|
||||
public:
|
||||
Ref<PropData> get_prop() const;
|
||||
void set_prop(const Ref<PropData> value);
|
||||
|
@ -1,14 +1,14 @@
|
||||
#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"
|
||||
|
||||
class PropDataScene : public PropDataEntry {
|
||||
GDCLASS(PropDataScene, PropDataEntry);
|
||||
|
||||
|
||||
public:
|
||||
Ref<PackedScene> get_scene() const;
|
||||
void set_scene(const Ref<PackedScene> value);
|
||||
|
@ -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>();
|
||||
@ -58,15 +57,15 @@ void register_voxelman_types() {
|
||||
ClassDB::register_class<VoxelmanLibraryMerger>();
|
||||
|
||||
ClassDB::register_class<VoxelLight>();
|
||||
|
||||
ClassDB::register_class<VoxelWorld>();
|
||||
ClassDB::register_class<VoxelChunk>();
|
||||
|
||||
ClassDB::register_class<VoxelWorld>();
|
||||
ClassDB::register_class<VoxelChunk>();
|
||||
ClassDB::register_class<VoxelStructure>();
|
||||
ClassDB::register_class<EnvironmentData>();
|
||||
ClassDB::register_class<VoxelChunkPropData>();
|
||||
|
||||
ClassDB::register_class<VoxelMesherCubic>();
|
||||
ClassDB::register_class<VoxelCubePoints>();
|
||||
ClassDB::register_class<VoxelMesherCubic>();
|
||||
ClassDB::register_class<VoxelCubePoints>();
|
||||
|
||||
ClassDB::register_class<PropData>();
|
||||
ClassDB::register_class<PropDataEntry>();
|
||||
@ -75,15 +74,13 @@ void register_voxelman_types() {
|
||||
ClassDB::register_class<PropDataLight>();
|
||||
ClassDB::register_class<PropDataProp>();
|
||||
ClassDB::register_class<PropDataEntity>();
|
||||
|
||||
ClassDB::register_class<VoxelmanLevelGenerator>();
|
||||
|
||||
ClassDB::register_class<VoxelmanLevelGenerator>();
|
||||
|
||||
ClassDB::register_class<WorldArea>();
|
||||
|
||||
ClassDB::register_class<GroundClutterFoliage>();
|
||||
}
|
||||
|
||||
void unregister_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);
|
||||
|
@ -83,11 +83,11 @@ void VoxelChunk::set_position(int x, int y, int z) {
|
||||
_position_z = z;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ int VoxelChunk::get_margin_start() const {
|
||||
return _margin_start;
|
||||
_FORCE_INLINE_ int VoxelChunk::get_margin_start() const {
|
||||
return _margin_start;
|
||||
}
|
||||
_FORCE_INLINE_ int VoxelChunk::get_margin_end() const {
|
||||
return _margin_end;
|
||||
return _margin_end;
|
||||
}
|
||||
|
||||
Ref<VoxelmanLibrary> VoxelChunk::get_library() {
|
||||
@ -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);
|
||||
@ -287,12 +287,12 @@ void VoxelChunk::set_channel_count(int count) {
|
||||
}
|
||||
void VoxelChunk::allocate_channel(int channel_index, uint8_t default_value) {
|
||||
ERR_FAIL_INDEX(channel_index, _channels.size());
|
||||
|
||||
|
||||
if (_channels[channel_index] != NULL)
|
||||
return;
|
||||
|
||||
uint32_t size = _data_size_x * _data_size_y * _data_size_z;
|
||||
|
||||
|
||||
uint8_t *ch = memnew_arr(uint8_t, size);
|
||||
memset(ch, default_value, size);
|
||||
|
||||
@ -309,7 +309,7 @@ void VoxelChunk::fill_channel(uint8_t value, int channel_index) {
|
||||
}
|
||||
|
||||
uint32_t size = get_data_size();
|
||||
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
ch[i] = value;
|
||||
}
|
||||
@ -321,7 +321,7 @@ void VoxelChunk::dealloc_channel(int channel_index) {
|
||||
|
||||
if (ch != NULL) {
|
||||
memdelete_arr(ch);
|
||||
|
||||
|
||||
_channels.set(channel_index, NULL);
|
||||
}
|
||||
}
|
||||
@ -576,13 +576,13 @@ void VoxelChunk::_build_phase(int phase) {
|
||||
|
||||
if (_clutter_mesh_instance_rid != RID())
|
||||
VS::get_singleton()->instance_set_visible(_clutter_mesh_instance_rid, is_visible());
|
||||
|
||||
|
||||
next_phase();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
next_phase();
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -72,7 +72,7 @@ public:
|
||||
DEFAULT_CHANNEL_LIGHT_COLOR_R,
|
||||
DEFAULT_CHANNEL_LIGHT_COLOR_G,
|
||||
DEFAULT_CHANNEL_LIGHT_COLOR_B,
|
||||
DEFAULT_CHANNEL_AO,
|
||||
DEFAULT_CHANNEL_AO,
|
||||
DEFAULT_CHANNEL_RANDOM_AO,
|
||||
DEFAULT_CHANNEL_LIQUID_TYPES,
|
||||
DEFAULT_CHANNEL_LIQUID_FILL,
|
||||
@ -177,11 +177,11 @@ public:
|
||||
|
||||
uint32_t get_data_index(uint32_t x, uint32_t y, uint32_t z) const;
|
||||
uint32_t get_data_size() const;
|
||||
|
||||
|
||||
//Data Management functions
|
||||
void generate_ao();
|
||||
|
||||
void add_light(int local_x, int local_y, int local_z, int size, Color color);
|
||||
void add_light(int local_x, int local_y, int local_z, int size, Color color);
|
||||
void clear_baked_lights();
|
||||
|
||||
//Meshing
|
||||
@ -195,7 +195,7 @@ public:
|
||||
void build_phase();
|
||||
void _build_phase(int phase);
|
||||
void next_phase();
|
||||
|
||||
|
||||
void clear();
|
||||
|
||||
//Colliders
|
||||
@ -211,13 +211,13 @@ public:
|
||||
void clear_voxel_lights();
|
||||
|
||||
void add_lights_into(Array target);
|
||||
void add_unique_lights_into(Array target);
|
||||
Array get_lights();
|
||||
void add_unique_lights_into(Array target);
|
||||
Array get_lights();
|
||||
|
||||
void bake_lights();
|
||||
void bake_lights();
|
||||
void bake_light(Ref<VoxelLight> light);
|
||||
|
||||
void add_prop_light(Ref<VoxelLight> light);
|
||||
|
||||
void add_prop_light(Ref<VoxelLight> light);
|
||||
|
||||
//props
|
||||
void add_prop(Ref<VoxelChunkPropData> prop);
|
||||
@ -226,20 +226,20 @@ public:
|
||||
void remove_prop(int index);
|
||||
void clear_props();
|
||||
|
||||
void process_props();
|
||||
|
||||
void process_props();
|
||||
|
||||
void build_prop_meshes();
|
||||
void build_prop_collider();
|
||||
void free_spawn_props();
|
||||
void free_spawn_props();
|
||||
|
||||
//Meshes
|
||||
void allocate_main_mesh();
|
||||
void allocate_main_mesh();
|
||||
void free_main_mesh();
|
||||
|
||||
|
||||
void allocate_prop_mesh();
|
||||
void free_prop_mesh();
|
||||
|
||||
void allocate_prop_colliders();
|
||||
|
||||
void allocate_prop_colliders();
|
||||
void free_prop_colliders();
|
||||
|
||||
void allocate_liquid_mesh();
|
||||
|
@ -1,18 +1,18 @@
|
||||
#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);
|
||||
|
||||
|
||||
public:
|
||||
int get_x();
|
||||
void set_x(int value);
|
||||
|
@ -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);
|
||||
|
||||
@ -47,7 +46,7 @@ public:
|
||||
|
||||
VoxelStructure();
|
||||
~VoxelStructure();
|
||||
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
@ -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();
|
||||
@ -439,7 +437,7 @@ void VoxelWorld::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("create_chunk", "x", "y", "z"), &VoxelWorld::create_chunk);
|
||||
ClassDB::bind_method(D_METHOD("_create_chunk", "x", "y", "z", "chunk"), &VoxelWorld::_create_chunk);
|
||||
ClassDB::bind_method(D_METHOD("_create_chunk", "x", "y", "z", "chunk"), &VoxelWorld::_create_chunk);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_generate_chunk", "chunk"), &VoxelWorld::_generate_chunk);
|
||||
ClassDB::bind_method(D_METHOD("_generate_chunk", "chunk"), &VoxelWorld::_generate_chunk);
|
||||
}
|
||||
|
@ -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"
|
||||
|
||||
@ -17,29 +17,29 @@ class VoxelWorld : public Navigation {
|
||||
GDCLASS(VoxelWorld, Navigation);
|
||||
|
||||
public:
|
||||
int get_chunk_size_x() const;
|
||||
void set_chunk_size_x(const int value);
|
||||
|
||||
int get_chunk_size_y() const;
|
||||
void set_chunk_size_y(const int value);
|
||||
|
||||
int get_chunk_size_z() const;
|
||||
void set_chunk_size_z(const int value);
|
||||
int get_chunk_size_x() const;
|
||||
void set_chunk_size_x(const int value);
|
||||
|
||||
int get_current_seed() const;
|
||||
void set_current_seed(const int value);
|
||||
int get_chunk_size_y() const;
|
||||
void set_chunk_size_y(const int value);
|
||||
|
||||
int get_chunk_size_z() const;
|
||||
void set_chunk_size_z(const int value);
|
||||
|
||||
int get_current_seed() const;
|
||||
void set_current_seed(const int value);
|
||||
|
||||
bool get_use_threads();
|
||||
void set_use_threads(bool value);
|
||||
|
||||
uint32_t get_max_concurrent_generations();
|
||||
void set_max_concurrent_generations(uint32_t value);
|
||||
|
||||
Ref<VoxelmanLibrary> get_library() const;
|
||||
void set_library(const Ref<VoxelmanLibrary> library);
|
||||
|
||||
Ref<VoxelmanLevelGenerator> get_level_generator() const;
|
||||
void set_level_generator(const Ref<VoxelmanLevelGenerator> level_generator);
|
||||
|
||||
Ref<VoxelmanLibrary> get_library() const;
|
||||
void set_library(const Ref<VoxelmanLibrary> library);
|
||||
|
||||
Ref<VoxelmanLevelGenerator> get_level_generator() const;
|
||||
void set_level_generator(const Ref<VoxelmanLevelGenerator> level_generator);
|
||||
|
||||
float get_voxel_scale() const;
|
||||
void set_voxel_scale(const float value);
|
||||
@ -49,8 +49,8 @@ public:
|
||||
|
||||
NodePath get_player_path();
|
||||
void set_player_path(NodePath player_path);
|
||||
|
||||
Spatial *get_player() const;
|
||||
|
||||
Spatial *get_player() const;
|
||||
void set_player(Spatial *player);
|
||||
void set_player_bind(Node *player);
|
||||
|
||||
@ -124,18 +124,18 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
int _chunk_size_x;
|
||||
int _chunk_size_x;
|
||||
int _chunk_size_y;
|
||||
int _chunk_size_z;
|
||||
int _current_seed;
|
||||
|
||||
Ref<VoxelmanLibrary> _library;
|
||||
Ref<VoxelmanLevelGenerator> _level_generator;
|
||||
|
||||
Ref<VoxelmanLibrary> _library;
|
||||
Ref<VoxelmanLevelGenerator> _level_generator;
|
||||
float _voxel_scale;
|
||||
int _chunk_spawn_range;
|
||||
|
||||
HashMap<IntPos, VoxelChunk *, IntPosHasher> _chunks;
|
||||
Vector<VoxelChunk *> _chunks_vector;
|
||||
|
||||
HashMap<IntPos, VoxelChunk *, IntPosHasher> _chunks;
|
||||
Vector<VoxelChunk *> _chunks_vector;
|
||||
|
||||
Vector<Ref<WorldArea> > _world_areas;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user