C# 클래스 Axiom.Graphics.Pass

Class defining a single pass of a Technique (of a Material), ie a single rendering call.
Rendering can be repeated with many passes for more complex effects. Each pass is either a fixed-function pass (meaning it does not use a vertex or fragment program) or a programmable pass (meaning it does use either a vertex or a fragment program, or both).

Programmable passes are complex to define, because they require custom programs and you have to set all constant inputs to the programs (like the position of lights, any base material colors you wish to use etc), but they do give you much total flexibility over the algorithms used to render your pass, and you can create some effects which are impossible with a fixed-function pass. On the other hand, you can define a fixed-function pass in very little time, and you can use a range of fixed-function effects like environment mapping very easily, plus your pass will be more likely to be compatible with older hardware. There are pros and cons to both, just remember that if you use a programmable pass to create some great effects, allow more time for definition and testing.

상속: DisposableObject
파일 보기 프로젝트 열기: mono-soc-2011/axiom 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
passId int

보호된 프로퍼티들

프로퍼티 타입 설명
nextPassId int
passLock Object
queuedForDeletion bool
shadowCasterVertexProgramUsage GpuProgramUsage
textureUnitStates TextureUnitStateList

Private Properties

프로퍼티 타입 설명
Load void
NotifyNeedsRecompile void
RecalculateHash void
Unload void
UpdateAutoParams void

공개 메소드들

메소드 설명
AddTextureUnitState ( TextureUnitState state ) : void

Adds the passed in TextureUnitState, to the existing Pass.

ApplyTextureAliases ( string>.Dictionary aliasList, bool apply ) : bool
Clone ( Technique parent, int index ) : Pass

Method for cloning a Pass object.

CopyTo ( Pass target ) : void

Copy the details of this pass to the target pass.

CreateTextureUnitState ( ) : TextureUnitState

Overloaded method.

CreateTextureUnitState ( string textureName ) : TextureUnitState

Overloaded method.

CreateTextureUnitState ( string textureName, int texCoordSet ) : TextureUnitState

Inserts a new TextureUnitState object into the Pass.

This unit is is added on top of all previous texture units.

Applies to both fixed-function and programmable passes.

DirtyHash ( ) : void

Mark the hash for this pass as dirty.

GetHashCode ( ) : int

Gets the 'hash' of this pass, ie a precomputed number to use for sorting.

This hash is used to sort passes, and for this reason the pass is hashed using firstly its index (so that all passes are rendered in order), then by the textures which it's TextureUnitState instances are using.

GetTextureUnitState ( int index ) : TextureUnitState

Gets a reference to the TextureUnitState for this pass at the specified indx.

Pass ( Technique parent, int index ) : System

Default constructor.

ProcessPendingUpdates ( ) : void

Process all dirty and pending deletion passes.

QueueForDeletion ( ) : void

Queue this pass for deletion when appropriate.

RemoveAllTextureUnitStates ( ) : void

Removes all texture unit settings from this pass.

RemoveTextureUnitState ( TextureUnitState state ) : void

Removes the specified TextureUnitState from this pass.

RemoveTextureUnitState ( int index ) : void

Removes the specified TextureUnitState from this pass.

SetAlphaRejectSettings ( CompareFunction alphaRejectFunction, int value ) : void

Sets the way the pass will have use alpha to totally reject pixels from the pipeline.

The default is i.e. alpha is not used to reject pixels.

This option applies in both the fixed function and the programmable pipeline.

SetDepthBias ( float constantBias ) : void
SetDepthBias ( float constantBias, float slopeBias ) : void

Sets the depth bias to be used for this Pass.

When polygons are coplanar, you can get problems with 'depth fighting' (or 'z fighting') where the pixels from the two polys compete for the same screen pixel. This is particularly a problem for decals (polys attached to another surface to represent details such as bulletholes etc.).

A way to combat this problem is to use a depth bias to adjust the depth buffer value used for the decal such that it is slightly higher than the true value, ensuring that the decal appears on top. There are two aspects to the biasing, a constant bias value and a slope-relative biasing value, which varies according to the maximum depth slope relative to the camera, ie:

