SCE Fire

   Print  Previous  Next

Functions Provided By SCE Fire

The following table provides an overview of all functions the effect can use:

Function

Description

General

void SetBpm(int bpm)

Set the speed of the effect in BPM. Valid values range from 0 to 9999.

int GetBpm()

Returns the current effect speed in BPM.

void SetDirection(int direction)

Sets the direction of the fire. Valid values for direction are DIR_LEFT, DIR_RIGHT, DIR_UP, and DIR_DOWN.

int GetDirection()

Returns the current direction.

void SetHeight(int height)

Sets the height of the fire. Valid values are include 1 up to 32.

int GetHeight()

Returns the current height.

void SetMode(mode)

Sets the mode of the effect. Valid values for mode are described in the table below.

int GetMode()

Returns the currently selected mode. See table below for returned values.

Mode "Fire"

void SetColorMode(int mode)

Sets the color mode of the fire. Valid values for mode are described in the table below.

int GetColorMode()

Returns the current color mode. See table below for returned values.

Mode "Flames"

void SetFlameSize(int size)

Sets the size of the flames. Valid values for size range from 1 to 100.

int GetFlameSize()

Returns the size of the flames.

void SetIntensity(int intensity)

Sets the intensity of the flames. Valid values for intensity range from 1 to 100.

int GetIntensity()

Returns the currently used intensity for the flames.

void SetColor(int index, color c)

Sets the color at the specified index in the Color Ramp dialog. If index is out of range, nothing happens.

color GetColor(int index)

Returns the color with the specified index in the Color Ramp dialog. If the index is out of range, black is returned.

int GetColorCount()

Returns the number of colors used in the Color Ramp.

int SetColorPosition(int index, float position)

Sets the color of the given index to a new position and returns the new index. Valid values for position range from 0.01 to 0.99. The first and last color are not allowed to be moved!

float GetColorPosition(int index)

Returns the position of a color at the specified index.

void SetColorFade(int index, int mode)

Disables or enables color fade for the color at the specified index position by either using 0 or 1 for mode.

int GetColorFade(int index)

Returns if color fade is set for the color at the specified index.

void FadeAllColors()

Enables color fade for all colors in the Color Ramp.

void FadeNoneColors()

Disables color fade for all colors in the Color Ramp.

void SetUniformDistances()

Sets uniform distances between each color in the Color Ramp.

void InvertColorPositions()

Inverts the positions of the colors in the Color Ramp.

void InvertColors()

Inverts every single color in the Color Ramp.

void AddColor(color c, float position, int fade)

Adds another color c to the Color Ramp at the specified position. Valid values for position range from 0.01 to 0.99. If the index is lower or equal to 0, the new color is added to the first position. If index is greater than the current number of colors, the new color is added at the end. Valid values for fade are 1 (On) or 0 (Off).

void RemoveColor(int index)

Removes the color at the specified index. If the given index is out of range, nothing happens.

 

This Effect uses the Color Ramp dialog. Learn more about Using Colors.

 

Deprecated Functions
Deprecated functions are outdated functions and should not be used anymore.

Function

Description

void SetSpeed(int speed)

Sets the speed of the effect in FPS. Valid values range from 0 to 166. Please note: This function is deprecated and may be removed in one of the next releases. Use SetBpm instead.

float GetSpeed()

Returns the current effect speed in FPS. Please note: This function is deprecated and may be removed in one of the next releases. Use GetBpm instead.

 

Color Modes

The SCE Fire effect supports different predefined color modes in the "Fire" mode. It is possible to set them within a macro using the SetColorMode function. Therefore the following values are defined and should be used as parameter:

Value

Description

COLOR_RG

Selects the red-green color mode.

COLOR_RB

Selects the red-blue color mode.

COLOR_GR

Selects the green-red color mode.

COLOR_GB

Selects the green-blue color mode.

COLOR_BR

Selects the blue-red color mode.

COLOR_BG

Selects the blue-green color mode.

 

Effect Modes

The SCE Fire effect supports two different modes:"Fire" and "Flames". It is possible to set them within a macro using the SetMode function. Therefore the following values are defined and should be used as parameter:

Value

Description

MODE_FIRE

Selects the fire mode.

MODE_Flames

Selects the flames mode.

 

Full Example

The following example combines functions of the fire effect with sound data analysis.

float new_width = 0.2;

float new_fact;

float old_fact;

int mh;

 

void InitEffect()

{

    SetBpm(400);

    SetDirection(DIR_UP);

    mh = GetMatrixHeight();

    SetColorMode(COLOR_RG);

}

 

void MatrixSizeChanged()

{

    InitEffect();

}

 

void PreRenderEffect()

{

    new_fact = ((float)(GetSoundLevel(0) + GetSoundLevel(1))) / 800.0 + 0.4;

    new_fact = new_fact * new_width + old_fact * (1.0 - new_width);

    SetHeight((int)((float)mh * new_fact));

    old_fact = new_fact;

}

 

Explanation:

The source code sets the height of the fire depending on the sound level. Furthermore, it stores the current matrix height in a global variable and therefore uses MatrixSizeChanged in order to set the variable equal to the matrix size. Works best with a matrix size of 50 x 50 pixels.