/// <summary> /// /// </summary> /// <param name="mode"></param> /// <returns></returns> public static D3D.FogMode ConvertEnum(Axiom.Graphics.FogMode mode) { // convert the fog mode value switch (mode) { case Axiom.Graphics.FogMode.Exp: return(D3D.FogMode.Exp); case Axiom.Graphics.FogMode.Exp2: return(D3D.FogMode.Exp2); case Axiom.Graphics.FogMode.Linear: return(D3D.FogMode.Linear); } // switch return(0); }
public override void SetFog( FogMode mode, ColorEx color, Real density, Real start, Real end) { RenderState fogType, fogTypeNot; if ((_deviceManager.ActiveDevice.D3D9DeviceCaps.RasterCaps & RasterCaps.FogTable) != 0) { fogType = RenderState.FogTableMode; fogTypeNot = RenderState.FogVertexMode; } else { fogType = RenderState.FogVertexMode; fogTypeNot = RenderState.FogTableMode; } if ( mode == FogMode.None ) { // just disable SetRenderState( RenderState.FogTableMode, (int)D3D.FogMode.None ); SetRenderState( RenderState.FogEnable, false ); } else { // Allow fog SetRenderState(RenderState.FogEnable, true); SetRenderState(fogTypeNot, (int)FogMode.None); SetRenderState(fogType, (int)D3DHelper.ConvertEnum(mode)); SetRenderState( RenderState.FogColor, D3DHelper.ToColor( color ).ToArgb() ); SetFloatRenderState( RenderState.FogStart, start ); SetFloatRenderState(RenderState.FogEnd, end); SetFloatRenderState(RenderState.FogDensity, density); } }