mirror of
https://github.com/Relintai/voxelman.git
synced 2024-11-12 10:15:12 +01:00
Moved the texture scale property to VoxelMesher.
This commit is contained in:
parent
142809d0cb
commit
64b9476eca
@ -28,13 +28,6 @@ SOFTWARE.
|
||||
|
||||
#include visual_server_h
|
||||
|
||||
int VoxelMesherCubic::get_texture_scale() const {
|
||||
return _texture_scale;
|
||||
}
|
||||
void VoxelMesherCubic::set_texture_scale(const int value) {
|
||||
_texture_scale = value;
|
||||
}
|
||||
|
||||
void VoxelMesherCubic::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
||||
Ref<VoxelChunkDefault> chunk = p_chunk;
|
||||
|
||||
@ -160,9 +153,5 @@ VoxelMesherCubic::~VoxelMesherCubic() {
|
||||
}
|
||||
|
||||
void VoxelMesherCubic::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_texture_scale"), &VoxelMesherCubic::get_texture_scale);
|
||||
ClassDB::bind_method(D_METHOD("set_texture_scale", "value"), &VoxelMesherCubic::set_texture_scale);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_scale"), "set_texture_scale", "get_texture_scale");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_add_chunk", "buffer"), &VoxelMesherCubic::_add_chunk);
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ class VoxelMesherCubic : public VoxelMesherDefault {
|
||||
GDCLASS(VoxelMesherCubic, VoxelMesherDefault);
|
||||
|
||||
public:
|
||||
int get_texture_scale() const;
|
||||
void set_texture_scale(const int value);
|
||||
|
||||
void _add_chunk(Ref<VoxelChunk> p_chunk);
|
||||
|
||||
VoxelMesherCubic();
|
||||
|
@ -39,13 +39,6 @@ SOFTWARE.
|
||||
typedef class RenderingServer VisualServer;
|
||||
#endif
|
||||
|
||||
int VoxelMesherMarchingCubes::get_texture_scale() const {
|
||||
return _texture_scale;
|
||||
}
|
||||
void VoxelMesherMarchingCubes::set_texture_scale(const int value) {
|
||||
_texture_scale = value;
|
||||
}
|
||||
|
||||
void VoxelMesherMarchingCubes::get_voxel_type_array(int *arr, Ref<VoxelChunk> chunk, const int x, const int y, const int z, const int size) {
|
||||
uint8_t *channel_type = chunk->get_channel(_channel_index_type);
|
||||
|
||||
@ -538,8 +531,6 @@ Vector3 VoxelMesherMarchingCubes::get_regular_vertex_direction(int index1, int i
|
||||
VoxelMesherMarchingCubes::VoxelMesherMarchingCubes() {
|
||||
_format = VisualServer::ARRAY_FORMAT_NORMAL | VisualServer::ARRAY_FORMAT_COLOR | VisualServer::ARRAY_FORMAT_TEX_UV | VisualServer::ARRAY_FORMAT_TEX_UV2;
|
||||
|
||||
_texture_scale = 4;
|
||||
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
_regular_cell_datas[i] = Ref<MarchingCubesCellData>(memnew(MarchingCubesCellData(regularCellData[i])));
|
||||
}
|
||||
@ -552,9 +543,6 @@ VoxelMesherMarchingCubes::~VoxelMesherMarchingCubes() {
|
||||
}
|
||||
|
||||
void VoxelMesherMarchingCubes::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_texture_scale"), &VoxelMesherMarchingCubes::get_texture_scale);
|
||||
ClassDB::bind_method(D_METHOD("set_texture_scale", "value"), &VoxelMesherMarchingCubes::set_texture_scale);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_scale"), "set_texture_scale", "get_texture_scale");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_add_chunk", "chunk"), &VoxelMesherMarchingCubes::_add_chunk);
|
||||
|
||||
|
@ -65,9 +65,6 @@ public:
|
||||
VOXEL_ENTRY_MASK_111 = 1 << 7,
|
||||
};
|
||||
|
||||
int get_texture_scale() const;
|
||||
void set_texture_scale(const int value);
|
||||
|
||||
//arr should have a size of 8
|
||||
void get_voxel_type_array(int *arr, Ref<VoxelChunk> chunk, const int x, const int y, const int z, const int size = 1);
|
||||
int get_case_code_from_arr(const int *data);
|
||||
@ -95,8 +92,6 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
Ref<MarchingCubesCellData> _regular_cell_datas[16];
|
||||
|
||||
int _texture_scale;
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(VoxelMesherMarchingCubes::VoxelEntryIndices);
|
||||
|
@ -107,6 +107,13 @@ void VoxelMesher::set_format(const int value) {
|
||||
_format = value;
|
||||
}
|
||||
|
||||
int VoxelMesher::get_texture_scale() const {
|
||||
return _texture_scale;
|
||||
}
|
||||
void VoxelMesher::set_texture_scale(const int value) {
|
||||
_texture_scale = value;
|
||||
}
|
||||
|
||||
Ref<VoxelmanLibrary> VoxelMesher::get_library() {
|
||||
return _library;
|
||||
}
|
||||
@ -906,6 +913,7 @@ VoxelMesher::VoxelMesher(const Ref<VoxelmanLibrary> &library) {
|
||||
_channel_index_isolevel = 0;
|
||||
|
||||
_format = 0;
|
||||
_texture_scale = 1;
|
||||
}
|
||||
|
||||
VoxelMesher::VoxelMesher() {
|
||||
@ -918,6 +926,7 @@ VoxelMesher::VoxelMesher() {
|
||||
_format = 0;
|
||||
_channel_index_type = 0;
|
||||
_channel_index_isolevel = 0;
|
||||
_texture_scale = 1;
|
||||
}
|
||||
|
||||
VoxelMesher::~VoxelMesher() {
|
||||
@ -947,6 +956,10 @@ void VoxelMesher::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_format", "value"), &VoxelMesher::set_format);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "format"), "set_format", "get_format");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_texture_scale"), &VoxelMesher::get_texture_scale);
|
||||
ClassDB::bind_method(D_METHOD("set_texture_scale", "value"), &VoxelMesher::set_texture_scale);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_scale"), "set_texture_scale", "get_texture_scale");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_library"), &VoxelMesher::get_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");
|
||||
|
@ -99,6 +99,9 @@ public:
|
||||
int get_format() const;
|
||||
void set_format(const int value);
|
||||
|
||||
int get_texture_scale() const;
|
||||
void set_texture_scale(const int value);
|
||||
|
||||
Ref<VoxelmanLibrary> get_library();
|
||||
void set_library(const Ref<VoxelmanLibrary> &library);
|
||||
|
||||
@ -195,6 +198,8 @@ protected:
|
||||
|
||||
int _format;
|
||||
|
||||
int _texture_scale;
|
||||
|
||||
PoolVector<Vertex> _vertices;
|
||||
PoolVector<int> _indices;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user