}         // Render(sunColor)

        #endregion

        #region Unit Testing
#if DEBUG
        /// <summary>
        /// Test lens flare
        /// </summary>
        public static void TestLensFlare()
        {
            Vector3   sunPos    = LensFlare.DefaultSunPos;
            LensFlare lensFlare = null;

            TestGame.Start("TestLensFlare",
                           delegate      // Init
            {
                lensFlare = new LensFlare(sunPos);
            },
                           delegate      // Render loop
            {
                BaseGame.GlowShader.Start();

                // Render sky cube map as our background.
                BaseGame.skyCube.RenderSky(1.0f, BaseGame.SkyBackgroundColor);

                lensFlare.Render(Color.White);

                TextureFont.WriteText(1, 30,
                                      "Sun pos to 2d=" + BaseGame.Convert3DPointTo2D(sunPos));
                TextureFont.WriteText(1, 60,
                                      "Sun pos in front=" + BaseGame.IsInFrontOfCamera(sunPos));
                Vector4 resultVector4 = Vector4.Transform(
                    new Vector4(sunPos.X, sunPos.Y, sunPos.Z, 1),
                    BaseGame.ViewMatrix * BaseGame.ProjectionMatrix);
                TextureFont.WriteText(1, 90,
                                      "result=" + resultVector4);
            });
        }         // TestLensFlare()
        }         // WriteAll(texts)

        #endregion

        #region Unit Testing
#if DEBUG
        /// <summary>
        /// Test render font
        /// </summary>
        public static void TestRenderFont()
        {
            TestGame.Start("TestRenderFont",
                           delegate
            {
                TextureFont.WriteText(30, 30,
                                      "Hi there .. whats up?");
            });
        }         // TestRenderFont()
        }         // Render()

        #endregion

        #region Unit Testing
#if DEBUG
        #region TestRenderLines
        /// <summary>
        /// Test render lines
        /// </summary>
        public static void TestRenderLines()
        {
            TestGame.Start(
                delegate                 // 3d render code
            {
                for (int num = 0; num < 200; num++)
                {
                    BaseGame.DrawLine(
                        new Vector3(-12.0f + num / 4.0f, 13.0f, 0),
                        new Vector3(-17.0f + num / 4.0f, -13.0f, 0),
                        new Color((byte)(255 - num), 14, (byte)num));
                }                         // for

                TextureFont.WriteText(2, 30,
                                      "cam pos=" + BaseGame.CameraPos);
            });
        }         // TestRenderLines()
Beispiel #4
0
        }         // Render(renderPos)

        #endregion

        #region Unit Testing
#if DEBUG
        #region TestSingleModel
        /// <summary>
        /// Test single model
        /// </summary>
        static public void TestSingleModel()
        {
            Model testModel1 = null;
            Model testModel2 = null;

            TestGame.Start("TestSingleModel",
                           delegate
            {
                testModel1 = new Model("goal");                        //"asteroid1");
                testModel2 = new Model("asteroid1Low");
            },
                           delegate
            {
                for (int num = 0; num < 200; num++)
                {
                    BaseGame.DrawLine(
                        new Vector3(-12.0f + num / 4.0f, 13.0f, 0),
                        new Vector3(-17.0f + num / 4.0f, -13.0f, 0),
                        new Color((byte)(255 - num), 14, (byte)num));
                }                         // for

                TextureFont.WriteText(2, 30,
                                      "cam pos=" + BaseGame.CameraPos);

                if (Input.Keyboard.IsKeyDown(Keys.LeftControl) == false)
                {
                    testModel1.Render(Matrix.CreateScale(4));
                }
                else
                {
                    testModel2.Render(Matrix.CreateScale(4));
                }

                // And flush render manager to draw all objects
                BaseGame.MeshRenderManager.Render();
            });
        }         // TestSingleModel()