5#include <Infinity/api.h>
6#include <Infinity/Plugin/API.h>
7#include <Infinity/Procedural/ProceduralComponent.hpp>
8#include <Infinity/Procedural/Registry.hpp>
9#include <Infinity/Util/unordered_dense.h>
74 ankerl::unordered_dense::map<Infinity::Procedural::ComponentID, std::pair<CreateComponentFunction*, DeleteComponentFunction*>>
registrants;
103 static_assert(std::is_base_of<Infinity::Procedural::ProceduralComponent, T>::value,
104 "Registered component type must inherit from Infinity::Procedural::ProceduralComponent");
106 registrants.emplace(
id, std::make_pair<CreateComponentFunction*, DeleteComponentFunction*>(
147#define INFINITY_PLUGIN(FactoryClass) \
149 std::unique_ptr<FactoryClass> g_factory; \
152 INFINITY_API_PLUGIN int plugin_get_api_version() { return INFINITY_PLUGIN_API_VERSION; } \
153 INFINITY_API_PLUGIN PluginHandle* plugin_create() { \
154 g_factory = std::make_unique<FactoryClass>(); \
155 g_factory->registerComponents(); \
156 return reinterpret_cast<PluginHandle*>(dynamic_cast<Infinity::Plugin::ComponentLibrary*>(g_factory.get())); \
158 INFINITY_API_PLUGIN void plugin_destroy(PluginHandle* handle) { \
Base class for plugin component libraries that provide custom ProceduralComponents.
Definition Plugin.hpp:31
virtual void registerComponents()=0
Register all components provided by this plugin.
void registerComponent(const std::string &group, const std::string &name)
Registers a component type with the specified group and name.
Definition Plugin.hpp:85
void registerComponent(const Infinity::Procedural::ComponentID &id)
Registers a component type with the specified ComponentID.
Definition Plugin.hpp:101
ankerl::unordered_dense::map< Infinity::Procedural::ComponentID, std::pair< CreateComponentFunction *, DeleteComponentFunction * > > registrants
Registry mapping ComponentIDs to their creation and deletion functions.
Definition Plugin.hpp:74
virtual ~ComponentLibrary()=default
Virtual destructor.
Description and configuration data for a ProceduralComponent instance.
Definition ProceduralComponentDescription.hpp:48
Base class for procedural generation components.
Definition ProceduralComponent.hpp:73
Unique identifier for a procedural component.
Definition ComponentID.hpp:35