Material ClassDelta Engine Documentation
Displays images or shapes via shaders in 2D or 3D. Always need a shader and a diffuse map, which can be a single , an , or a ImageImageAnimationSpriteSheetView code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Content ContentData
    DeltaEngine.Content Material

Namespace: DeltaEngine.Content
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public sealed class Material : ContentData, 
	IEquatable<Material>

The Material type exposes the following members.

Constructors

  NameDescription
Public methodMaterial(Color)
Creates an 1x1 image with a colored shader material for simple solid flat surfaces. View code on GitHub
Public methodMaterial(Color, ShaderFlags)
Initializes a new instance of the Material class
Public methodMaterial(Shader, Image)
Special constructor for creating custom shaders and images or reusing existing instances. View code on GitHub
Public methodMaterial(ShaderFlags, String)
As opposed to loading a material from content it can also be created with this constructor. If imageOrAnimationName is used you need to provide either a DiffuseMap or an Animation. View code on GitHub
Public methodMaterial(Size, ShaderFlags)
Creates a new image with the specified size to be filled dynamically (via .DiffuseMap.Fill). View code on GitHub
Top
Methods

  NameDescription
Protected methodCreateDefault (Inherited from ContentData.)
Public methodDispose (Inherited from ContentData.)
Protected methodDisposeData (Overrides ContentData DisposeData .)
Public methodEquals(Object) (Overrides Object Equals(Object).)
Public methodEquals(Material)
Public methodGetHashCode (Overrides Object GetHashCode .)
Public methodInternalCreateDefault (Inherited from ContentData.)
Protected methodLoadData (Overrides ContentData LoadData(Stream).)
Public methodToString (Overrides ContentData ToString .)
Top
Fields

  NameDescription
Protected fieldContentChanged (Inherited from ContentData.)
Top
Properties

  NameDescription
Protected propertyAllowCreationIfContentNotFound (Inherited from ContentData.)
Public propertyAnimation
Public propertyDefaultColor
Public propertyDiffuseMap
Public propertyDuration
Public propertyIsDisposed (Inherited from ContentData.)
Public propertyLightMap
Public propertyMaterialRenderSize
When using the Sprite(Material, Vector2D) constructor this size is used for the draw area. It is calculated from the DiffuseMap.PixelSize and the default content resolution, i.e. a 100x200 pixel image will be displayed aspect ratio correct relative to the window size. View code on GitHub
Public propertyMetaData (Inherited from ContentData.)
Public propertyName (Inherited from ContentData.)
Public propertyRenderingCalculator
Public propertyRenderSizeMode
Public propertyShader
Public propertySpriteSheet
Top
Remarks

Tests: DeltaEngine.Tests.Content.MaterialTests
Examples

7 unit tests call DeltaEngine.Content.Material
[Test]
public void TestPixelBasedRenderSize()
{
    material.RenderSizeMode = RenderSizeMode.PixelBased;
    Assert.AreEqual(0.3125f, material.MaterialRenderSize.Width);
    Assert.AreEqual(0.3125f, material.MaterialRenderSize.Height);
}
[Test]
public void Test800X480RenderSize()
{
    material.RenderSizeMode = RenderSizeMode.SizeFor800X480;
    Assert.AreEqual(0.125f, material.MaterialRenderSize.Width);
    Assert.AreEqual(0.125f, material.MaterialRenderSize.Height);
}
[Test]
public void Test1024X720RenderSize()
{
    material.RenderSizeMode = RenderSizeMode.SizeFor1024X768;
    Assert.AreEqual(0.09765625f, material.MaterialRenderSize.Width);
    Assert.AreEqual(0.09765625f, material.MaterialRenderSize.Height);
}
See Also