Click or drag to resize
AB4D logo

EffectsManager Class

EffectsManager class help use the Effect classes. It provides loading, caching and reusing the effects and shaders. All access to effects and shaders is thread safe.
Inheritance Hierarchy
SystemObject
  Ab3d.DirectXDXResourceBase
    Ab3d.DirectXDisposableDXResource
      Ab3d.DirectXDXDeviceResource
        Ab3d.DirectXEffectsManager

Namespace: Ab3d.DirectX
Assembly: Ab3d.DXEngine (in Ab3d.DXEngine.dll) Version: 7.1.9105.2048 (1.0.0.0)
Syntax
C#
public class EffectsManager : DXDeviceResource

The EffectsManager type exposes the following members.

Constructors
 NameDescription
Public methodEffectsManager Constructor
Top
Properties
 NameDescription
Public propertyEffects Gets a readonly collection of all registered effects
Public propertyEffectsCount Gets a number of registered effects
Public propertyIsCustomStandardEffect Gets a Boolean that specifies if a custom standard effect was registered.
Top
Methods
 NameDescription
Public methodClearAllCachedShader Clears all cached shaders that were created by the GetXXXShader method. After this method is called, the shaders will be created again (useful when shader bytecode is changed). To remove only one shader from the cache, use the ClearShaderCache(String) method.
Public methodClearShaderCache Clears the cached shader that was created by the GetXXXShader method. After this method is called, the shader with shaderName will be created again when needed (useful when shader bytecode is changed). To clear all caches shaders, use the ClearAllCachedShader method.
Public methodGetEffect(String) Gets an effect by its name (using ordinal ignore case comparison). The effect must be registered before it can be get with GetEffect. If the effect is not found null is returned. To get StandardEffect (effect that can render all possible lights), use GetStandardEffect method. NOTE: User must call Dispose on the get effect (reference count is increased in GetEffect method).
Public methodGetEffectT(Boolean, Boolean) Gets an effect by its type T (by default the type must exactly match the type T and no derived class is matched; this is controller by an optional parameter exactlyMatchType). If the effect was not yet registered by EffectsManager and if createNewEffectInstanceIfNotFound is true, then a new instance of effect T is created, registered with EffectsManager and returned. To get StandardEffect (effect that can render all possible lights), use GetStandardEffect method. NOTE: When the returned effect is not used any more, user must call Dispose (reference count is increased in GetEffect method).
Public methodGetGeometryShader GetGeometryShader returns a SharedDXResourceWrapper with GeometryShader specified by the pixelShaderResourceName.
Public methodGetPixelShader GetPixelShader returns a SharedDXResourceWrapper with PixelShader specified by the pixelShaderResourceName.
Public methodGetRegisteredShaderResourceNames Returns an array of strings of all registered resource names. This method is the same as static GetRegisteredShaderResourceNamesStatic method.
Public methodStatic memberGetRegisteredShaderResourceNamesStatic Returns an array of strings of all registered resource names.
Public methodGetShaderBytes Gets bytes array of the shader byte code. Before using this method, the shader resources need to be registered with RegisterShaderResource(ShaderBytecodeProvider) method.
Public methodGetShaders(String, String, InputElement, SharedDXResourceWrapperVertexShader, SharedDXResourceWrapperPixelShader, SharedDXResourceWrapperInputLayout, Boolean) GetShaders loads vertex shader, pixel shader and creates an InputLayout from the specified resource names
Public methodGetShaders(String, String, String, InputElement, SharedDXResourceWrapperVertexShader, SharedDXResourceWrapperGeometryShader, SharedDXResourceWrapperPixelShader, SharedDXResourceWrapperInputLayout, Boolean) GetShaders loads vertex shader, geometry shader, pixel shader and creates an InputLayout from the specified resource names
Public methodGetStandardEffect Gets a StandardEffect that can render many different lights and all standard materials. NOTE: User must call Dispose on the get effect (reference count is increased in GetEffect method).
Public methodGetStandardSpriteEffect Gets the SpriteEffect that is set as standard sprite effect. User need to dispose the returned SpriteEffect when it is not used any more.
Public methodGetVertexShader GetVertexShader returns a SharedDXResourceWrapper with VertexShader specified by the vertexShaderResourceName.
Public methodIsEffectRegistered Returns Boolean that specifies if the effect with effectName was already registered with this EffectsManager.
Public methodRegisterEffect Registers the effect with EffectManager. Each used effect must be registered. Registering effect will also initialize it (called InitializeResources) if the effect was not initialized yet.
Public methodRegisterShaderResource(ShaderBytecodeProvider) Registers newShaderResource as source for shaders code. Returns true if resource was registered, false if the same resource was already registered. This method is the same as static RegisterShaderResourceStatic(ShaderBytecodeProvider) method.
Public methodRegisterShaderResource(String, Byte) Registers the specified resourceName and its bytes array as a source for the shaders bytecode. Returns true if resource was registered, false if the same resource was already registered. This method is the same as static RegisterShaderResourceStatic(String, Byte) method.
Public methodStatic memberRegisterShaderResourceStatic(ShaderBytecodeProvider) Registers newShaderResource as source for shaders code. Returns true if resource was registered, false if the same resource was already registered. This method is the same as non-static RegisterShaderResource(ShaderBytecodeProvider) method.
Public methodStatic memberRegisterShaderResourceStatic(String, Byte) Registers the specified resourceName and its bytes array as a source for the shaders bytecode. Returns true if resource was registered, false if the same resource was already registered. This method is the same as non-static RegisterShaderResource(String, Byte) method.
Public methodSetStandardEffect Sets a StandardEffect that can render many different lights and all standard materials. If newStandardEffect is not yet registered by EffectsManager then this method also registers the newStandardEffect.
Public methodUnregisterShaderResource(ShaderBytecodeProvider) Unregisters shaderResource as source for shaders code. Returns true if resource was unregistered, false if the this resource was not registered and was therefore not unregistered. This method is the same as static UnregisterShaderResourceStatic(ShaderBytecodeProvider) method.
Public methodUnregisterShaderResource(String) Unregisters the specified resourceName from the list of registered shader resources (resource that was previously registered by RegisterShaderResource(String, Byte) or RegisterShaderResourceStatic(String, Byte). Returns true if resource was unregistered, false if the this resource was not registered and was therefore not unregistered. This method is the same as static UnregisterShaderResourceStatic(String) method.
Public methodStatic memberUnregisterShaderResourceStatic(ShaderBytecodeProvider) Unregisters shaderResource as source for shaders code. Returns true if resource was unregistered, false if the this resource was not registered and was therefore not unregistered. This method is the same as non-static UnregisterShaderResource(ShaderBytecodeProvider) method.
Public methodStatic memberUnregisterShaderResourceStatic(String) Unregisters the specified resourceName from the list of registered shader resources (resource that was previously registered by RegisterShaderResource(String, Byte) or RegisterShaderResourceStatic(String, Byte). Returns true if resource was unregistered, false if the this resource was not registered and was therefore not unregistered. This method is the same as non-static UnregisterShaderResource(String) method.
Top
Events
 NameDescription
Public eventEffectRegistered EffectRegistered event is fired when a new effect is registered
Top
See Also