• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Media3D.ModelVisual3D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Media.Media3D.ModelVisual3D的典型用法代码示例。如果您正苦于以下问题:C# ModelVisual3D类的具体用法?C# ModelVisual3D怎么用?C# ModelVisual3D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ModelVisual3D类属于System.Windows.Media.Media3D命名空间,在下文中一共展示了ModelVisual3D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: render

        public GeometryModel3D[] render()
        {
            Model3DGroup modelGroup     = new Model3DGroup();
            Viewport3D visualisation    = new Viewport3D();
            ModelVisual3D modelsVisual  = new ModelVisual3D();
            int depthPoint              = 0;

            //Setup viewport environment
            init = new ViewportCalibrator(this.cp);
            visualisation = init.setupViewport(init.setupCamera(), this.cp.ActualHeight, this.cp.ActualWidth);

            //Create triangle mesh
            for (int y = 0; y < 480; y += pos)
            {
                for (int x = 0; x < 640; x += pos)
                {
                    pts[depthPoint] = Triangle(x, y, pos);
                    pts[depthPoint].Transform = new TranslateTransform3D(0, 0, 0);
                    modelGroup.Children.Add(pts[depthPoint]);
                    depthPoint++;
                }
            }

            //Add mesh to visualisation and viewport/canvas
            modelGroup.Children.Add(init.setupDirectionalLights(Colors.White));
            modelsVisual.Content = modelGroup;
            visualisation.Children.Add(modelsVisual);
            cp.Children.Add(visualisation);

            Canvas.SetTop(visualisation, 0);
            Canvas.SetLeft(visualisation, 0);

            return pts;
        }
开发者ID:robinj,项目名称:parse-client,代码行数:34,代码来源:TriangularPointCloud.cs


示例2: Neuron

 public Neuron(Point3D position, ModelVisual3D visual, DiffuseMaterial material)
 {
     _position = position;
     this.Visual = visual;
     this.Material = material;
     this.Value = 0d;
 }
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:7,代码来源:NeuralTester.xaml.cs


示例3: Load

        public static ModelVisual3D Load(string path)
        {
            if (path == null)
            {
                return null;
            }
            ModelVisual3D model= new ModelVisual3D();
            string ext = Path.GetExtension(path).ToLower();
            switch (ext)
            {
                case ".obj":
                    {
                        var r = new SmileObjReader();
                        model = r.Read(path);
                        break;
                    }

                case ".objz":
                    {
                        var r = new SmileObjReader();
                        model = r.ReadZ(path);
                        break;
                    }                

                default:
                    throw new InvalidOperationException("File format not supported.");
            }
           return model;
        }
开发者ID:sivarajankumar,项目名称:dentalsmile,代码行数:29,代码来源:SmileModelImporter.cs


示例4: simpleButtonClick

        private void simpleButtonClick(object sender, RoutedEventArgs e)
        {
            MeshGeometry3D triagleMesh = new MeshGeometry3D();
            Point3D p0 = new Point3D(0, 0, 0);
            Point3D p1 = new Point3D(5, 0, 0);
            Point3D p2 = new Point3D(0, 0, 5);

            triagleMesh.Positions.Add(p0);
            triagleMesh.Positions.Add(p1);
            triagleMesh.Positions.Add(p2);

            triagleMesh.TriangleIndices.Add(0);
            triagleMesh.TriangleIndices.Add(2);
            triagleMesh.TriangleIndices.Add(1);

            Vector3D normal = new Vector3D(0, 1, 0);
            triagleMesh.Normals.Add(normal);
            triagleMesh.Normals.Add(normal);
            triagleMesh.Normals.Add(normal);

            Material material = new DiffuseMaterial(new SolidColorBrush(Colors.LawnGreen));
            GeometryModel3D triangleModel = new GeometryModel3D(triagleMesh, material);

            ModelVisual3D model = new ModelVisual3D();
            model.Content = triangleModel;
            this.mainViewport.Children.Add(model);
        }
开发者ID:AaronRevilla,项目名称:TT_2012b-049_ComputerGraphics,代码行数:27,代码来源:MainWindow.xaml.cs


