Table Of Contents

Previous topic

21.16. The Effect Object

Next topic

21.18. The Floor Object

This Page

21.17. The EffectManager Object

Provides management of the Effect objects used by the Scene objects.

This object keeps a map of requested Effects by name in order to avoid duplicates. It also provides support for a default Effect for those cases where the required one is missing by using the map() function.

Required scripts

The EffectManager object requires:

/*{{ javascript("jslib/effectmanager.js") }}*/

21.17.1. Registering an Effect

The renderers supply many default Effects for skinned and rigid geometry types. These can be extended by adding a new geometryType to an existing Effect or by registering a new Effect.

effect = Effect.create("mycustomeffect");
effectManager.add(effect);

effectTypeData = {  prepare : myPrepareFn,
                    shaderName : "shaders/myshader.cgfx",
                    techniqueName : "mycustomeffect",
                    update : myUpdateFn };

effect.add("rigid", effectTypeData);

21.17.2. Constructor

21.17.2.1. create

Summary

Syntax

var effectManager = EffectManager.create();

21.17.3. Method

21.17.3.1. add

Summary

Add an Effect to the EffectManager dictionary using the Effect.name.

Syntax

effectManager.add(effect);
effect
The the Effect to add.

21.17.3.2. remove

Summary

Deletes the Effect stored with the given name.

Syntax

effectManager.remove(name);
name
The name of the effect to remove.

21.17.3.3. get

Summary

Returns the Effect stored with the given name.

Syntax

var effect = effectManager.get(name);
name
The name of the effect to get.

Returns an Effect object. The “default” effect if the required one is missing.

21.17.3.4. map

Summary

Alias one Effect to another name.

During construction the renderers use the map() to set a “default” effect to “blinn”. This can be overridden at a later stage using effectManager.map(“default”, yourEffectName).

Syntax

effectManager.map(alias, name);
name
The name to be mapped.
alias
The new alias for name.

21.17.4. Properties

21.17.4.1. version

Summary

The version number of the EffectManager implementation.

Syntax

var versionNumber = effectManager.version;