Exemplo n.º 1
0
        static void Main()
        {
            device = IrrlichtDevice.CreateDevice(DriverType.Direct3D9, new Dimension2Di(1280, 720));
            if (device == null)
            {
                return;
            }

            VideoDriver  driver = device.VideoDriver;
            SceneManager scene  = device.SceneManager;

            device.SetWindowCaption("Abstract Trace - Irrlicht Engine");
            device.OnEvent += Device_OnEvent;

            GUIFont font      = device.GUIEnvironment.GetFont("../../media/fontlucida.png");
            Color   textColor = Color.SolidWhite;

            CameraSceneNode camera = scene.AddCameraSceneNode();

            camera.FarValue = 20000;
            SceneNodeAnimator a = scene.CreateFlyCircleAnimator(new Vector3Df(), (AbstractTrace.CubeSize * AbstractTrace.GridDim) / 1.25f, 0.000025f, new Vector3Df(0.1f, 1, 0));

            camera.AddAnimator(a);
            a.Drop();

            trace = new AbstractTrace(device);
            trace.Init();

            while (device.Run())
            {
                driver.BeginScene();
                scene.DrawAll();

                if (!isPaused)
                {
                    trace.Step();
                }

                trace.Draw(drawGenerator);

                font.Draw("[G]enerator: " + (drawGenerator ? "ON" : "OFF"), new Vector2Di(20, 20), textColor);
                font.Draw("[P]ause: " + (isPaused ? "ON" : "OFF"), new Vector2Di(20, 35), textColor);
                font.Draw("Cubes: " + trace.GetTotalCubeCount(), new Vector2Di(20, 50), textColor);
                font.Draw("FPS: " + driver.FPS, new Vector2Di(20, 65), textColor);

                driver.EndScene();
            }

            trace.Drop();
            device.Drop();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            device = IrrlichtDevice.CreateDevice(DriverType.Direct3D9, new Dimension2Di(1280, 720));
            if (device == null)
            {
                return;
            }

            VideoDriver  driver = device.VideoDriver;
            SceneManager scene  = device.SceneManager;

            CameraSceneNode camera = scene.AddCameraSceneNode();

            camera.FarValue = 20000;
            SceneNodeAnimator a = scene.CreateFlyCircleAnimator(new Vector3Df(), (AbstractTrace.CubeSize * AbstractTrace.GridDim) / 1.25f, 0.000025f, new Vector3Df(0.1f, 1, 0));

            camera.AddAnimator(a);
            a.Drop();

            trace = new AbstractTrace(device);
            trace.Init();

            int lastFps = -1;

            while (device.Run())
            {
                driver.BeginScene();
                scene.DrawAll();
                trace.Step();
                trace.Draw();
                driver.EndScene();

                int fps = driver.FPS;
                if (fps != lastFps)
                {
                    device.SetWindowCaption("Abstract Trace - Irrlicht Engine [" + fps + " fps; " + trace.GetTotalCubeCount() + " cubes]");
                    lastFps = fps;
                }
            }

            trace.Drop();
            device.Drop();
        }
Exemplo n.º 3
0
		static void Main(string[] args)
		{
			device = IrrlichtDevice.CreateDevice(DriverType.Direct3D9, new Dimension2Di(1280, 720));
			if (device == null)
				return;

			VideoDriver driver = device.VideoDriver;
			SceneManager scene = device.SceneManager;

			CameraSceneNode camera = scene.AddCameraSceneNode();
			camera.FarValue = 20000;
			SceneNodeAnimator a = scene.CreateFlyCircleAnimator(new Vector3Df(), (AbstractTrace.CubeSize * AbstractTrace.GridDim) / 1.25f, 0.000025f, new Vector3Df(0.1f, 1, 0));
			camera.AddAnimator(a);
			a.Drop();

			trace = new AbstractTrace(device);
			trace.Init();

			int lastFps = -1;
			while (device.Run())
			{
				driver.BeginScene();
				scene.DrawAll();
				trace.Step();
				trace.Draw();
				driver.EndScene();

				int fps = driver.FPS;
				if (fps != lastFps)
				{
					device.SetWindowCaption("Abstract Trace - Irrlicht Engine [" + fps + " fps; " + trace.GetTotalCubeCount() + " cubes]");
					lastFps = fps;
				}
			}

			trace.Drop();
			device.Drop();
		}