/// <summary> /// Loads any component specific content /// </summary> protected override void LoadContent() { fSpriteBatch = new SpriteBatch(Game.GraphicsDevice); InitializeTransform(); InitializeEffect(); fModel1 = this.Game.Content.Load <Model>("MyFirstModel/grid"); fModel2 = this.Game.Content.Load <Model>("MyFirstModel/dude"); fLines = new PrimitiveLine(Game.GraphicsDevice); fLines.AddLine( new VertexPositionColor(new Vector3(0, 0, 0), Color.Red), new VertexPositionColor(new Vector3(1000, 0, 0), Color.Yellow)); fLines.AddLine( new VertexPositionColor(new Vector3(0, 0, 0), Color.Green), new VertexPositionColor(new Vector3(0, 1000, 0), Color.LightGreen)); fLines.AddLine( new VertexPositionColor(new Vector3(0, 0, 0), Color.Blue), new VertexPositionColor(new Vector3(0, 0, 1000), Color.Cyan)); fLines.AddLine( new VertexPositionColor(new Vector3(0, 0, 0), Color.DarkRed), new VertexPositionColor(new Vector3(-1000, 0, 0), Color.DarkRed)); fLines.AddLine( new VertexPositionColor(new Vector3(0, 0, 0), Color.DarkGreen), new VertexPositionColor(new Vector3(0, -1000, 0), Color.DarkGreen)); fLines.AddLine( new VertexPositionColor(new Vector3(0, 0, 0), Color.DarkBlue), new VertexPositionColor(new Vector3(0, 0, -1000), Color.DarkBlue)); for (int r = 0; r < 360; r += 10) { float angle = MathHelper.ToRadians(r); fLines.AddCircle(0, 35, 0, 40, 50, Color.Red, 0, 0); fLines.AddCircle(0, 35, 0, 40, 50, Color.Tomato, angle, 0); fLines.AddCircle(0, 35, 0, 40, 50, Color.Orange, 0, angle); } fStateBlend = BlendState.Opaque; fStateDepth = DepthStencilState.Default; fStateNoDepth = DepthStencilState.None; fStateRasterizer = new RasterizerState() { FillMode = FillMode.Solid, CullMode = CullMode.None }; fStateSampler = new SamplerState() { AddressU = TextureAddressMode.Wrap, AddressV = TextureAddressMode.Wrap }; base.LoadContent(); }
private void SetupCircles() { int maxLines = 16000; fLines = new PrimitiveLine(fSpriteBatch.GraphicsDevice); bool first = true; while (fLines.Lines < maxLines) { //int w = Game.GraphicsDevice.Viewport.Width; //int h = Game.GraphicsDevice.Viewport.Height; float x = (float)(1500.0f * (fRandom.NextDouble() - 0.5f)); float y = (float)(1500.0f * (fRandom.NextDouble() - 0.5f)); int radius = fRandom.Next(400) + 10; int segments = 50; byte r = (byte)fRandom.Next(256); byte g = (byte)fRandom.Next(256); byte b = (byte)fRandom.Next(256); byte a = 255; if (first) { x = 0; y = 0; radius = 500; r = 255; g = 255; b = 255; first = false; } while (fLines.Lines < maxLines && radius > 20) { Color color = new Color(r, g, b, a); fLines.AddCircle(x, y, 0, radius, segments, color); radius -= 20; x++; if (r > 10) { r -= 10; } if (g > 10) { g -= 10; } if (b > 10) { b -= 10; } } } }