2019-05-31 22:54:31 +02:00
|
|
|
#include "voxel_surface.h"
|
|
|
|
|
2019-06-01 00:11:59 +02:00
|
|
|
int VoxelSurface::get_id() const {
|
|
|
|
return _id;
|
|
|
|
}
|
|
|
|
void VoxelSurface::set_id(int value) {
|
|
|
|
_id = value;
|
|
|
|
}
|
|
|
|
|
2019-08-11 15:29:32 +02:00
|
|
|
int VoxelSurface::get_atlas_x() const {
|
|
|
|
return _atlas_x;
|
2019-06-01 00:11:59 +02:00
|
|
|
}
|
2019-08-11 15:29:32 +02:00
|
|
|
void VoxelSurface::set_atlas_x(int value) {
|
|
|
|
_atlas_x = value;
|
2019-06-01 00:11:59 +02:00
|
|
|
}
|
|
|
|
|
2019-08-11 15:29:32 +02:00
|
|
|
int VoxelSurface::get_atlas_y() const {
|
|
|
|
return _atlas_y;
|
2019-06-01 00:11:59 +02:00
|
|
|
}
|
2019-08-11 15:29:32 +02:00
|
|
|
void VoxelSurface::set_atlas_y(int value) {
|
|
|
|
_atlas_y = value;
|
2019-06-01 00:11:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool VoxelSurface::is_transparent() const {
|
|
|
|
return _is_transparent;
|
|
|
|
}
|
|
|
|
void VoxelSurface::set_transparent(bool transparent) {
|
|
|
|
_is_transparent = transparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
String VoxelSurface::get_voxel_name() const {
|
|
|
|
return _name;
|
|
|
|
}
|
2019-05-31 22:54:31 +02:00
|
|
|
void VoxelSurface::set_voxel_name(String name) {
|
2019-06-01 00:11:59 +02:00
|
|
|
_name = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<VoxelmanLibrary> VoxelSurface::get_library() const {
|
|
|
|
return Ref<VoxelmanLibrary>(_library);
|
|
|
|
}
|
|
|
|
|
|
|
|
void VoxelSurface::set_library(Ref<VoxelmanLibrary> library) {
|
|
|
|
_library = library;
|
2019-05-31 22:54:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
VoxelSurface::VoxelSurface() {
|
2019-08-11 15:29:32 +02:00
|
|
|
_id = 0;
|
|
|
|
|
|
|
|
_atlas_x = 0;
|
|
|
|
_atlas_y = 0;
|
|
|
|
|
|
|
|
_is_transparent = false;
|
2019-05-31 22:54:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
VoxelSurface::VoxelSurface(int id) {
|
2019-08-11 15:29:32 +02:00
|
|
|
_id = id;
|
2019-05-31 22:54:31 +02:00
|
|
|
|
2019-08-11 15:29:32 +02:00
|
|
|
_atlas_x = 0;
|
|
|
|
_atlas_y = 0;
|
|
|
|
|
|
|
|
_is_transparent = false;
|
2019-05-31 22:54:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
VoxelSurface::~VoxelSurface() {
|
2019-08-11 15:29:32 +02:00
|
|
|
_library.unref();
|
2019-05-31 22:54:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void VoxelSurface::_bind_methods() {
|
2019-06-01 00:11:59 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_id"), &VoxelSurface::get_id);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_id", "value"), &VoxelSurface::set_id);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
|
2019-05-31 22:54:31 +02:00
|
|
|
|
2019-08-11 15:29:32 +02:00
|
|
|
//create an array
|
|
|
|
ClassDB::bind_method(D_METHOD("get_atlas_x"), &VoxelSurface::get_atlas_x);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_atlas_x", "value"), &VoxelSurface::set_atlas_x);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "atlas_x"), "set_atlas_x", "get_atlas_x");
|
2019-05-31 22:54:31 +02:00
|
|
|
|
2019-08-11 15:29:32 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_atlas_y"), &VoxelSurface::get_atlas_y);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_atlas_y", "value"), &VoxelSurface::set_atlas_y);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "atlas_y"), "set_atlas_y", "get_atlas_y");
|
2019-05-31 22:54:31 +02:00
|
|
|
|
2019-08-11 15:29:32 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("set_transparent", "transparent"), &VoxelSurface::set_transparent, DEFVAL(false));
|
2019-06-01 00:11:59 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("is_transparent"), &VoxelSurface::is_transparent);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transparent"), "set_transparent", "is_transparent");
|
2019-05-31 22:54:31 +02:00
|
|
|
|
2019-06-01 00:11:59 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("set_voxel_name", "name"), &VoxelSurface::set_voxel_name);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_voxel_name"), &VoxelSurface::get_voxel_name);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "voxel_name"), "set_name", "get_name");
|
2019-06-09 20:59:54 +02:00
|
|
|
|
|
|
|
BIND_ENUM_CONSTANT(VOXEL_SIDE_TOP);
|
|
|
|
BIND_ENUM_CONSTANT(VOXEL_SIDE_BOTTOM);
|
|
|
|
BIND_ENUM_CONSTANT(VOXEL_SIDE_LEFT);
|
|
|
|
BIND_ENUM_CONSTANT(VOXEL_SIDE_FRONT);
|
|
|
|
BIND_ENUM_CONSTANT(VOXEL_SIDE_RIGHT);
|
|
|
|
BIND_ENUM_CONSTANT(VOXEL_SIDE_BACK);
|
|
|
|
BIND_ENUM_CONSTANT(VOXEL_SIDES_COUNT);
|
2019-05-31 22:54:31 +02:00
|
|
|
}
|