示例5: WindowLoaded

        private void WindowLoaded(object sender, EventArgs e)
        {
            //Set camera viewpoint and properties.
            myPCamera.FarPlaneDistance = 20;
            myPCamera.NearPlaneDistance = 1;
            myPCamera.FieldOfView = 45;
            myPCamera.Position = new Point3D(-5, 2, 3);
            myPCamera.LookDirection = new Vector3D(5, -2, -3);
            myPCamera.UpDirection = new Vector3D(0, 1, 0);

            //Add light sources to the scene.
            myDirLight.Color = Colors.White;
            myDirLight.Direction = new Vector3D(-3, -4, -5);
            teapotModel.Geometry = (MeshGeometry3D)Application.Current.Resources["myTeapot"];

            //Define material and apply to the mesh geometries.
            DiffuseMaterial teapotMaterial = new DiffuseMaterial(new SolidColorBrush(Colors.Blue));

            teapotModel.Material = teapotMaterial;

            //Add 3D model and lights to the collection; add the collection to the visual.

            modelGroup.Children.Add(teapotModel);
            modelGroup.Children.Add(myDirLight);

            ModelVisual3D modelsVisual = new ModelVisual3D();
            modelsVisual.Content = modelGroup;

            //Add the visual and camera to the Viewport3D.
            myViewport.Camera = myPCamera;
            myViewport.Children.Add(modelsVisual);

            mainWindow.Content = myViewport;
        }
开发者ID:jayawantsawant,项目名称:WPFSamples,代码行数:34,代码来源:MainWindow.xaml.cs


示例6: TerrianCollisionMask3D

        public TerrianCollisionMask3D(World world, ModelVisual3D visual)
        {
            if (visual == null) throw new ArgumentNullException("visual");

            _visual = visual;
            Initialise(world);
        }
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:7,代码来源:TerrianCollisionMask3D.cs


示例7: Visual3DBodyBase

		public Visual3DBodyBase(World world, ModelVisual3D visual)
		{
			if (visual == null) throw new ArgumentNullException("visual");

			_visual = visual;
			Initialise(world);
		}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:7,代码来源:Visual3DBodyBase.cs


示例8: Cell

        public Cell(INeuron neuron, ModelVisual3D mophology, Imaging imager)
        {
            this.neuron = neuron;
            this.mophology = mophology;
            this.imager = imager;
            neuron.Updated += OnUpdated;
            neuron.Hillock.Spike += OnSpike;
            IsPushing = true;

            var transforms = new Transform3DGroup();
            Rotate = new RotateTransform3D(new QuaternionRotation3D());
            Translate = new TranslateTransform3D(neuron.Position.X, neuron.Position.Y, neuron.Position.Z);
            Scale = new ScaleTransform3D();
            transforms.Children.Add(Rotate);
            transforms.Children.Add(Translate);
            transforms.Children.Add(Scale);
            Mophology.Transform = transforms;

            var binding = new Binding()
            {
                Source = neuron,
                Path = new PropertyPath("Position"),
                Mode = BindingMode.OneWay
            };
            BindingOperations.SetBinding(this, Cell.PositionProperty, binding);
        }
开发者ID:babaq,项目名称:Soul,代码行数:26,代码来源:Cell.cs


示例9: BlenderModel

 /// <summary>
 /// Loads a model from a (WPF-) ResourceDictionary
 /// </summary>
 /// <param name="resourceDictionary">A (WPF-)  ResourceDictionary to load the model from</param>
 /// <param name="index">the name/key/index of the model to load</param>
 public BlenderModel(ResourceDictionary resourceDictionary, String index)
 {
     model3DGroup = resourceDictionary[index] as Model3DGroup;
     modelVisual3D = new ModelVisual3D();
     modelVisual3D.Content = model3DGroup;
     this.index = index;
 }
开发者ID:KinectStudienarbeit,项目名称:KinectStudienarbeit,代码行数:12,代码来源:BlenderModel.cs


