mirror of
https://github.com/Relintai/voxelman.git
synced 2024-11-22 10:57:30 +01:00
More work on clutter.
This commit is contained in:
parent
356621bf12
commit
f82076e9c2
@ -4,12 +4,12 @@ int GroundClutterFoliage::get_texture_count() const {
|
||||
return _textures.size();
|
||||
}
|
||||
Ref<Texture> GroundClutterFoliage::get_texture(const int index) {
|
||||
ERR_FAIL_COND_V(index, _textures.size(), Ref<Texture>());
|
||||
ERR_FAIL_INDEX_V(index, _textures.size(), Ref<Texture>());
|
||||
|
||||
return _textures.get(index);
|
||||
}
|
||||
void GroundClutterFoliage::remove_texture(const int index) {
|
||||
ERR_FAIL_COND(index, _textures.size());
|
||||
ERR_FAIL_INDEX(index, _textures.size());
|
||||
|
||||
_textures.remove(index);
|
||||
}
|
||||
@ -25,8 +25,8 @@ GroundClutterFoliage::~GroundClutterFoliage() {
|
||||
}
|
||||
|
||||
void GroundClutterFoliage::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_texture_count"), &VoxelMesher::get_texture_count);
|
||||
ClassDB::bind_method(D_METHOD("get_texture", "index"), &VoxelMesher::get_texture);
|
||||
ClassDB::bind_method(D_METHOD("remove_texture", "index"), &VoxelMesher::remove_texture);
|
||||
ClassDB::bind_method(D_METHOD("add_texture", "texture"), &VoxelMesher::add_texture);
|
||||
ClassDB::bind_method(D_METHOD("get_texture_count"), &GroundClutterFoliage::get_texture_count);
|
||||
ClassDB::bind_method(D_METHOD("get_texture", "index"), &GroundClutterFoliage::get_texture);
|
||||
ClassDB::bind_method(D_METHOD("remove_texture", "index"), &GroundClutterFoliage::remove_texture);
|
||||
ClassDB::bind_method(D_METHOD("add_texture", "texture"), &GroundClutterFoliage::add_texture);
|
||||
}
|
||||
|
@ -21,6 +21,13 @@ void VoxelSurface::set_rect(const VoxelSurfaceSides side, const Rect2 rect) {
|
||||
_rects[side] = rect;
|
||||
}
|
||||
|
||||
Ref<GroundClutter> VoxelSurface::get_clutter() {
|
||||
return _clutter;
|
||||
}
|
||||
void VoxelSurface::set_clutter(Ref<GroundClutter> clutter) {
|
||||
_clutter = clutter;
|
||||
}
|
||||
|
||||
Ref<VoxelmanLibrary> VoxelSurface::get_library() const {
|
||||
return Ref<VoxelmanLibrary>(_library);
|
||||
}
|
||||
@ -66,6 +73,10 @@ void VoxelSurface::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("is_transparent"), &VoxelSurface::is_transparent);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transparent"), "set_transparent", "is_transparent");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_clutter", "transparent"), &VoxelSurface::get_clutter);
|
||||
ClassDB::bind_method(D_METHOD("set_clutter"), &VoxelSurface::set_clutter);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "clutter", PROPERTY_HINT_RESOURCE_TYPE, "GroundClutter"), "set_clutter", "get_clutter");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_rect", "side"), &VoxelSurface::get_rect);
|
||||
ClassDB::bind_method(D_METHOD("set_rect", "side", "rect"), &VoxelSurface::set_rect);
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "scene/resources/material.h"
|
||||
|
||||
#include "voxelman_library.h"
|
||||
#include "../clutter/ground_clutter.h"
|
||||
|
||||
class VoxelmanLibrary;
|
||||
|
||||
@ -51,6 +52,9 @@ public:
|
||||
Rect2 get_rect(const VoxelSurfaceSides side) const;
|
||||
void set_rect(const VoxelSurfaceSides side, const Rect2 rect);
|
||||
|
||||
Ref<GroundClutter> get_clutter();
|
||||
void set_clutter(Ref<GroundClutter> clutter);
|
||||
|
||||
Ref<VoxelmanLibrary> get_library() const;
|
||||
void set_library(Ref<VoxelmanLibrary> library);
|
||||
|
||||
@ -69,6 +73,7 @@ protected:
|
||||
int _id;
|
||||
bool _is_transparent;
|
||||
Rect2 _rects[VOXEL_SIDES_COUNT];
|
||||
Ref<GroundClutter> _clutter;
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(VoxelSurface::VoxelSurfaceSides);
|
||||
|
Loading…
Reference in New Issue
Block a user