Пример #1
0
        public void Export_SimpleModel_ValidOutput()
        {
            string path = "temp.x3d";

            var runner = new CrossThreadTestRunner();
            runner.RunInSTA(
              delegate
              {
                  Console.WriteLine(Thread.CurrentThread.GetApartmentState());

                  var vp = new Viewport3D();
                  vp.Camera = CameraHelper.CreateDefaultCamera();
                  vp.Width = 1280;
                  vp.Height = 720;
                  vp.Children.Add(new DefaultLightsVisual3D());
                  var box = new BoxVisual3D();
                  box.UpdateModel();
                  vp.Children.Add(box);

                  using (var e = new X3DExporter(path))
                  {
                      e.Export(vp);
                  }
              });

            var result = Validate(path);
            Assert.IsNull(result, result);
        }
Пример #2
0
        private static BoxVisual3D CreateBox(double width, double height, double length, Color color)
        {
            var box = new BoxVisual3D();

            box.Width = width;
            box.Height = height;
            box.Length = length;
            box.Material = new DiffuseMaterial(new SolidColorBrush(color));

            return box;
        }
Пример #3
0
        private VisualObjectData ParseTriggerObject(VisualObjectData obj)
        {
            var box = new BoxVisual3D();

            double tempValue = 0;

            if (!double.TryParse(obj.ObjectData.GetProperty("w"), out tempValue))
            {
                tempValue = 2.5 * 4;
            }
            box.Width = tempValue/4;
            box.Length = tempValue / 4;
            if (!double.TryParse(obj.ObjectData.GetProperty("h"), out tempValue))
            {
                tempValue = 2.5 * 4;
            }
            box.Height = tempValue/4;

            box.Material = new DiffuseMaterial(new SolidColorBrush(Color.FromArgb(128, 255, 171, 0)));

            obj.Model = box;
            return obj;
        }