示例10: dibujaCubo

        public ModelVisual3D dibujaCubo(Point3D[] puntos)
        {
            if (puntos.Length == 8)
            {
                Model3DGroup cube = new Model3DGroup();
                cube.Children.Add(CreateTriangleModel(puntos[3], puntos[2], puntos[6]));
                cube.Children.Add(CreateTriangleModel(puntos[3], puntos[6], puntos[7]));

                cube.Children.Add(CreateTriangleModel(puntos[2], puntos[1], puntos[5]));
                cube.Children.Add(CreateTriangleModel(puntos[2], puntos[5], puntos[6]));

                cube.Children.Add(CreateTriangleModel(puntos[1], puntos[0], puntos[4]));
                cube.Children.Add(CreateTriangleModel(puntos[1], puntos[4], puntos[5]));

                cube.Children.Add(CreateTriangleModel(puntos[0], puntos[3], puntos[7]));
                cube.Children.Add(CreateTriangleModel(puntos[0], puntos[7], puntos[4]));

                cube.Children.Add(CreateTriangleModel(puntos[7], puntos[6], puntos[5]));
                cube.Children.Add(CreateTriangleModel(puntos[7], puntos[5], puntos[4]));

                cube.Children.Add(CreateTriangleModel(puntos[2], puntos[3], puntos[0]));
                cube.Children.Add(CreateTriangleModel(puntos[2], puntos[0], puntos[1]));
                ModelVisual3D modelo = new ModelVisual3D();
                modelo.Content = cube;
                return modelo;
            }
            return null;
        }
开发者ID:AaronRevilla,项目名称:TT_2012b-049_ComputerGraphics,代码行数:28,代码来源:Graficos.cs


示例11: CellNet

        public CellNet(INetwork network, ModelVisual3D mophology, Dictionary<Guid, ICell> cells, Dictionary<Guid, ICellNet> childcellnet)
        {
            this.network = network;
            this.mophology = mophology;
            this.cells = cells;
            this.childcellnet = childcellnet;
            IsPushing = true;

            var transforms = new Transform3DGroup();
            Rotate = new RotateTransform3D(new QuaternionRotation3D());
            Translate = new TranslateTransform3D(network.Position.X, network.Position.Y, network.Position.Z);
            Scale = new ScaleTransform3D();
            transforms.Children.Add(Rotate);
            transforms.Children.Add(Translate);
            transforms.Children.Add(Scale);
            Mophology.Transform = transforms;

            var binding = new Binding()
            {
                Source = network,
                Path = new PropertyPath("Position"),
                Mode = BindingMode.OneWay
            };
            BindingOperations.SetBinding(this, CellNet.PositionProperty, binding);
        }
开发者ID:babaq,项目名称:Soul,代码行数:25,代码来源:CellNet.cs


示例12: NodesVisual

        public NodesVisual()
        {
            InitializeComponent();

            // Make IMU model here

            Model3DGroup items = new Model3DGroup();
            GeometryModel3D model = new GeometryModel3D();
            MeshGeometry3D geom = new MeshGeometry3D();
            DiffuseMaterial paint = new DiffuseMaterial(new SolidColorBrush(Colors.Red));

            double xPos, yPos, zPos;

            for(int z = 0; z < 2; z++)
                for (int y = 0; y < 2; y++)
                    for (int x = 0; x < 2; x++)
                    {
                        xPos = x * CUBE_SIZE - CUBE_SIZE / 2;
                        yPos = y * CUBE_SIZE - CUBE_SIZE / 2;
                        zPos = z * CUBE_SIZE - CUBE_SIZE / 2;

                        geom.Positions.Add(new Point3D(xPos, yPos, zPos));
                        Debug.Print("(" + x + "," + y + "," + z + ")");
                    }
            

            // TriangleIndices = "2 3 1  2 1 0  7 1 3  7 5 1  6 5 7  6 4 5  6 2 0  6 0 4  2 7 3  2 6 7  0 1 5  0 5 4" >
            geom.TriangleIndices.Add(2);    geom.TriangleIndices.Add(3);    geom.TriangleIndices.Add(1);
            geom.TriangleIndices.Add(2);    geom.TriangleIndices.Add(1);    geom.TriangleIndices.Add(0);
            geom.TriangleIndices.Add(7);    geom.TriangleIndices.Add(1);    geom.TriangleIndices.Add(3);

            geom.TriangleIndices.Add(7);    geom.TriangleIndices.Add(5);    geom.TriangleIndices.Add(1);
            geom.TriangleIndices.Add(6);    geom.TriangleIndices.Add(5);    geom.TriangleIndices.Add(7);
            geom.TriangleIndices.Add(6);    geom.TriangleIndices.Add(4);    geom.TriangleIndices.Add(5);

            geom.TriangleIndices.Add(6);    geom.TriangleIndices.Add(2);    geom.TriangleIndices.Add(0);
            geom.TriangleIndices.Add(6);    geom.TriangleIndices.Add(0);    geom.TriangleIndices.Add(4);
            geom.TriangleIndices.Add(2);    geom.TriangleIndices.Add(7);    geom.TriangleIndices.Add(3);

            geom.TriangleIndices.Add(2);    geom.TriangleIndices.Add(6);    geom.TriangleIndices.Add(7);
            geom.TriangleIndices.Add(0);    geom.TriangleIndices.Add(1);    geom.TriangleIndices.Add(5);
            geom.TriangleIndices.Add(0);    geom.TriangleIndices.Add(5);    geom.TriangleIndices.Add(4);

            model.Material = paint;
            model.Geometry = geom;
            items.Children.Add(model);

            imu = new ModelVisual3D();
            imu.Content = items;
            viewportIMU.Children.Add(imu);

            combobox_nodeSelect.Items.Clear();
            Nodes.UpdateAvailableSensors();

            foreach (string sensor in Nodes.COM_Ports)
                combobox_nodeSelect.Items.Add(sensor);

            if (!combobox_nodeSelect.Items.IsEmpty)
                combobox_nodeSelect.SelectedIndex = 0;
        }
