C# Класс Axiom.Graphics.GpuProgramParameters

Collects together the program parameters used for a GpuProgram.
Gpu program state includes constant parameters used by the program, and bindings to render system state which is propagated into the constants by the engine automatically if requested.

GpuProgramParameters objects should be created through the GpuProgramManager and may be shared between multiple GpuProgram instances. For this reason they are managed using a shared pointer, which will ensure they are automatically deleted when no program is using them anymore.

Different types of GPU programs support different types of constant parameters. For example, it's relatively common to find that vertex programs only support floating point constants, and that fragment programs only support integer (fixed point) parameters. This can vary depending on the program version supported by the graphics card being used. You should consult the documentation for the type of low level program you are using, or alternatively use the methods provided on Capabilities to determine the options.

Another possible limitation is that some systems only allow constants to be set on certain boundaries, e.g. in sets of 4 values for example. Again, see Capabilities for full details.

Наследование: DisposableObject
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
AutoConstantDictionary AutoConstantDefinition[]
autoAddParamName bool
autoConstantList AutoConstantEntryList
floatConstants FloatConstantEntryList
ignoreMissingParameters bool
intConstants IntConstantEntryList
namedParams AxiomCollection
paramTypeList List
tmpVals float[]
transposeMatrices bool

Private Properties

Свойство Тип Описание
SetLogicalIndexes void

Открытые методы

Метод Описание
AddParameterToDefaultsList ( GpuProgramParameterType type, string name ) : void
ClearAutoConstantType ( ) : void

Clears all the existing automatic constants.

Clone ( ) : GpuProgramParameters
CopyConstantsFrom ( GpuProgramParameters source ) : void

Copies the values of all constants (including auto constants) from another GpuProgramParameters object.

CopyMatchingNamedConstantsFrom ( GpuProgramParameters source ) : void
FindNamedConstantDefinition ( string name, bool throwExceptionIfNotFound ) : GpuConstantDefinition

Find a constant definition for a named parameter. This method returns null if the named parameter did not exist, unlike GetConstantDefinition which is more strict; unless you set the last parameter to true.

GetAutoConstantDefinition ( int idx, AutoConstantDefinition &def ) : bool

gets the auto constant definition using an index into the auto constant definition array. If the index is out of bounds then false is returned;

GetAutoConstantDefinition ( string name, AutoConstantDefinition &def ) : bool

Gets the auto constant definition associated with name if found else returns false

GetFloatConstant ( int i ) : FloatConstantEntry

GetFloatPointer ( int physicalIndex ) : float[]
GetIntConstant ( int i ) : IntConstantEntry

GetIntPointer ( int physicalIndex ) : int[]
GetNameByIndex ( int index ) : string

Given an index, this function will return the name of the parameter at that index.

GetNamedFloatConstant ( string name ) : FloatConstantEntry

Gets a Named Float Constant entry if the name is found otherwise returns a null.

GetNamedIntConstant ( string name ) : IntConstantEntry

Gets a Named Int Constant entry if the name is found otherwise returns a null.

GetParamIndex ( string name ) : int

Gets the constant index of the specified named param.

GpuProgramParameters ( ) : System

Default constructor.

IncPassIterationNumber ( ) : void
MapParamNameToIndex ( string name, int index ) : void

Maps a parameter name to the specified constant index.

SetAutoConstant ( AutoConstantEntry entry ) : void

Overloaded method.

SetAutoConstant ( int index, AutoConstantType type ) : void

Sets up a constant which will automatically be updated by the engine.

Vertex and fragment programs often need parameters which are to do with the current render state, or particular values which may very well change over time, and often between objects which are being rendered. This feature allows you to set up a certain number of predefined parameter mappings that are kept up to date for you.

SetAutoConstant ( int index, AutoConstantType type, float extraInfo ) : void

Overloaded method.

SetAutoConstant ( int index, AutoConstantType type, int extraInfo ) : void

Overloaded method.