finalBias = maxSlope * slopeScaleBias + constantBias
Note that slope scale bias, whilst more accurate, may be ignored by old hardware.
SetFog ( bool overrideScene ) : void

Overloaded method.

SetFog ( bool overrideScene, FogMode mode ) : void

Overloaded method.

SetFog ( bool overrideScene, FogMode mode, ColorEx color ) : void

Overloaded method.

SetFog ( bool overrideScene, FogMode mode, ColorEx color, float density ) : void

Overloaded method.

SetFog ( bool overrideScene, FogMode mode, ColorEx color, float density, float start, float end ) : void

Sets the fogging mode applied to this pass.

Fogging is an effect that is applied as polys are rendered. Sometimes, you want fog to be applied to an entire scene. Other times, you want it to be applied to a few polygons only. This pass-level specification of fog parameters lets you easily manage both.

The SceneManager class also has a SetFog method which applies scene-level fog. This method lets you change the fog behavior for this pass compared to the standard scene-level fog.

SetFragmentProgram ( string name ) : void

SetFragmentProgram ( string name, bool resetParams ) : void

SetGeometryProgram ( string name ) : void

SetGeometryProgram ( string name, bool resetParams ) : void

SetRunOncePerLight ( bool enabled ) : void
SetRunOncePerLight ( bool enabled, bool onlyForOneLightType ) : void
SetRunOncePerLight ( bool enabled, bool onlyForOneLightType, LightType lightType ) : void

Sets whether or not this pass should be run once per light which can affect the object being rendered.

The default behavior for a pass (when this option is 'false'), is for a pass to be rendered only once, with all the lights which could affect this object set at the same time (up to the maximum lights allowed in the render system, which is typically 8).

Setting this option to 'true' changes this behavior, such that instead of trying to issue render this pass once per object, it is run once per light which can affect this object. In this case, only light index 0 is ever used, and is a different light every time the pass is issued, up to the total number of lights which is affecting this object. This has 2 advantages:

  • There is no limit on the number of lights which can be supported
  • It's easier to write vertex / fragment programs for this because a single program can be used for any number of lights
However, this technique is a lot more expensive, and typically you will want an additional ambient pass, because if no lights are affecting the object it will not be rendered at all, which will look odd even if ambient light is zero (imagine if there are lit objects behind it - the objects silhouette would not show up). Therefore, use this option with care, and you would be well advised to provide a less expensive fallback technique for use in the distance.

Note: The number of times this pass runs is still limited by the maximum number of lights allowed as set in MaxLights, so you will never get more passes than this.

SetSceneBlending ( SceneBlendFactor src, SceneBlendFactor dest ) : void

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

Wheras the texture blending operations seen in the TextureUnitState class are concerned with blending between texture layers, this blending is about combining the output of the material as a whole with the existing contents of the rendering target. This blending therefore allows object transparency and other special effects.

This version of the method allows complete control over the blending operation, by specifying the source and destination blending factors. The result of the blending operation is: final = (texture * sourceFactor) + (pixel * destFactor)

Each of the factors is specified as one of a number of options, as specified in the SceneBlendFactor enumerated type.

This method is applicable for both the fixed-function and programmable pipelines.

SetSceneBlending ( SceneBlendType type ) : void

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

Whereas the texture blending operations seen in the TextureUnitState class are concerned with blending between texture layers, this blending is about combining the output of the Pass as a whole with the existing contents of the rendering target. This blending therefore allows object transparency and other special effects. If all passes in a technique have a scene blend, then the whole technique is considered to be transparent.

This method allows you to select one of a number of predefined blending types. If you require more control than this, use the alternative version of this method which allows you to specify source and destination blend factors.

This method is applicable for both the fixed-function and programmable pipelines.

SetShadowCasterFragmentProgram ( string name ) : void

SetShadowCasterVertexProgram ( string name ) : void

SetShadowReceiverFragmentProgram ( string name ) : void