开发者ID:xohmz,项目名称:E-MAT,代码行数:60,代码来源:NodesVisual.xaml.cs


示例13: VisualisationWindow

        public VisualisationWindow(Interferometry.math_classes.ZArrayDescriptor array)
        {
            InitializeComponent();

            // prepare points
            Point3D[,] points = new Point3D[array.width, array.height];
            for (int i = 0; i < array.width; ++i)
                for (int j = 0; j < array.height; ++j)
                    points[i, j] = new Point3D(i, array.array[i][j], j);

            // build model
            Model3DGroup surface = new Model3DGroup();
            for (int i = 0; i < array.width - 1; ++i)
            {
                for (int j = 0; j < array.height - 1; ++j)
                {
                    surface.Children.Add(createTriangle(points[i, j], points[i + 1, j], points[i, j + 1]));
                    surface.Children.Add(createTriangle(points[i, j + 1], points[i + 1, j], points[i, j]));

                    surface.Children.Add(createTriangle(points[i, j + 1], points[i + 1, j], points[i + 1, j + 1]));
                    surface.Children.Add(createTriangle(points[i + 1, j + 1], points[i + 1, j], points[i, j + 1]));
                }
                System.Console.WriteLine("buidling on row: " + i + "/" + array.width);
            }
            System.Console.WriteLine("model building done");

            ModelVisual3D model = new ModelVisual3D();
            model.Content = surface;
            this.mainViewport.Children.Add(model);
        }
开发者ID:interferometry7,项目名称:interferometry,代码行数:30,代码来源:VisualisationWindow.xaml.cs


示例14: VisualTree3DView

		public VisualTree3DView(Visual visual)
		{
			DirectionalLight directionalLight1 = new DirectionalLight(Colors.White, new Vector3D(0, 0, 1));
			DirectionalLight directionalLight2 = new DirectionalLight(Colors.White, new Vector3D(0, 0, -1));

			double z = 0;
			Model3D model = this.ConvertVisualToModel3D(visual, ref z);

			Model3DGroup group = new Model3DGroup();
			group.Children.Add(directionalLight1);
			group.Children.Add(directionalLight2);
			group.Children.Add(model);
			this.zScaleTransform = new ScaleTransform3D();
			group.Transform = this.zScaleTransform;

			ModelVisual3D modelVisual = new ModelVisual3D();
			modelVisual.Content = group;

			Rect3D bounds = model.Bounds;
			double fieldOfView = 45;
			Point3D lookAtPoint = new Point3D(bounds.X + bounds.SizeX / 2, bounds.Y + bounds.SizeY / 2, bounds.Z + bounds.SizeZ / 2);
			double cameraDistance = 0.5 * bounds.SizeX / Math.Tan(0.5 * fieldOfView * Math.PI / 180);
			Point3D position = lookAtPoint - new Vector3D(0, 0, cameraDistance);
			Camera camera = new PerspectiveCamera(position, new Vector3D(0, 0, 1), new Vector3D(0, -1, 0), fieldOfView);

			this.zScaleTransform.CenterZ = lookAtPoint.Z;

			this.Children.Add(modelVisual);
			this.Camera = camera;
			this.ClipToBounds = false;
			this.Width = 500;
			this.Height = 500;

			this.trackballBehavior = new TrackballBehavior(this, lookAtPoint);
		}
开发者ID:JonGonard,项目名称:snoopwpf,代码行数:35,代码来源:VisualTree3DView.cs


