spaceconquest.PlanetModel.Draw C# (CSharp) Method

Draw() public static method

public static Draw ( Matrix world, Matrix view, Matrix projection, Color newcolor, float scale, bool isPopulated, float curAngle ) : void
world Matrix
view Matrix
projection Matrix
newcolor Color
scale float
isPopulated bool
curAngle float
return void
        public static void Draw(Matrix world, Matrix view, Matrix projection, Color newcolor, float scale, bool isPopulated, float curAngle)
        {
            // Set BasicEffect parameters.
            Matrix worldMatrix = Matrix.CreateScale(scale) *
                 Matrix.CreateRotationZ( (float) ((curAngle / 360.0) * 2 * Math.PI)) *
                 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.

            if (isPopulated)
            {
                foreach (ModelMesh mesh in poplulatedPlanet.Meshes)
                {
                    mesh.Draw();
                }
            }
            else
            {
                foreach (ModelMesh mesh in unpoplulatedPlanet.Meshes)
                {
                    mesh.Draw();
                }
            }
        }