Files
academy2/modules/world/mesher/mesher.h
2021-07-31 03:37:28 +03:00

55 lines
1.5 KiB
C++

#include <modules/voxel/meshers/transvoxel/voxel_mesher_transvoxel.h>
#include <editor/editor_plugin.h>
#include <scene/resources/packed_scene.h>
class CompoundTransvoxel: public VoxelMesherTransvoxel
{
GDCLASS(CompoundTransvoxel, VoxelMesherTransvoxel)
friend class CompoundTransvoxelInspector;
protected:
struct place_item {
Ref<PackedScene> scene;
String scene_path;
bool full_instance;
bool use_collision;
int priority;
};
List<struct place_item> items;
public:
CompoundTransvoxel();
~CompoundTransvoxel();
void build(VoxelMesher::Output &output, const VoxelMesher::Input &input) override;
Ref<Resource> duplicate(bool p_subresources = false) const override;
int get_used_channels_mask() const override;
protected:
static void _bind_methods();
};
class CompoundTransvoxelInspector: public EditorInspectorPlugin {
GDCLASS(CompoundTransvoxelInspector, EditorInspectorPlugin)
public:
virtual bool can_handle(Object *p_object);
CompoundTransvoxelInspector();
private:
EditorFileDialog *fd;
protected:
void open_scene(Object *button);
void scenes_selected(const PoolVector<String> &p_paths);
void parse_begin(Object *p_object);
static void _bind_methods();
};
class CompoundTransvoxelEditorPlugin : public EditorPlugin {
GDCLASS(CompoundTransvoxelEditorPlugin, EditorPlugin)
public:
virtual String get_name() const { return "CompoundTransvoxel"; }
CompoundTransvoxelEditorPlugin(EditorNode *p_node)
{
Ref<CompoundTransvoxelInspector> plugin;
plugin.instance();
add_inspector_plugin(plugin);
}
};