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-05-31 22:54:31 +02:00
|
|
|
#include "voxelman_library.h"
|
|
|
|
|
2019-11-10 13:42:59 +01:00
|
|
|
Ref<Material> VoxelmanLibrary::get_material() const {
|
|
|
|
return _material;
|
|
|
|
}
|
|
|
|
void VoxelmanLibrary::set_material(Ref<Material> mat) {
|
|
|
|
_material = mat;
|
2019-05-31 22:54:31 +02:00
|
|
|
}
|
|
|
|
|
2019-11-10 13:42:59 +01:00
|
|
|
Ref<Material> VoxelmanLibrary::get_prop_material() const {
|
|
|
|
return _prop_material;
|
|
|
|
}
|
|
|
|
void VoxelmanLibrary::set_prop_material(Ref<Material> mat) {
|
|
|
|
_prop_material = mat;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<Material> VoxelmanLibrary::get_liquid_material() const {
|
|
|
|
return _liquid_material;
|
|
|
|
}
|
|
|
|
void VoxelmanLibrary::set_liquid_material(Ref<Material> mat) {
|
|
|
|
_liquid_material = mat;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<Material> VoxelmanLibrary::get_clutter_material() const {
|
|
|
|
return _clutter_material;
|
|
|
|
}
|
|
|
|
void VoxelmanLibrary::set_clutter_material(Ref<Material> mat) {
|
|
|
|
_clutter_material = mat;
|
2019-05-31 22:54:31 +02:00
|
|
|
}
|
|
|
|
|
2019-11-09 23:39:19 +01:00
|
|
|
//Surfaces
|
2019-05-31 22:54:31 +02:00
|
|
|
Ref<VoxelSurface> VoxelmanLibrary::get_voxel_surface(int index) const {
|
2019-11-09 17:26:16 +01:00
|
|
|
return Ref<VoxelSurface>();
|
2019-05-31 22:54:31 +02:00
|
|
|
}
|
2019-11-10 22:18:31 +01:00
|
|
|
void VoxelmanLibrary::add_voxel_surface(Ref<VoxelSurface> value) {
|
|
|
|
}
|
2019-05-31 22:54:31 +02:00
|
|
|
void VoxelmanLibrary::set_voxel_surface(int index, Ref<VoxelSurface> value) {
|
|
|
|
}
|
2019-11-09 17:26:16 +01:00
|
|
|
void VoxelmanLibrary::remove_surface(int index) {
|
2019-05-31 22:54:31 +02:00
|
|
|
}
|
2019-11-09 17:26:16 +01:00
|
|
|
int VoxelmanLibrary::get_num_surfaces() {
|
|
|
|
return 0;
|
2019-05-31 22:54:31 +02:00
|
|
|
}
|
2019-11-09 23:39:19 +01:00
|
|
|
void VoxelmanLibrary::clear_surfaces() {
|
|
|
|
}
|
2019-05-31 22:54:31 +02:00
|
|
|
|
2019-11-09 23:39:19 +01:00
|
|
|
//Liquids
|
|
|
|
Ref<VoxelSurface> VoxelmanLibrary::get_liquid_voxel_surface(int index) const {
|
|
|
|
return Ref<VoxelSurface>();
|
|
|
|
}
|
2019-11-10 22:18:31 +01:00
|
|
|
void VoxelmanLibrary::add_liquid_voxel_surface(Ref<VoxelSurface> value) {
|
|
|
|
}
|
2019-11-09 23:39:19 +01:00
|
|
|
void VoxelmanLibrary::set_liquid_voxel_surface(int index, Ref<VoxelSurface> value) {
|
|
|
|
}
|
|
|
|
void VoxelmanLibrary::remove_liquid_surface(int index) {
|
|
|
|
}
|
|
|
|
int VoxelmanLibrary::get_liquid_num_surfaces() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
void VoxelmanLibrary::clear_liquid_surfaces() {
|
|
|
|
}
|
2019-05-31 22:54:31 +02:00
|
|
|
|
2019-11-09 23:39:19 +01:00
|
|
|
//Rects
|
|
|
|
void VoxelmanLibrary::refresh_rects() {
|
2019-05-31 22:54:31 +02:00
|
|
|
}
|
|
|
|
|
2019-11-25 12:03:45 +01:00
|
|
|
void VoxelmanLibrary::setup_material_albedo(int material_index, Ref<Texture> texture) {
|
|
|
|
if (has_method("_setup_material_albedo"))
|
|
|
|
call("_setup_material_albedo", material_index, texture);
|
|
|
|
}
|
|
|
|
|
2019-11-10 13:42:59 +01:00
|
|
|
VoxelmanLibrary::VoxelmanLibrary() {
|
|
|
|
}
|
|
|
|
|
|
|
|
VoxelmanLibrary::~VoxelmanLibrary() {
|
|
|
|
_material.unref();
|
|
|
|
_prop_material.unref();
|
|
|
|
_liquid_material.unref();
|
|
|
|
_clutter_material.unref();
|
|
|
|
}
|
|
|
|
|
2019-05-31 22:54:31 +02:00
|
|
|
void VoxelmanLibrary::_bind_methods() {
|
2019-11-25 12:03:45 +01:00
|
|
|
BIND_VMETHOD(MethodInfo("_setup_material_albedo", PropertyInfo(Variant::INT, "material_index"), PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture")));
|
|
|
|
|
2019-05-31 22:54:31 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_material"), &VoxelmanLibrary::get_material);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_material", "value"), &VoxelmanLibrary::set_material);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_material", "get_material");
|
|
|
|
|
2019-07-18 18:56:42 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_prop_material"), &VoxelmanLibrary::get_prop_material);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_prop_material", "value"), &VoxelmanLibrary::set_prop_material);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop_material", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_prop_material", "get_prop_material");
|
|
|
|
|
2019-11-10 13:42:59 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("get_liquid_material"), &VoxelmanLibrary::get_liquid_material);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_liquid_material", "value"), &VoxelmanLibrary::set_liquid_material);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "liquid_material", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_liquid_material", "get_liquid_material");
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_clutter_material"), &VoxelmanLibrary::get_clutter_material);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_clutter_material", "value"), &VoxelmanLibrary::set_clutter_material);
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "clutter_material", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_clutter_material", "get_clutter_material");
|
|
|
|
|
2019-05-31 22:54:31 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_voxel_surface", "index"), &VoxelmanLibrary::get_voxel_surface);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_voxel_surface", "index", "surface"), &VoxelmanLibrary::set_voxel_surface);
|
2019-11-09 17:26:16 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("remove_surface", "index"), &VoxelmanLibrary::remove_surface);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_num_surfaces"), &VoxelmanLibrary::get_num_surfaces);
|
2019-11-09 23:39:19 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("clear_surfaces"), &VoxelmanLibrary::clear_surfaces);
|
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_liquid_voxel_surface", "index"), &VoxelmanLibrary::get_liquid_voxel_surface);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_liquid_voxel_surface", "index", "surface"), &VoxelmanLibrary::set_liquid_voxel_surface);
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_liquid_surface", "index"), &VoxelmanLibrary::remove_liquid_surface);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_liquid_num_surfaces"), &VoxelmanLibrary::get_liquid_num_surfaces);
|
|
|
|
ClassDB::bind_method(D_METHOD("clear_liquid_surfaces"), &VoxelmanLibrary::clear_liquid_surfaces);
|
2019-05-31 22:54:31 +02:00
|
|
|
|
2019-11-09 17:26:16 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("refresh_rects"), &VoxelmanLibrary::refresh_rects);
|
2019-11-25 12:03:45 +01:00
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("setup_material_albedo", "material_index", "texture"), &VoxelmanLibrary::setup_material_albedo);
|
|
|
|
|
|
|
|
BIND_CONSTANT(MATERIAL_INDEX_VOXELS);
|
|
|
|
BIND_CONSTANT(MATERIAL_INDEX_PROP);
|
|
|
|
BIND_CONSTANT(MATERIAL_INDEX_LIQUID);
|
|
|
|
BIND_CONSTANT(MATERIAL_INDEX_CLUTTER);
|
2019-05-31 22:54:31 +02:00
|
|
|
}
|