/// <summary> /// Function to handle idle time for the application. /// </summary> /// <returns><b>true</b> to continue processing, <b>false</b> to stop.</returns> private static bool Idle() { // Animate the ball. UpdateBall(); // Clear to our gray color and clear out the depth buffer. _swap.RenderTargetView.Clear(Color.FromArgb(173, 173, 173)); //_depthBuffer.Clear(0.0f, 0); _depthBuffer.Clear(0.0f, 0); // Render the back and floor planes. // ReSharper disable once ForCanBeConvertedToForeach for (int i = 0; i < _planes.Length; ++i) { RenderModel(_planes[i]); } // Render the ball. _sphere.Material.Diffuse = GorgonColor.White; RenderModel(_sphere); // Remember the position and rotation so we can restore them later. DX.Vector3 spherePosition = _sphere.Position; DX.Vector3 sphereRotation = _sphere.Rotation; // Offset the position of the ball so we can fake a shadow under the ball. _sphere.Position = new DX.Vector3(spherePosition.X + 0.25f, spherePosition.Y - 0.125f, spherePosition.Z + 0.5f); // Scale on the z-axis so the ball "shadow" has no real depth, and on the x & y to make it look slightly bigger. _sphere.Scale = new DX.Vector3(1.155f, 1.155f, 0.001f); // Reset the rotation so we don't rotate our flattened ball "shadow" (it'd look real weird if it rotated). _sphere.Rotation = DX.Vector3.Zero; // Render as black with alpha of 0.5 to simulate a shadow. _sphere.Material.Diffuse = new GorgonColor(0, 0, 0, 0.5f); // Render the shadow. RenderModel(_sphere); // Restore our original positioning so we can render the ball in the correct place on the next frame. _sphere.Position = spherePosition; // Reset scale on the z-axis so the ball so it'll be normal for the next frame. _sphere.Scale = DX.Vector3.One; // Reset the rotation so it'll be in the correct place on the next frame. _sphere.Rotation = sphereRotation; // Draw our text. // Use this to show how incredibly slow and terrible my 3D code is. GorgonExample.DrawStatsAndLogo(_2D); // Now we flip our buffers. // We need to this or we won't see anything. _swap.Present(1); return(true); }