public void Initialize() { CamPos = Complex.Zero; CamZoom = 1; RequiresUpdate = true; }
Texture2D CreateTexture(Complex CamPos, double CamZoom, int Width, int Height) { Color[] clr = new Color[Width * Height]; double zoom = .001 / CamZoom; double a = AspectRatio; Complex size = new Complex(zoom * a, zoom); Complex TL = new Complex(CamPos.X - size.X, CamPos.Y + size.Y); Complex Span = new Complex(2 * size.X, -2 * size.Y); for (int i = 0; i < Width; i++) { for (int j = 0; j < Height; j++) { var z = TL + new Complex(i * Span.X / Width, j * Span.Y / Height); for (int n = 0; n < 150 && z.LengthSquared() < 100; n++) z = CurFractal.Iterate(z); clr[i + j * Width] = z.Length() > 10 ? Color.Black : Color.White; } } Texture2D Texture = new Texture2D(GraphicsDevice, Width, Height); Texture.SetData(clr); return Texture; }