C# Class Axiom.Graphics.Material

Class encapsulating the rendering properties of an object.
Inheritance: Axiom.Core.Resource, IComparable
Afficher le fichier Open project: WolfgangSt/axiom Class Usage Examples

Protected Properties

Свойство Type Description
UserLodValues LodValueList
autoNumber int
bestTechniquesByScheme Dictionary>
defaultSettings Material

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
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

Private Methods

Méthode Description
ClearBestTechniqueList ( ) : void
InsertSupportedTechnique ( Technique technique ) : void
NotifyNeedsRecompile ( ) : void

Tells the material that it needs recompilation.

Method Details

ApplyDefaults() public méthode

public ApplyDefaults ( ) : void
Résultat void

ApplyTextureAliases() public méthode

public ApplyTextureAliases ( string>.Dictionary aliasList ) : bool
aliasList string>.Dictionary
Résultat bool

ApplyTextureAliases() public méthode

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.
Résultat bool

Clone() public méthode

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.
Résultat Material

Clone() public méthode

public Clone ( string newName, bool changeGroup, string newGroup ) : Material
newName string
changeGroup bool
newGroup string
Résultat Material

CompareTo() public méthode

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
Résultat int

Compile() public méthode

'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
Résultat void

Compile() public méthode

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. ///
Résultat void

CopyTo() public méthode

Copies the details from the supplied material.
public CopyTo ( Material target ) : void
target Material Material which will receive this material's settings.
Résultat void

CopyTo() public méthode

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.
Résultat void

CreateTechnique() public méthode

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
Résultat Technique

GetBestTechnique() public méthode

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
Résultat Technique

GetBestTechnique() public méthode

public GetBestTechnique ( int lodIndex ) : Technique
lodIndex int
Résultat Technique

GetBestTechnique() public méthode

public GetBestTechnique ( int lodIndex, IRenderable renderable ) : Technique
lodIndex int
renderable IRenderable
Résultat Technique

GetHashCode() public méthode

Overridden to give Materials a meaningful hash code.
public GetHashCode ( ) : int
Résultat int

GetLodIndex() public méthode

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
Résultat int

GetTechnique() public méthode

Gets the technique at the specified index.
public GetTechnique ( int index ) : Technique
index int Index of the technique to return.
Résultat Technique

Material() public méthode

public Material ( ResourceManager parent, string name, System.UInt64 handle, string group ) : System
parent Axiom.Core.ResourceManager
name string
handle System.UInt64
group string
Résultat System

Material() public méthode

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
Résultat System

RemoveAllTechniques() public méthode

Removes all techniques from this material.
public RemoveAllTechniques ( ) : void
Résultat void

RemoveTechnique() public méthode

Removes the specified Technique from this material.
public RemoveTechnique ( Technique t ) : void
t Technique A reference to the technique to remove
Résultat void

SetFog() public méthode

public SetFog ( bool overrideScene ) : void
overrideScene bool
Résultat void

SetFog() public méthode

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
Résultat void

SetLodLevels() public méthode

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). ///
Résultat void

SetSceneBlending() public méthode

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
Résultat void

SetSceneBlending() public méthode

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
Résultat void

ToString() public méthode

Overridden.
public ToString ( ) : string
Résultat string

Touch() public méthode

Overridden to ensure a recompile occurs if needed before use.
public Touch ( ) : void
Résultat void

calculateSize() protected méthode

Calculate the size of a material; this will only be called after 'load'
protected calculateSize ( ) : int
Résultat int

dispose() protected méthode

Overridden to ensure a release of techniques.
protected dispose ( bool disposeManagedResources ) : void
disposeManagedResources bool
Résultat void

load() protected méthode

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
Résultat void

unload() protected méthode

Unloads the material, frees resources etc. Resource
protected unload ( ) : void
Résultat void

Property Details

UserLodValues protected_oe property

List of LOD distances specified for this material.
protected LodValueList UserLodValues
Résultat LodValueList

autoNumber protected_oe static_oe property

Auto incrementing number for creating unique names.
protected static int autoNumber
Résultat int

bestTechniquesByScheme protected_oe property

protected Dictionary> bestTechniquesByScheme
Résultat Dictionary>

defaultSettings protected_oe static_oe property

A reference to a precreated Material that contains all the default settings.
protected static Material,Axiom.Graphics defaultSettings
Résultat Material