EffectBinding Class |
Namespace: DigitalRune.Graphics.Effects
The EffectBinding type exposes the following members.
Name | Description | |
---|---|---|
EffectBinding |
Initializes a new instance of the EffectBinding class. (This constructor
creates an uninitialized instance. Use this constructor only for cloning or other special
cases!)
| |
EffectBinding(IGraphicsService, Effect) |
Initializes a new instance of the EffectBinding class which can store
all kinds of effect parameters.
| |
EffectBinding(IGraphicsService, Effect, IDictionaryString, Object) | ||
EffectBinding(IGraphicsService, Effect, IDictionaryString, Object, EffectParameterHint) |
Initializes a new instance of the EffectBinding class with the given settings.
|
Name | Description | |
---|---|---|
Clone |
Creates a new EffectBinding that is a clone of the current instance.
| |
CloneCore |
Makes the instance a clone (deep copy) of the specified EffectBinding.
| |
CreateInstanceCore |
When implemented in a derived class, creates a new instance of the
EffectBinding derived class.
| |
Equals | (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnInitializeBindings |
Called when the effect technique and parameter bindings should be initialized.
| |
SetT(EffectParameter, ActionDelegateParameterArrayBindingT, RenderContext, T) |
Sets a DelegateParameterArrayBindingT for the specified effect parameter.
| |
SetT(EffectParameter, FuncDelegateParameterBindingT, RenderContext, T) |
Sets a DelegateParameterBindingT for the specified effect parameter.
| |
SetT(EffectParameter, T) |
Sets a ConstParameterBindingT for the specified effect parameter.
| |
SetT(EffectParameter, T) |
Sets a ConstParameterArrayBindingT for the specified effect parameter.
| |
SetT(String, ActionDelegateParameterArrayBindingT, RenderContext, T) |
Sets a DelegateParameterArrayBindingT for the effect parameter with the
specified name.
| |
SetT(String, FuncDelegateParameterBindingT, RenderContext, T) |
Sets a DelegateParameterBindingT for the effect parameter with the specified
name.
| |
SetT(String, T) |
Sets a ConstParameterBindingT for the effect parameter with the specified
name.
| |
SetT(String, T) |
Sets a ConstParameterArrayBindingT for the effect parameter with the
specified name.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
Effect |
Gets the effect.
| |
Hints |
Gets a value indicating which effect parameters are handled by this effect binding.
| |
KeepOpaqueData |
Gets or sets a value indicating whether OpaqueData should be kept for
debugging.
| |
OpaqueData |
Gets the opaque data (only used for debugging, only set if KeepOpaqueData is
).
| |
ParameterBindings |
Gets the bindings that resolve effect parameters.
| |
TechniqueBinding |
Gets or sets the binding that resolves the effect technique.
| |
UserData |
Gets or sets user-defined data.
|
An Effect defines the render states required to render an object. An EffectBinding provides the logic that is required for using an effect at runtime.
Multiple EffectBindings can share the same Effect. An EffectBinding can in theory be shared by different graphics objects. But in most cases an EffectBinding belongs to a single object, such as a Mesh.
Technique and Parameter Bindings:
An effect may define one or more effect techniques. When rendering a certain object the
correct technique needs to be chosen. In addition, an effect defines a set of effect
parameters. An effect file (.fx) can define default values for effect parameters. However,
most effect parameters need to be set at runtime. Static parameters (such as colors, textures,
etc.) can be set when assets are loaded. Dynamic parameters (such as world matrix, view
matrix, projection matrix, etc.) need to be updated, typically once per frame, when the
associated objects are rendered.
Effect parameters belong to different categories, defined by EffectParameterHint. An EffectBinding can be used to manage all kinds of effect parameters, or only parameters of a certain type, e.g. only Material parameters. See also Hints.
DigitalRune Graphics introduces the concept of effect technique bindings and effect parameter bindings: The technique binding (see property TechniqueBinding) provides the logic for selecting a technique at runtime. Parameter bindings (stored in ParameterBindings) links a effect parameters to a certain values. By using a ConstParameterBindingT a parameter can be bound to a static value. By using a DelegateParameterBindingT a parameter can be dynamically updated when needed. Effect technique and parameter bindings are evaluated when the associated object (e.g. a mesh) needs to be rendered. Evaluation consists of two phases:
Initialization: When an effect binding is created all technique and parameter bindings are created automatically. This initialization involves two steps:
Cloning:
EffectBindings need to be cloneable. The method Clone calls
CreateInstanceCore and CloneCore(EffectBinding) which are responsible for
creating a clone of the current instance. Classes that derive from EffectBinding
need to provide the implementation for CreateInstanceCore and override
CloneCore(EffectBinding) if necessary.
By default, when an EffectBinding is cloned all technique and parameter bindings are duplicated (deep copy). Any optional object stored in UserData is copied per reference (shallow copy).