当前位置: 首页>>代码示例>>C#>>正文


C# Media3D.DiffuseMaterial类代码示例

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


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

示例1: FlipTile

        public FlipTile(DiffuseMaterial frontMaterial,
            Size size, Point center, Material backMaterial, Rect backTextureCoordinates)
        {
            m_locationDesired = new Point3D(center.X, center.Y, 0);
            m_locationCurrent = new Point3D(0, 0, Util.Rnd.NextDouble() * 10 - 20);
            m_size = size;

            Point3D topLeft = new Point3D(-size.Width / 2, size.Height / 2, 0);
            Point3D topRight = new Point3D(size.Width / 2, size.Height / 2, 0);
            Point3D bottomLeft = new Point3D(-size.Width / 2, -size.Height / 2, 0);
            Point3D bottomRight = new Point3D(size.Width / 2, -size.Height / 2, 0);

            m_frontMaterial = frontMaterial;

            Model3DGroup quad = new Model3DGroup();
            quad.Children.Add(
                CreateTile(
                    frontMaterial,
                    backMaterial,
                    m_borderMaterial,
                    new Size3D(size.Width, size.Height, .01),
                    backTextureCoordinates));

            Transform3DGroup group = new Transform3DGroup();

            group.Children.Add(new RotateTransform3D(m_verticalFlipRotation));
            group.Children.Add(new RotateTransform3D(m_quaternionRotation3D));

            group.Children.Add(m_scaleTransform);
            group.Children.Add(m_translate);

            quad.Transform = group;

            this.Visual3DModel = quad;
        }
开发者ID:hungdluit,项目名称:bot,代码行数:35,代码来源:FlipTile.cs

示例2: floor

        public void floor(double l, double h, double w)
        {
            DiffuseMaterial material1 = new DiffuseMaterial();
            ImageBrush brush = new ImageBrush();
            brush.ImageSource = new BitmapImage(new Uri(@"floor15.jpg", UriKind.Relative));
            brush.Viewport = new Rect(0, 0, 0.1, 0.1);
            brush.TileMode = TileMode.Tile;
            material1.Brush = brush;

            Model3DGroup cube = new Model3DGroup();
            material[0] = material1;
            material[1] = material1;
            material[2] = material1;
            material[3] = material1;
            material[4] = material1;
            material[5] = material1;
            material[6] = material1;
            material[7] = material1;
            material[8] = material1;
            material[9] = material1;
            material[10] = material1;
            material[11] = material1;
            cubegroup(l, h, w,ref cube,  material);
            this.Content = cube;  
        }
开发者ID:uwitec,项目名称:gloryview-rfid,代码行数:25,代码来源:ModelWall.cs

示例3: 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

示例4: makeTriangle

        private ModelVisual3D makeTriangle(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3)
        {
            MeshGeometry3D triangleMesh = new MeshGeometry3D();

            Point3D point0 = new Point3D(x1, y1, z1);
            Point3D point1 = new Point3D(x2, y2, z2);
            Point3D point2 = new Point3D(x3, y3, z3);

            triangleMesh.Positions.Add(point0);
            triangleMesh.Positions.Add(point1);
            triangleMesh.Positions.Add(point2);

            triangleMesh.TriangleIndices.Add(0); // Важно - порядок обхода
            triangleMesh.TriangleIndices.Add(2);
            triangleMesh.TriangleIndices.Add(1);

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

            Material material = new DiffuseMaterial(new SolidColorBrush(Colors.Red));

            return new ModelVisual3D { Content = new GeometryModel3D(triangleMesh, material) };
        }
开发者ID:alno,项目名称:hse-oop-csharp,代码行数:25,代码来源:Window1.xaml.cs

示例5: 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

