.. _IofxExample:

============
IOFx Example
============

Introduction
------------
The parameters of an IOFx asset control the type of the asset and select which modifiers are to be used to 
change how the objects are spawned and behave after they are spawned.  

To output 2D sprites, set the spriteMaterialName.

::

    spriteMaterialName = SampleRenderer/1/materials/particle_dust.xml

If instead of sprites instanced 3D meshes are to be used the following parameters are set  One 
or more render mesh assets may be specified.  For each mesh you add, you can specify a weight.  The 
relative weights of all added meshes determines the percentage of objects that will be rendered using
each mesh.

::

    addRenderMeshAssetName = RenderMeshAssetName
    setRenderMeshRelativeWeight = 1
    addRenderMeshAssetName = Skull/Skull01
    setRenderMeshRelativeWeight = 1

The next step is to decide which modifiers should be applied.  There are two types of modifiers, spawn modifiers
and continuous modifiers.  Spawn modifiers change the behavior of how the objects are spawned while the continuous
modifiers alter the objects after they have been spawned.

| Examples\:
| SpawnModifier <ModifierName> <Modifier Parameters>
|
|     ContinuousModifier <ModifierName> <Modifier Parameters>
|     ModifierName and Modifier Parameters will be explained below. Please note that unless otherwise
|     indicated, all parameters for a given ModifierName are required. Please also note that all
|     modifiers for a particular stage will be processed in order specified.
|     Common parameters
|     Certain parameters are common to multiple types, and are described here\:
|     <colorChannel> should be one of the following\:
|         0 : Red
|         1 : Green
|         2 : Blue
|         3 : Alpha

| <function> describes a mathematical function g=f(x). More specifically,
| our function consists of a list of points sorted in f, and the return value g that
| should be returned for that point. We first must know how many pairs to expect.
| ex: 3 0 0 0.5 0.75 1 1
| would describe a curve of 3 points: (0, 0), (0.5, 0.75), (1, 1)
| NOTE: At least 2 points are required for a function to be valid.
| <axis> describes which axis a modifier applies to, and maps as following\:

|    0 : X
|    1 : Y
|    2 : Z

| Rotation <rollType>
|     <rollType> is one of the following\:
|     0 : MPR_Spherical
|     1 : MPR_Cubic
|     2 : MPR_FlatX
|     3 : MPR_FlatY
|     4 : MPR_FlatZ
|     5 : MPR_LongX
|     6 : MPR_LongY
|     7 : MPR_LongZ
|     8 : Sprite

::

    ContinuousModifier Rotation 1 5 15

| SimpleScale <xScale> <yScale> <zScale>
|     Applies a simple scale factor to all particles

::

    SpawnModifier SimpleScale 0.002 0.002 0.002

| RandomScale <scaleMin> <scaleMax>
|     Applies a random uniform in (scaleMin, scaleMax) to all three dimensions

| ColorVsLife <colorChannel> <function>
|     Modulates the colorChannel specified by the function, using lifeRemains as input.

| ColorVsDensity <colorChannel> <function>
|     Modulates the colorChannel specified by the function, using particle density as input.

| SubtextureVsLife <function>
|     Returns the functional transform, using lifeRemains as input. Note that it is up to
|     the application to interpret the meaning of the returned value

| OrientAlongVelocity <fowardX> <forwardY> <forwardZ>
|     Orients the specified forward velocity towards the velocity vector.

| ScaleAlongVelocity <scale>
|     Scales the particle in the one dimension that it is currently traveling.

| RandomSubtextureModifier <scaleMin> <scaleMax>
|     Passes a random uniform in (scaleMin, scaleMax) through the subtexture semantic.

| RandomRotation <rotMin> <rotMax>
|     Applies a random uniform rotation (in (rotMin, rotMax)) to a sprite, where 0 is up,
|     the values are in radians and increase clockwise.

| ScaleVsLife <axis> <function>
|     Applies the functional transform to the specified axis, using lifeRemains as input.

| ScaleVsDensity <axis> <function>
|     Applies the functional transform to the specified axis, using particle density as input.
