// wenn aktuelles feld weiß ist, dann rot färben - nach links drehen und eins vorwärts // wenn aktuelles feld rot, dann weiß färben - nach rechts drehen und eins vorwärts private void Aufgabe() { FrmFlowControl flow = new FrmFlowControl(); flow.StepCount = 1; int i = 0; int i2 = 0; int iOut = 1; while (true) { i++; //for (int ix = 0; ix < 100000; ix++) { } // Alle Termiten eins weiter setzen moveAllTermites(); if (i == iOut) { // Statearray durchlaufen und Farben im Bild aktualisieren Logger.Instance.LogInfo("" + i2 + " * " + iOut); updateColors(); i2++; i = 0; flow.Wait(); } } }
/// <summary> /// Setup the example. /// </summary> public override void Setup() { _scene = new Scene(); _rand = new Random(); _contentManager = new ContentManager(XnaRenderer.Instance.Services, GLabController.Instance.HomeDirectory + "\\Data\\FractalTerrain"); _psf = new PlatonicSolidFactory(XnaRenderer.Instance); _matrixStack = new MatrixStack(); filename = InputHelper.LoadFileDialog("Load LIN-File"); if (filename == "") { return; } _lindenmayerSystem = GLabReader.ReadLindenmayerSystemFromFile(filename); if (filename.Contains("1_")) { _pos = new Vector3(0, 0, Math.Abs(_lindenmayerSystem.CoordinateSystem.MaxX) + Math.Abs(_lindenmayerSystem.CoordinateSystem.MinX)); } if (filename.Contains("2_")) { _pos = new Vector3(0, 0, 3); } if (filename.Contains("3_")) { _pos = new Vector3(3, 5, 3); } flow = new FrmFlowControl(); // Breite und Länge initialisieren _vecStart = new Vector3(0, 0, 0); Vector3 pos = _pos; // new Vector3(0, 0, 5); Vector3 lookAt = Vector3.Zero; Vector3 up = Vector3.UnitY; //_polarCamera = new PolarCamera(); //_polarCamera.SetLookAt(pos, lookAt, up); //_polarCamera.ActivateControl(); //_polarCamView = new RenderView(512, 512, _scene, _polarCamera, // "Polar Camera"); //Logger.Instance.LogInfo( // "Controls (Polar Camera): <W>, <A>, <S>, <D>, <Q>, <E> and mouse movement (while left or right clicking)."); _flyCamera = new FlyCamera(); _flyCamera.ActivateControl(); _flyCamera.SetLookAt(pos, lookAt, up); _flyCamera.Movement = 0.2f; _flyCamView = new RenderView(256, 256, _scene, _flyCamera, "Fly Camera"); Logger.Instance.LogInfo( "Controls (Fly Camera): <W>, <A>, <S>, <D>, <Q>, <E> and mouse movement (while left clicking). Use <R> to reset the camera to the initial position."); //XnaRenderer.Instance.Views.Add(_polarCamView); XnaRenderer.Instance.Views.Add(_flyCamView); Start(); _scene.RenderCoordinateAxes = false; flow.StepCount = 1; currentAxiom = _lindenmayerSystem.Axiom; int iStep = 11; while (true) { iStep++; nextGeneration(_scene, 0, iStep, currentAxiom); flow.Wait(); Logger.Instance.LogInfo("" + iStep); } }