// draw public void RenderStarport() { if (starportMesh == null) { starportMesh = new MeshObject("\\starport.x"); } if (OuterSpace.theWindowMgr.FindWindow(" ") == -1) { if (OuterSpace.theWindowMgr.LoadWindow("CStarportWindow", 75, 0, 175, OuterSpace.ClientArea.Height, Color.FromArgb(255, 255, 255, 255)) == true) { OuterSpace.theWindowMgr.DoModal(OuterSpace.theWindowMgr.FindWindow(" ")); wndStarport = (CStarportWindow)(OuterSpace.theWindowMgr.GetWindow(OuterSpace.theWindowMgr.FindWindow(" "))); } } Mesh moMesh = starportMesh.GetMesh(); List <Material> materialList = new List <Material>(); List <Texture> textureList = new List <Texture>(); HandleMouseInput(); OuterSpace.device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0F, 0); OuterSpace.d3d_scene.SetupLights(); OuterSpace.thisPlanet.drawplanet(); // render starport Direct3D.Cull oldCull = OuterSpace.device.RenderState.CullMode; OuterSpace.device.RenderState.CullMode = Cull.CounterClockwise; fYAngle += 0.001F; OuterSpace.d3d_scene.transformWorld(Matrix.Zero, Matrix.RotationY(fYAngle), Matrix.Zero, Matrix.Zero, Matrix.Translation(0.3F, 0.0F, -77.5F)); OuterSpace.d3d_scene.transformView_Projection(new Vector3(0.0F, 0.1F, -80.0F), new Vector3(0.0F, 0.0F, 0.0F), new Vector3(0.0F, 1.0F, 0.0F), Convert.ToSingle(Math.PI / 4), Convert.ToSingle(OuterSpace.ClientArea.Width / OuterSpace.ClientArea.Height), 0.01F, 1000.0F); OuterSpace.d3d_scene.transform_Pipeline(); starportMesh.Drawmesh(); OuterSpace.device.RenderState.CullMode = oldCull; OuterSpace.device.RenderState.Ambient = Color.FromArgb(255, 65, 65, 65); OuterSpace.textfont.DrawText(5, 5, Color.Blue, statustext); }
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 ... }