Beispiel #1
0
        public void TestRotation()
        {
            _rootBody.Clear();
            _rootBody.Add(YellowWall);
            _rootBody.Add(GreenWall);
            var sourceBody = new Body {
                Model = Model.FromResource(() => Resources.arrowblue)
            };

            _rootBody.Add(sourceBody);
            var camera = new FirstPersonCamera(sourceBody, new Frame3D(0, 0, 20), SceneConfig.FirstPersonViewAngle,
                                               Width / Height);

            byte[] bitmapBytes;
            _offscreenDrawer.TryGetImage(camera, out bitmapBytes);
            SaveImage(bitmapBytes);
            var bitmap = new Bitmap(new MemoryStream(bitmapBytes));

            CheckBitmapCenter(bitmap, Color.Green);
            sourceBody.Location = sourceBody.Location.NewYaw(Angle.Pi);
            Console.WriteLine(sourceBody.Location);
            _offscreenDrawer.TryGetImage(camera, out bitmapBytes);
            SaveImage(bitmapBytes);
            bitmap = new Bitmap(new MemoryStream(bitmapBytes));
            CheckBitmapCenter(bitmap, Color.Yellow);
        }
Beispiel #2
0
 public CVARCEngineCamera(Body body, DrawerFactory factory, RobotCameraSettings settings)
 {
     Settings = settings;
     this.robot = body;
     Angle viewAngle = Settings.ViewAngle;
     _camera = new FirstPersonCamera(this.robot, Settings.Location,
                                     viewAngle, DefaultWidth / (double)DefaultHeight);
     _drawer = new OffscreenDirectXDrawer(factory.GetDirectXScene(), DefaultWidth,
                                          DefaultHeight);
 }
		public void TestRotation()
		{
			_rootBody.Clear();
			_rootBody.Add(YellowWall);
			_rootBody.Add(GreenWall);
			var sourceBody = new Body {Model =Model.FromResource(()=>Resources.arrowblue)};
			_rootBody.Add(sourceBody);
			var camera = new FirstPersonCamera(sourceBody, new Frame3D(0, 0, 20), SceneConfig.FirstPersonViewAngle,
			                                   Width / Height);
			byte[] bitmapBytes;
			_offscreenDrawer.TryGetImage(camera, out bitmapBytes);
			SaveImage(bitmapBytes);
			var bitmap = new Bitmap(new MemoryStream(bitmapBytes));
			CheckBitmapCenter(bitmap, Color.Green);
			sourceBody.Location = sourceBody.Location.NewYaw(Angle.Pi);
			Console.WriteLine(sourceBody.Location);
			_offscreenDrawer.TryGetImage(camera, out bitmapBytes);
			SaveImage(bitmapBytes);
			bitmap = new Bitmap(new MemoryStream(bitmapBytes));
			CheckBitmapCenter(bitmap, Color.Yellow);
		}