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


C# DiffuseMaterial.SetValue方法代码示例

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


在下文中一共展示了DiffuseMaterial.SetValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InteractiveVisual3D

        static InteractiveVisual3D()
        {
            _defaultMaterialPropertyValue = new DiffuseMaterial();
            _defaultMaterialPropertyValue.SetValue(InteractiveVisual3D.IsInteractiveMaterialProperty, true);
            _defaultMaterialPropertyValue.Freeze();

            MaterialProperty = DependencyProperty.Register("Material",
                                                           typeof(Material),
                                                           typeof(InteractiveVisual3D),
                                                           new PropertyMetadata(_defaultMaterialPropertyValue, 
                                                                                new PropertyChangedCallback(OnMaterialPropertyChanged)));
        }
开发者ID:ssickles,项目名称:archive,代码行数:12,代码来源:InteractiveVisual3D.cs

示例2: CreateVisualChild

        private FrameworkElement CreateVisualChild()
        {
            MeshGeometry3D simpleQuad = new MeshGeometry3D()
                                            {
                                                Positions = new Point3DCollection(_mesh),
                                                TextureCoordinates = new PointCollection(_texCoords),
                                                TriangleIndices = new Int32Collection(_indices)
                                            };

            // Front material is interactive, back material is not.
            Material frontMaterial = new DiffuseMaterial(Brushes.White);
            frontMaterial.SetValue(Viewport2DVisual3D.IsVisualHostMaterialProperty, true);

            VisualBrush vb = new VisualBrush(_logicalChild);
            SetCachingForObject(vb);  // big perf wins by caching!!
            Material backMaterial = new DiffuseMaterial(vb);

            _rotationTransform.Rotation = _quaternionRotation;
            var xfGroup = new Transform3DGroup() { Children = { _scaleTransform, _rotationTransform } };

            GeometryModel3D backModel = new GeometryModel3D() { Geometry = simpleQuad, Transform = xfGroup, BackMaterial = backMaterial };
            Model3DGroup m3dGroup = new Model3DGroup()
                                        {
                                            Children = { new DirectionalLight(Colors.White, new Vector3D(0, 0, -1)),
                                                         new DirectionalLight(Colors.White, new Vector3D(0.1, -0.1, 1)),
                                                         backModel }
                                        };

            // Non-interactive Visual3D consisting of the backside, and two lights.
            ModelVisual3D mv3d = new ModelVisual3D() { Content = m3dGroup };

            // Interactive frontside Visual3D
            Viewport2DVisual3D frontModel = new Viewport2DVisual3D() { Geometry = simpleQuad, Visual = _logicalChild, Material = frontMaterial, Transform = xfGroup };

            // Cache the brush in the VP2V3 by setting caching on it.  Big perf wins.
            SetCachingForObject(frontModel);

            // Scene consists of both the above Visual3D's.
            _viewport3d = new Viewport3D() { ClipToBounds = false, Children = { mv3d, frontModel } };

            UpdateRotation();

            return _viewport3d;
        }
开发者ID:krikelin,项目名称:torshify-client,代码行数:44,代码来源:Planerator.cs

示例3: GetVisual3DRepresentation

        protected override InteractiveVisual3D GetVisual3DRepresentation(object o)
        {
            FlickrPhoto photo = (FlickrPhoto)o;

            // create the visual3D to return
            PhotoStackViewVisual3D visual3D = new PhotoStackViewVisual3D(photo);

            // set up the material
            MaterialGroup material = new MaterialGroup();
            DiffuseMaterial interactiveMaterial = new DiffuseMaterial();
            interactiveMaterial.SetValue(InteractiveVisual3D.IsInteractiveMaterialProperty, true);
            material.Children.Add(interactiveMaterial);
            material.Children.Add(new SpecularMaterial(Brushes.White, 40));
            visual3D.Material = material;

            visual3D.Geometry = meshGeometry;
            PictureComment xamlRep = GetXamlRepresentation();
            visual3D.Visual = xamlRep;

            xamlRep.pictureVisual.curvatureSlider.ValueChanged +=
                new RoutedPropertyChangedEventHandler<double>(delegate(object sender, RoutedPropertyChangedEventArgs<double> e)
                                                              {
                                                                  visual3D.Geometry = CreateGeometry(e.NewValue);
                                                              });

            xamlRep.pictureVisual.closeButton.Click += new RoutedEventHandler(
                                                     delegate(object sender, RoutedEventArgs e)
                                                     {
                                                         RemoveItem(photo);
                                                     });

            xamlRep.pictureVisual.geoButton.Click += new RoutedEventHandler(
                                                     delegate(object sender, RoutedEventArgs e)
                                                     {
                                                         XmlDocument doc = new XmlDocument();
                                                         doc.Load(new StringReader(photo.Info));

                                                         XmlNode node = doc.SelectSingleNode("/photo/location");

                                                         GeoLocationSelected(Double.Parse(node.Attributes["longitude"].Value),
                                                                             Double.Parse(node.Attributes["latitude"].Value),
                                                                             photo);
                                                     });

            xamlRep.pictureVisual.blogButton.Click += new RoutedEventHandler(
                                                      delegate(object sender, RoutedEventArgs e)
                                                      {
                                                          BlogRequested(photo);
                                                      });

            // if there is an authorized user - set it up so they can comment on photos
            if (Flickr.CurrAuthorizedUser != null)
            {
                xamlRep.submitCommentButton.IsEnabled = true;
                xamlRep.submitCommentButton.Click += new RoutedEventHandler(
                        delegate(object sender, RoutedEventArgs e)
                        {
                            Flickr.AsynchPostComments(xamlRep.textBox1.Text,
                                                      photo,
                                                      Flickr.CurrAuthorizedUser,
                                                      Dispatcher,
                                                      delegate(object result)
                                                      {
                                                          if ((bool)result)
                                                          {
                                                              Flickr.AsynchGetPhotoComments(photo,
                                                                                            visual3D.Dispatcher,
                                                                                            delegate(object resultData)
                                                                                            {
                                                                                                PhotoCommentsReceived(xamlRep, (string)resultData);
                                                                                            });
                                                          }
                                                      });
                        });
            }

            // make an asynch call to flickr to get the photo information we're interested in
            if (photo != null)
            {
                BitmapImage b = new BitmapImage(new Uri(photo.URL_Medium));

                if (b.IsDownloading)
                {
                    // use the small image until the large is ready
                    if (photo.SmallImage != null)
                    {
                        xamlRep.UpdateImage(photo.SmallImage);
                    }

                    b.DownloadCompleted += delegate(object sender, EventArgs e)
                                           {
                                               xamlRep.UpdateImage(b);
                                               ScaleVisual3D(visual3D, xamlRep.Width / (2 * xamlRep.Height));
                                           };
                }
                else
                {
                    xamlRep.UpdateImage(b);
                }
            }
//.........这里部分代码省略.........
开发者ID:dingxinbei,项目名称:OLdBck,代码行数:101,代码来源:PhotoStack3D.cs


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