Table of Contents

Class EffectParameter

Namespace
Microsoft.Xna.Framework.Graphics
Assembly
MonoGame.Framework.dll

Represents an Effect parameter.

public class EffectParameter
Inheritance
EffectParameter
Inherited Members

Examples

  1. Create a EffectParameter for each parameter in your Effect that you will be setting in Draw(GameTime) or Update(GameTime).

public EffectParameter mWorld;
public EffectParameter mCameraView;
public EffectParameter CameraPos;
public EffectParameter mCameraProj;
  1. Assign an Effect parameter to your EffectParameter.

mWorld = effect.Parameters["g_mWorld"];
mCameraView = effect.Parameters["g_mCameraView"];
CameraPos = effect.Parameters["g_CameraPos"];
mCameraProj = effect.Parameters["g_mCameraProj"];
  1. Call SetValue() on your EffectParameter to change the parameter value.

Remarks

Creating and assigning a EffectParameter instance for each technique in your Effect is significantly faster than using the Parameters indexed property on Effect.

Properties

Annotations

Gets the collection of EffectAnnotation objects for this parameter.

public EffectAnnotationCollection Annotations { get; }

Property Value

EffectAnnotationCollection

ColumnCount

Gets the number of columns in the parameter description.

public int ColumnCount { get; }

Property Value

int

Elements

Gets the collection of effect parameters.

public EffectParameterCollection Elements { get; }

Property Value

EffectParameterCollection

Name

Gets the name of the parameter.

public string Name { get; }

Property Value

string

ParameterClass

Gets the class of the parameter.

public EffectParameterClass ParameterClass { get; }

Property Value

EffectParameterClass

ParameterType

Gets the type of the parameter.

public EffectParameterType ParameterType { get; }

Property Value

EffectParameterType

RowCount

Gets the number of rows in the parameter description.

public int RowCount { get; }

Property Value

int

Semantic

Gets the semantic meaning, or usage, of the parameter.

public string Semantic { get; }

Property Value

string

StructureMembers

Gets the collection of structure members.

public EffectParameterCollection StructureMembers { get; }

Property Value

EffectParameterCollection

Methods

GetValueBoolean()

Gets the value of the EffectParameter as a bool.

public bool GetValueBoolean()

Returns

bool

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type bool.

GetValueInt32()

Gets the value of the EffectParameter as an int.

public int GetValueInt32()

Returns

int

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type int.

GetValueInt32Array()

Gets the value of the EffectParameter as an array of int.

public int[] GetValueInt32Array()

Returns

int[]

GetValueMatrix()

Gets the value of the EffectParameter as an Matrix.

public Matrix GetValueMatrix()

Returns

Matrix

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type Matrix.

GetValueMatrixArray(int)

Gets the value of the EffectParameter as an array of Matrix.

public Matrix[] GetValueMatrixArray(int count)

Parameters

count int

The number of elements in the array.

Returns

Matrix[]

GetValueQuaternion()

Gets the value of the EffectParameter as an Quaternion.

public Quaternion GetValueQuaternion()

Returns

Quaternion

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type Quaternion.

GetValueSingle()

Gets the value of the EffectParameter as an float.

public float GetValueSingle()

Returns

float

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type float.

GetValueSingleArray()

Gets the value of the EffectParameter as an array of float.

public float[] GetValueSingleArray()

Returns

float[]

GetValueString()

Gets the value of the EffectParameter as an string.

public string GetValueString()

Returns

string

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type string.

GetValueTexture2D()

Gets the value of the EffectParameter as an Texture2D.

public Texture2D GetValueTexture2D()

Returns

Texture2D

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type Texture2D.

GetValueTexture3D()

Gets the value of the EffectParameter as an Texture3D.

public Texture3D GetValueTexture3D()

Returns

Texture3D

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type Texture3D.

GetValueTextureCube()

Gets the value of the EffectParameter as an TextureCube.

public TextureCube GetValueTextureCube()

Returns

TextureCube

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type TextureCube.

GetValueVector2()

Gets the value of the EffectParameter as an Vector2.

public Vector2 GetValueVector2()

Returns

Vector2

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type Vector2.

GetValueVector2Array()

Gets the value of the EffectParameter as an array of Vector2.

public Vector2[] GetValueVector2Array()

Returns

Vector2[]

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type Vector2.

GetValueVector3()

Gets the value of the EffectParameter as an Vector3.

public Vector3 GetValueVector3()

Returns

Vector3

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type Vector3.

GetValueVector3Array()

Gets the value of the EffectParameter as an array of Vector3.

public Vector3[] GetValueVector3Array()

Returns

Vector3[]

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type Vector3.

GetValueVector4()

Gets the value of the EffectParameter as an Vector4.

public Vector4 GetValueVector4()

Returns

Vector4

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type Vector4.

GetValueVector4Array()

Gets the value of the EffectParameter as an array of Vector4.

public Vector4[] GetValueVector4Array()

Returns

Vector4[]

Exceptions

InvalidCastException

Unable to cast this EffectParameter to type Vector4.

SetValue(Texture)

Sets the value of the EffectParameter.

public void SetValue(Texture value)

Parameters

value Texture

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValue(Matrix)

Sets the value of the EffectParameter.

public void SetValue(Matrix value)

Parameters

value Matrix

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValue(Matrix[])

Sets the value of the EffectParameter.

public void SetValue(Matrix[] value)

Parameters

value Matrix[]

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValue(Quaternion)

Sets the value of the EffectParameter.

public void SetValue(Quaternion value)

Parameters

value Quaternion

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValue(Vector2)

Sets the value of the EffectParameter.

public void SetValue(Vector2 value)

Parameters

value Vector2

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValue(Vector2[])

Sets the value of the EffectParameter.

public void SetValue(Vector2[] value)

Parameters

value Vector2[]

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValue(Vector3)

Sets the value of the EffectParameter.

public void SetValue(Vector3 value)

Parameters

value Vector3

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValue(Vector3[])

Sets the value of the EffectParameter.

public void SetValue(Vector3[] value)

Parameters

value Vector3[]

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValue(Vector4)

Sets the value of the EffectParameter.

public void SetValue(Vector4 value)

Parameters

value Vector4

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValue(Vector4[])

Sets the value of the EffectParameter.

public void SetValue(Vector4[] value)

Parameters

value Vector4[]

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValue(bool)

Sets the value of the EffectParameter.

public void SetValue(bool value)

Parameters

value bool

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValue(int)

Sets the value of the EffectParameter.

public void SetValue(int value)

Parameters

value int

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValue(int[])

Sets the value of the EffectParameter.

public void SetValue(int[] value)

Parameters

value int[]

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValue(float)

Sets the value of the EffectParameter.

public void SetValue(float value)

Parameters

value float

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValue(float[])

Sets the value of the EffectParameter.

public void SetValue(float[] value)

Parameters

value float[]

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.

SetValueTranspose(Matrix)

Sets the value of the EffectParameter to the transpose of a Matrix.

public void SetValueTranspose(Matrix value)

Parameters

value Matrix

The value to assign to the EffectParameter.

Remarks

Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.

Exceptions

InvalidCastException

Unable to cast this EffectParameter to target type.