示例15: ConvexBody3D

        public ConvexBody3D(World world, ModelVisual3D model, CollisionShape collisionShape, double radius, double height)
            : base(world, model)
        {
            // Validate
            switch (collisionShape)
            {
                case CollisionShape.Capsule:
                case CollisionShape.ChamferCylinder:
                case CollisionShape.Cone:
                case CollisionShape.Cylinder:
                    break;

                default:
                    throw new ArgumentException("This constructor overload only supports collision shapes of cone, cylinder, capsule, chamfer cylinder");
            }

            // Store the definition of the collision shape
            _collisionShape = collisionShape;
            _collisionShapeRatio1 = radius;
            _collisionShapeRatio2 = height;
            _collisionShapeRatio3 = -1d;

            // Calculate the collision mask
            RecalculateCollisionMask();
        }
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:25,代码来源:ConvexBody3D.cs


示例16: PhotoAlbum

        public PhotoAlbum()
        {
            InitializeComponent();
            dt.Interval = TimeSpan.FromSeconds(2);
            dt.Tick += new EventHandler(dt_Tick);
            for (int i = 0; i < 16; i++)
            {
                ImageBrush ib = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/images/albums/im" + i + ".jpg")));
                ib.Stretch = Stretch.Uniform;

                ModelVisual3D mv = new ModelVisual3D();
                Material mat = new DiffuseMaterial(ib);
                GeometryModel3D plane = new GeometryModel3D(planeFactory.Mesh, mat);
                mv.Content = plane;
                mvs[i] = mv;
                myViewPort3D.Children.Add(mv);
                Matrix3D trix = new Matrix3D();
                double x = ran.NextDouble() * 50 - 50;
                double y = ran.NextDouble() * 2 - 2;
                double z = -i * 10;
                p3s[i] = new Point3D(x, y, z);
                trix.Append(new TranslateTransform3D(x, y, z).Value);
                mv.Transform = new MatrixTransform3D(trix);
            }

            pa = new Point3DAnimation(p3s[0], TimeSpan.FromMilliseconds(300));
            pa.AccelerationRatio = 0.3;
            pa.DecelerationRatio = 0.3;
            pa.Completed += new EventHandler(pa_Completed);
            cam.BeginAnimation(PerspectiveCamera.PositionProperty, pa);
        }
开发者ID:pjmodi,项目名称:projects,代码行数:31,代码来源:PhotoAlbum.xaml.cs


示例17: StructureControl

        /// <summary>
        /// Initializes a new instance of the <see cref="StructureControl"/> class and sets up visual elements for rendering.
        /// </summary>
        /// <param name="pdbViewer">The PDB viewer.</param>
        internal StructureControl(PdbViewer pdbViewer)
        {
            this.pdbViewer = pdbViewer;

            NameScope.SetNameScope(this, new NameScope());

            this.viewport = new Viewport3D();
            this.viewport.ClipToBounds = true;
            this.Children.Add(this.viewport);

            this.camera = new PerspectiveCamera();
            this.camera.Position = new Point3D(0, 0, cameraOffset);
            this.viewport.Camera = this.camera;

            ModelVisual3D lightingVisual = new ModelVisual3D();
            this.viewport.Children.Add(lightingVisual);

            Model3DGroup lightingModel = new Model3DGroup();
            lightingVisual.Content = lightingModel;

            PointLight pointLight = new PointLight(Colors.White, new Point3D(-4, 4, 8));
            lightingModel.Children.Add(pointLight);

            AmbientLight ambientLight = new AmbientLight(Color.FromRgb(32, 32, 32));
            lightingModel.Children.Add(ambientLight);

            this.moleculeVisual = new ModelVisual3D();
            viewport.Children.Add(this.moleculeVisual);

            Transform3DGroup transformGroup = new Transform3DGroup();
            this.moleculeVisual.Transform = transformGroup;

            this.translateTransform = new TranslateTransform3D();
            transformGroup.Children.Add(this.translateTransform);

            this.scaleTransform = new ScaleTransform3D();
            transformGroup.Children.Add(this.scaleTransform);

            this.rotateTransform = new RotateTransform3D();
            this.rotateTransform.Rotation = new QuaternionRotation3D();
            transformGroup.Children.Add(this.rotateTransform);

            this.selectionRectangle = new Rectangle();
            this.selectionRectangle.Stroke = Brushes.White;
            this.selectionRectangle.Fill = new SolidColorBrush(Color.FromArgb(32, 255, 255, 255));
            this.selectionRectangle.Visibility = Visibility.Hidden;
            this.Children.Add(this.selectionRectangle);

            this.testLabel = new Label();
            this.testLabel.Foreground = Brushes.White;
            this.testLabel.FontSize = 20;
            this.testLabel.HorizontalAlignment = HorizontalAlignment.Left;
            this.testLabel.VerticalAlignment = VerticalAlignment.Center;
            this.Children.Add(this.testLabel);

            this.clip = 1;
            this.slab = 0;
            this.UpdateClipping();
        }
