Ejemplo n.º 1
0
        private void DrawMoon(GameTime gameTime, Moon moon)
        {
            Matrix matRotateY, matScale, matOrbTranslation, matOrbRotation;
            Matrix _world = matrixStrack.Peek();

            matScale = Matrix.CreateScale(moon.MoonScale);


            matRotateY     = Matrix.CreateRotationY(moon.MoonRotY);
            moon.MoonRotY += (float)gameTime.ElapsedGameTime.Milliseconds / 5000.0f;
            moon.MoonRotY  = moon.MoonRotY % (float)(2 * Math.PI);

            matOrbTranslation = Matrix.CreateTranslation(moon.MoonDistanceToSun);
            moon.MoonOrbitY  += (moon.MoonOrbitSpeed / 60); //  * (float)gameTime.ElapsedGameTime.Milliseconds / 5000.0f
            moon.MoonOrbitY   = moon.MoonOrbitY % (float)(2 * Math.PI);
            matOrbRotation    = Matrix.CreateRotationY(moon.MoonOrbitY);


            world = matScale * matRotateY * matOrbTranslation * matOrbRotation * _world;
            matrixStrack.Push(world);

            effect.World = world;
            mMoon.Draw(world, camera.View, camera.Projection);
        }
Ejemplo n.º 2
0
        private void DrawMoon(GameTime gameTime, Moon moon)
        {
            Matrix matRotateY, matScale, matOrbTranslation, matOrbRotation;
            Matrix _world = matrixStrack.Peek();

            matScale = Matrix.CreateScale(moon.MoonScale);

            matRotateY = Matrix.CreateRotationY(moon.MoonRotY);
            moon.MoonRotY += (float)gameTime.ElapsedGameTime.Milliseconds / 5000.0f;
            moon.MoonRotY = moon.MoonRotY % (float)(2 * Math.PI);

            matOrbTranslation = Matrix.CreateTranslation(moon.MoonDistanceToSun);
            moon.MoonOrbitY += (moon.MoonOrbitSpeed / 60); //  * (float)gameTime.ElapsedGameTime.Milliseconds / 5000.0f
            moon.MoonOrbitY = moon.MoonOrbitY % (float)(2 * Math.PI);
            matOrbRotation = Matrix.CreateRotationY(moon.MoonOrbitY);

            world = matScale * matRotateY * matOrbTranslation * matOrbRotation * _world;
            matrixStrack.Push(world);

            effect.World = world;
            mMoon.Draw(world, camera.View, camera.Projection);
        }