ShaderWithFormat ClassDelta Engine Documentation
Adds graphics specific features to a shader object like VertexFormat and the shader code. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Content ContentData
    DeltaEngine.Content Shader
      DeltaEngine.Graphics ShaderWithFormat
        DeltaEngine.Graphics.BaseOpenGL11 OpenGL11Shader
        DeltaEngine.Graphics.BaseOpenGL20 OpenGL20Shader
        DeltaEngine.Graphics.Mocks MockShader
        DeltaEngine.Graphics.SharpDX SharpDXShader
        DeltaEngine.Graphics.SlimDX SlimDXShader
        DeltaEngine.Graphics.Xna XnaShader

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

public abstract class ShaderWithFormat : Shader

The ShaderWithFormat type exposes the following members.

Constructors

  NameDescription
Protected methodShaderWithFormat(ShaderCreationData)
Initializes a new instance of the ShaderWithFormat class
Protected methodShaderWithFormat(ShaderWithFormatCreationData)
Initializes a new instance of the ShaderWithFormat class
Top
Methods

  NameDescription
Public methodApplyFogSettings (Inherited from Shader.)
Public methodApplyShaderParameters (Inherited from Shader.)
Public methodBind (Inherited from Shader.)
Public methodBindVertexDeclaration (Inherited from Shader.)
Protected methodCreateDefault (Inherited from ContentData.)
Protected methodCreateShader (Inherited from Shader.)
Public methodDispose (Inherited from ContentData.)
Protected methodDisposeData (Inherited from ContentData.)
Public methodEquals(Object) (Inherited from Shader.)
Public methodEquals(Shader) (Inherited from Shader.)
Protected methodFillShaderCode (Overrides Shader FillShaderCode .)
Public methodGetHashCode (Inherited from Shader.)
Public methodInternalCreateDefault (Inherited from ContentData.)
Protected methodLoadData (Inherited from Shader.)
Public methodSetDiffuseTexture (Inherited from Shader.)
Public methodSetJointMatrices (Inherited from Shader.)
Public methodSetLightmapTexture (Inherited from Shader.)
Public methodSetModelViewProjection(Matrix) (Inherited from Shader.)
Public methodSetModelViewProjection(Matrix, Matrix, Matrix) (Inherited from Shader.)
Public methodSetSunLight (Inherited from Shader.)
Public methodToString (Inherited from ContentData.)
Protected methodTryCreateShader (Inherited from Shader.)
Top
Fields

  NameDescription
Protected fieldContentChanged (Inherited from ContentData.)
Top
Properties

  NameDescription
Protected propertyAllowCreationIfContentNotFound (Inherited from ContentData.)
Protected propertyData (Inherited from Shader.)
Protected propertyDX11Code
Protected propertyDX9Code
Public propertyFlags (Inherited from Shader.)
Public propertyFormat
Public propertyIsDisposed (Inherited from ContentData.)
Public propertyMetaData (Inherited from ContentData.)
Public propertyName (Inherited from ContentData.)
Protected propertyOpenGLFragmentCode
Protected propertyOpenGLVertexCode
Top
Remarks

Tests: DeltaEngine.Graphics.Tests.ShaderWithFormatTests
Examples

7 unit tests call DeltaEngine.Graphics.ShaderWithFormat
[Test, CloseAfterFirstFrame]
public void InvalidVertexFormat()
{
    var invalidData = new ShaderWithFormatCreationData(ShaderFlags.None, "", "", "", "", null);
    Assert.Throws<ShaderWithFormat.InvalidVertexFormat>(
        () => ContentLoader.Create<Shader>(invalidData));
    var emptyFormat = new ShaderWithFormatCreationData(ShaderFlags.None, "", "", "", "",
        new VertexFormat(new VertexElement[0]));
    Assert.Throws<ShaderWithFormat.InvalidVertexFormat>(
        () => ContentLoader.Create<Shader>(emptyFormat));
}
[Test, CloseAfterFirstFrame]
public void InvalidVertexAndPixelCode()
{
    var data = new ShaderWithFormatCreationData(ShaderFlags.None, "", "", "", "",
        VertexFormat.Position2DColor);
    Assert.Throws<ShaderWithFormat.NoShaderCodeSpecifiedForOpenGLAndDirectX>(
        () => ContentLoader.Create<Shader>(data));
}
[Test, CloseAfterFirstFrame]
public void AllowDynamicCreationViaCreationData()
{
    var data = new ShaderWithFormatCreationData(ShaderFlags.None, "AnyData", "AnyData",
        "AnyData", "AnyData", VertexFormat.Position2DColor);
    var shader = ContentLoader.Create<NoDataShaderWithFormat>(data);
    Assert.DoesNotThrow(() => shader.ReloadCreationData(data));
}
See Also