SetShadowReceiverVertexProgram ( string name ) : void

SetVertexProgram ( string name ) : void

SetVertexProgram ( string name, bool resetParams ) : void

Split ( int numUnits ) : Pass

Splits this Pass to one which can be handled in the number of texture units specified.

UpdateAutoParamsLightsOnly ( AutoParamDataSource source ) : void

Update any automatic light parameters on this pass.

UpdateAutoParamsNoLights ( AutoParamDataSource source ) : void

Update any automatic parameters (except lights) on this pass.

비공개 메소드들

메소드 설명
Load ( ) : void

Internal method for loading this pass.

NotifyNeedsRecompile ( ) : void

Tells the pass that it needs recompilation.

RecalculateHash ( ) : void

Internal method for recalculating the hash code used for sorting passes.

Unload ( ) : void

Internal method for unloaded this pass.

UpdateAutoParams ( AutoParamDataSource source, GpuProgramParameters mask ) : void

메소드 상세

AddTextureUnitState() 공개 메소드

Adds the passed in TextureUnitState, to the existing Pass.
public AddTextureUnitState ( TextureUnitState state ) : void
state TextureUnitState TextureUnitState to add to this pass.
리턴 void

ApplyTextureAliases() 공개 메소드

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

Clone() 공개 메소드

Method for cloning a Pass object.
public Clone ( Technique parent, int index ) : Pass
parent Technique Parent technique that will own this cloned Pass.
index int
리턴 Pass

CopyTo() 공개 메소드

Copy the details of this pass to the target pass.
public CopyTo ( Pass target ) : void
target Pass Destination pass to copy this pass's attributes to.
리턴 void

CreateTextureUnitState() 공개 메소드

Overloaded method.
public CreateTextureUnitState ( ) : TextureUnitState
리턴 TextureUnitState

CreateTextureUnitState() 공개 메소드

Overloaded method.
public CreateTextureUnitState ( string textureName ) : TextureUnitState
textureName string The basic name of the texture (i.e. brickwall.jpg)
리턴 TextureUnitState

CreateTextureUnitState() 공개 메소드

Inserts a new TextureUnitState object into the Pass.
This unit is is added on top of all previous texture units.

Applies to both fixed-function and programmable passes.

public CreateTextureUnitState ( string textureName, int texCoordSet ) : TextureUnitState
textureName string The basic name of the texture (i.e. brickwall.jpg)
texCoordSet int The index of the texture coordinate set to use.
리턴 TextureUnitState

DirtyHash() 공개 메소드

Mark the hash for this pass as dirty.
public DirtyHash ( ) : void
리턴 void

GetHashCode() 공개 메소드

Gets the 'hash' of this pass, ie a precomputed number to use for sorting.
This hash is used to sort passes, and for this reason the pass is hashed using firstly its index (so that all passes are rendered in order), then by the textures which it's TextureUnitState instances are using.
public GetHashCode ( ) : int
리턴 int

GetTextureUnitState() 공개 메소드

Gets a reference to the TextureUnitState for this pass at the specified indx.
public GetTextureUnitState ( int index ) : TextureUnitState
index int Index of the state to retreive.
리턴 TextureUnitState

Pass() 공개 메소드

Default constructor.
public Pass ( Technique parent, int index ) : System
parent Technique Technique that owns this Pass.
index int Index of this pass.
리턴 System

ProcessPendingUpdates() 공개 정적인 메소드

Process all dirty and pending deletion passes.
public static ProcessPendingUpdates ( ) : void
리턴 void

QueueForDeletion() 공개 메소드

Queue this pass for deletion when appropriate.
public QueueForDeletion ( ) : void
리턴 void

RemoveAllTextureUnitStates() 공개 메소드

Removes all texture unit settings from this pass.
public RemoveAllTextureUnitStates ( ) : void
리턴 void

RemoveTextureUnitState() 공개 메소드

