voxelman/world/voxel_chunk_prop_data.cpp

152 lines
5.2 KiB
C++
Raw Normal View History

#include "voxel_chunk_prop_data.h"
int VoxelChunkPropData::get_x() {
return _x;
}
void VoxelChunkPropData::set_x(int value) {
_x = value;
}
int VoxelChunkPropData::get_y() {
return _y;
}
void VoxelChunkPropData::set_y(int value) {
_y = value;
}
int VoxelChunkPropData::get_z() {
return _z;
}
void VoxelChunkPropData::set_z(int value) {
_z = value;
}
Vector3 VoxelChunkPropData::get_rotation() {
return _rotation;
}
void VoxelChunkPropData::set_rotation(Vector3 value) {
_rotation = value;
}
Vector3 VoxelChunkPropData::get_scale() {
return _scale;
}
void VoxelChunkPropData::set_scale(Vector3 value) {
_scale = value;
}
bool VoxelChunkPropData::get_snap_to_mesh() {
return _snap_to_mesh;
}
void VoxelChunkPropData::set_snap_to_mesh(bool value) {
_snap_to_mesh = value;
}
Vector3 VoxelChunkPropData::get_snap_axis() {
return _snap_axis;
}
void VoxelChunkPropData::set_snap_axis(Vector3 value) {
_snap_axis = value;
}
Ref<MeshDataResource> VoxelChunkPropData::get_mesh() const {
return _mesh;
}
void VoxelChunkPropData::set_mesh(const Ref<MeshDataResource> value) {
_mesh = value;
}
Ref<Texture> VoxelChunkPropData::get_mesh_texture() const {
return _texture;
}
void VoxelChunkPropData::set_mesh_texture(const Ref<Texture> value) {
_texture = value;
}
2019-11-07 21:32:31 +01:00
Ref<PropDataLight> VoxelChunkPropData::get_light() const {
return _light;
}
2019-11-07 21:32:31 +01:00
void VoxelChunkPropData::set_light(const Ref<PropDataLight> value) {
_light = value;
}
2019-11-07 21:32:31 +01:00
Ref<PropData> VoxelChunkPropData::get_prop() const {
return _prop;
}
2019-11-07 21:32:31 +01:00
void VoxelChunkPropData::set_prop(const Ref<PropData> value) {
_prop = value;
}
Ref<PackedScene> VoxelChunkPropData::get_scene() const {
return _scene;
}
void VoxelChunkPropData::set_scene(const Ref<PackedScene> value) {
_scene = value;
}
VoxelChunkPropData::VoxelChunkPropData() {
_x = 0;
_y = 0;
_z = 0;
_scale = Vector3(1, 1, 1);
_snap_to_mesh = false;
2019-11-06 13:44:22 +01:00
_snap_axis = Vector3(0, -1, 0);
}
VoxelChunkPropData::~VoxelChunkPropData() {
_mesh.unref();
_texture.unref();
_light.unref();
_prop.unref();
_scene.unref();
}
void VoxelChunkPropData::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_x"), &VoxelChunkPropData::get_x);
ClassDB::bind_method(D_METHOD("set_x", "value"), &VoxelChunkPropData::set_x);
ADD_PROPERTY(PropertyInfo(Variant::INT, "x"), "set_x", "get_x");
ClassDB::bind_method(D_METHOD("get_y"), &VoxelChunkPropData::get_y);
ClassDB::bind_method(D_METHOD("set_y", "value"), &VoxelChunkPropData::set_y);
ADD_PROPERTY(PropertyInfo(Variant::INT, "y"), "set_y", "get_y");
ClassDB::bind_method(D_METHOD("get_z"), &VoxelChunkPropData::get_z);
ClassDB::bind_method(D_METHOD("set_z", "value"), &VoxelChunkPropData::set_z);
ADD_PROPERTY(PropertyInfo(Variant::INT, "z"), "set_z", "get_z");
ClassDB::bind_method(D_METHOD("get_rotation"), &VoxelChunkPropData::get_rotation);
ClassDB::bind_method(D_METHOD("set_rotation", "value"), &VoxelChunkPropData::set_rotation);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "rotation"), "set_rotation", "get_rotation");
ClassDB::bind_method(D_METHOD("get_scale"), &VoxelChunkPropData::get_scale);
ClassDB::bind_method(D_METHOD("set_scale", "value"), &VoxelChunkPropData::set_scale);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "scale"), "set_scale", "get_scale");
ClassDB::bind_method(D_METHOD("get_snap_to_mesh"), &VoxelChunkPropData::get_snap_to_mesh);
ClassDB::bind_method(D_METHOD("set_snap_to_mesh", "value"), &VoxelChunkPropData::set_snap_to_mesh);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "snap_to_mesh"), "set_snap_to_mesh", "get_snap_to_mesh");
ClassDB::bind_method(D_METHOD("get_snap_axis"), &VoxelChunkPropData::get_snap_axis);
ClassDB::bind_method(D_METHOD("set_snap_axis", "value"), &VoxelChunkPropData::set_snap_axis);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap_axis"), "set_snap_axis", "get_snap_axis");
ClassDB::bind_method(D_METHOD("get_mesh"), &VoxelChunkPropData::get_mesh);
2019-10-16 00:50:30 +02:00
ClassDB::bind_method(D_METHOD("set_mesh", "value"), &VoxelChunkPropData::set_mesh);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "MeshDataResource"), "set_mesh", "get_mesh");
ClassDB::bind_method(D_METHOD("get_mesh_texture"), &VoxelChunkPropData::get_mesh_texture);
ClassDB::bind_method(D_METHOD("set_mesh_texture", "value"), &VoxelChunkPropData::set_mesh_texture);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_mesh_texture", "get_mesh_texture");
ClassDB::bind_method(D_METHOD("get_light"), &VoxelChunkPropData::get_light);
2019-10-16 00:50:30 +02:00
ClassDB::bind_method(D_METHOD("set_light", "value"), &VoxelChunkPropData::set_light);
2019-11-07 21:32:31 +01:00
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "light", PROPERTY_HINT_RESOURCE_TYPE, "PropDataLight"), "set_light", "get_light");
ClassDB::bind_method(D_METHOD("get_prop"), &VoxelChunkPropData::get_prop);
ClassDB::bind_method(D_METHOD("set_prop", "value"), &VoxelChunkPropData::set_prop);
2019-11-07 21:32:31 +01:00
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop", PROPERTY_HINT_RESOURCE_TYPE, "PropData"), "set_prop", "get_prop");
ClassDB::bind_method(D_METHOD("get_scene"), &VoxelChunkPropData::get_scene);
ClassDB::bind_method(D_METHOD("set_scene", "value"), &VoxelChunkPropData::set_scene);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "scene", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_scene", "get_scene");
}