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") }}*/
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);
Summary
Add an Effect to the EffectManager dictionary using the Effect.name.
Syntax
effectManager.add(effect);
Summary
Deletes the Effect stored with the given name.
Syntax
effectManager.remove(name);
Summary
Returns the Effect stored with the given name.
Syntax
var effect = effectManager.get(name);
Returns an Effect object. The “default” effect if the required one is missing.
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);