SetConstant ( int index, ColorEx color ) : void

Sends 4 packed floating-point RGBA color values to the program.

SetConstant ( int index, Matrix4 val ) : void

Sends a multiple value constant floating-point parameter to the program.

This method is made virtual to allow GpuProgramManagers, or even individual GpuProgram implementations to supply their own implementation if need be. An example would be where a Matrix needs to be transposed to row-major format before passing to the hardware.

SetConstant ( int index, Matrix4 matrices, int count ) : void

Sends a multiple matrix values to the program.

SetConstant ( int index, Vector3 val ) : void

Sends 3 packed floating-point values to the program.

SetConstant ( int index, Vector4 val ) : void

Sends 4 packed floating-point values to the program.

SetConstant ( int index, float value ) : void

Provides a way to pass in a single float

SetConstant ( int index, float f0, float f1, float f2, float f3 ) : void

Optimize the most common case of setting constant consisting of four floats

SetConstant ( int index, int ints ) : void

Sets an array of int values starting at the specified index.

SetConstantFromTime ( int index, float factor ) : void

SetIntConstant ( int index, int value ) : void

Provides a way to pass in the technique pass number

SetNamedAutoConstant ( string name, AutoConstantType type ) : void
SetNamedAutoConstant ( string name, AutoConstantType type, int extraInfo ) : void

Sets up a constant which will automatically be updated by the engine.

Vertex and fragment programs often need parameters which are to do with the current render state, or particular values which may very well change over time, and often between objects which are being rendered. This feature allows you to set up a certain number of predefined parameter mappings that are kept up to date for you.

SetNamedConstant ( string name, ColorEx color ) : void

Sends 4 packed floating-point RGBA color values to the program.

SetNamedConstant ( string name, Matrix4 val ) : void

Sends a multiple value constant floating-point parameter to the program.

SetNamedConstant ( string name, Matrix4 matrices, int count ) : void

Sends multiple matrices into a program.

SetNamedConstant ( string name, Vector3 val ) : void

Sends 3 packed floating-point values to the program.

SetNamedConstant ( string name, Vector4 val ) : void

Sends 4 packed floating-point values to the program.

SetNamedConstant ( string name, float val ) : void
SetNamedConstant ( string name, int val ) : void
SetNamedConstantFromTime ( string name, float factor ) : void

SetNamedConstants ( GpuNamedConstants constantDefs ) : void
UpdateAutoParams ( AutoParamDataSource source, GpuParamVariability mask ) : void

Update automatic parameters.

UpdateAutoParamsLightsOnly ( AutoParamDataSource source ) : void

Updates the automatic light parameters based on the details provided.

UpdateAutoParamsNoLights ( AutoParamDataSource source ) : void

Updates the automatic parameters (except lights) based on the details provided.

Приватные методы

Метод Описание
SetLogicalIndexes ( GpuLogicalBufferStruct floatIndexMap, GpuLogicalBufferStruct intIndexMap ) : void

Описание методов

AddParameterToDefaultsList() публичный Метод

public AddParameterToDefaultsList ( GpuProgramParameterType type, string name ) : void
type GpuProgramParameterType
name string
Результат void

ClearAutoConstantType() публичный Метод

Clears all the existing automatic constants.
public ClearAutoConstantType ( ) : void
Результат void

Clone() публичный Метод

public Clone ( ) : GpuProgramParameters
Результат GpuProgramParameters

CopyConstantsFrom() публичный Метод

Copies the values of all constants (including auto constants) from another GpuProgramParameters object.
public CopyConstantsFrom ( GpuProgramParameters source ) : void
source GpuProgramParameters Set of params to use as the source.
Результат void

CopyMatchingNamedConstantsFrom() публичный Метод

public CopyMatchingNamedConstantsFrom ( GpuProgramParameters source ) : void
source GpuProgramParameters
Результат void

FindNamedConstantDefinition() публичный Метод

Find a constant definition for a named parameter. This method returns null if the named parameter did not exist, unlike GetConstantDefinition which is more strict; unless you set the last parameter to true.
public FindNamedConstantDefinition ( string name, bool throwExceptionIfNotFound ) : GpuConstantDefinition
name string The name to look up
throwExceptionIfNotFound bool
Результат GpuConstantDefinition

GetAutoConstantDefinition() публичный статический Метод

gets the auto constant definition using an index into the auto constant definition array. If the index is out of bounds then false is returned;
public static GetAutoConstantDefinition ( int idx, AutoConstantDefinition &def ) : bool
idx int The auto constant index
def AutoConstantDefinition
Результат bool

GetAutoConstantDefinition() публичный статический Метод

Gets the auto constant definition associated with name if found else returns false
public static GetAutoConstantDefinition ( string name, AutoConstantDefinition &def ) : bool
name string The name of the auto constant
def AutoConstantDefinition
Результат bool

GetFloatConstant() публичный Метод

public GetFloatConstant ( int i ) : FloatConstantEntry
i int
Результат FloatConstantEntry

GetFloatPointer() публичный Метод

public GetFloatPointer ( int physicalIndex ) : float[]
physicalIndex int
Результат float[]

GetIntConstant() публичный Метод

public GetIntConstant ( int i ) : IntConstantEntry
i int
Результат IntConstantEntry

GetIntPointer() публичный Метод

public GetIntPointer ( int physicalIndex ) : int[]
physicalIndex int
Результат int[]

GetNameByIndex() публичный Метод

Given an index, this function will return the name of the parameter at that index.
public GetNameByIndex ( int index ) : string
index int Index of the parameter to look up.
Результат string

GetNamedFloatConstant() публичный Метод

Gets a Named Float Constant entry if the name is found otherwise returns a null.
public GetNamedFloatConstant ( string name ) : FloatConstantEntry
name string Name of the constant to retreive.
Результат FloatConstantEntry

GetNamedIntConstant() публичный Метод

Gets a Named Int Constant entry if the name is found otherwise returns a null.
public GetNamedIntConstant ( string name ) : IntConstantEntry
name string Name of the constant to retreive.
Результат IntConstantEntry

GetParamIndex() публичный Метод

Gets the constant index of the specified named param.
public GetParamIndex ( string name ) : int
name string /// Name of the param. ///
Результат int

GpuProgramParameters() публичный Метод

Default constructor.
public GpuProgramParameters ( ) : System
Результат System

IncPassIterationNumber() публичный Метод

public IncPassIterationNumber ( ) : void
Результат void

MapParamNameToIndex() публичный Метод

Maps a parameter name to the specified constant index.
public MapParamNameToIndex ( string name, int index ) : void
name string Name of the param.
index int Constant index of the param.
Результат void

SetAutoConstant() публичный Метод

Overloaded method.
public SetAutoConstant ( AutoConstantEntry entry ) : void
entry AutoConstantEntry
Результат void

SetAutoConstant() публичный Метод

Sets up a constant which will automatically be updated by the engine.
Vertex and fragment programs often need parameters which are to do with the current render state, or particular values which may very well change over time, and often between objects which are being rendered. This feature allows you to set up a certain number of predefined parameter mappings that are kept up to date for you.
public SetAutoConstant ( int index, AutoConstantType type ) : void
index int /// The location in the constant list to place this updated constant every time /// it is changed. Note that because of the nature of the types, we know how big the /// parameter details will be so you don't need to set that like you do for manual constants. ///
type AutoConstantType The type of automatic constant to set.
Результат void

SetAutoConstant() публичный Метод

Overloaded method.
public SetAutoConstant ( int index, AutoConstantType type, float extraInfo ) : void
index int /// The location in the constant list to place this updated constant every time /// it is changed. Note that because of the nature of the types, we know how big the /// parameter details will be so you don't need to set that like you do for manual constants. ///
type AutoConstantType The type of automatic constant to set.
extraInfo float If the constant type needs more information (like a light index) put it here.
Результат void