示例6: aricondition

        public void aricondition(double x, double y, double z)
        {
            type = 4;
            DiffuseMaterial material1 = new DiffuseMaterial();
            material1.Brush = Brushes.LightGray;
            DiffuseMaterial material2 = new DiffuseMaterial();
            ImageBrush brush = new ImageBrush();
            brush.ImageSource = new BitmapImage(new Uri(@"air.jpg", UriKind.Relative));
            material2.Brush = brush;

            Model3DGroup cube = new Model3DGroup();
            material[0] = material1;
            material[1] = material1;
            material[2] = material1;
            material[3] = material1;
            material[4] = material1;
            material[5] = material1;
            material[6] = material1;
            material[7] = material1;
            material[8] = material2;
            material[9] = material2;
            material[10] = material1;
            material[11] = material1;
            cubegroup( x, y, z,ref cube, material);
            this.Content = cube;           
        }
开发者ID:uwitec,项目名称:gloryview-rfid,代码行数:26,代码来源:ModelObject.cs

示例7: 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

示例8: CreateTriangleModel

        public Model3DGroup CreateTriangleModel(Point3D p0, Point3D p1, Point3D p2)
        {
            MeshGeometry3D mesh = new MeshGeometry3D();
            mesh.Positions.Add(p0);
            mesh.Positions.Add(p1);
            mesh.Positions.Add(p2);

            for (int i = 0; i < 3; i++)
            {
                mesh.TriangleIndices.Add(i);
            }

            Vector3D normal = CalculateNormal(p0, p1, p2);

            for (int i = 0; i < 3; i++)
            {
                mesh.Normals.Add(normal);
            }

            Material material = new DiffuseMaterial(new SolidColorBrush(Colors.DarkCyan));
            GeometryModel3D model = new GeometryModel3D(mesh, material);
            Model3DGroup group = new Model3DGroup();
            group.Children.Add(model);
            return group;
        }
开发者ID:AaronRevilla,项目名称:TT_2012b-049_ComputerGraphics,代码行数:25,代码来源:Graficos.cs

示例9: 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

示例10: GetSkeletonModel

        public static Model3D GetSkeletonModel(AnimData animData, int frameNo)
        {
            if (null == animData) {
                return null;
            }

            GeometryModel3D model = new GeometryModel3D();
            MeshGeometry3D mesh = new MeshGeometry3D();

            Point3D[] parentPoints = new Point3D[64];
            parentPoints[0] = new Point3D(0, 0, 0);

            for (int jointNum = 0; jointNum < animData.skeletonDef.GetLength(0); ++jointNum)
            {
                int parentIndex = animData.skeletonDef[jointNum];
                // Binding position
                Point3D pos = animData.bindingPose[jointNum];

                if (frameNo >= 0)
                {
                    AnimMeshPose pose = animData.perFrameFKPoses[frameNo, jointNum];
                    pos = pose.Position;
                }
                parentPoints[parentIndex + 1] = pos;
                AddBone(mesh, parentPoints[parentIndex], pos);
            }

            model.Geometry = mesh;

            DiffuseMaterial dm = new DiffuseMaterial();
            dm.Brush = new SolidColorBrush(Colors.DarkGreen);
            model.Material = dm;

            return model;
        }
开发者ID:Stranho,项目名称:bgda-explorer,代码行数:35,代码来源:SkeletonProcessor.cs

示例11: Setup3DItem

        public void Setup3DItem(Model3DGroup targetGroup, DiffuseMaterial diffuseMaterialBrushPair,
            Size size, Point center, Material backMaterial, Rect backTextureCoordinates)
        {
            _locationDesired = new Point3D(center.X, center.Y, 0);
            _locationCurrent = new Point3D(0, 0, Rnd.NextDouble() * 10 - 20);
            _size = size;

            Point3D topLeft = new Point3D(-size.Width / 2, size.Height / 2, 0);
            Point3D topRight = new Point3D(size.Width / 2, size.Height / 2, 0);
            Point3D bottomLeft = new Point3D(-size.Width / 2, -size.Height / 2, 0);
            Point3D bottomRight = new Point3D(size.Width / 2, -size.Height / 2, 0);

            DiffuseMaterial = diffuseMaterialBrushPair;

            _quad.Children.Add(
                CreateTile(
                    diffuseMaterialBrushPair,
                    backMaterial,
                    _borderMaterial,
                    new Size3D(size.Width, size.Height, .01),
                    backTextureCoordinates));

            Transform3DGroup group = new Transform3DGroup();

            group.Children.Add(new RotateTransform3D(_verticalFlipRotation));
            group.Children.Add(new RotateTransform3D(this._quaternionRotation3D));

            group.Children.Add(_scaleTransform);
            group.Children.Add(_translate);

            _quad.Transform = group;

            targetGroup.Children.Add(_quad);
        }
