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
DeltaEngine.Content ContentData
DeltaEngine.Content Material
Namespace: DeltaEngine.Content
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The Material type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | Material(Color) |
Creates an 1x1 image with a colored shader material for simple solid flat surfaces.
View code on GitHub |
![]() | Material(Color, ShaderFlags) | Initializes a new instance of the Material class |
![]() | Material(Shader, Image) |
Special constructor for creating custom shaders and images or reusing existing instances.
View code on GitHub |
![]() | Material(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 |
![]() | Material(Size, ShaderFlags) |
Creates a new image with the specified size to be filled dynamically (via .DiffuseMap.Fill).
View code on GitHub |
Methods
Name | Description | |
---|---|---|
![]() | CreateDefault | (Inherited from ContentData.) |
![]() | Dispose | (Inherited from ContentData.) |
![]() | DisposeData | (Overrides ContentData DisposeData .) |
![]() | Equals(Object) | (Overrides Object Equals(Object).) |
![]() | Equals(Material) | |
![]() | GetHashCode | (Overrides Object GetHashCode .) |
![]() | InternalCreateDefault | (Inherited from ContentData.) |
![]() | LoadData | (Overrides ContentData LoadData(Stream).) |
![]() | ToString | (Overrides ContentData ToString .) |
Fields
Name | Description | |
---|---|---|
![]() | ContentChanged | (Inherited from ContentData.) |
Properties
Name | Description | |
---|---|---|
![]() | AllowCreationIfContentNotFound | (Inherited from ContentData.) |
![]() | Animation | |
![]() | DefaultColor | |
![]() | DiffuseMap | |
![]() | Duration | |
![]() | IsDisposed | (Inherited from ContentData.) |
![]() | LightMap | |
![]() | MaterialRenderSize |
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 |
![]() | MetaData | (Inherited from ContentData.) |
![]() | Name | (Inherited from ContentData.) |
![]() | RenderingCalculator | |
![]() | RenderSizeMode | |
![]() | Shader | |
![]() | SpriteSheet |
Remarks
Examples
[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