plugins 3 LIBG3D Library plugins G3DPlugin interface Synopsis #include <g3d/plugins.h> enum G3DPluginType; gpointer (*G3DPluginInitFunc) (G3DContext *context); void (*G3DPluginCleanupFunc) (gpointer user_data); gboolean (*G3DPluginLoadModelFunc) (G3DContext *context, const gchar *filename, G3DModel *model, gpointer user_data); gboolean (*G3DPluginLoadModelFromStreamFunc) (G3DContext *context, G3DStream *stream, G3DModel *model, gpointer user_data); gboolean (*G3DPluginLoadImageFunc) (G3DContext *context, const gchar *filename, G3DImage *image, gpointer user_data); gboolean (*G3DPluginLoadImageStreamFunc) (G3DContext *context, G3DStream *stream, G3DImage *image, gpointer user_data); gchar* (*G3DPluginGetDescFunc) (G3DContext *context); gchar** (*G3DPluginGetExtFunc) (G3DContext *context); G3DPlugin; gboolean g3d_plugins_init (G3DContext *context); void g3d_plugins_cleanup (G3DContext *context); gboolean g3d_plugins_load_model (G3DContext *context, const gchar *filename, G3DModel *model); gboolean g3d_plugins_load_model_from_stream (G3DContext *context, G3DStream *stream, G3DModel *model); gboolean g3d_plugins_load_image (G3DContext *context, const gchar *filename, G3DImage *image); gboolean g3d_plugins_load_image_from_stream (G3DContext *context, G3DStream *stream, G3DImage *image); gchar** g3d_plugins_get_image_extensions (G3DContext *context); Description Direct interaction with the plugin system is normally not needed when using libg3d. It may be required when writing a plugin which should load a G3DImage or a G3DModel with another plugin. Details enum G3DPluginType G3DPluginTypetypedef enum { G3D_PLUGIN_UNKNOWN = 0x00, G3D_PLUGIN_IMPORT, G3D_PLUGIN_IMAGE } G3DPluginType; Type of plugin. G3D_PLUGIN_UNKNOWN unknown plugin type G3D_PLUGIN_IMPORT model import plugin G3D_PLUGIN_IMAGE image loading plugin G3DPluginInitFunc () G3DPluginInitFuncgpointer (*G3DPluginInitFunc) (G3DContext *context); Prototype for plugin_init(). context : the context Returns : opaque plugin data. G3DPluginCleanupFunc () G3DPluginCleanupFuncvoid (*G3DPluginCleanupFunc) (gpointer user_data); Prototype for plugin_cleanup(). user_data : opaque plugin data G3DPluginLoadModelFunc () G3DPluginLoadModelFuncgboolean (*G3DPluginLoadModelFunc) (G3DContext *context, const gchar *filename, G3DModel *model, gpointer user_data); Prototype for plugin_load_model(). context : the context filename : file name of model model : the model structure to fill user_data : opaque plugin data Returns : TRUE on success, FALSE else. G3DPluginLoadModelFromStreamFunc () G3DPluginLoadModelFromStreamFuncgboolean (*G3DPluginLoadModelFromStreamFunc) (G3DContext *context, G3DStream *stream, G3DModel *model, gpointer user_data); Prototype for plugin_load_model_from_stream(). context : the context stream : the stream to load from model : the model structure to fill user_data : opaque plugin data Returns : TRUE on success, FALSE else. G3DPluginLoadImageFunc () G3DPluginLoadImageFuncgboolean (*G3DPluginLoadImageFunc) (G3DContext *context, const gchar *filename, G3DImage *image, gpointer user_data); Prototype for plugin_load_image(). context : the context filename : file name of image image : image structure to fill user_data : opaque plugin data Returns : TRUE on success, FALSE else. G3DPluginLoadImageStreamFunc () G3DPluginLoadImageStreamFuncgboolean (*G3DPluginLoadImageStreamFunc) (G3DContext *context, G3DStream *stream, G3DImage *image, gpointer user_data); Prototype for plugin_load_image_from_stream(). context : the context stream : the stream to load from image : image structure to fill user_data : opaque plugin data Returns : TRUE on success, FALSE else. G3DPluginGetDescFunc () G3DPluginGetDescFuncgchar* (*G3DPluginGetDescFunc) (G3DContext *context); Prototype for plugin_description(). context : the context Returns : a newly-allocated string containing the description of the plugin. G3DPluginGetExtFunc () G3DPluginGetExtFuncgchar** (*G3DPluginGetExtFunc) (G3DContext *context); Prototype for plugin_extensions(). context : the context Returns : NULL-terminated list of file extensions supported by this plugin. Free with g_strfreev(). G3DPlugin G3DPlugintypedef struct { } G3DPlugin; A libg3d plugin. g3d_plugins_init () g3d_plugins_initgboolean g3d_plugins_init (G3DContext *context); Initializes the plugin system. This is implicitly done when using g3d_context_new(). context : a valid G3DContext Returns : TRUE on success, FALSE else. g3d_plugins_cleanup () g3d_plugins_cleanupvoid g3d_plugins_cleanup (G3DContext *context); Clean up the plugin system. Usually done by g3d_context_free(). context : a valid context g3d_plugins_load_model () g3d_plugins_load_modelgboolean g3d_plugins_load_model (G3DContext *context, const gchar *filename, G3DModel *model); Try to load a model from file using import plugins. context : a valid context filename : file name of model to load model : model structure to fill Returns : TRUE on success, FALSE else. g3d_plugins_load_model_from_stream () g3d_plugins_load_model_from_streamgboolean g3d_plugins_load_model_from_stream (G3DContext *context, G3DStream *stream, G3DModel *model); Try to load a model from stream using import plugins. context : a valid context stream : stream to load model from model : model structure to fill Returns : TRUE on success, FALSE else. g3d_plugins_load_image () g3d_plugins_load_imagegboolean g3d_plugins_load_image (G3DContext *context, const gchar *filename, G3DImage *image); Try to load an image from file using import plugins. context : a valid context filename : file name of image to load image : image structure to fill Returns : TRUE on success, FALSE else. g3d_plugins_load_image_from_stream () g3d_plugins_load_image_from_streamgboolean g3d_plugins_load_image_from_stream (G3DContext *context, G3DStream *stream, G3DImage *image); Try to load an image from stream using import plugins. context : a valid context stream : stream to load image from image : image structure to fill Returns : TRUE on success, FALSE else. g3d_plugins_get_image_extensions () g3d_plugins_get_image_extensionsgchar** g3d_plugins_get_image_extensions (G3DContext *context); Get the supported image type extensions. context : a valid context Returns : NULL-terminated list of image file extensions supported by this plugin. Free with g_strfreev(). See Also G3DPlugin