[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 4.9.13 Sprite3D Mesh Object

Written by Jorrit Tyberghein, jorrit.tyberghein@gmail.com.

A 3D Sprite is a complex set of 3D triangles that supports animation through frames.

#### Basic Structure

The following SCF class names are used (for `csLoadPlugin`):

- Type plugin: ``crystalspace.mesh.object.sprite.3d'`
- Loader plugin: ``crystalspace.mesh.loader.sprite.3d'`
- Factory loader plugin: ``crystalspace.mesh.loader.factory.sprite.3d'`

Objects in this plugin implement the following SCF interfaces (get with `scfQueryInterface`):

- MeshObject
  - Implements ``iMeshObject'`
  - Implements ``iSprite3DState'`
- MeshObjectFactory
  - Implements ``iMeshObjectFactory'`
  - Implements ``iSprite3DFactoryState'`
- MeshObjectType
  - Implements ``iMeshObjectType'`
  - Implements ``iConfig'`

#### Factory State Interface

Use the ``iSprite3DFactoryState'` SCF interface to access settings for a 3D sprite factory. The definition of this interface can be found in ``CS/include/imesh/sprite3d.h'` and that is also the include file you need to include in your applications to use this plugin. Using this interface you can access the material, triangles, vertices, texture coordinates, normals, frames, actions, and various other configuration parameters for a 3D sprite factory.

For frame based animation you need to access the ``iSpriteFrame'` and ``iSpriteAction'` interfaces (defined in ``CS/include/imesh/sprite3d.h'`).

#### Factory Loader

`<material>materialname</material>`

  Material to use for the sprite.

`<frame name="framename"><v x="" y="" z="" u="" v="" /> ...`

  Define one frame. A frame is a list of vertices which are specified using the ``v'` tag. Every vertex has a 3D position in object space and (u,v) coordinates in the given texture (from 0 to 1). Note that every frame needs to have the same number of vertices.

`<action name="actionname"><f name="framename"><delay>`

  Define one action. An action is a list of frames. Every frame is annotated with the ``f'` tag which contains the name of the frame to use and a delay.

`<t v1="" v2="" v3="" />`

  Define one triangle. The three parameters are the indices for the three triangle vertices.

`<smooth>base/frame</smooth>`

  Defines how to apply normal smoothing on the sprite.

`<tween>yes/no</tween>`

  Set to yes if you want to enable frame tweening. Default is false.

#### Object State Interface

``iSprite3DState'` is the SCF interface that you can use to set/get settings for a 3D Sprite object. The definition of this interface can be found in ``CS/include/imesh/sprite3d.h'` and that's also the include file you need to include in your applications to use this plugin. Using this interface you can access the material, blending mode (mixmode), current frame and action, and various other configuration parameters for an 3D sprite object.

#### Object Loader

`<factory>factoryname</factory>`

  Name of the factory to use for creation of this instance.

`<mixmode><mode \></mixmode>`

  Blending mode, one of ``add'`, ``alpha'`, ``copy'`, ``keycolor'`, ``multiply2'`, ``multiply'`, or ``transparent'`.

`<material>materialname</material>`

  Material to use for the sprite.

`<tween>yes/no</tween>`

  Set to yes if you want to enable frame tweening. Default is false.

`<lighting>yes/no</lighting>`

  Set to yes if you want to enable lighting. Default is true.

`<basecolor red="" green="" blue="" />`

  Base color that will be added to all vertex colors. Default 0,0,0.

`<action name="actionname">`

  The default action to use for this sprite instance.

#### Configuration Parameters

The ``sprite3d'` plugin supports the following configuration parameters via the ``iConfig'` interface in the mesh object type plugin:

`sprlod`

  Set the sprite level-of-detail (LOD) level.

`sprlq`

  Set the sprite lighting quality.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ]

This document was generated using texi2html 1.76.