Exemplo n.º 1
0
        public static void ResetRenderTargets()
        {
            if (SceneRender != null)
            {
                SceneRender.Dispose();
                while (!SceneRender.IsDisposed)
                {
                }                                   // Possible hard-lock.
            }
            if (UIRender != null)
            {
                UIRender.Dispose();
                while (!UIRender.IsDisposed)
                {
                }                                // Possible hard-lock.
            }
            SceneRender = new RenderTarget2D(GraphicsDevice, GraphicsDeviceManager.PreferredBackBufferWidth,
                                             GraphicsDeviceManager.PreferredBackBufferHeight, false,
                                             GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat,
                                             GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.PreserveContents);
            UIRender = new RenderTarget2D(GraphicsDevice, GraphicsDeviceManager.PreferredBackBufferWidth,
                                          GraphicsDeviceManager.PreferredBackBufferHeight, false,
                                          GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat,
                                          GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.PreserveContents);

            FinalRender = GameEngine.IsEditor
                ? new RenderTarget2D(GraphicsDevice, GraphicsDeviceManager.PreferredBackBufferWidth,
                                     GraphicsDeviceManager.PreferredBackBufferHeight, false,
                                     GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat,
                                     GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.DiscardContents)
                : null;

            Lighting.Reset();
            GC.Collect();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("RayTracer");
            var started = DateTime.Now;

            Console.WriteLine("Started: " + started);
            SceneRender.Render(new ShinyBallPlaneScene("ShinyBallsCMD.ppm"));
            var ended = DateTime.Now;

            Console.WriteLine("Finished: " + ended);
            Console.WriteLine("Time Taken" + (ended - started));
        }
        public void RenderScene()
        {
            var scene = new ShinyBallPlaneScene("RefractionWorldScene.ppm");

            SceneRender.Render(scene);
        }