Table of Contents

Class Shader

Namespace
OmegaEngine.Graphics.Shaders
Assembly
OmegaEngine.dll

Provides access to the properties of shader-programm executing on the GPU.

public abstract class Shader : EngineElement, IDisposable
Inheritance
Shader
Implements
Derived
Inherited Members
Extension Methods

Fields

GlobalScript

A list of commands composing the global SAS script

protected IList<SasScriptCommand>? GlobalScript

Field Value

IList<SasScriptCommand>

ParameterInfos

A list of annotated shader parameters

protected ParameterInfo[]? ParameterInfos

Field Value

ParameterInfo[]

Passes

A list of passes and their SAS scripts

protected readonly Dictionary<EffectHandle, IList<SasScriptCommand>> Passes

Field Value

Dictionary<EffectHandle, IList<SasScriptCommand>>

ScriptType

The type of shader the SAS scripts were written for

protected ScriptEffectType ScriptType

Field Value

ScriptEffectType

Techniques

A list of techniques and their SAS scripts

protected readonly Dictionary<EffectHandle, IList<SasScriptCommand>> Techniques

Field Value

Dictionary<EffectHandle, IList<SasScriptCommand>>

Properties

Effect

The Direct3D effect for this shader

[Browsable(false)]
protected Effect Effect { get; set; }

Property Value

Effect

Methods

ExecuteScript(IEnumerable<SasScriptCommand>, Action?, Size, RenderTarget?)

Executes a SAS post-screen shader technique script block

protected void ExecuteScript(IEnumerable<SasScriptCommand> script, Action? render = null, Size sceneSize = default, RenderTarget? sceneMap = null)

Parameters

script IEnumerable<SasScriptCommand>

A list of script commands

render Action

The render delegate (is called once for every shader pass); null for global script

sceneSize Size

The size of the scene on the screen - leave empty for fullscreen

sceneMap RenderTarget

A texture containing the rendered scene for PostShader), null if the shader doesn't need it

ExecuteScript(IEnumerable<SasScriptCommand>, Action?, Size, RenderTarget?, bool)

Executes a SAS script block

protected void ExecuteScript(IEnumerable<SasScriptCommand> script, Action? render, Size sceneSize, RenderTarget? sceneMap, bool passScript)

Parameters

script IEnumerable<SasScriptCommand>

A list of script commands

render Action

The render delegate (is called once for every shader pass); null for global script

sceneSize Size

The size of the scene on the screen - leave empty for fullscreen

sceneMap RenderTarget

A texture containing the rendered scene for PostShader), null if the shader doesn't need it

passScript bool

Is this a pass script?

Inject(string)

Replaces the loaded shader with a new one loaded from a file at run time.

public void Inject(string path)

Parameters

path string

The shader file path relative to the shader directory or as an absolute path

Remarks

This should only be used for debugging!

LoadShaderFile(string)

Loads an Effect from an

.fx
or
.fxo
file.
protected void LoadShaderFile(string path)

Parameters

path string

The shader file path relative to the shader directory or as an absolute path

OnDispose()

Hook that is called when the object needs to dispose its internal resources.

protected override void OnDispose()

OnEngineSet()

Hook that is called when Engine is set for the first time.

protected override void OnEngineSet()

OnLostDevice()

Called when the device has been lost.

public void OnLostDevice()

OnResetDevice()

Called when the device has been reset.

public void OnResetDevice()

SetShaderParameter(string, Color)

Sets a specific shader parameter. Automatically defers the action if Effect has not been set yet.

protected void SetShaderParameter(string name, Color value)

Parameters

name string

The name of the shader parameter to set.

value Color

The value to set.

SetShaderParameter<T>(string, T)

Sets a specific shader parameter. Automatically defers the action if Effect has not been set yet.

protected void SetShaderParameter<T>(string name, T value) where T : struct

Parameters

name string

The name of the shader parameter to set.

value T

The value to set.

Type Parameters

T

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.