mirror of
https://github.com/Relintai/voxelman.git
synced 2024-11-14 10:17:20 +01:00
Cleaned up VoxelSurface a bit.
This commit is contained in:
parent
b5bdecf95a
commit
7b99cff1dd
@ -1,100 +1,191 @@
|
|||||||
#include "voxel_surface.h"
|
#include "voxel_surface.h"
|
||||||
|
|
||||||
|
int VoxelSurface::get_id() const {
|
||||||
void VoxelSurface::set_transparent(bool t) {
|
return _id;
|
||||||
_is_transparent = t;
|
}
|
||||||
|
void VoxelSurface::set_id(int value) {
|
||||||
|
_id = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelSurface::set_library(Ref<VoxelmanLibrary> lib) {
|
Color VoxelSurface::get_voxel_color() const {
|
||||||
_library = (*lib);
|
return _voxel_color;
|
||||||
|
}
|
||||||
|
void VoxelSurface::set_voxel_color(Color value) {
|
||||||
|
_voxel_color = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<VoxelmanLibrary> VoxelSurface::get_library() {
|
int VoxelSurface::get_atlas_texture_id() const {
|
||||||
return Ref<VoxelmanLibrary>(_library);
|
return _atlas_texture_id;
|
||||||
|
}
|
||||||
|
void VoxelSurface::set_atlas_texture_id(int value) {
|
||||||
|
_atlas_texture_id = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VoxelSurface::has_face_color() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int VoxelSurface::get_mesh_id() const {
|
||||||
|
return _mesh_id;
|
||||||
|
}
|
||||||
|
void VoxelSurface::set_mesh_id(int value) {
|
||||||
|
_mesh_id = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3 VoxelSurface::get_mesh_offset() const {
|
||||||
|
return _mesh_offset;
|
||||||
|
}
|
||||||
|
void VoxelSurface::set_mesh_offset(Vector3 value) {
|
||||||
|
_mesh_offset = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
int VoxelSurface::get_prefab_id() const {
|
||||||
|
return _prefab_id;
|
||||||
|
}
|
||||||
|
void VoxelSurface::set_prefab_id(int value) {
|
||||||
|
_prefab_id = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3 VoxelSurface::get_prefab_offset() const {
|
||||||
|
return _prefab_offset;
|
||||||
|
}
|
||||||
|
void VoxelSurface::set_prefab_offset(Vector3 value) {
|
||||||
|
_prefab_offset = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3 VoxelSurface::get_prefab_rotation() const {
|
||||||
|
return _prefab_rotation;
|
||||||
|
}
|
||||||
|
void VoxelSurface::set_prefab_rotation(Vector3 value) {
|
||||||
|
_prefab_rotation = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VoxelSurface::get_light() const {
|
||||||
|
return _light;
|
||||||
|
}
|
||||||
|
void VoxelSurface::set_light(bool value) {
|
||||||
|
_light = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
float VoxelSurface::get_light_strength() const {
|
||||||
|
return _light_strength;
|
||||||
|
}
|
||||||
|
void VoxelSurface::set_light_strength(float value) {
|
||||||
|
_light_strength = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Color VoxelSurface::get_light_color() const {
|
||||||
|
return _light_color;
|
||||||
|
}
|
||||||
|
void VoxelSurface::set_light_color(Color value) {
|
||||||
|
_light_color = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3 VoxelSurface::get_light_offset() const {
|
||||||
|
return _light_offset;
|
||||||
|
}
|
||||||
|
void VoxelSurface::set_light_offset(Vector3 value) {
|
||||||
|
_light_offset = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
void VoxelSurface::set_voxel_name(String name) {
|
void VoxelSurface::set_voxel_name(String name) {
|
||||||
_name = name;
|
_name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ref<VoxelmanLibrary> VoxelSurface::get_library() const {
|
||||||
|
return Ref<VoxelmanLibrary>(_library);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VoxelSurface::set_library(Ref<VoxelmanLibrary> library) {
|
||||||
|
_library = library;
|
||||||
}
|
}
|
||||||
|
|
||||||
VoxelSurface::VoxelSurface() {
|
VoxelSurface::VoxelSurface() {
|
||||||
_id = -1;
|
_id = -1;
|
||||||
_atlas_texture_id = 0;
|
_atlas_texture_id = 0;
|
||||||
_mesh_id = 0;
|
_mesh_id = 0;
|
||||||
_prefab_id = 0;
|
_prefab_id = 0;
|
||||||
_light = false;
|
_light = false;
|
||||||
_light_strength = 0;
|
_light_strength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VoxelSurface::VoxelSurface(int id) {
|
VoxelSurface::VoxelSurface(int id) {
|
||||||
_id = -1;
|
_id = id;
|
||||||
_atlas_texture_id = 0;
|
_atlas_texture_id = 0;
|
||||||
|
|
||||||
_mesh_id = 0;
|
_mesh_id = 0;
|
||||||
_prefab_id = 0;
|
_prefab_id = 0;
|
||||||
_light = false;
|
_light = false;
|
||||||
_light_strength = 0;
|
_light_strength = 0;
|
||||||
|
|
||||||
_id = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VoxelSurface::~VoxelSurface() {
|
VoxelSurface::~VoxelSurface() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelSurface::_bind_methods() {
|
void VoxelSurface::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("get_id"), &VoxelSurface::get_id);
|
ClassDB::bind_method(D_METHOD("get_id"), &VoxelSurface::get_id);
|
||||||
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_voxel_color"), &VoxelSurface::get_voxel_color);
|
ClassDB::bind_method(D_METHOD("get_voxel_color"), &VoxelSurface::get_voxel_color);
|
||||||
ClassDB::bind_method(D_METHOD("set_voxel_color", "value"), &VoxelSurface::set_voxel_color);
|
ClassDB::bind_method(D_METHOD("set_voxel_color", "value"), &VoxelSurface::set_voxel_color);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_voxel_color", "get_voxel_color");
|
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_voxel_color", "get_voxel_color");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_atlas_texture_id"), &VoxelSurface::get_atlas_texture_id);
|
ClassDB::bind_method(D_METHOD("get_atlas_texture_id"), &VoxelSurface::get_atlas_texture_id);
|
||||||
ClassDB::bind_method(D_METHOD("set_atlas_texture_id", "value"), &VoxelSurface::set_atlas_texture_id);
|
ClassDB::bind_method(D_METHOD("set_atlas_texture_id", "value"), &VoxelSurface::set_atlas_texture_id);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "atlas_texture_id"), "set_atlas_texture_id", "get_atlas_texture_id");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "atlas_texture_id"), "set_atlas_texture_id", "get_atlas_texture_id");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_mesh_id"), &VoxelSurface::get_mesh_id);
|
ClassDB::bind_method(D_METHOD("get_mesh_id"), &VoxelSurface::get_mesh_id);
|
||||||
ClassDB::bind_method(D_METHOD("set_mesh_id", "value"), &VoxelSurface::set_mesh_id);
|
ClassDB::bind_method(D_METHOD("set_mesh_id", "value"), &VoxelSurface::set_mesh_id);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "mesh_id"), "set_mesh_id", "get_mesh_id");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "mesh_id"), "set_mesh_id", "get_mesh_id");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_mesh_offset"), &VoxelSurface::get_mesh_offset);
|
ClassDB::bind_method(D_METHOD("get_mesh_offset"), &VoxelSurface::get_mesh_offset);
|
||||||
ClassDB::bind_method(D_METHOD("set_mesh_offset", "value"), &VoxelSurface::set_mesh_offset);
|
ClassDB::bind_method(D_METHOD("set_mesh_offset", "value"), &VoxelSurface::set_mesh_offset);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "mesh_offset"), "set_mesh_offset", "get_mesh_offset");
|
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "mesh_offset"), "set_mesh_offset", "get_mesh_offset");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_prefab_id"), &VoxelSurface::get_prefab_id);
|
ClassDB::bind_method(D_METHOD("get_prefab_id"), &VoxelSurface::get_prefab_id);
|
||||||
ClassDB::bind_method(D_METHOD("set_prefab_id", "value"), &VoxelSurface::set_prefab_id);
|
ClassDB::bind_method(D_METHOD("set_prefab_id", "value"), &VoxelSurface::set_prefab_id);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "prefab_id"), "set_prefab_id", "get_prefab_id");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "prefab_id"), "set_prefab_id", "get_prefab_id");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_prefab_offset"), &VoxelSurface::get_prefab_offset);
|
ClassDB::bind_method(D_METHOD("get_prefab_offset"), &VoxelSurface::get_prefab_offset);
|
||||||
ClassDB::bind_method(D_METHOD("set_prefab_offset", "value"), &VoxelSurface::set_prefab_offset);
|
ClassDB::bind_method(D_METHOD("set_prefab_offset", "value"), &VoxelSurface::set_prefab_offset);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "prefab_offset"), "set_prefab_offset", "get_prefab_offset");
|
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "prefab_offset"), "set_prefab_offset", "get_prefab_offset");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_prefab_rotation"), &VoxelSurface::get_prefab_rotation);
|
ClassDB::bind_method(D_METHOD("get_prefab_rotation"), &VoxelSurface::get_prefab_rotation);
|
||||||
ClassDB::bind_method(D_METHOD("set_prefab_rotation", "value"), &VoxelSurface::set_prefab_rotation);
|
ClassDB::bind_method(D_METHOD("set_prefab_rotation", "value"), &VoxelSurface::set_prefab_rotation);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "prefab_rotation"), "set_prefab_rotation", "get_prefab_rotation");
|
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "prefab_rotation"), "set_prefab_rotation", "get_prefab_rotation");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_light"), &VoxelSurface::get_light);
|
ClassDB::bind_method(D_METHOD("get_light"), &VoxelSurface::get_light);
|
||||||
ClassDB::bind_method(D_METHOD("set_light", "value"), &VoxelSurface::set_light);
|
ClassDB::bind_method(D_METHOD("set_light", "value"), &VoxelSurface::set_light);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "has_light"), "set_prefab_id", "get_light");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "has_light"), "set_prefab_id", "get_light");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_light_strength"), &VoxelSurface::get_light_strength);
|
ClassDB::bind_method(D_METHOD("get_light_strength"), &VoxelSurface::get_light_strength);
|
||||||
ClassDB::bind_method(D_METHOD("set_light_strength", "value"), &VoxelSurface::set_light_strength);
|
ClassDB::bind_method(D_METHOD("set_light_strength", "value"), &VoxelSurface::set_light_strength);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "light_strength"), "set_light_strength", "get_light_strength");
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "light_strength"), "set_light_strength", "get_light_strength");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_light_color"), &VoxelSurface::get_light_color);
|
ClassDB::bind_method(D_METHOD("get_light_color"), &VoxelSurface::get_light_color);
|
||||||
ClassDB::bind_method(D_METHOD("set_light_color", "value"), &VoxelSurface::set_light_color);
|
ClassDB::bind_method(D_METHOD("set_light_color", "value"), &VoxelSurface::set_light_color);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "light_color"), "set_light_color", "get_light_color");
|
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "light_color"), "set_light_color", "get_light_color");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_light_offset"), &VoxelSurface::get_light_offset);
|
ClassDB::bind_method(D_METHOD("get_light_offset"), &VoxelSurface::get_light_offset);
|
||||||
ClassDB::bind_method(D_METHOD("set_light_offset", "value"), &VoxelSurface::set_light_offset);
|
ClassDB::bind_method(D_METHOD("set_light_offset", "value"), &VoxelSurface::set_light_offset);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "light_offset"), "set_light_offset", "get_light_offset");
|
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "light_offset"), "set_light_offset", "get_light_offset");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_transparent", "transparent"), &VoxelSurface::set_transparent, DEFVAL(true));
|
ClassDB::bind_method(D_METHOD("set_transparent", "transparent"), &VoxelSurface::set_transparent, DEFVAL(true));
|
||||||
ClassDB::bind_method(D_METHOD("is_transparent"), &VoxelSurface::is_transparent);
|
ClassDB::bind_method(D_METHOD("is_transparent"), &VoxelSurface::is_transparent);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transparent"), "set_transparent", "is_transparent");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transparent"), "set_transparent", "is_transparent");
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_voxel_name", "name"), &VoxelSurface::set_voxel_name);
|
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);
|
ClassDB::bind_method(D_METHOD("get_voxel_name"), &VoxelSurface::get_voxel_name);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "voxel_name"), "set_name", "get_name");
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "voxel_name"), "set_name", "get_name");
|
||||||
}
|
}
|
||||||
|
@ -14,55 +14,53 @@ class VoxelSurface : public Resource {
|
|||||||
GDCLASS(VoxelSurface, Resource)
|
GDCLASS(VoxelSurface, Resource)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int get_id() { return _id; }
|
int get_id() const;
|
||||||
void set_id(int value) { _id = value; }
|
void set_id(int value);
|
||||||
|
|
||||||
Color get_voxel_color() { return _voxel_color; }
|
Color get_voxel_color() const;
|
||||||
void set_voxel_color(Color value) { _voxel_color = value; }
|
void set_voxel_color(Color value);
|
||||||
|
|
||||||
int get_atlas_texture_id() { return _atlas_texture_id; }
|
int get_atlas_texture_id() const;
|
||||||
void set_atlas_texture_id(int value) { _atlas_texture_id = value; }
|
void set_atlas_texture_id(int value);
|
||||||
|
|
||||||
bool has_face_color() {
|
bool has_face_color() const;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_mesh_id() { return _mesh_id; }
|
int get_mesh_id() const;
|
||||||
void set_mesh_id(int value) { _mesh_id = value; }
|
void set_mesh_id(int value);
|
||||||
|
|
||||||
Vector3 get_mesh_offset() { return _mesh_offset; }
|
Vector3 get_mesh_offset() const;
|
||||||
void set_mesh_offset(Vector3 value) { _mesh_offset = value; }
|
void set_mesh_offset(Vector3 value);
|
||||||
|
|
||||||
int get_prefab_id() { return _prefab_id; }
|
int get_prefab_id() const;
|
||||||
void set_prefab_id(int value) { _prefab_id = value; }
|
void set_prefab_id(int value);
|
||||||
|
|
||||||
Vector3 get_prefab_offset() { return _prefab_offset; }
|
Vector3 get_prefab_offset() const;
|
||||||
void set_prefab_offset(Vector3 value) { _prefab_offset = value; }
|
void set_prefab_offset(Vector3 value);
|
||||||
|
|
||||||
Vector3 get_prefab_rotation() { return _prefab_rotation; }
|
Vector3 get_prefab_rotation()const;
|
||||||
void set_prefab_rotation(Vector3 value) { _prefab_rotation = value; }
|
void set_prefab_rotation(Vector3 value);
|
||||||
|
|
||||||
bool get_light() { return _light; }
|
bool get_light() const;
|
||||||
void set_light(bool value) { _light = value; }
|
void set_light(bool value);
|
||||||
|
|
||||||
float get_light_strength() { return _light_strength; }
|
float get_light_strength() const;
|
||||||
void set_light_strength(float value) { _light_strength = value; }
|
void set_light_strength(float value);
|
||||||
|
|
||||||
Color get_light_color() { return _light_color; }
|
Color get_light_color() const;
|
||||||
void set_light_color(Color value) { _light_color = value; }
|
void set_light_color(Color value);
|
||||||
|
|
||||||
Vector3 get_light_offset() { return _light_offset; }
|
Vector3 get_light_offset() const;
|
||||||
void set_light_offset(Vector3 value) { _light_offset = value; }
|
void set_light_offset(Vector3 value);
|
||||||
|
|
||||||
void set_transparent(bool t = true);
|
|
||||||
bool is_transparent() const { return _is_transparent; }
|
|
||||||
|
|
||||||
|
bool is_transparent() const;
|
||||||
|
void set_transparent(bool transparent);
|
||||||
|
|
||||||
|
String get_voxel_name() const;
|
||||||
void set_voxel_name(String name);
|
void set_voxel_name(String name);
|
||||||
String get_voxel_name() const { return _name; }
|
|
||||||
|
Ref<VoxelmanLibrary> get_library() const;
|
||||||
void set_library(Ref<VoxelmanLibrary> lib);
|
void set_library(Ref<VoxelmanLibrary> library);
|
||||||
Ref<VoxelmanLibrary> get_library();
|
|
||||||
|
|
||||||
VoxelSurface();
|
VoxelSurface();
|
||||||
VoxelSurface(int id);
|
VoxelSurface(int id);
|
||||||
~VoxelSurface();
|
~VoxelSurface();
|
||||||
@ -71,7 +69,7 @@ protected:
|
|||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VoxelmanLibrary *_library;
|
Ref<VoxelmanLibrary> _library;
|
||||||
|
|
||||||
int _id;
|
int _id;
|
||||||
String _name;
|
String _name;
|
||||||
|
Loading…
Reference in New Issue
Block a user