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


C# MeshBuilder.AddQuad方法代码示例

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


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

示例1: buildQuad

 private static object buildQuad()
 {
     var mb = new MeshBuilder(true, false);
     var p0 = new Point3D(0, 0, 0);
     var p1 = new Point3D(1, 0, 0);
     var p2 = new Point3D(1, 1, 0);
     var p3 = new Point3D(0, 1, 0);
     mb.AddQuad(p0, p1, p2, p3);
     mb.Normals.ToList().ForEach(x => System.Diagnostics.Trace.WriteLine(x.ToString()));
     return mb.ToMesh();
 }
开发者ID:chantsunman,项目名称:helix-toolkit,代码行数:11,代码来源:MainWindow.xaml.cs

示例2: Tessellate

        protected override MeshGeometry3D Tessellate()
        {
            // A quadrilateral defined by the four corner points.
             // tl              tr
             // +---------------+
             // |               |
             // |               |
             // +---------------+
             // bl              br

             // The texture coordinates are
             // (0,0)           (1,0)
             // +---------------+
             // |               |
             // |               |
             // +---------------+
             // (0,1)          (1,1)

             MeshBuilder builder = new MeshBuilder(false, true);
             // Initially use defaults
             Vector3D upVector = new Vector3D(0, 0, 1);
             Vector3D observerVector = new Vector3D(0, 1, 0);

             // Get the value from the camera if a camera exists.
             Viewport3D viewport = this.GetViewport3D();
             if (viewport != null) {
            ProjectionCamera camera = viewport.Camera as ProjectionCamera;
            if (camera != null) {
               Point3D cameraPosition = camera.Position;
               // Get direction to observer
               //upVector = camera.UpDirection;
               observerVector = Origin - camera.Position;
            }
             }
             observerVector.Normalize();
             upVector.Normalize();
             Vector3D widthVector = Vector3D.CrossProduct(upVector, observerVector);
             widthVector.Normalize();
             Vector3D heightVector = Vector3D.CrossProduct(widthVector, observerVector);
             heightVector.Normalize();

             Vector3D halfWidthVector = widthVector * Width * 0.5;
             Vector3D halfHeightVector = heightVector * Height * 0.5;
             // Centre of billboard
             Point3D centrePoint = Origin - (observerVector * OriginOffset);
             // Bottom-left corner to visual space
             Point3D bl = centrePoint + halfWidthVector + halfHeightVector;
             // Bottom-right corner to visual space
             Point3D br = centrePoint - halfWidthVector + halfHeightVector;
             // Top-right corner to visual space
             Point3D tr = centrePoint - halfWidthVector - halfHeightVector;
             // Top-left corner to visual space
             Point3D tl = centrePoint + halfWidthVector - halfHeightVector;
             builder.AddQuad(bl, br, tr, tl,
                  new Point(0, 1),
                new Point(1, 1),
                new Point(1, 0),
                new Point(0, 0)
                );
                //  new Point(0, 1),
                //new Point(1, 1),
                //new Point(1, 0),
                //new Point(0, 0));
             return builder.ToMesh();
        }
开发者ID:chantsunman,项目名称:helix-toolkit,代码行数:65,代码来源:FaceTheCameraBillboard.cs

示例3: AppearanceChanged

        private void AppearanceChanged()
        {
            var builder = new MeshBuilder(false, false);
            foreach (var p1 in DistributePoles(this.Positions, this.PoleDistance))
            {
                var p2 = p1 + new Vector3D(0, 0, this.Height);
                builder.AddCylinder(p1, p2, this.Diameter, 36);
            }

            this.postsModel.Geometry = builder.ToMesh();

            var fenceBuilder = new MeshBuilder(false, true);
            var w0 = 0d;
            for (int i = 0; i + 1 < this.Positions.Count; i++)
            {
                var p0 = this.Positions[i];
                var p1 = this.Positions[i + 1];
                var p2 = this.Positions[i + 1] + new Vector3D(0, 0, this.Height);
                var p3 = this.Positions[i] + new Vector3D(0, 0, this.Height);
                var h = this.Height / this.MeshSize;
                var dw = p0.DistanceTo(p1) / this.MeshSize;
                fenceBuilder.AddQuad(
                    p0,
                    p1,
                    p2,
                    p3,
                    new Point(w0, h),
                    new Point(w0 + dw, h),
                    new Point(w0 + dw, 0),
                    new Point(w0, 0));
                w0 += dw;
            }

            this.fenceModel.Geometry = fenceBuilder.ToMesh();
        }
开发者ID:chantsunman,项目名称:helix-toolkit,代码行数:35,代码来源:FenceVisual3D.cs


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