开发者ID:liuxr,项目名称:wpfumprototype,代码行数:34,代码来源:TileData.cs

示例12: CreateCube

        //--------------------------------------------------------------------------------------------
        public Model3DGroup CreateCube()
        {
            Model3DGroup models = new Model3DGroup();

            Point3D p0 = new Point3D(0, 0, 0);
            Point3D p1 = new Point3D(1, 0, 0);
            Point3D p2 = new Point3D(1, 1, 0);
            Point3D p3 = new Point3D(0, 1, 0);
            Point3D p4 = new Point3D(0, 0, 1);
            Point3D p5 = new Point3D(1, 0, 1);
            Point3D p6 = new Point3D(1, 1, 1);
            Point3D p7 = new Point3D(0, 1, 1);

            ImageBrush myBrush = new ImageBrush(new BitmapImage(new Uri(@"brick.jpg", UriKind.RelativeOrAbsolute)));
            myBrush.TileMode = TileMode.Tile;

            //BitmapImage brickjpg = new BitmapImage();
            //brickjpg.BeginInit();
            //brickjpg.UriSource = new Uri(@"brick.jpg", UriKind.RelativeOrAbsolute);
            //brickjpg.EndInit();
            //DiffuseMaterial DiffMat = new DiffuseMaterial(new ImageBrush(brickjpg));

            DiffuseMaterial DiffMat = new DiffuseMaterial(myBrush);

            models.Children.Add(CreateRectangle(p3, p2, p1, p0, DiffMat));
            models.Children.Add(CreateRectangle(p4, p5, p6, p7, DiffMat));
            models.Children.Add(CreateRectangle(p0, p1, p5, p4, DiffMat));
            models.Children.Add(CreateRectangle(p1, p2, p6, p5, DiffMat));
            models.Children.Add(CreateRectangle(p2, p3, p7, p6, DiffMat));
            models.Children.Add(CreateRectangle(p3, p0, p4, p7, DiffMat));

            return models;
        }
开发者ID:777ondro,项目名称:sw-en,代码行数:34,代码来源:Window3.xaml.cs

示例13: 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

示例14: ParticleSystem

        public ParticleSystem(int maxCount, System.Windows.Media.Color color)
        {
            this.maxParticleCount = maxCount;

            this.particleList = new List<Particle>();

            this.particleModel = new GeometryModel3D();
            this.particleModel.Geometry = new MeshGeometry3D();

            Ellipse e = new Ellipse();
            e.Width = 32.0;
            e.Height = 32.0;
            RadialGradientBrush b = new RadialGradientBrush();
            b.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0xFF, color.R, color.G, color.B), 0.25));
            b.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0x00, color.R, color.G, color.B), 1.0));
            e.Fill = b;
            e.Measure(new System.Windows.Size(32, 32));
            e.Arrange(new Rect(0, 0, 32, 32));

            var brush = new VisualBrush(e);

            DiffuseMaterial material = new DiffuseMaterial(brush);

            this.particleModel.Material = material;

            this.rand = new Random(brush.GetHashCode());
        }
开发者ID:xerxesb,项目名称:codekatas,代码行数:27,代码来源:ParticleSystem.cs

示例15: Sphere

        /// <summary>
        /// Default constructor
        /// </summary>
        public Sphere()
            : base()
        {
            GeometryTransform.Children.Add(scaleTransform);
            GeometryTransform.Children.Add(translateTransform);

            Material = new DiffuseMaterial(Brushes.Blue);
            Geometry = GetMesh();
        }
开发者ID:prabuddha1987,项目名称:NuGenBioChem,代码行数:12,代码来源:Sphere.cs


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