home << prev next >> contents  

Assemblies

Assemblies can be created either by referencing an assembly file, or procedurally by an assembly callback.

    miAssembly *mi_api_assembly_begin(
        char            *name)     /* assembly name */
Begins the definition of an assembly with the given name. If the name parameter is zero, the assembly is not registered in the symbol tables, so it cannot be referenced by name. In this case the tag returned by mi_api_assembly_end must be used for referencing the assembly.
The returned  miAssembly pointer should be used to initialize the bounding box and motion bounding box of the assembly.
    miTag mi_api_assembly_end()
Completes the definition of the assembly, a database tag is returned, type is miSCENE_ASSEMBLY.

File Assemblies

    miBoolean mi_api_assembly_filename(
        char            *filename)     /* filename of assembly */
Defines a file assembly. The given file contains the subscene and is loaded on demand.

Procedural Assembly

    typedef miTag (*miApi_assembly_callback)(const miState * state, void * args);
    typedef miBoolean (*miApi_assembly_exit_callback(const miState * state, void * args);

    miBoolean mi_api_assembly_callback(
        miApi_assembly_callback      cb,    /* assembly creation callback */
        miApi_assembly_exit_callback ecb,   /* optional exit callback */
        void                         *args) /* arguments for both callbacks */
Defines a procedural assembly. The given creation callback is executed on demand. The args parameter is passed to the callbacks when executed.

The exit callback argument is optional, null pointer can be passed. It is called when the assembly is deleted from the database and could be used for cleanup of the arguments passed with args.

The state passed has to the callbacks has the following fields initialized:

Both and exit callbacks are executed on the master host.

Parser functions

    miBoolean mi_api_assembly_root(
        char            *root_name)     /* root group name */
Defines the root group name of a file assembly. This function must be called when the file assembly is being loaded, usually inside a parser.
The name must refer to an existing instgroup in the assembly file.
    miTag mi_api_get_assembly_root()
Returns root group of the last defined file assembly. The tag is of type miSCENE_GROUP.

The Examples sections contains source code for a geometry shader creating assemblies.



home << prev next >> contents  


Copyright © 1986-2007 by mental images GmbH