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

C# Media3D.Visual3D类代码示例

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

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



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

示例1: AddContours

 private void AddContours(Visual3D model1, int o, int m, int n)
 {
     var bounds = Visual3DHelper.FindBounds(model1, Transform3D.Identity);
     for (int i = 1; i < n; i++)
     {
         this.ContourPlane = new Plane3D(new Point3D(0, 0, bounds.Location.Z + bounds.Size.Z * i / n), new Vector3D(0, 0, 1));
         Visual3DHelper.Traverse<GeometryModel3D>(model1, this.AddContours);
     }
     for (int i = 1; i < m; i++)
     {
         this.ContourPlane = new Plane3D(new Point3D(0, bounds.Location.Y + bounds.Size.Y * i / m, 0), new Vector3D(0, 1, 0));
         Visual3DHelper.Traverse<GeometryModel3D>(model1, this.AddContours);
     }
     for (int i = 1; i < o; i++)
     {
         this.ContourPlane = new Plane3D(new Point3D(bounds.Location.X + bounds.Size.X * i / o, 0, 0), new Vector3D(1, 0, 0));
         Visual3DHelper.Traverse<GeometryModel3D>(model1, this.AddContours);
     }
 }
开发者ID:BEEden,项目名称:Diplomarbeit,代码行数:19,代码来源:MainWindow.xaml.cs


示例2: ManipulatorControl

 public ManipulatorControl(ManipulatorType type, Visual3D visual)
 {
     targetVisual = visual;
     Type = type;
     Transform = targetVisual.Transform;
     Diameter = 0.5;
     double l = 5;
     switch (type)
     {
         case ManipulatorType.TranslateX:
             Normal = new Vector3D(0, 0, 1);
             Direction = new Vector3D(l, 0, 0);
             Fill = Brushes.Red;
             break;
         case ManipulatorType.TranslateY:
             Normal = new Vector3D(0, 0, 1);
             Direction = new Vector3D(0, l, 0);
             Fill = Brushes.Green;
             break;
         case ManipulatorType.TranslateZ:
             Normal = new Vector3D(0, 1, 0);
             Direction = new Vector3D(0, 0, l);
             Fill = Brushes.Blue;
             break;
     }
 }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:26,代码来源:ManipulatorControl.cs


示例3: BlipVisual

 public BlipVisual(Visual3D visual, bool isVisualUpright, TranslateTransform3D translate, AxisAngleRotation3D rotate)
 {
     this.Visual = visual;
     this.IsVisualUpright = isVisualUpright;
     this.Translate = translate;
     this.Rotate = rotate;
 }
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:7,代码来源:MinimapHelper.cs


示例4: Export

 public void Export(Visual3D visual)
 {
     object obj = visual;
     if (CreateResourceDictionary)
         obj = WrapInResourceDictionary(obj);
     XamlWriter.Save(obj, xw);
 }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:7,代码来源:XamlExporter.cs


示例5: RemoveChild

 public static void RemoveChild(DependencyObject parent, Visual3D v3d)
 {
     var parentAsModelVisual3D = parent as ModelVisual3D;
     if (parentAsModelVisual3D != null)
     {
         parentAsModelVisual3D.Children.Remove(v3d);
     }
 }
开发者ID:node-net,项目名称:Node.Net,代码行数:8,代码来源:Visual3D.Extension.cs


示例6: Visual3DClickedEventArgs

 public Visual3DClickedEventArgs(Visual3D visual, MouseButtonState left, MouseButtonState right, bool hasMoved, Point position)
 {
     _Visual = visual;
     _LeftButton = left;
     _RightButton = right;
     _HasMoved = hasMoved;
     _MousePosition = position;
 }
开发者ID:generateui,项目名称:SettleIn,代码行数:8,代码来源:Visual3DClickedEventArgs.cs


