2020-01-31 19:52:37 +01:00
|
|
|
/*
|
|
|
|
Copyright (c) 2019-2020 Péter Magyar
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
|
|
copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2019-06-07 01:33:41 +02:00
|
|
|
#ifndef VOXEL_CHUNK_H
|
|
|
|
#define VOXEL_CHUNK_H
|
|
|
|
|
2021-02-06 11:51:50 +01:00
|
|
|
#include "core/version.h"
|
|
|
|
|
|
|
|
#if VERSION_MAJOR > 3
|
2022-02-07 00:15:44 +01:00
|
|
|
#include "core/config/engine.h"
|
2021-02-06 11:51:50 +01:00
|
|
|
#include "core/io/resource.h"
|
|
|
|
#include "core/string/ustring.h"
|
|
|
|
#include "core/variant/array.h"
|
|
|
|
#else
|
2022-02-07 00:15:44 +01:00
|
|
|
#include "core/array.h"
|
|
|
|
#include "core/engine.h"
|
2020-04-02 21:28:19 +02:00
|
|
|
#include "core/resource.h"
|
2021-02-06 11:51:50 +01:00
|
|
|
#include "core/ustring.h"
|
|
|
|
#endif
|
2019-11-06 03:37:22 +01:00
|
|
|
|
2020-05-23 10:34:47 +02:00
|
|
|
#include "../defines.h"
|
2020-04-09 12:34:39 +02:00
|
|
|
|
2020-05-23 10:34:47 +02:00
|
|
|
#include pool_vector_h
|
|
|
|
include_pool_vector
|
2020-04-09 12:34:39 +02:00
|
|
|
|
2020-02-12 20:34:16 +01:00
|
|
|
#include "core/os/mutex.h"
|
2019-11-19 20:39:45 +01:00
|
|
|
#include "core/os/thread.h"
|
|
|
|
#include "core/os/thread_safe.h"
|
2020-04-09 12:34:39 +02:00
|
|
|
|
2020-01-09 04:29:05 +01:00
|
|
|
#include "scene/resources/packed_scene.h"
|
2019-06-07 01:33:41 +02:00
|
|
|
|
2019-07-18 02:05:50 +02:00
|
|
|
#include "voxel_world.h"
|
|
|
|
|
2019-06-07 01:33:41 +02:00
|
|
|
#include "../data/voxel_light.h"
|
|
|
|
|
2019-07-18 18:56:42 +02:00
|
|
|
#include "../meshers/voxel_mesher.h"
|
2019-06-07 01:33:41 +02:00
|
|
|
|
2020-07-07 01:06:46 +02:00
|
|
|
#if PROPS_PRESENT
|
|
|
|
#include "../../props/props/prop_data.h"
|
|
|
|
#endif
|
2019-06-07 01:33:41 +02:00
|
|
|
|
2020-04-09 12:34:39 +02:00
|
|
|
#include "core/version.h"
|
|
|
|
|
|
|
|
#if VERSION_MAJOR >= 4
|
|
|
|
#define Texture Texture2D
|
2022-02-07 00:15:44 +01:00
|
|
|
|
|
|
|
#include "core/math/transform_3d.h"
|
|
|
|
typedef class Transform3D Transform;
|
2020-04-09 12:34:39 +02:00
|
|
|
#endif
|
|
|
|
|
2022-02-08 12:36:37 +01:00
|
|
|
#include "../library/voxel_library.h"
|
2022-02-08 22:47:06 +01:00
|
|
|
#include "../library/voxel_surface.h"
|
2022-02-07 00:15:44 +01:00
|
|
|
; //hackfix for a clang format issue
|
2020-08-04 09:44:18 +02:00
|
|
|
|
2020-10-01 20:49:54 +02:00
|
|
|
class VoxelJob;
|
|
|
|
class VoxelWorld;
|
2020-10-25 17:05:15 +01:00
|
|
|
class VoxelStructure;
|
2019-08-12 20:40:05 +02:00
|
|
|
|
2020-04-02 21:28:19 +02:00
|
|
|
class VoxelChunk : public Resource {
|
|
|
|
GDCLASS(VoxelChunk, Resource);
|
2019-06-07 01:33:41 +02:00
|
|
|
|
2020-10-23 19:47:04 +02:00
|
|
|
_THREAD_SAFE_CLASS_
|
|
|
|
|
2019-06-07 01:33:41 +02:00
|
|
|
public:
|
2019-11-10 03:10:42 +01:00
|
|
|
enum {
|
|
|
|
VOXEL_CHUNK_STATE_OK = 0,
|
2020-03-06 16:12:39 +01:00
|
|
|
};
|
|
|
|
|
2019-11-10 03:10:42 +01:00
|
|
|
public:
|
2020-04-18 02:15:01 +02:00
|
|
|
bool get_is_build_threaded() const;
|
|
|
|
void set_is_build_threaded(const bool value);
|
|
|
|
|
2020-04-02 21:28:19 +02:00
|
|
|
bool get_process() const;
|
|
|
|
void set_process(const bool value);
|
|
|
|
|
|
|
|
bool get_physics_process() const;
|
|
|
|
void set_physics_process(const bool value);
|
|
|
|
|
|
|
|
bool get_visible() const;
|
|
|
|
void set_visible(const bool value);
|
|
|
|
|
2019-11-19 14:42:21 +01:00
|
|
|
bool get_is_generating() const;
|
2020-04-16 17:10:04 +02:00
|
|
|
void set_is_generating(const bool value);
|
2019-11-19 14:42:21 +01:00
|
|
|
|
2020-04-22 12:33:14 +02:00
|
|
|
bool is_in_tree() const;
|
|
|
|
|
2019-11-10 03:10:42 +01:00
|
|
|
bool get_dirty() const;
|
2020-04-16 17:10:04 +02:00
|
|
|
void set_dirty(const bool value);
|
2019-11-10 03:10:42 +01:00
|
|
|
|
|
|
|
int get_state() const;
|
|
|
|
void set_state(int value);
|
|
|
|
|
2020-04-16 17:10:04 +02:00
|
|
|
int get_position_x() const;
|
|
|
|
void set_position_x(const int value);
|
|
|
|
int get_position_y() const;
|
|
|
|
void set_position_y(const int value);
|
|
|
|
int get_position_z() const;
|
|
|
|
void set_position_z(const int value);
|
|
|
|
|
|
|
|
int get_size_x() const;
|
|
|
|
int get_size_y() const;
|
|
|
|
int get_size_z() const;
|
|
|
|
void set_size_x(const int value);
|
|
|
|
void set_size_y(const int value);
|
|
|
|
void set_size_z(const int value);
|
|
|
|
|
|
|
|
int get_data_size_x() const;
|
|
|
|
int get_data_size_y() const;
|
|
|
|
int get_data_size_z() const;
|
|
|
|
void set_data_size_x(const int value);
|
|
|
|
void set_data_size_y(const int value);
|
|
|
|
void set_data_size_z(const int value);
|
2019-11-18 19:22:11 +01:00
|
|
|
|
2019-11-18 20:16:29 +01:00
|
|
|
Vector3 get_position() const;
|
|
|
|
Vector3 get_size() const;
|
2020-08-16 18:20:16 +02:00
|
|
|
|
|
|
|
Vector3 get_world_position() const;
|
|
|
|
Vector3 get_world_size() const;
|
|
|
|
AABB get_world_aabb() const;
|
|
|
|
|
2020-04-16 17:10:04 +02:00
|
|
|
void set_position(const int x, const int y, const int z);
|
2019-11-18 19:22:11 +01:00
|
|
|
|
2019-11-18 19:43:15 +01:00
|
|
|
int get_margin_start() const;
|
|
|
|
int get_margin_end() const;
|
2020-04-16 17:10:04 +02:00
|
|
|
void set_margin_start(const int value);
|
|
|
|
void set_margin_end(const int value);
|
2019-11-18 19:22:11 +01:00
|
|
|
|
2022-02-08 22:47:06 +01:00
|
|
|
int material_cache_key_get() const;
|
|
|
|
void material_cache_key_set(const int value);
|
|
|
|
|
|
|
|
bool material_cache_key_has() const;
|
|
|
|
void material_cache_key_has_set(const bool value);
|
|
|
|
|
|
|
|
int liquid_material_cache_key_get() const;
|
|
|
|
void liquid_material_cache_key_set(const int value);
|
|
|
|
|
|
|
|
bool liquid_material_cache_key_has() const;
|
|
|
|
void liquid_material_cache_key_has_set(const bool value);
|
|
|
|
|
|
|
|
int prop_material_cache_key_get() const;
|
|
|
|
void prop_material_cache_key_set(const int value);
|
|
|
|
|
|
|
|
bool prop_material_cache_key_has() const;
|
|
|
|
void prop_material_cache_key_has_set(const bool value);
|
|
|
|
|
2022-02-08 12:36:37 +01:00
|
|
|
Ref<VoxelLibrary> get_library();
|
|
|
|
void set_library(const Ref<VoxelLibrary> &value);
|
2019-07-17 17:01:12 +02:00
|
|
|
|
2019-07-17 02:28:16 +02:00
|
|
|
float get_voxel_scale() const;
|
2020-04-16 17:10:04 +02:00
|
|
|
void set_voxel_scale(const float value);
|
2019-06-07 01:33:41 +02:00
|
|
|
|
2020-03-12 23:23:38 +01:00
|
|
|
VoxelWorld *get_voxel_world() const;
|
|
|
|
void set_voxel_world(VoxelWorld *world);
|
|
|
|
void set_voxel_world_bind(Node *world);
|
2020-01-13 00:39:55 +01:00
|
|
|
|
2020-10-01 20:49:54 +02:00
|
|
|
//Jobs
|
2020-10-26 18:29:05 +01:00
|
|
|
Ref<VoxelJob> job_get(const int index) const;
|
|
|
|
void job_set(const int index, const Ref<VoxelJob> &job);
|
|
|
|
void job_remove(const int index);
|
|
|
|
void job_add(const Ref<VoxelJob> &job);
|
|
|
|
int job_get_count() const;
|
|
|
|
|
|
|
|
int job_get_current_index();
|
|
|
|
void job_next();
|
|
|
|
Ref<VoxelJob> job_get_current();
|
2020-06-23 14:30:49 +02:00
|
|
|
|
2020-03-12 23:23:38 +01:00
|
|
|
//Channels
|
2020-10-27 12:45:15 +01:00
|
|
|
void channel_setup();
|
2019-11-18 19:43:15 +01:00
|
|
|
|
2020-04-16 17:10:04 +02:00
|
|
|
void set_size(const int size_x, const int size_y, const int size_z, const int margin_start = 0, const int margin_end = 0);
|
2019-11-18 23:50:06 +01:00
|
|
|
|
2020-10-27 12:45:15 +01:00
|
|
|
bool validate_data_position(const int x, const int y, const int z) const;
|
2019-11-18 21:53:33 +01:00
|
|
|
|
2020-10-27 12:45:15 +01:00
|
|
|
uint8_t get_voxel(const int p_x, const int p_y, const int p_z, const int p_index) const;
|
|
|
|
void set_voxel(const uint8_t p_value, const int p_x, const int p_y, const int p_z, const int p_index);
|
2019-11-18 19:43:15 +01:00
|
|
|
|
2020-10-27 12:45:15 +01:00
|
|
|
int channel_get_count() const;
|
|
|
|
void channel_set_count(const int count);
|
2020-02-26 01:08:18 +01:00
|
|
|
|
2020-10-27 12:45:15 +01:00
|
|
|
bool channel_is_allocated(const int channel_index);
|
|
|
|
void channel_ensure_allocated(const int channel_index, const uint8_t default_value = 0);
|
|
|
|
void channel_allocate(const int channel_index, const uint8_t default_value = 0);
|
|
|
|
void channel_fill(const uint8_t value, const int channel_index);
|
|
|
|
void channel_dealloc(const int channel_index);
|
2019-11-18 19:43:15 +01:00
|
|
|
|
2020-10-27 12:45:15 +01:00
|
|
|
uint8_t *channel_get(const int channel_index);
|
|
|
|
uint8_t *channel_get_valid(const int channel_index, const uint8_t default_value = 0);
|
2019-11-18 23:50:06 +01:00
|
|
|
|
2020-10-27 12:45:15 +01:00
|
|
|
PoolByteArray channel_get_array(const int channel_index) const;
|
|
|
|
void channel_set_array(const int channel_index, const PoolByteArray &array);
|
2020-02-26 01:08:18 +01:00
|
|
|
|
2020-10-27 12:45:15 +01:00
|
|
|
PoolByteArray channel_get_compressed(const int channel_index) const;
|
|
|
|
void channel_set_compressed(const int channel_index, const PoolByteArray &data);
|
2020-04-05 22:07:52 +02:00
|
|
|
|
2020-04-16 17:10:04 +02:00
|
|
|
int get_index(const int x, const int y, const int z) const;
|
|
|
|
int get_data_index(const int x, const int y, const int z) const;
|
2020-04-07 14:23:20 +02:00
|
|
|
int get_data_size() const;
|
2020-01-09 04:29:05 +01:00
|
|
|
|
2020-10-25 17:05:15 +01:00
|
|
|
//Voxel Structures
|
|
|
|
Ref<VoxelStructure> voxel_structure_get(const int index) const;
|
|
|
|
void voxel_structure_add(const Ref<VoxelStructure> &structure);
|
|
|
|
void voxel_structure_remove(const Ref<VoxelStructure> &structure);
|
|
|
|
void voxel_structure_remove_index(const int index);
|
|
|
|
void voxel_structure_clear();
|
|
|
|
int voxel_structure_get_count() const;
|
|
|
|
void voxel_structure_add_at_position(Ref<VoxelStructure> structure, const Vector3 &world_position);
|
|
|
|
|
|
|
|
Vector<Variant> voxel_structures_get();
|
|
|
|
void voxel_structures_set(const Vector<Variant> &structures);
|
|
|
|
|
2019-10-10 23:51:05 +02:00
|
|
|
//Meshing
|
2020-10-03 17:18:43 +02:00
|
|
|
void build();
|
2019-07-19 23:54:56 +02:00
|
|
|
void clear();
|
2020-10-03 17:18:43 +02:00
|
|
|
void finalize_build();
|
|
|
|
|
|
|
|
void _build();
|
2019-06-07 01:33:41 +02:00
|
|
|
|
2020-04-15 12:41:52 +02:00
|
|
|
//light Baking
|
2020-01-09 04:29:05 +01:00
|
|
|
void bake_lights();
|
2019-07-17 02:28:16 +02:00
|
|
|
void bake_light(Ref<VoxelLight> light);
|
2020-03-12 23:23:38 +01:00
|
|
|
void clear_baked_lights();
|
|
|
|
|
2020-07-07 01:06:46 +02:00
|
|
|
#if PROPS_PRESENT
|
2020-10-27 12:56:34 +01:00
|
|
|
void prop_add(const Transform &tarnsform, const Ref<PropData> &prop);
|
|
|
|
Ref<PropData> prop_get(const int index);
|
|
|
|
Transform prop_get_tarnsform(const int index);
|
|
|
|
int prop_get_count() const;
|
|
|
|
void prop_remove(const int index);
|
|
|
|
void props_clear();
|
2020-07-07 01:06:46 +02:00
|
|
|
#endif
|
2019-07-20 14:48:56 +02:00
|
|
|
|
2020-06-28 16:57:53 +02:00
|
|
|
#if MESH_DATA_RESOURCE_PRESENT
|
2020-10-26 16:52:38 +01:00
|
|
|
int mesh_data_resource_addv(const Vector3 &local_data_pos, const Ref<MeshDataResource> &mesh, const Ref<Texture> &texture = Ref<Texture>(), const Color &color = Color(1, 1, 1, 1), const bool apply_voxel_scale = true);
|
|
|
|
int mesh_data_resource_add(const Transform &local_transform, const Ref<MeshDataResource> &mesh, const Ref<Texture> &texture = Ref<Texture>(), const Color &color = Color(1, 1, 1, 1), const bool apply_voxel_scale = true);
|
2020-06-28 16:57:53 +02:00
|
|
|
|
2020-10-26 16:52:38 +01:00
|
|
|
Ref<MeshDataResource> mesh_data_resource_get(const int index);
|
|
|
|
void mesh_data_resource_set(const int index, const Ref<MeshDataResource> &mesh);
|
2020-06-28 16:57:53 +02:00
|
|
|
|
2020-10-26 16:52:38 +01:00
|
|
|
Ref<Texture> mesh_data_resource_get_texture(const int index);
|
|
|
|
void mesh_data_resource_set_texture(const int index, const Ref<Texture> &texture);
|
2020-06-28 16:57:53 +02:00
|
|
|
|
2020-10-26 16:52:38 +01:00
|
|
|
Color mesh_data_resource_get_color(const int index);
|
|
|
|
void mesh_data_resource_set_color(const int index, const Color &color);
|
2020-06-28 16:57:53 +02:00
|
|
|
|
2020-10-26 16:52:38 +01:00
|
|
|
Rect2 mesh_data_resource_get_uv_rect(const int index);
|
|
|
|
void mesh_data_resource_set_uv_rect(const int index, const Rect2 &uv_rect);
|
2020-06-28 16:57:53 +02:00
|
|
|
|
2020-10-26 16:52:38 +01:00
|
|
|
Transform mesh_data_resource_get_transform(const int index);
|
|
|
|
void mesh_data_resource_set_transform(const int index, const Transform &transform);
|
2020-06-28 16:57:53 +02:00
|
|
|
|
2020-10-26 16:52:38 +01:00
|
|
|
bool mesh_data_resource_get_is_inside(const int index);
|
|
|
|
void mesh_data_resource_set_is_inside(const int index, const bool &inside);
|
2020-08-16 18:20:16 +02:00
|
|
|
|
2020-10-26 16:52:38 +01:00
|
|
|
int mesh_data_resource_get_count() const;
|
|
|
|
void mesh_data_resource_remove(const int index);
|
|
|
|
void mesh_data_resource_clear();
|
2020-06-28 16:57:53 +02:00
|
|
|
#endif
|
|
|
|
|
2020-06-30 18:55:50 +02:00
|
|
|
//Colliders
|
2020-10-26 17:24:22 +01:00
|
|
|
int collider_add(const Transform &local_transform, const Ref<Shape> &shape, const RID &shape_rid = RID(), const RID &body = RID());
|
2020-06-30 18:55:50 +02:00
|
|
|
|
2020-10-26 17:24:22 +01:00
|
|
|
Transform collider_get_transform(const int index);
|
|
|
|
void collider_set_transform(const int index, const Transform &transform);
|
2020-06-30 18:55:50 +02:00
|
|
|
|
2020-10-26 17:24:22 +01:00
|
|
|
Ref<Shape> collider_get_shape(const int index);
|
|
|
|
void collider_set_shape(const int index, const Ref<Shape> &shape);
|
2020-06-30 18:55:50 +02:00
|
|
|
|
2020-10-26 17:24:22 +01:00
|
|
|
RID collider_get_shape_rid(const int index);
|
|
|
|
void collider_set_shape_rid(const int index, const RID &rid);
|
2020-06-30 18:55:50 +02:00
|
|
|
|
2020-10-26 17:24:22 +01:00
|
|
|
RID collider_get_body(const int index);
|
|
|
|
void collider_set_body(const int index, const RID &rid);
|
2020-06-30 18:55:50 +02:00
|
|
|
|
2020-10-26 17:24:22 +01:00
|
|
|
int collider_get_count() const;
|
|
|
|
void collider_remove(const int index);
|
|
|
|
void colliders_clear();
|
2020-06-30 18:55:50 +02:00
|
|
|
|
2020-04-15 13:06:45 +02:00
|
|
|
//handlers
|
2020-04-02 21:28:19 +02:00
|
|
|
void enter_tree();
|
|
|
|
void exit_tree();
|
2020-04-16 17:10:04 +02:00
|
|
|
void process(const float delta);
|
|
|
|
void physics_process(const float delta);
|
2020-04-02 21:28:19 +02:00
|
|
|
void world_transform_changed();
|
2020-04-16 17:10:04 +02:00
|
|
|
void visibility_changed(const bool visible);
|
2020-04-15 12:41:52 +02:00
|
|
|
void world_light_added(const Ref<VoxelLight> &light);
|
|
|
|
void world_light_removed(const Ref<VoxelLight> &light);
|
2020-10-02 16:45:08 +02:00
|
|
|
void generation_process(const float delta);
|
|
|
|
void generation_physics_process(const float delta);
|
2020-04-02 21:28:19 +02:00
|
|
|
|
|
|
|
Transform get_transform() const;
|
|
|
|
void set_transform(const Transform &transform);
|
|
|
|
|
2020-07-20 01:06:34 +02:00
|
|
|
Transform get_global_transform() const;
|
|
|
|
Vector3 to_local(Vector3 p_global) const;
|
|
|
|
Vector3 to_global(Vector3 p_local) const;
|
|
|
|
|
2022-02-07 00:15:44 +01:00
|
|
|
#if VERSION_MAJOR >= 4
|
|
|
|
GDVIRTUAL1(_mesh_data_resource_added, int);
|
|
|
|
|
|
|
|
GDVIRTUAL0(_channel_setup);
|
|
|
|
|
|
|
|
GDVIRTUAL0(_bake_lights);
|
|
|
|
GDVIRTUAL1(_bake_light, Ref<VoxelLight>);
|
|
|
|
GDVIRTUAL0(_clear_baked_lights);
|
|
|
|
|
|
|
|
GDVIRTUAL0(_enter_tree);
|
|
|
|
GDVIRTUAL0(_exit_tree);
|
|
|
|
GDVIRTUAL1(_process, float);
|
|
|
|
GDVIRTUAL1(_physics_process, float);
|
|
|
|
GDVIRTUAL0(_world_transform_changed);
|
|
|
|
GDVIRTUAL1(_visibility_changed, bool);
|
|
|
|
GDVIRTUAL1(_world_light_added, Ref<VoxelLight>);
|
|
|
|
GDVIRTUAL1(_world_light_removed, Ref<VoxelLight>);
|
|
|
|
|
|
|
|
GDVIRTUAL1(_generation_process, float);
|
|
|
|
GDVIRTUAL1(_generation_physics_process, float);
|
|
|
|
|
|
|
|
GDVIRTUAL0(_finalize_build);
|
|
|
|
GDVIRTUAL0(_build);
|
|
|
|
#endif
|
|
|
|
|
2019-07-18 01:43:58 +02:00
|
|
|
VoxelChunk();
|
|
|
|
~VoxelChunk();
|
|
|
|
|
2020-10-02 23:47:39 +02:00
|
|
|
protected:
|
|
|
|
virtual void _enter_tree();
|
|
|
|
virtual void _exit_tree();
|
|
|
|
virtual void _generation_process(const float delta);
|
|
|
|
virtual void _generation_physics_process(const float delta);
|
|
|
|
|
2020-06-28 16:57:53 +02:00
|
|
|
protected:
|
2020-07-07 01:06:46 +02:00
|
|
|
#if PROPS_PRESENT
|
|
|
|
struct PropDataStore {
|
|
|
|
Transform transform;
|
|
|
|
Ref<PropData> prop;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2020-06-30 18:55:50 +02:00
|
|
|
#if MESH_DATA_RESOURCE_PRESENT
|
2020-06-28 16:57:53 +02:00
|
|
|
struct MeshDataResourceEntry {
|
|
|
|
Ref<MeshDataResource> mesh;
|
|
|
|
Ref<Texture> texture;
|
|
|
|
Color color;
|
|
|
|
Rect2 uv_rect;
|
|
|
|
Transform transform;
|
2020-08-16 18:20:16 +02:00
|
|
|
bool is_inside;
|
2020-06-28 16:57:53 +02:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2020-06-30 18:55:50 +02:00
|
|
|
struct ColliderBody {
|
|
|
|
Transform transform;
|
|
|
|
RID body;
|
|
|
|
Ref<Shape> shape;
|
|
|
|
RID shape_rid;
|
|
|
|
};
|
|
|
|
|
2019-06-07 01:33:41 +02:00
|
|
|
protected:
|
2020-04-02 21:28:19 +02:00
|
|
|
virtual void _world_transform_changed();
|
|
|
|
|
2020-03-31 12:42:22 +02:00
|
|
|
/*
|
2020-02-26 01:08:18 +01:00
|
|
|
bool _set(const StringName &p_name, const Variant &p_value);
|
|
|
|
bool _get(const StringName &p_name, Variant &r_ret) const;
|
|
|
|
void _get_property_list(List<PropertyInfo> *p_list) const;
|
2020-03-31 12:42:22 +02:00
|
|
|
*/
|
2019-06-07 01:33:41 +02:00
|
|
|
static void _bind_methods();
|
2019-11-10 03:10:42 +01:00
|
|
|
|
2020-04-18 02:15:01 +02:00
|
|
|
bool _is_build_threaded;
|
|
|
|
|
2020-04-02 21:28:19 +02:00
|
|
|
bool _is_processing;
|
|
|
|
bool _is_phisics_processing;
|
|
|
|
|
|
|
|
bool _is_visible;
|
|
|
|
|
2019-11-19 14:42:21 +01:00
|
|
|
bool _is_generating;
|
2019-11-10 03:10:42 +01:00
|
|
|
bool _dirty;
|
|
|
|
int _state;
|
|
|
|
|
2020-04-22 12:33:14 +02:00
|
|
|
bool _is_in_tree;
|
|
|
|
|
2019-07-18 02:05:50 +02:00
|
|
|
VoxelWorld *_voxel_world;
|
|
|
|
|
2019-11-18 20:16:29 +01:00
|
|
|
int _position_x;
|
|
|
|
int _position_y;
|
|
|
|
int _position_z;
|
2019-11-18 19:22:11 +01:00
|
|
|
|
2020-04-05 01:36:41 +02:00
|
|
|
int _size_x;
|
|
|
|
int _size_y;
|
|
|
|
int _size_z;
|
2019-11-18 19:22:11 +01:00
|
|
|
|
2020-04-05 01:36:41 +02:00
|
|
|
int _data_size_x;
|
|
|
|
int _data_size_y;
|
|
|
|
int _data_size_z;
|
2019-11-18 19:22:11 +01:00
|
|
|
|
2020-04-05 01:36:41 +02:00
|
|
|
int _margin_start;
|
|
|
|
int _margin_end;
|
2019-07-17 02:28:16 +02:00
|
|
|
|
2022-02-08 22:47:06 +01:00
|
|
|
int _material_cache_key;
|
|
|
|
bool _material_cache_key_has;
|
|
|
|
|
|
|
|
int _liquid_material_cache_key;
|
|
|
|
bool _liquid_material_cache_key_has;
|
|
|
|
|
|
|
|
int _prop_material_cache_key;
|
|
|
|
bool _prop_material_cache_key_has;
|
|
|
|
|
2019-11-18 19:43:15 +01:00
|
|
|
Vector<uint8_t *> _channels;
|
|
|
|
|
2019-06-07 01:33:41 +02:00
|
|
|
float _voxel_scale;
|
|
|
|
|
2020-10-02 16:45:08 +02:00
|
|
|
int _current_job;
|
2022-02-07 00:15:44 +01:00
|
|
|
Vector<Ref<VoxelJob>> _jobs;
|
2020-10-01 20:49:54 +02:00
|
|
|
|
2022-02-08 12:36:37 +01:00
|
|
|
Ref<VoxelLibrary> _library;
|
2019-06-07 01:33:41 +02:00
|
|
|
|
2022-02-07 00:15:44 +01:00
|
|
|
Vector<Ref<VoxelStructure>> _voxel_structures;
|
2020-10-25 17:05:15 +01:00
|
|
|
|
2020-07-07 01:06:46 +02:00
|
|
|
#if PROPS_PRESENT
|
|
|
|
Vector<PropDataStore> _props;
|
|
|
|
#endif
|
|
|
|
|
2020-06-28 16:57:53 +02:00
|
|
|
#if MESH_DATA_RESOURCE_PRESENT
|
|
|
|
Vector<MeshDataResourceEntry> _mesh_data_resources;
|
|
|
|
#endif
|
2019-07-18 18:56:42 +02:00
|
|
|
|
2020-06-30 18:55:50 +02:00
|
|
|
Vector<ColliderBody> _colliders;
|
|
|
|
|
2020-04-02 21:28:19 +02:00
|
|
|
Transform _transform;
|
2020-10-02 23:47:39 +02:00
|
|
|
|
|
|
|
bool _abort_build;
|
2020-10-03 17:18:43 +02:00
|
|
|
bool _queued_generation;
|
2019-06-07 01:33:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|