/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); var device = graphics.GraphicsDevice; //Sphere sp = new Sphere(3, GraphicsDevice); // Copy any parent transforms. //Matrix[] transforms = new Matrix[myModel.Bones.Count]; //myModel.CopyAbsoluteBoneTransformsTo(transforms); //var cam = new Camera(); //graphics.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineStrip, ; //sp.Draw(cam); BoundingSphereRenderer.InitializeGraphics(device, 100); var look = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up); var projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f); BoundingSphereRenderer.Render(new BoundingSphere(center, 2), device, look, projection, Color.Red, Color.Blue, Color.Green); // TODO: Add your drawing code here base.Draw(gameTime); }
protected override void Initialize() { Application.Idle += delegate { Refresh(); }; Application.Idle += delegate { Invalidate(); }; BoundingSphereRenderer.InitializeGraphics(GraphicsDevice, 49); m_SceneView = Form1.g_SceneView; }