## plugins

plugins — G3DPlugin interface

## Functions

gpointer | (*G3DPluginInitFunc) ()
void | (*G3DPluginCleanupFunc) ()
gboolean | (*G3DPluginLoadModelFunc) ()
gboolean | (*G3DPluginLoadModelFromStreamFunc) ()
gboolean | (*G3DPluginLoadImageFunc) ()
gboolean | (*G3DPluginLoadImageStreamFunc) ()
gchar * | (*G3DPluginGetDescFunc) ()
gchar ** | (*G3DPluginGetExtFunc) ()
gboolean | g3d_plugins_init ()
void | g3d_plugins_cleanup ()
gboolean | g3d_plugins_load_model ()
gboolean | g3d_plugins_load_model_from_stream ()
gboolean | g3d_plugins_load_image ()
gboolean | g3d_plugins_load_image_from_stream ()
gchar ** | g3d_plugins_get_image_extensions ()

## Types and Values

enum | G3DPluginType
| G3DPlugin

## Includes

    #include <g3d/plugins.h>

## 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.

## Functions

### G3DPluginInitFunc ()

    gpointer
    (*G3DPluginInitFunc) (G3DContext *context);

Prototype for `plugin_init()`.

#### Parameters

context | the context |

#### Returns

opaque plugin data.

### G3DPluginCleanupFunc ()

    void
    (*G3DPluginCleanupFunc) (gpointer user_data);

Prototype for `plugin_cleanup()`.

#### Parameters

user_data | opaque plugin data |

### G3DPluginLoadModelFunc ()

    gboolean
    (*G3DPluginLoadModelFunc) (G3DContext *context,
                               const gchar *filename,
                               G3DModel *model,
                               gpointer user_data);

Prototype for `plugin_load_model()`.

#### Parameters

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 ()

    gboolean
    (*G3DPluginLoadModelFromStreamFunc) (G3DContext *context,
                                         G3DStream *stream,
                                         G3DModel *model,
                                         gpointer user_data);

Prototype for `plugin_load_model_from_stream()`.

#### Parameters

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 ()

    gboolean
    (*G3DPluginLoadImageFunc) (G3DContext *context,
                               const gchar *filename,
                               G3DImage *image,
                               gpointer user_data);

Prototype for `plugin_load_image()`.

#### Parameters

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 ()

    gboolean
    (*G3DPluginLoadImageStreamFunc) (G3DContext *context,
                                     G3DStream *stream,
                                     G3DImage *image,
                                     gpointer user_data);

Prototype for `plugin_load_image_from_stream()`.

#### Parameters

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 ()

    gchar *
    (*G3DPluginGetDescFunc) (G3DContext *context);

Prototype for `plugin_description()`.

#### Parameters

context | the context |

#### Returns

a newly-allocated string containing the description of the plugin.

### G3DPluginGetExtFunc ()

    gchar **
    (*G3DPluginGetExtFunc) (G3DContext *context);

Prototype for `plugin_extensions()`.

#### Parameters

context | the context |

#### Returns

NULL-terminated list of file extensions supported by this plugin. Free with `g_strfreev()`.

### g3d_plugins_init ()

    gboolean
    g3d_plugins_init (G3DContext *context);

Initializes the plugin system. This is implicitly done when using `g3d_context_new()`.

#### Parameters

context | a valid G3DContext |

#### Returns

TRUE on success, FALSE else.

### g3d_plugins_cleanup ()

    void
    g3d_plugins_cleanup (G3DContext *context);

Clean up the plugin system. Usually done by `g3d_context_free()`.

#### Parameters

context | a valid context |

### g3d_plugins_load_model ()

    gboolean
    g3d_plugins_load_model (G3DContext *context,
                            const gchar *filename,
                            G3DModel *model);

Try to load a model from file using import plugins.

#### Parameters

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 ()

    gboolean
    g3d_plugins_load_model_from_stream (G3DContext *context,
                                        G3DStream *stream,
                                        G3DModel *model);

Try to load a model from stream using import plugins.

#### Parameters

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 ()

    gboolean
    g3d_plugins_load_image (G3DContext *context,
                            const gchar *filename,
                            G3DImage *image);

Try to load an image from file using import plugins.

#### Parameters

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 ()

    gboolean
    g3d_plugins_load_image_from_stream (G3DContext *context,
                                        G3DStream *stream,
                                        G3DImage *image);

Try to load an image from stream using import plugins.

#### Parameters

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 ()

    gchar **
    g3d_plugins_get_image_extensions (G3DContext *context);

Get the supported image type extensions.

#### Parameters

context | a valid context |

#### Returns

NULL-terminated list of image file extensions supported by this plugin. Free with `g_strfreev()`.

## Types and Values

### enum G3DPluginType

Type of plugin.

#### Members

G3D_PLUGIN_UNKNOWN | unknown plugin type |
G3D_PLUGIN_IMPORT | model import plugin |
G3D_PLUGIN_IMAGE | image loading plugin |

### G3DPlugin

    typedef struct {
    } G3DPlugin;

A libg3d plugin.

## See Also

G3DPlugin