示例7: HitTest

 public Point3D? HitTest(Visual3D reference, Point3D point, Vector3D direction)
 {
     if (reference != null)
     {
         var hitParams = new RayHitTestParameters(point, direction);
         hit = false;
         VisualTreeHelper.HitTest(reference, null, HitTestCallback, hitParams);
         if (hit)
         {
             return hitTestValue;
         }
     }
     return null;
 }
开发者ID:node-net,项目名称:Node.Net,代码行数:14,代码来源:HitTester.cs


示例8: IsTransparent

        /// <summary>
        /// Determines whether the specified visual is transparent.
        /// </summary>
        /// <param name="v">The v.</param>
        /// <returns>
        /// 	<c>true</c> if the specified visual is transparent; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsTransparent(Visual3D v)
        {
            var mv3D = v as ModelVisual3D;
            if (mv3D != null)
            {
                // check if Model3D is transparent
                if (IsTransparent(mv3D.Content))
                    return true;

                // check if any child Visual3D are transparent
                return mv3D.Children.Any(IsTransparent);
            }

            return false;
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:22,代码来源:OpacitySortingHelper.cs


示例9: CreateClone

        /// <summary>
        /// Create a clone of a Visual3D
        /// </summary>
        /// <param name="v">
        /// a Visual3D
        /// </param>
        /// <returns>
        /// the clone
        /// </returns>
        public static Visual3D CreateClone(Visual3D v)
        {
            if (v is ModelUIElement3D)
            {
                var m = v as ModelUIElement3D;
                if (m.Model != null)
                {
                    /*if (m.Model.CanFreeze)
                        m.Model.Freeze();
                    if (m.Model.IsFrozen)*/
                    {
                        var clonedModel = m.Model.Clone();
                        var clonedElement = new ModelUIElement3D();
                        clonedElement.Transform = m.Transform;
                        clonedElement.Model = clonedModel;
                        return clonedElement;
                    }
                }
            }

            if (v is ModelVisual3D)
            {
                var m = v as ModelVisual3D;
                var clone = new ModelVisual3D();
                clone.Transform = m.Transform;
                if (m.Content != null && m.Content.CanFreeze)
                {
                    m.Content.Freeze();
                    var clonedModel = m.Content.Clone();
                    clone.Content = clonedModel;
                }

                if (m.Children.Count > 0)
                {
                    foreach (var child in m.Children)
                    {
                        var clonedChild = CreateClone(child);
                        clone.Children.Add(clonedChild);
                    }
                }

                return clone;
            }

            return null;
        }
开发者ID:ORRNY66,项目名称:helix-toolkit,代码行数:55,代码来源:StereoHelper.cs


示例10: RayMeshGeometry3DHitTestResult

        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        #region Constructors

        internal RayMeshGeometry3DHitTestResult(
            Visual3D visualHit,
            Model3D modelHit,
            MeshGeometry3D meshHit,
            Point3D pointHit,
            double distanceToRayOrigin, 
            int vertexIndex1,
            int vertexIndex2,
            int vertexIndex3,
            Point barycentricCoordinate) : base (visualHit, modelHit)
            {
                _meshHit = meshHit;
                _pointHit = pointHit;
                _distanceToRayOrigin = distanceToRayOrigin;
                _vertexIndex1 = vertexIndex1;
                _vertexIndex2 = vertexIndex2;
                _vertexIndex3 = vertexIndex3;
                _barycentricCoordinate = barycentricCoordinate;
            }
开发者ID:JianwenSun,项目名称:cc,代码行数:27,代码来源:RayMeshGeometry3DHitTestResult.cs


示例11: PropagateFlags

        /// <summary>
        /// Propagates the flags up to the root.
        /// </summary>
        /// <remarks>
        /// The walk stops on a node with all of the required flags set.
        /// </remarks>
        internal static void PropagateFlags(
            Visual3D e, 
            VisualFlags flags,
            VisualProxyFlags proxyFlags)
        {
            while ((e != null) && 
                   (!e.CheckFlagsAnd(flags) || !e.CheckFlagsOnAllChannels(proxyFlags)))
            {
                // These asserts are mostly for documentation when diffing the 2D/3D
                // implementations.
                Debug.Assert(!e.CheckFlagsOr(VisualFlags.ShouldPostRender),
                    "Visual3Ds should never be the root of a tree.");
                 Debug.Assert(!e.CheckFlagsOr(VisualFlags.NodeIsCyclicBrushRoot),
                    "Visual3Ds should never be the root of an ICyclicBrush.");

                e.SetFlags(true, flags);
                e.SetFlagsOnAllChannels(true, proxyFlags);

                // If our 3D parent is null call back into VisualTreeUtils to potentially
                // continue the walk in 2D.
                if (e._3DParent == null)
                {
                    Viewport3DVisual viewport = e.InternalVisualParent as Viewport3DVisual;

                    Debug.Assert((viewport == null) == (e.InternalVisualParent == null),
                        "Viewport3DVisual is the only supported 2D parent of a 3D visual.");
                    
                    if(viewport != null)
                    {
                        // We must notify the 2D visual that its contents have changed.
                        // This will cause the 2D visual to set it's content dirty flag
                        // and continue the propagation of IsDirtyForRender/Precompute.
                        viewport.Visual3DTreeChanged();

                        // continue propagating flags up the 2D world
                        Visual.PropagateFlags(viewport, flags, proxyFlags);
                    }
                        
                    // Stop propagating.  We are at the root of the 3D subtree.
                    return;
                }

                e = e._3DParent;
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:51,代码来源:Visual3D.cs


示例12: DoAnyChildrenHaveABitSet

        /// <summary>
        ///     Check all the children for a bit.
        /// </summary>
        internal static bool DoAnyChildrenHaveABitSet(Visual3D pe,
                                                      VisualFlags flag)
        {

            int count = pe.InternalVisual2DOr3DChildrenCount;
            for (int i = 0; i < count; i++)
            {
                DependencyObject child = pe.InternalGet2DOr3DVisualChild(i);
                                
                Visual v = null;
                Visual3D v3D = null;
                VisualTreeUtils.AsNonNullVisual(child, out v, out v3D);
                
                if (v != null && v.CheckFlagsAnd(flag))
                {
                    return true;
                }
                else if (v3D != null && v3D.CheckFlagsAnd(flag))
                {
                    return true;
                }
            }

            return false;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:28,代码来源:Visual3D.cs


示例13: TryTransformToViewport3DVisual

        /// <summary>
        /// Computes the transformation matrix to go from a 3D point in the given Visual3D's coordinate space out in to
        /// the Viewport3DVisual.
        /// </summary> 
        internal static bool TryTransformToViewport3DVisual(Visual3D visual3D, out Viewport3DVisual viewport, out Matrix3D matrix)
        { 
            matrix = GetWorldTransformationMatrix(visual3D, out viewport); 

            if (viewport != null) 
            {
                matrix *= GetWorldToViewportTransform3D(viewport.Camera, viewport.Viewport);
                return true;
            } 
            else
            { 
                return false; 
            }
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:18,代码来源:M3DUtil.cs


示例14: GetWorldTransformationMatrix

        /// <summary> 
        /// Gets the object space to world space transformation for the given Visual3D
        /// </summary>
        /// <param name="visual">The visual whose world space transform should be found</param>
        /// <returns>The world space transformation</returns> 
        internal static Matrix3D GetWorldTransformationMatrix(Visual3D visual)
        { 
            Viewport3DVisual ignored; 

            return GetWorldTransformationMatrix(visual, out ignored); 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:11,代码来源:M3DUtil.cs


示例15: BillboardGeometryBuilder

 /// <summary>
 /// Initializes a new instance of the <see cref="BillboardGeometryBuilder"/> class.
 /// </summary>
 /// <param name="visual">
 /// The visual.
 /// </param>
 public BillboardGeometryBuilder(Visual3D visual)
     : base(visual)
 {
 }
开发者ID:ORRNY66,项目名称:helix-toolkit,代码行数:10,代码来源:BillboardGeometryBuilder.cs


示例16: GetCameraDistance

 /// <summary>
 /// Gets the distance from the camera for the specified visual.
 /// </summary>
 /// <param name="c">
 /// The visual.
 /// </param>
 /// <param name="cameraPos">
 /// The camera position.
 /// </param>
 /// <param name="transform">
 /// The total transform of the visual.
 /// </param>
 /// <returns>
 /// The camera distance.
 /// </returns>
 private double GetCameraDistance(Visual3D c, Point3D cameraPos, Transform3D transform)
 {
     var bounds = Visual3DHelper.FindBounds(c, transform);
     switch (this.Method)
     {
         case SortingMethod.BoundingBoxCenter:
             var mid = new Point3D(
                 bounds.X + bounds.SizeX * 0.5, bounds.Y + bounds.SizeY * 0.5, bounds.Z + bounds.SizeZ * 0.5);
             return (mid - cameraPos).LengthSquared;
         case SortingMethod.BoundingBoxCorners:
             double d = double.MaxValue;
             d = Math.Min(d, cameraPos.DistanceTo(new Point3D(bounds.X, bounds.Y, bounds.Z)));
             d = Math.Min(d, cameraPos.DistanceTo(new Point3D(bounds.X + bounds.SizeX, bounds.Y, bounds.Z)));
             d = Math.Min(
                 d, cameraPos.DistanceTo(new Point3D(bounds.X + bounds.SizeX, bounds.Y + bounds.SizeY, bounds.Z)));
             d = Math.Min(d, cameraPos.DistanceTo(new Point3D(bounds.X, bounds.Y + bounds.SizeY, bounds.Z)));
             d = Math.Min(d, cameraPos.DistanceTo(new Point3D(bounds.X, bounds.Y, bounds.Z + bounds.SizeZ)));
             d = Math.Min(
                 d, cameraPos.DistanceTo(new Point3D(bounds.X + bounds.SizeX, bounds.Y, bounds.Z + bounds.SizeZ)));
             d = Math.Min(
                 d,
                 cameraPos.DistanceTo(
                     new Point3D(bounds.X + bounds.SizeX, bounds.Y + bounds.SizeY, bounds.Z + bounds.SizeZ)));
             d = Math.Min(
                 d, cameraPos.DistanceTo(new Point3D(bounds.X, bounds.Y + bounds.SizeY, bounds.Z + bounds.SizeZ)));
             return d;
         default:
             var boundingSphere = BoundingSphere.CreateFromRect3D(bounds);
             return boundingSphere.DistanceFrom(cameraPos);
     }
 }
开发者ID:ORRNY66,项目名称:helix-toolkit,代码行数:46,代码来源:SortingVisual3D.cs


示例17: SetParent

        internal void SetParent(Visual3D newParent)
        {
            _2DParent.ClearValue(this);
            _3DParent = newParent;

            Debug.Assert(InternalVisualParent == newParent);
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:7,代码来源:Visual3D.cs


示例18: AddVisual3DChild

        //------------------------------------------------------
        //
        //  Public Properties
        //
        //------------------------------------------------------
        
        //------------------------------------------------------
        //
        //  Public Events
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Protected Methods
        //
        //------------------------------------------------------
        
        #region Protected Methods

        /// <summary>
        /// AttachChild
        ///
        ///    Derived classes must call this method to notify the Visual3D layer that a new
        ///    child appeard in the children collection. The Visual3D layer will then call the GetVisual3DChild
        ///    method to find out where the child was added.
        ///
        ///  Remark: To move a Visual3D child in a collection it must be first disconnected and then connected
        ///    again. (Moving forward we might want to add a special optimization there so that we do not
        ///    unmarshal our composition resources).
        /// </summary>
        protected void AddVisual3DChild(Visual3D child)
        {            
            // It is invalid to modify the children collection that we 
            // might be iterating during a property invalidation tree walk.
            if (IsVisualChildrenIterationInProgress)
            {
                throw new InvalidOperationException(SR.Get(SRID.CannotModifyVisualChildrenDuringTreeWalk));
            }

            Debug.Assert(child != null);
            Debug.Assert(child.InternalVisualParent == null);

            child.SetParent(this);
            
            // set the inheritance context so databinding, etc... work
            ProvideSelfAsInheritanceContext(child, null);
            
            // The child already might be dirty. Hence we need to propagate dirty information
            // from the parent and from the child.
            Visual3D.PropagateFlags(
                this, 
                VisualFlags.IsSubtreeDirtyForPrecompute, 
                VisualProxyFlags.IsSubtreeDirtyForRender);

            Visual3D.PropagateFlags(
                child, 
                VisualFlags.IsSubtreeDirtyForPrecompute, 
                VisualProxyFlags.IsSubtreeDirtyForRender);

            // 


            // Fire notifications
            OnVisualChildrenChanged(child, /* visualRemoved = */ null);
            
            child.FireOnVisualParentChanged(null);
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:68,代码来源:Visual3D.cs


示例19: RemoveVisual3DChild

        /// <summary>
        /// DisconnectChild
        ///
        ///    Derived classes must call this method to notify the Visual3D layer that a
        ///    child was removed from the children collection. The Visual3D layer will then call
        ///    GetVisual3DChild to find out which child has been removed.
        ///
        /// </summary>
        protected void RemoveVisual3DChild(Visual3D child)
        {
            // It is invalid to modify the children collection that we 
            // might be iterating during a property invalidation tree walk.
            if (IsVisualChildrenIterationInProgress)
            {
                throw new InvalidOperationException(SR.Get(SRID.CannotModifyVisualChildrenDuringTreeWalk));
            }

            Debug.Assert(child != null);
            Debug.Assert(child.InternalVisualParent == this);

            child.SetParent(/* newParent = */ (Visual3D) null);  // CS0121: Call is ambigious without casting null to Visual3D.
                    
            // remove the inheritance context
            RemoveSelfAsInheritanceContext(child, null);
                        
            //
            // Remove the child on all the channels 
            // this visual is being marshalled to.
            //

            for (int i = 0, limit = _proxy.Count; i < limit; i++) 
            {
                DUCE.Channel channel = _proxy.GetChannel(i);

                if (child.CheckFlagsAnd(channel, VisualProxyFlags.IsConnectedToParent))
                {
                    child.SetFlags(channel, false, VisualProxyFlags.IsConnectedToParent);
                    DUCE.IResource childResource = (DUCE.IResource)child;
                    childResource.RemoveChildFromParent(this, channel);
                    childResource.ReleaseOnChannel(channel);
                }
            }

            //
            // Force a full precompute and render pass for this visual.
            //

            Visual3D.PropagateFlags(
                this, 
                VisualFlags.IsSubtreeDirtyForPrecompute,
                VisualProxyFlags.IsSubtreeDirtyForRender);

            // 


            // Fire notifications
            child.FireOnVisualParentChanged(this);

            OnVisualChildrenChanged(/* visualAdded = */ null , child);
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:60,代码来源:Visual3D.cs


示例20: LineGeometryBuilder

 /// <summary>
 /// Initializes a new instance of the <see cref="LineGeometryBuilder"/> class.
 /// </summary>
 /// <param name="visual">
 /// The visual parent of the geometry (the transform is calculated from this object).
 /// </param>
 public LineGeometryBuilder(Visual3D visual)
     : base(visual)
 {
 }
开发者ID:chantsunman,项目名称:helix-toolkit,代码行数:10,代码来源:LineGeometryBuilder.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# TextFormatting.TextLine类代码示例发布时间:2022-05-26
下一篇:
C# Media3D.Vector3D类代码示例发布时间: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