Removes the specified TextureUnitState from this pass.
public RemoveTextureUnitState ( TextureUnitState state ) : void
state TextureUnitState A reference to the TextureUnitState to remove from this pass.
리턴 void

RemoveTextureUnitState() 공개 메소드

Removes the specified TextureUnitState from this pass.
public RemoveTextureUnitState ( int index ) : void
index int Index of the TextureUnitState to remove from this pass.
리턴 void

SetAlphaRejectSettings() 공개 메소드

Sets the way the pass will have use alpha to totally reject pixels from the pipeline.
The default is i.e. alpha is not used to reject pixels.

This option applies in both the fixed function and the programmable pipeline.

public SetAlphaRejectSettings ( CompareFunction alphaRejectFunction, int value ) : void
alphaRejectFunction CompareFunction The comparison which must pass for the pixel to be written.
value int value against which alpha values will be tested [(0-255]
리턴 void

SetDepthBias() 공개 메소드

public SetDepthBias ( float constantBias ) : void
constantBias float
리턴 void

SetDepthBias() 공개 메소드

Sets the depth bias to be used for this Pass.
When polygons are coplanar, you can get problems with 'depth fighting' (or 'z fighting') where the pixels from the two polys compete for the same screen pixel. This is particularly a problem for decals (polys attached to another surface to represent details such as bulletholes etc.).

A way to combat this problem is to use a depth bias to adjust the depth buffer value used for the decal such that it is slightly higher than the true value, ensuring that the decal appears on top. There are two aspects to the biasing, a constant bias value and a slope-relative biasing value, which varies according to the maximum depth slope relative to the camera, ie:

finalBias = maxSlope * slopeScaleBias + constantBias
Note that slope scale bias, whilst more accurate, may be ignored by old hardware.
public SetDepthBias ( float constantBias, float slopeBias ) : void
constantBias float The constant bias value, expressed as a factor of the minimum observable depth
slopeBias float The slope-relative bias value, expressed as a factor of the depth slope
리턴 void

SetFog() 공개 메소드

Overloaded method.
public SetFog ( bool overrideScene ) : void
overrideScene bool /// If true, you authorise this pass to override the scene's fog params with it's own settings. /// If you specify false, so other parameters are necessary, and this is the default behaviour for passs. ///
리턴 void

SetFog() 공개 메소드

Overloaded method.
public SetFog ( bool overrideScene, FogMode mode ) : void
overrideScene bool /// If true, you authorise this pass to override the scene's fog params with it's own settings. /// If you specify false, so other parameters are necessary, and this is the default behaviour for passs. ///
mode FogMode /// Only applicable if is true. You can disable fog which is turned on for the /// rest of the scene by specifying FogMode.None. Otherwise, set a pass-specific fog mode as /// defined in the enum FogMode. ///
리턴 void

SetFog() 공개 메소드

Overloaded method.
public SetFog ( bool overrideScene, FogMode mode, ColorEx color ) : void
overrideScene bool /// If true, you authorise this pass to override the scene's fog params with it's own settings. /// If you specify false, so other parameters are necessary, and this is the default behaviour for passs. ///
mode FogMode /// Only applicable if is true. You can disable fog which is turned on for the /// rest of the scene by specifying FogMode.None. Otherwise, set a pass-specific fog mode as /// defined in the enum FogMode. ///
color ColorEx /// The color of the fog. Either set this to the same as your viewport background color, /// or to blend in with a skydome or skybox. ///
리턴 void

SetFog() 공개 메소드

Overloaded method.
public SetFog ( bool overrideScene, FogMode mode, ColorEx color, float density ) : void
overrideScene bool /// If true, you authorise this pass to override the scene's fog params with it's own settings. /// If you specify false, so other parameters are necessary, and this is the default behaviour for passs. ///
mode FogMode /// Only applicable if is true. You can disable fog which is turned on for the /// rest of the scene by specifying FogMode.None. Otherwise, set a pass-specific fog mode as /// defined in the enum FogMode. ///
color ColorEx /// The color of the fog. Either set this to the same as your viewport background color, /// or to blend in with a skydome or skybox. ///
density float /// The density of the fog in FogMode.Exp or FogMode.Exp2 mode, as a value between 0 and 1. /// The default is 0.001. ///
리턴 void

SetFog() 공개 메소드

Sets the fogging mode applied to this pass.
Fogging is an effect that is applied as polys are rendered. Sometimes, you want fog to be applied to an entire scene. Other times, you want it to be applied to a few polygons only. This pass-level specification of fog parameters lets you easily manage both.

The SceneManager class also has a SetFog method which applies scene-level fog. This method lets you change the fog behavior for this pass compared to the standard scene-level fog.

public SetFog ( bool overrideScene, FogMode mode, ColorEx color, float density, float start, float end ) : void
overrideScene bool /// If true, you authorise this pass to override the scene's fog params with it's own settings. /// If you specify false, so other parameters are necessary, and this is the default behaviour for passs. ///
mode FogMode /// Only applicable if is true. You can disable fog which is turned on for the /// rest of the scene by specifying FogMode.None. Otherwise, set a pass-specific fog mode as /// defined in the enum FogMode. ///
color ColorEx /// The color of the fog. Either set this to the same as your viewport background color, /// or to blend in with a skydome or skybox. ///
density float /// The density of the fog in FogMode.Exp or FogMode.Exp2 mode, as a value between 0 and 1. /// The default is 0.001. ///
start float /// Distance in world units at which linear fog starts to encroach. /// Only applicable if mode is FogMode.Linear. ///
end float /// Distance in world units at which linear fog becomes completely opaque. /// Only applicable if mode is FogMode.Linear. ///
리턴 void

SetFragmentProgram() 공개 메소드

public SetFragmentProgram ( string name ) : void
name string
리턴 void

SetFragmentProgram() 공개 메소드

public SetFragmentProgram ( string name, bool resetParams ) : void
name string
resetParams bool
리턴 void

SetGeometryProgram() 공개 메소드

public SetGeometryProgram ( string name ) : void
name string
리턴 void

SetGeometryProgram() 공개 메소드

public SetGeometryProgram ( string name, bool resetParams ) : void
name string
resetParams bool
리턴 void

SetRunOncePerLight() 공개 메소드

public SetRunOncePerLight ( bool enabled ) : void
enabled bool
리턴 void

SetRunOncePerLight() 공개 메소드

public SetRunOncePerLight ( bool enabled, bool onlyForOneLightType ) : void
enabled bool
onlyForOneLightType bool
리턴 void

SetRunOncePerLight() 공개 메소드

Sets whether or not this pass should be run once per light which can affect the object being rendered.
The default behavior for a pass (when this option is 'false'), is for a pass to be rendered only once, with all the lights which could affect this object set at the same time (up to the maximum lights allowed in the render system, which is typically 8).

Setting this option to 'true' changes this behavior, such that instead of trying to issue render this pass once per object, it is run once per light which can affect this object. In this case, only light index 0 is ever used, and is a different light every time the pass is issued, up to the total number of lights which is affecting this object. This has 2 advantages:

  • There is no limit on the number of lights which can be supported
  • It's easier to write vertex / fragment programs for this because a single program can be used for any number of lights
However, this technique is a lot more expensive, and typically you will want an additional ambient pass, because if no lights are affecting the object it will not be rendered at all, which will look odd even if ambient light is zero (imagine if there are lit objects behind it - the objects silhouette would not show up). Therefore, use this option with care, and you would be well advised to provide a less expensive fallback technique for use in the distance.

Note: The number of times this pass runs is still limited by the maximum number of lights allowed as set in MaxLights, so you will never get more passes than this.

public SetRunOncePerLight ( bool enabled, bool onlyForOneLightType, LightType lightType ) : void
enabled bool Whether this feature is enabled.
onlyForOneLightType bool /// If true, the pass will only be run for a single type of light, other light types will be ignored. ///
lightType LightType The single light type which will be considered for this pass.
리턴 void

SetSceneBlending() 공개 메소드

Allows very fine control of blending this Pass with the existing contents of the scene.
Wheras the texture blending operations seen in the TextureUnitState class are concerned with blending between texture layers, this blending is about combining the output of the material as a whole with the existing contents of the rendering target. This blending therefore allows object transparency and other special effects.

This version of the method allows complete control over the blending operation, by specifying the source and destination blending factors. The result of the blending operation is: final = (texture * sourceFactor) + (pixel * destFactor)

Each of the factors is specified as one of a number of options, as specified in the SceneBlendFactor enumerated type.

This method is applicable for both the fixed-function and programmable pipelines.

public SetSceneBlending ( SceneBlendFactor src, SceneBlendFactor dest ) : void
src SceneBlendFactor The source factor in the above calculation, i.e. multiplied by the texture color components.
dest SceneBlendFactor The destination factor in the above calculation, i.e. multiplied by the pixel color components.
리턴 void

SetSceneBlending() 공개 메소드

Sets the kind of blending this pass has with the existing contents of the scene.
Whereas the texture blending operations seen in the TextureUnitState class are concerned with blending between texture layers, this blending is about combining the output of the Pass as a whole with the existing contents of the rendering target. This blending therefore allows object transparency and other special effects. If all passes in a technique have a scene blend, then the whole technique is considered to be transparent.

This method allows you to select one of a number of predefined blending types. If you require more control than this, use the alternative version of this method which allows you to specify source and destination blend factors.

This method is applicable for both the fixed-function and programmable pipelines.

public SetSceneBlending ( SceneBlendType type ) : void
type SceneBlendType One of the predefined SceneBlendType blending types.
리턴 void

SetShadowCasterFragmentProgram() 공개 메소드

public SetShadowCasterFragmentProgram ( string name ) : void
name string
리턴 void

SetShadowCasterVertexProgram() 공개 메소드

public SetShadowCasterVertexProgram ( string name ) : void
name string
리턴 void

SetShadowReceiverFragmentProgram() 공개 메소드

public SetShadowReceiverFragmentProgram ( string name ) : void
name string
리턴 void

SetShadowReceiverVertexProgram() 공개 메소드

public SetShadowReceiverVertexProgram ( string name ) : void
name string
리턴 void

SetVertexProgram() 공개 메소드

public SetVertexProgram ( string name ) : void
name string
리턴 void

SetVertexProgram() 공개 메소드

public SetVertexProgram ( string name, bool resetParams ) : void
name string
resetParams bool
리턴 void

Split() 공개 메소드

Splits this Pass to one which can be handled in the number of texture units specified.
public Split ( int numUnits ) : Pass
numUnits int /// The target number of texture units. ///
리턴 Pass

UpdateAutoParamsLightsOnly() 공개 메소드

Update any automatic light parameters on this pass.
public UpdateAutoParamsLightsOnly ( AutoParamDataSource source ) : void
source AutoParamDataSource
리턴 void

UpdateAutoParamsNoLights() 공개 메소드

Update any automatic parameters (except lights) on this pass.
public UpdateAutoParamsNoLights ( AutoParamDataSource source ) : void
source AutoParamDataSource
리턴 void

프로퍼티 상세

nextPassId 보호되어 있는 정적으로 프로퍼티

protected static int nextPassId
리턴 int

passId 공개적으로 프로퍼티

public int passId
리턴 int

passLock 보호되어 있는 정적으로 프로퍼티

protected static Object passLock
리턴 Object

queuedForDeletion 보호되어 있는 프로퍼티

Is this pass queued for deletion?
protected bool queuedForDeletion
리턴 bool

shadowCasterVertexProgramUsage 보호되어 있는 프로퍼티

Details on the shadow caster vertex program to be used for this pass.
protected GpuProgramUsage shadowCasterVertexProgramUsage
리턴 GpuProgramUsage

textureUnitStates 보호되어 있는 프로퍼티

List of fixed function texture unit states for this pass.
protected TextureUnitStateList textureUnitStates
리턴 TextureUnitStateList