mirror of
https://github.com/Relintai/voxelman.git
synced 2024-11-14 10:17:20 +01:00
Added mesher index property to both VoxelMesher, and VoxelSurface.
This commit is contained in:
parent
8b08a9b14f
commit
601a61619b
@ -29,6 +29,13 @@ void VoxelSurface::set_id(const int value) {
|
|||||||
_id = value;
|
_id = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int VoxelSurface::get_mesher_index() const {
|
||||||
|
return _mesher_index;
|
||||||
|
}
|
||||||
|
void VoxelSurface::set_mesher_index(const int value) {
|
||||||
|
_mesher_index = value;
|
||||||
|
}
|
||||||
|
|
||||||
bool VoxelSurface::is_transparent() const {
|
bool VoxelSurface::is_transparent() const {
|
||||||
return _is_transparent;
|
return _is_transparent;
|
||||||
}
|
}
|
||||||
@ -93,6 +100,7 @@ void VoxelSurface::refresh_rects() {
|
|||||||
|
|
||||||
VoxelSurface::VoxelSurface() {
|
VoxelSurface::VoxelSurface() {
|
||||||
_id = 0;
|
_id = 0;
|
||||||
|
_mesher_index = 0;
|
||||||
_is_transparent = false;
|
_is_transparent = false;
|
||||||
_library = NULL;
|
_library = NULL;
|
||||||
}
|
}
|
||||||
@ -106,6 +114,10 @@ void VoxelSurface::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_id", "value"), &VoxelSurface::set_id);
|
ClassDB::bind_method(D_METHOD("set_id", "value"), &VoxelSurface::set_id);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_mesher_index"), &VoxelSurface::get_mesher_index);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_mesher_index", "value"), &VoxelSurface::set_mesher_index);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "mesher_index"), "set_mesher_index", "get_mesher_index");
|
||||||
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "voxel_name"), "set_name", "get_name");
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "voxel_name"), "set_name", "get_name");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_transparent", "transparent"), &VoxelSurface::set_transparent);
|
ClassDB::bind_method(D_METHOD("set_transparent", "transparent"), &VoxelSurface::set_transparent);
|
||||||
|
@ -69,6 +69,9 @@ public:
|
|||||||
int get_id() const;
|
int get_id() const;
|
||||||
void set_id(const int value);
|
void set_id(const int value);
|
||||||
|
|
||||||
|
int get_mesher_index() const;
|
||||||
|
void set_mesher_index(const int value);
|
||||||
|
|
||||||
bool is_transparent() const;
|
bool is_transparent() const;
|
||||||
void set_transparent(const bool transparent);
|
void set_transparent(const bool transparent);
|
||||||
|
|
||||||
@ -95,6 +98,7 @@ protected:
|
|||||||
VoxelmanLibrary *_library;
|
VoxelmanLibrary *_library;
|
||||||
|
|
||||||
int _id;
|
int _id;
|
||||||
|
int _mesher_index;
|
||||||
bool _is_transparent;
|
bool _is_transparent;
|
||||||
Rect2 _rects[VOXEL_SIDES_COUNT];
|
Rect2 _rects[VOXEL_SIDES_COUNT];
|
||||||
Ref<GroundClutter> _clutter;
|
Ref<GroundClutter> _clutter;
|
||||||
|
@ -24,10 +24,17 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "../world/voxel_chunk.h"
|
#include "../world/voxel_chunk.h"
|
||||||
|
|
||||||
|
int VoxelMesher::get_mesher_index() const {
|
||||||
|
return _mesher_index;
|
||||||
|
}
|
||||||
|
void VoxelMesher::set_mesher_index(const int value) {
|
||||||
|
_mesher_index = value;
|
||||||
|
}
|
||||||
|
|
||||||
Ref<VoxelmanLibrary> VoxelMesher::get_library() {
|
Ref<VoxelmanLibrary> VoxelMesher::get_library() {
|
||||||
return _library;
|
return _library;
|
||||||
}
|
}
|
||||||
void VoxelMesher::set_library(Ref<VoxelmanLibrary> library) {
|
void VoxelMesher::set_library(const Ref<VoxelmanLibrary> &library) {
|
||||||
_library = library;
|
_library = library;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,7 +694,7 @@ PoolVector<int> VoxelMesher::get_indices() {
|
|||||||
return _indices;
|
return _indices;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelMesher::set_indices(const PoolVector<int> values) {
|
void VoxelMesher::set_indices(const PoolVector<int> &values) {
|
||||||
_indices = values;
|
_indices = values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -707,17 +714,21 @@ void VoxelMesher::remove_indices(int idx) {
|
|||||||
_indices.remove(idx);
|
_indices.remove(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
VoxelMesher::VoxelMesher(Ref<VoxelmanLibrary> library) {
|
VoxelMesher::VoxelMesher(const Ref<VoxelmanLibrary> &library) {
|
||||||
_library = library;
|
_library = library;
|
||||||
|
|
||||||
|
_mesher_index = 0;
|
||||||
_voxel_scale = 1;
|
_voxel_scale = 1;
|
||||||
_lod_size = 1;
|
_lod_size = 1;
|
||||||
|
_ao_strength = 0.25;
|
||||||
|
_base_light_value = 0.5;
|
||||||
|
_uv_margin = Rect2(0, 0, 1, 1);
|
||||||
|
|
||||||
_surface_tool.instance();
|
_surface_tool.instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
VoxelMesher::VoxelMesher() {
|
VoxelMesher::VoxelMesher() {
|
||||||
|
_mesher_index = 0;
|
||||||
_voxel_scale = 1;
|
_voxel_scale = 1;
|
||||||
_lod_size = 1;
|
_lod_size = 1;
|
||||||
_ao_strength = 0.25;
|
_ao_strength = 0.25;
|
||||||
@ -741,6 +752,10 @@ void VoxelMesher::_bind_methods() {
|
|||||||
BIND_VMETHOD(MethodInfo("_bake_colors", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
|
BIND_VMETHOD(MethodInfo("_bake_colors", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
|
||||||
BIND_VMETHOD(MethodInfo("_bake_liquid_colors", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
|
BIND_VMETHOD(MethodInfo("_bake_liquid_colors", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk")));
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_mesher_index"), &VoxelMesher::get_mesher_index);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_mesher_index", "value"), &VoxelMesher::set_mesher_index);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "mesher_index"), "set_mesher_index", "get_mesher_index");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_library"), &VoxelMesher::get_library);
|
ClassDB::bind_method(D_METHOD("get_library"), &VoxelMesher::get_library);
|
||||||
ClassDB::bind_method(D_METHOD("set_library", "value"), &VoxelMesher::set_library);
|
ClassDB::bind_method(D_METHOD("set_library", "value"), &VoxelMesher::set_library);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanLibrary"), "set_library", "get_library");
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanLibrary"), "set_library", "get_library");
|
||||||
|
@ -52,17 +52,20 @@ class VoxelMesher : public Reference {
|
|||||||
GDCLASS(VoxelMesher, Reference);
|
GDCLASS(VoxelMesher, Reference);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
int get_mesher_index() const;
|
||||||
|
void set_mesher_index(const int value);
|
||||||
|
|
||||||
Ref<VoxelmanLibrary> get_library();
|
Ref<VoxelmanLibrary> get_library();
|
||||||
void set_library(Ref<VoxelmanLibrary> library);
|
void set_library(const Ref<VoxelmanLibrary> &library);
|
||||||
|
|
||||||
Ref<Material> get_material();
|
Ref<Material> get_material();
|
||||||
void set_material(const Ref<Material> &material);
|
void set_material(const Ref<Material> &material);
|
||||||
|
|
||||||
float get_ao_strength() const;
|
float get_ao_strength() const;
|
||||||
void set_ao_strength(float value);
|
void set_ao_strength(const float value);
|
||||||
|
|
||||||
float get_base_light_value() const;
|
float get_base_light_value() const;
|
||||||
void set_base_light_value(float value);
|
void set_base_light_value(const float value);
|
||||||
|
|
||||||
float get_voxel_scale() const;
|
float get_voxel_scale() const;
|
||||||
void set_voxel_scale(const float voxel_scale);
|
void set_voxel_scale(const float voxel_scale);
|
||||||
@ -134,19 +137,21 @@ public:
|
|||||||
void add_uv2(Vector2 vector);
|
void add_uv2(Vector2 vector);
|
||||||
|
|
||||||
PoolVector<int> get_indices();
|
PoolVector<int> get_indices();
|
||||||
void set_indices(const PoolVector<int> values);
|
void set_indices(const PoolVector<int> &values);
|
||||||
int get_indices_count();
|
int get_indices_count();
|
||||||
int get_indice(int idx);
|
int get_indice(int idx);
|
||||||
void remove_indices(int idx);
|
void remove_indices(int idx);
|
||||||
void add_indices(int index);
|
void add_indices(int index);
|
||||||
|
|
||||||
VoxelMesher(Ref<VoxelmanLibrary> library);
|
VoxelMesher(const Ref<VoxelmanLibrary> &library);
|
||||||
VoxelMesher();
|
VoxelMesher();
|
||||||
~VoxelMesher();
|
~VoxelMesher();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
|
int _mesher_index;
|
||||||
|
|
||||||
PoolVector<Vector3> _vertices;
|
PoolVector<Vector3> _vertices;
|
||||||
PoolVector<Vector3> _normals;
|
PoolVector<Vector3> _normals;
|
||||||
PoolVector<Color> _colors;
|
PoolVector<Color> _colors;
|
||||||
|
Loading…
Reference in New Issue
Block a user