Axiom.Graphics.Pass.SetFog C# (CSharp) Method

SetFog() public method

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. ///
return void
		public void SetFog( bool overrideScene, FogMode mode, ColorEx color, float density, float start, float end )
		{
			_fogOverride = overrideScene;

			// set individual params if overriding scene level fog
			if ( overrideScene )
			{
				_fogMode = mode;
				_fogColor = color;
				_fogDensity = density;
				_fogStart = start;
				_fogEnd = end;
			}
		}

Same methods

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

Usage Example

Beispiel #1
0
		public override bool PreAddToRenderState( TargetRenderState targetRenderState, Pass srcPass, Pass dstPass )
		{
			FogMode fMode;
			ColorEx newFogColor;
			Real newFogStart, newFogEnd, newFogDensity;

			if ( srcPass.FogOverride )
			{
				fMode = srcPass.FogMode;
				newFogColor = srcPass.FogColor;
				newFogStart = srcPass.FogStart;
				newFogEnd = srcPass.FogEnd;
				newFogDensity = srcPass.FogDensity;
			}
			else
			{
				var sceneMgr = ShaderGenerator.Instance.ActiveSceneManager;

				if ( sceneMgr == null )
				{
					fMode = FogMode.None;
					newFogColor = ColorEx.White;
					newFogStart = 0.0f;
					newFogEnd = 0.0f;
					newFogDensity = 0.0f;
				}
				else
				{
					fMode = sceneMgr.FogMode;
					newFogColor = sceneMgr.FogColor;
					newFogStart = sceneMgr.FogStart;
					newFogEnd = sceneMgr.FogEnd;
					newFogDensity = sceneMgr.FogDensity;
				}

				this.passOverrideParams = false;
			}
			//Set fog properties
			SetFogProperties( fMode, newFogColor, newFogStart, newFogEnd, newFogDensity );

			//Override scene fog since it will happen in shader
			dstPass.SetFog( true, FogMode.None, newFogColor, newFogDensity, newFogStart, newFogEnd );
			return true;
		}
All Usage Examples Of Axiom.Graphics.Pass::SetFog