spaceconquest.ShipModel.Draw C# (CSharp) Method

Draw() public method

public Draw ( Matrix world, Matrix view, Matrix projection, Color newcolor, float scale, float hoveringHeight ) : void
world Matrix
view Matrix
projection Matrix
newcolor Color
scale float
hoveringHeight float
return void
        public void Draw(Matrix world, Matrix view, Matrix projection, Color newcolor, float scale, float hoveringHeight)
        {
            // Set BasicEffect parameters.
            Matrix worldMatrix = Matrix.CreateScale(scale) *
                Matrix.CreateRotationX((float)(Math.PI)) *
                Matrix.CreateTranslation(new Vector3(0, 0, hoveringHeight)) *
                world;

            basicEffect.World = worldMatrix;
            basicEffect.View = view;
            basicEffect.Projection = projection;
            basicEffect.DiffuseColor = newcolor.ToVector3();
            // basicEffect.VertexColorEnabled = true;

            //basicEffect.Alpha = color.A / 255.0f;
            basicEffect.EmissiveColor = newcolor.ToVector3();

            GraphicsDevice device = basicEffect.GraphicsDevice;
            device.DepthStencilState = DepthStencilState.Default;
            device.BlendState = BlendState.AlphaBlend;

            // Draw the model, using BasicEffect.

            foreach (ModelMesh mesh in ship.Meshes)
            {
                mesh.Draw();
            }
        }