} // 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()
/// <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); }); }