Beispiel #1
0
        public void OnFrameRender(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime)
        {
            currentTime = totalTime;
            bool beginSceneCalled = false;

            if (scenery != null)
            {
                scenery.RenderTextures(device, totalTime, elapsedTime);
            }

            // Clear the render target and the zbuffer
            device.Clear(ClearFlags.ZBuffer | ClearFlags.Target, 0x00424B79, 1.0f, 0);
            try
            {
                device.BeginScene();
                beginSceneCalled = true;

                // Get the world matrix
                //Matrix worldMatrix = worldCenter * camera.WorldMatrix;
                Framework.Instance.Device.RenderState.Ambient = System.Drawing.Color.FromArgb(148, 148, 148);
                scenery.OnFrameRender(device, totalTime, elapsedTime);
                birds.OnFrameRender(device, totalTime, elapsedTime);
                if (airplaneMesh != null)
                {
                    airplaneMesh.OnFrameRender(device, totalTime, elapsedTime);
                }
                transparentObjectManager.OnFrameRender(device, totalTime, elapsedTime);
                cursor3d.OnFrameRender(device, totalTime, elapsedTime);
                selectedObject.OnFrameRender(device, totalTime, elapsedTime);
                // Show UI
                hud.OnRender(elapsedTime);
            }
            finally
            {
                if (beginSceneCalled)
                {
                    device.EndScene();
                }
            }
        }