#include <scene/main/node.h>
#include <scene/resources/packed_scene.h>
class Spawner: public Object {
	GDCLASS(Spawner, Object);
protected:
	Vector3 last_org;
	bool force_update;
	HashMap<String, Ref<PackedScene> > scenes;
	struct spawn_object {
		Transform xform;
		bool active;
		bool pooled;
		int instance;
	};
	HashMap<String, PoolVector<struct spawn_object> > positions;
	Mutex lock;
	static void _bind_methods();
public:
	void add_scene(const StringName &name, Ref<PackedScene> scene);
	void remove_scene(const StringName &name);
	void place_scene(const StringName &name, const Transform &place);
	void place_scene_relative(const StringName &name, Node *parent, const Transform &place);
	void update_view(Node *node, float distance);
	static void create_singleton();
	static void destroy_singleton();
	static Spawner *get_singleton();
};

