/// <summary>
        ///		Helper method to convert Axiom scene blend factors to D3D
        /// </summary>
        /// <param name="factor"></param>
        /// <returns></returns>
        public static D3D.Blend ConvertEnum(SceneBlendFactor factor)
        {
            D3D.Blend d3dBlend = 0;

            switch (factor)
            {
            case SceneBlendFactor.One:
                d3dBlend = Blend.One;
                break;

            case SceneBlendFactor.Zero:
                d3dBlend = Blend.Zero;
                break;

            case SceneBlendFactor.DestColor:
                d3dBlend = Blend.DestinationColor;
                break;

            case SceneBlendFactor.SourceColor:
                d3dBlend = Blend.SourceColor;
                break;

            case SceneBlendFactor.OneMinusDestColor:
                d3dBlend = Blend.InvDestinationColor;
                break;

            case SceneBlendFactor.OneMinusSourceColor:
                d3dBlend = Blend.InvSourceColor;
                break;

            case SceneBlendFactor.DestAlpha:
                d3dBlend = Blend.DestinationAlpha;
                break;

            case SceneBlendFactor.SourceAlpha:
                d3dBlend = Blend.SourceAlpha;
                break;

            case SceneBlendFactor.OneMinusDestAlpha:
                d3dBlend = Blend.InvDestinationAlpha;
                break;

            case SceneBlendFactor.OneMinusSourceAlpha:
                d3dBlend = Blend.InvSourceAlpha;
                break;
            }

            return(d3dBlend);
        }
        public void RenderPlanet()
        {
            transform_world();

            if (!OuterSpace.theGameState.IsGameInState(OuterSpace.GameStates.DockedAtStation))
            {
                OuterSpace.d3d_scene.SetupLights();
                OuterSpace.d3d_scene.transformView_Projection();
            }
            else
            {
                OuterSpace.d3d_scene.transformView_Projection(new Vector3(0.0F, 0.0F, -80.0F),
                                                              new Vector3(0.0F, 0.0F, 0.0F), new Vector3(0.0F, 1.0F, 0.0F),
                                                              Convert.ToSingle(Math.PI / 2.0), OuterSpace.ClientArea.Width / OuterSpace.ClientArea.Height,
                                                              0.01F, 1000.0F);
            }

            OuterSpace.d3d_scene.transform_Pipeline();

            OuterSpace.device.RenderState.AlphaBlendEnable = false;

            OuterSpace.device.SetTexture(0, texture);
            OuterSpace.device.TextureState[0].ColorOperation = TextureOperation.Modulate;
            OuterSpace.device.TextureState[0].ColorArgument1 = TextureArgument.TextureColor;
            OuterSpace.device.TextureState[0].ColorArgument2 = TextureArgument.Diffuse;
            OuterSpace.device.TextureState[0].AlphaOperation = TextureOperation.Disable;
            OuterSpace.device.SetStreamSource(0, vertexBuffer, 0);
            OuterSpace.device.VertexFormat = CustomVertex.PositionNormalTextured.Format;
            OuterSpace.device.DrawPrimitives(PrimitiveType.TriangleList, 0, startSphere.maxtriangles);

            //If (OuterSpace.theGameState.IsGameInState(OuterSpace.GameStates.DockedAtStation)) Then
            OuterSpace.device.RenderState.AlphaBlendEnable = true;

            Microsoft.DirectX.Direct3D.Cull           oldCull      = OuterSpace.device.RenderState.CullMode;
            Microsoft.DirectX.Direct3D.Blend          oldSrcBlend  = OuterSpace.device.RenderState.SourceBlend;
            Microsoft.DirectX.Direct3D.Blend          OldDestBlend = OuterSpace.device.RenderState.DestinationBlend;
            Microsoft.DirectX.Direct3D.BlendOperation oldBlendOp   = OuterSpace.device.RenderState.BlendOperation;

            if (Environment.TickCount % 5000 == 0)
            {
                jBlend++;
                if (jBlend > 15)
                {
                    iBlend += 1;
                    jBlend  = 1;
                }

                if (iBlend > 15)
                {
                    iBlend = 1;
                }
            }

            OuterSpace.device.RenderState.CullMode         = Cull.CounterClockwise;
            OuterSpace.device.RenderState.SourceBlend      = Blend.SourceColor;
            OuterSpace.device.RenderState.DestinationBlend = Blend.BothSourceAlpha;
            OuterSpace.device.RenderState.BlendOperation   = BlendOperation.Add;

            // render clouds around planet
            OuterSpace.d3d_scene.transformWorld(Matrix.Zero, Matrix.RotationY(fCloudRotAngle),
                                                Matrix.Zero, Matrix.Scaling(1.135F, 1.135F, 1.135F), Matrix.Translation(x, y, z));
            OuterSpace.d3d_scene.transform_Pipeline();

            //planetcloudsMesh.Drawmesh();

            OuterSpace.device.RenderState.CullMode         = oldCull;
            OuterSpace.device.RenderState.SourceBlend      = oldSrcBlend;
            OuterSpace.device.RenderState.DestinationBlend = OldDestBlend;
            OuterSpace.device.RenderState.BlendOperation   = oldBlendOp;

            OuterSpace.device.RenderState.AlphaBlendEnable = false;
            //End If
            ///3-10-06 ...
        }