开发者ID:alkampfergit,项目名称:BaktunShell,代码行数:63,代码来源:StructureControl.cs


示例18: ToAvalonObj

 public override Visual3D ToAvalonObj()
 {
     ModelVisual3D model = new ModelVisual3D();
     DirectionalLight light = new DirectionalLight(System.Windows.Media.Color.FromArgb(clr.A, clr.R, clr.G, clr.B),
                                                   new Vector3D(direction.X, direction.Y, direction.Z));
     model.Content = light;
     return model;
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:8,代码来源:ABLight.cs


示例19: PUMA

 public PUMA(HelixViewport3D viewport, ModelVisual3D start, ModelVisual3D end)
 {
     startFrame = start;
     endFrame = end;
     converter = Singleton<EulerToQuaternionConverter>.Instance;
     mathHelper = Singleton<MathHelper>.Instance;
     Initialize(viewport);
 }
开发者ID:Arkady92,项目名称:PUSN,代码行数:8,代码来源:Robot.cs


示例20: BeginTransition3D

        protected override void BeginTransition3D(TransitionElement transitionElement, ContentPresenter oldContent, ContentPresenter newContent, Viewport3D viewport)
        {
            Brush clone = CreateBrush(oldContent);

            Size size = transitionElement.RenderSize;
            MeshGeometry3D leftDoor = CreateMesh(new Point3D(),
               new Vector3D(size.Width / 2, 0, 0),
               new Vector3D(0, size.Height, 0),
               1,
               1,
               new Rect(0, 0, 0.5, 1));

            GeometryModel3D leftDoorGeometry = new GeometryModel3D();
            leftDoorGeometry.Geometry = leftDoor;
            leftDoorGeometry.Material = new DiffuseMaterial(clone);

            AxisAngleRotation3D leftRotation = new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0);
            leftDoorGeometry.Transform = new RotateTransform3D(leftRotation);

            GeometryModel3D rightDoorGeometry = new GeometryModel3D();
            MeshGeometry3D rightDoor = CreateMesh(new Point3D(size.Width / 2, 0, 0),
                 new Vector3D(size.Width / 2, 0, 0),
                 new Vector3D(0, size.Height, 0),
                 1,
                 1,
                 new Rect(0.5, 0, 0.5, 1));

            rightDoorGeometry.Geometry = rightDoor;
            rightDoorGeometry.Material = new DiffuseMaterial(clone);

            AxisAngleRotation3D rightRotation = new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0);
            rightDoorGeometry.Transform = new RotateTransform3D(rightRotation, size.Width, 0, 0);


            Model3DGroup doors = new Model3DGroup();
            doors.Children.Add(leftDoorGeometry);
            doors.Children.Add(rightDoorGeometry);

            ModelVisual3D model = new ModelVisual3D();
            model.Content = doors;

            // Replace old content in visual tree with new 3d model
            transitionElement.HideContent(oldContent);
            viewport.Children.Add(model);

            DoubleAnimation da = new DoubleAnimation(90 - 0.5 * FieldOfView, Duration);
            leftRotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, da);

            da = new DoubleAnimation(-(90 - 0.5 * FieldOfView), Duration);
            rightRotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, da);

            da = new DoubleAnimation(0, Duration);
            da.Completed += delegate
            {
                EndTransition(transitionElement, oldContent, newContent);
            };
            clone.BeginAnimation(Brush.OpacityProperty, da);
        }
开发者ID:bradsjm,项目名称:LaJustPowerMeter,代码行数:58,代码来源:DoorTransition.cs



注:本文中的System.Windows.Media.Media3D.ModelVisual3D类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Media3D.PerspectiveCamera类代码示例发布时间:2022-05-26
下一篇:
C# Media3D.Model3DGroup类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap