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

Class encapsulating the rendering properties of an object.
Наследование: Axiom.Core.Resource, IComparable
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
UserLodValues LodValueList
autoNumber int
bestTechniquesByScheme Dictionary>
defaultSettings Material

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

Метод Описание
ApplyDefaults ( ) : void

ApplyTextureAliases ( string>.Dictionary aliasList ) : bool
ApplyTextureAliases ( string>.Dictionary aliasList, bool apply ) : bool

Applies texture names to Texture Unit State with matching texture name aliases. All techniques, passes, and Texture Unit States within the material are checked. If matching texture aliases are found then true is returned.

Clone ( string newName ) : Material

Creates a copy of this Material with the specified name (must be unique).

Clone ( string newName, bool changeGroup, string newGroup ) : Material
CompareTo ( object obj ) : int

Used for comparing 2 Material objects.

This comparison will be used in RenderQueue group sorting of Materials materials. If this object is transparent and the object being compared is not, this is greater that obj. If this object is not transparent and the object being compared is, obj is greater than this.

Compile ( ) : void

'Compiles' this Material.

Compiling a material involves determining which Techniques are supported on the card on which the engine is currently running, and for fixed-function Passes within those Techniques, splitting the passes down where they contain more TextureUnitState instances than the current card has texture units.

This process is automatically done when the Material is loaded, but may be repeated if you make some procedural changes.By default, the engine will automatically split texture unit operations into multiple passes when the target hardware does not have enough texture units.

Compile ( bool autoManageTextureUnits ) : void
CopyTo ( Material target ) : void

Copies the details from the supplied material.

CopyTo ( Material target, bool copyUniqueInfo ) : void
CreateTechnique ( ) : Technique

Creates a new Technique for this Material.

A Technique is a single way of rendering geometry in order to achieve the effect you are intending in a material. There are many reason why you would want more than one - the main one being to handle variable graphics card abilities; you might have one technique which is impressive but only runs on 4th-generation graphics cards, for example. In this case you will want to create at least one fallback Technique. The engine will work out which Techniques a card can support and pick the best one.

If multiple Techniques are available, the order in which they are created is important - the engine will consider lower-indexed Techniques to be preferable to higher-indexed Techniques, ie when asked for the 'best' technique it will return the first one in the technique list which is supported by the hardware.

GetBestTechnique ( ) : Technique

Gets the best supported technique.

This method returns the lowest-index supported Technique in this material (since lower-indexed Techniques are considered to be better than higher-indexed ones).

The best supported technique is only available after this material has been compiled, which typically happens on loading the material. Therefore, if this method returns null, try calling Material.Load.

GetBestTechnique ( int lodIndex ) : Technique
GetBestTechnique ( int lodIndex, IRenderable renderable ) : Technique
GetHashCode ( ) : int

Overridden to give Materials a meaningful hash code.

GetLodIndex ( Real distance ) : int

Gets the LOD index to use at the given distance.

The value passed in is the 'transformed' value. If you are dealing with an original source value (e.g. distance), use to turn this into a lookup value.

GetTechnique ( int index ) : Technique

Gets the technique at the specified index.

Material ( ResourceManager parent, string name, System.UInt64 handle, string group ) : System
Material ( ResourceManager parent, string name, System.UInt64 handle, string group, bool isManual, IManualResourceLoader loader ) : System
RemoveAllTechniques ( ) : void

Removes all techniques from this material.

RemoveTechnique ( Technique t ) : void

Removes the specified Technique from this material.

SetFog ( bool overrideScene ) : void
SetFog ( bool overrideScene, FogMode mode, ColorEx color, System.Single expDensity, System.Single linearStart, System.Single linearEnd ) : void

Sets the fogging mode applied to each pass.

This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.

SetLodLevels ( LodValueList lodDistanceList ) : void

Sets the distance at which level-of-detail (LOD) levels come into effect.

You should only use this if you have assigned LOD indexes to the Technique instances attached to this Material. If you have done so, you should call this method to determine the distance at which the low levels of detail kick in. The decision about what distance is actually used is a combination of this and the LOD bias applied to both the current Camera and the current Entity.

SetSceneBlending ( SceneBlendFactor src, SceneBlendFactor dest ) : void

Allows very fine control of blending every Pass with the existing contents of the scene.

This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.

SetSceneBlending ( SceneBlendType blendType ) : void

Sets the kind of blending every pass has with the existing contents of the scene.

This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.

ToString ( ) : string

Overridden.

Touch ( ) : void

Overridden to ensure a recompile occurs if needed before use.

Защищенные методы

Метод Описание
calculateSize ( ) : int

Calculate the size of a material; this will only be called after 'load'

dispose ( bool disposeManagedResources ) : void

Overridden to ensure a release of techniques.

load ( ) : void

Overridden from Resource.

By default, Materials are not loaded, and adding additional textures etc do not cause those textures to be loaded. When the Load method is called, all textures are loaded (if they are not already), GPU programs are created if applicable, and Controllers are instantiated. Once a material has been loaded, all changes made to it are immediately loaded too

unload ( ) : void

Unloads the material, frees resources etc. Resource

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

Метод Описание
ClearBestTechniqueList ( ) : void
InsertSupportedTechnique ( Technique technique ) : void
NotifyNeedsRecompile ( ) : void

Tells the material that it needs recompilation.

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

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

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

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

public ApplyTextureAliases ( string>.Dictionary aliasList ) : bool
aliasList string>.Dictionary
Результат bool

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

Applies texture names to Texture Unit State with matching texture name aliases. All techniques, passes, and Texture Unit States within the material are checked. If matching texture aliases are found then true is returned.
public ApplyTextureAliases ( string>.Dictionary aliasList, bool apply ) : bool
aliasList string>.Dictionary is a map container of texture alias, texture name pairs
apply bool set true to apply the texture aliases else just test to see if texture alias matches are found.
Результат bool

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

Creates a copy of this Material with the specified name (must be unique).
public Clone ( string newName ) : Material
newName string The name that the cloned material will be known as.
Результат Material

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

public Clone ( string newName, bool changeGroup, string newGroup ) : Material
newName string
changeGroup bool
newGroup string
Результат Material

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

Used for comparing 2 Material objects.
This comparison will be used in RenderQueue group sorting of Materials materials. If this object is transparent and the object being compared is not, this is greater that obj. If this object is not transparent and the object being compared is, obj is greater than this.
public CompareTo ( object obj ) : int
obj object
Результат int

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

'Compiles' this Material.
Compiling a material involves determining which Techniques are supported on the card on which the engine is currently running, and for fixed-function Passes within those Techniques, splitting the passes down where they contain more TextureUnitState instances than the current card has texture units.

This process is automatically done when the Material is loaded, but may be repeated if you make some procedural changes. By default, the engine will automatically split texture unit operations into multiple passes when the target hardware does not have enough texture units.

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

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

public Compile ( bool autoManageTextureUnits ) : void
autoManageTextureUnits bool /// If true, when a fixed function pass has too many TextureUnitState /// entries than the card has texture units, the Pass in question will be split into /// more than one Pass in order to emulate the Pass. If you set this to false and /// this situation arises, an Exception will be thrown. ///
Результат void

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

Copies the details from the supplied material.
public CopyTo ( Material target ) : void
target Material Material which will receive this material's settings.
Результат void

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

public CopyTo ( Material target, bool copyUniqueInfo ) : void
target Material
copyUniqueInfo bool preserves the target's handle, group, name, and loading properties (unlike operator=) but copying everything else.
Результат void

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

Creates a new Technique for this Material.
A Technique is a single way of rendering geometry in order to achieve the effect you are intending in a material. There are many reason why you would want more than one - the main one being to handle variable graphics card abilities; you might have one technique which is impressive but only runs on 4th-generation graphics cards, for example. In this case you will want to create at least one fallback Technique. The engine will work out which Techniques a card can support and pick the best one.

If multiple Techniques are available, the order in which they are created is important - the engine will consider lower-indexed Techniques to be preferable to higher-indexed Techniques, ie when asked for the 'best' technique it will return the first one in the technique list which is supported by the hardware.

public CreateTechnique ( ) : Technique
Результат Technique

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

Gets the best supported technique.
This method returns the lowest-index supported Technique in this material (since lower-indexed Techniques are considered to be better than higher-indexed ones).

The best supported technique is only available after this material has been compiled, which typically happens on loading the material. Therefore, if this method returns null, try calling Material.Load.

public GetBestTechnique ( ) : Technique
Результат Technique

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

public GetBestTechnique ( int lodIndex ) : Technique
lodIndex int
Результат Technique

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

public GetBestTechnique ( int lodIndex, IRenderable renderable ) : Technique
lodIndex int
renderable IRenderable
Результат Technique

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

Overridden to give Materials a meaningful hash code.
public GetHashCode ( ) : int
Результат int

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

Gets the LOD index to use at the given distance.
The value passed in is the 'transformed' value. If you are dealing with an original source value (e.g. distance), use to turn this into a lookup value.
public GetLodIndex ( Real distance ) : int
distance Real
Результат int

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

Gets the technique at the specified index.
public GetTechnique ( int index ) : Technique
index int Index of the technique to return.
Результат Technique

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

public Material ( ResourceManager parent, string name, System.UInt64 handle, string group ) : System
parent Axiom.Core.ResourceManager
name string
handle System.UInt64
group string
Результат System

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

public Material ( ResourceManager parent, string name, System.UInt64 handle, string group, bool isManual, IManualResourceLoader loader ) : System
parent Axiom.Core.ResourceManager
name string
handle System.UInt64
group string
isManual bool
loader IManualResourceLoader
Результат System

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

Removes all techniques from this material.
public RemoveAllTechniques ( ) : void
Результат void

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

Removes the specified Technique from this material.
public RemoveTechnique ( Technique t ) : void
t Technique A reference to the technique to remove
Результат void

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

public SetFog ( bool overrideScene ) : void
overrideScene bool
Результат void

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

Sets the fogging mode applied to each pass.
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
public SetFog ( bool overrideScene, FogMode mode, ColorEx color, System.Single expDensity, System.Single linearStart, System.Single linearEnd ) : void
overrideScene bool
mode FogMode
color ColorEx
expDensity System.Single
linearStart System.Single
linearEnd System.Single
Результат void

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

Sets the distance at which level-of-detail (LOD) levels come into effect.
You should only use this if you have assigned LOD indexes to the Technique instances attached to this Material. If you have done so, you should call this method to determine the distance at which the low levels of detail kick in. The decision about what distance is actually used is a combination of this and the LOD bias applied to both the current Camera and the current Entity.
public SetLodLevels ( LodValueList lodDistanceList ) : void
lodDistanceList LodValueList /// A list of floats which indicate the distance at which to /// switch to lower details. They are listed in LOD index order, starting at index /// 1 (ie the first level down from the highest level 0, which automatically applies /// from a distance of 0). ///
Результат void

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

Allows very fine control of blending every Pass with the existing contents of the scene.
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
public SetSceneBlending ( SceneBlendFactor src, SceneBlendFactor dest ) : void
src SceneBlendFactor
dest SceneBlendFactor
Результат void

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

Sets the kind of blending every pass has with the existing contents of the scene.
This property has been moved to the Pass class, which is accessible via the Technique. For simplicity, this method allows you to set these properties for every current Technique, and for every current Pass within those Techniques. If you need more precision, retrieve the Technique and Pass instances and set the property there.
public SetSceneBlending ( SceneBlendType blendType ) : void
blendType SceneBlendType
Результат void

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

Overridden.
public ToString ( ) : string
Результат string

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

Overridden to ensure a recompile occurs if needed before use.
public Touch ( ) : void
Результат void

calculateSize() защищенный Метод

Calculate the size of a material; this will only be called after 'load'
protected calculateSize ( ) : int
Результат int

dispose() защищенный Метод

Overridden to ensure a release of techniques.
protected dispose ( bool disposeManagedResources ) : void
disposeManagedResources bool
Результат void

load() защищенный Метод

Overridden from Resource.
By default, Materials are not loaded, and adding additional textures etc do not cause those textures to be loaded. When the Load method is called, all textures are loaded (if they are not already), GPU programs are created if applicable, and Controllers are instantiated. Once a material has been loaded, all changes made to it are immediately loaded too
protected load ( ) : void
Результат void

unload() защищенный Метод

Unloads the material, frees resources etc. Resource
protected unload ( ) : void
Результат void

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

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

List of LOD distances specified for this material.
protected LodValueList UserLodValues
Результат LodValueList

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

Auto incrementing number for creating unique names.
protected static int autoNumber
Результат int

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

protected Dictionary> bestTechniquesByScheme
Результат Dictionary>

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

A reference to a precreated Material that contains all the default settings.
protected static Material,Axiom.Graphics defaultSettings
Результат Material