SetAutoConstant() публичный Метод

Overloaded method.
public SetAutoConstant ( int index, AutoConstantType type, int extraInfo ) : void
index int /// The location in the constant list to place this updated constant every time /// it is changed. Note that because of the nature of the types, we know how big the /// parameter details will be so you don't need to set that like you do for manual constants. ///
type AutoConstantType The type of automatic constant to set.
extraInfo int If the constant type needs more information (like a light index) put it here.
Результат void

SetConstant() публичный Метод

Sends 4 packed floating-point RGBA color values to the program.
public SetConstant ( int index, ColorEx color ) : void
index int Index of the contant register.
color Axiom.Core.ColorEx Structure containing 4 packed RGBA color values.
Результат void

SetConstant() публичный Метод

Sends a multiple value constant floating-point parameter to the program.
This method is made virtual to allow GpuProgramManagers, or even individual GpuProgram implementations to supply their own implementation if need be. An example would be where a Matrix needs to be transposed to row-major format before passing to the hardware.
public SetConstant ( int index, Matrix4 val ) : void
index int Index of the contant register.
val Axiom.Math.Matrix4 Structure containing 3 packed float values.
Результат void

SetConstant() публичный Метод

Sends a multiple matrix values to the program.
public SetConstant ( int index, Matrix4 matrices, int count ) : void
index int Index of the contant register.
matrices Axiom.Math.Matrix4 Values to set.
count int Number of matrices to set
Результат void

SetConstant() публичный Метод

Sends 3 packed floating-point values to the program.
public SetConstant ( int index, Vector3 val ) : void
index int Index of the contant register.
val Vector3 Structure containing 3 packed float values.
Результат void

SetConstant() публичный Метод

Sends 4 packed floating-point values to the program.
public SetConstant ( int index, Vector4 val ) : void
index int Index of the contant register.
val Vector4 Structure containing 4 packed float values.
Результат void

SetConstant() публичный Метод

Provides a way to pass in a single float
public SetConstant ( int index, float value ) : void
index int Index of the contant register to start at.
value float
Результат void

SetConstant() публичный Метод

Optimize the most common case of setting constant consisting of four floats
public SetConstant ( int index, float f0, float f1, float f2, float f3 ) : void
index int Index of the contant register to start at.
f0 float The floats.
f1 float The floats.
f2 float The floats.
f3 float The floats.
Результат void

SetConstant() публичный Метод

Sets an array of int values starting at the specified index.
public SetConstant ( int index, int ints ) : void
index int Index of the contant register to start at.
ints int Array of ints.
Результат void

SetConstantFromTime() публичный Метод

public SetConstantFromTime ( int index, float factor ) : void
index int
factor float
Результат void

SetIntConstant() публичный Метод

Provides a way to pass in the technique pass number
public SetIntConstant ( int index, int value ) : void
index int Index of the contant register to start at.
value int Value of the constant.
Результат void

SetNamedAutoConstant() публичный Метод

public SetNamedAutoConstant ( string name, AutoConstantType type ) : void
name string
type AutoConstantType
Результат void

SetNamedAutoConstant() публичный Метод

Sets up a constant which will automatically be updated by the engine.
Vertex and fragment programs often need parameters which are to do with the current render state, or particular values which may very well change over time, and often between objects which are being rendered. This feature allows you to set up a certain number of predefined parameter mappings that are kept up to date for you.
public SetNamedAutoConstant ( string name, AutoConstantType type, int extraInfo ) : void
name string /// Name of the param. ///
type AutoConstantType /// The type of automatic constant to set. ///
extraInfo int /// Any extra information needed by the auto constant (i.e. light index, etc). ///
Результат void

SetNamedConstant() публичный Метод

