Material Class |
Namespace: DigitalRune.Graphics
The Material type exposes the following members.
Name | Description | |
---|---|---|
Add |
Adds an effect binding for the specified render pass to the material.
| |
Clear |
Removes all render passes and effect bindings from the material.
| |
Clone |
Creates a new Material that is a clone of the current instance.
| |
CloneCore |
Makes the instance a clone (deep copy) of the specified Material.
| |
Contains |
Determines whether the material contains an effect binding for the specified render pass.
| |
CreateInstanceCore |
When implemented in a derived class, creates a new instance of the Material
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.) | |
GetEnumerator |
Returns an enumerator that iterates through a collection.
| |
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.) | |
Remove |
Removes the effect binding for the specified render pass from the material.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
TryGet |
Gets the effect binding for the specified render pass
|
Name | Description | |
---|---|---|
AddRangeKeyValuePairString, EffectBinding |
Adds the specified items to the ICollectionT.
(Defined by CollectionHelper.) | |
DoKeyValuePairString, EffectBinding(ActionKeyValuePairString, EffectBinding) | Overloaded.
Performs the given action on each element in a sequence when it is enumerated.
(Defined by LinqHelper.) | |
DoKeyValuePairString, EffectBinding(ActionKeyValuePairString, EffectBinding, Int32) | Overloaded.
Performs the given action on each element (incorporating its index) in a sequence when it is
enumerated.
(Defined by LinqHelper.) | |
ForEachKeyValuePairString, EffectBinding(ActionKeyValuePairString, EffectBinding) | Overloaded.
Immediately performs the given action on each element in a sequence.
(Defined by LinqHelper.) | |
ForEachKeyValuePairString, EffectBinding(ActionKeyValuePairString, EffectBinding, Int32) | Overloaded.
Immediately performs the given action on each element (incorporating its index) in a
sequence.
(Defined by LinqHelper.) | |
IndexOfKeyValuePairString, EffectBinding |
Returns the index of the first element in a sequence that satisfies the specified condition.
(Defined by LinqHelper.) |
Name | Description | |
---|---|---|
Count |
Gets the number of render passes supported by this material.
| |
EffectBindings |
Gets a collection of effect bindings used by this material.
| |
Item |
Gets or sets the effect binding for the specified render pass.
| |
Name |
Gets the name of the material.
| |
Passes |
Gets a collection of all the render passes supported by this material.
|
A Mesh represents the geometry and materials of a 3D object that can be rendered. A mesh owns a collection of Materials and is divided into Submeshes. Each Submesh describes a batch of primitives (usually triangles) that use one material and can be rendered with a single draw call.
An effect binding (see class EffectBinding) provides the render states required for each draw call: An that defines the graphics device states. A technique binding selects the vertex and pixel shaders for rendering. And parameter bindings define static properties (color, diffuse texture, gloss map, normal map, etc.) as well as dynamic properties (world/view/projection matrices, light properties, etc.). But depending on the render pipeline that is used, multiple render passes may be required to draw a certain object. Therefore, a Material is a dictionary of effect bindings - one effect binding per render pass. The dictionary key is the name of the render pass (a case-sensitive string such as "Default", "ZPass", "ShadowMap", "GBuffer", "Material", etc.). The dictionary value is the EffectBinding that contains required settings for this render pass. The entries in a material depend on the type of renderer that is used.
Example: A forward renderer usually only requires a single render pass, in which the mesh is rendered into the back buffer. In this case the material contains one entry (Key = "Default", Value = EffectBinding).
Advanced example: A light pre-pass renderer usually requires several render passes per mesh: In the "ShadowMap" pass the mesh is rendered into the shadow-map texture, which is used later on. Then in the "GBuffer" pass the depth, the normals, and other properties of the mesh are rendered into multiple render targets. Next, the renderer computes the lighting information. Then in the "Material" pass, the mesh is rendered again - the lighting information is combined with the material settings. In this example the material contains 3 entries. The keys are "GBuffer", "Material", and "ShadowMap".
A Material is not bound to a certain Mesh. It can be shared by different Mesh objects.
Important: When an EffectBinding is used as part of a Material, then it can only contain parameter bindings with the sort hint Material (see EffectParameterHint).
Cloning:
Materials can be cloned. When Clone is called all
EffectBinding are duplicated (deep copy).