Sends 4 packed floating-point RGBA color values to the program.
public SetNamedConstant ( string name, ColorEx color ) : void
name string Name of the param.
color Axiom.Core.ColorEx Structure containing 4 packed RGBA color values.
Результат void

SetNamedConstant() публичный Метод

Sends a multiple value constant floating-point parameter to the program.
public SetNamedConstant ( string name, Matrix4 val ) : void
name string Name of the param.
val Axiom.Math.Matrix4 Structure containing 3 packed float values.
Результат void

SetNamedConstant() публичный Метод

Sends multiple matrices into a program.
public SetNamedConstant ( string name, Matrix4 matrices, int count ) : void
name string Name of the param.
matrices Axiom.Math.Matrix4 Array of matrices.
count int
Результат void

SetNamedConstant() публичный Метод

Sends 3 packed floating-point values to the program.
public SetNamedConstant ( string name, Vector3 val ) : void
name string Name of the param.
val Vector3 Structure containing 3 packed float values.
Результат void

SetNamedConstant() публичный Метод

Sends 4 packed floating-point values to the program.
public SetNamedConstant ( string name, Vector4 val ) : void
name string Name of the contant register.
val Vector4 Structure containing 4 packed float values.
Результат void

SetNamedConstant() публичный Метод

public SetNamedConstant ( string name, float val ) : void
name string
val float
Результат void

SetNamedConstant() публичный Метод

public SetNamedConstant ( string name, int val ) : void
name string
val int
Результат void

SetNamedConstantFromTime() публичный Метод

public SetNamedConstantFromTime ( string name, float factor ) : void
name string
factor float
Результат void

SetNamedConstants() публичный Метод

public SetNamedConstants ( GpuNamedConstants constantDefs ) : void
constantDefs GpuNamedConstants
Результат void

UpdateAutoParams() публичный Метод

Update automatic parameters.
public UpdateAutoParams ( AutoParamDataSource source, GpuParamVariability mask ) : void
source AutoParamDataSource The source of the parameters
mask GpuParamVariability A mask of GpuParamVariability which identifies which autos will need updating
Результат void

UpdateAutoParamsLightsOnly() публичный Метод

Updates the automatic light parameters based on the details provided.
public UpdateAutoParamsLightsOnly ( AutoParamDataSource source ) : void
source AutoParamDataSource /// A source containing all the updated data to be made available for auto updating /// the GPU program constants. ///
Результат void

UpdateAutoParamsNoLights() публичный Метод

Updates the automatic parameters (except lights) based on the details provided.
public UpdateAutoParamsNoLights ( AutoParamDataSource source ) : void
source AutoParamDataSource /// A source containing all the updated data to be made available for auto updating /// the GPU program constants. ///
Результат void

Описание свойств

AutoConstantDictionary защищенное статическое свойство

protected static AutoConstantDefinition[] AutoConstantDictionary
Результат AutoConstantDefinition[]

autoAddParamName защищенное свойство

Flag to indicate if names not found will be automatically added.
protected bool autoAddParamName
Результат bool

autoConstantList защищенное свойство

List of automatically updated parameters.
protected AutoConstantEntryList autoConstantList
Результат AutoConstantEntryList

floatConstants защищенное свойство

Table of Vector4 constants by index.
protected FloatConstantEntryList floatConstants
Результат FloatConstantEntryList

ignoreMissingParameters защищенное свойство

protected bool ignoreMissingParameters
Результат bool

intConstants защищенное свойство

Packed list of integer constants
protected IntConstantEntryList intConstants
Результат IntConstantEntryList

namedParams защищенное свойство

Lookup of constant indicies for named parameters.
protected AxiomCollection namedParams
Результат AxiomCollection

paramTypeList защищенное свойство

protected List paramTypeList
Результат List

tmpVals защищенное свойство

Temp array for use when passing constants around.
protected float[] tmpVals
Результат float[]

transposeMatrices защищенное свойство

Specifies whether matrices need to be transposed prior to being sent to the hardware.
protected bool transposeMatrices
Результат bool