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

C# Media.Int32Collection类代码示例

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

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



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

示例1: Triangulate

        protected override void Triangulate(DependencyPropertyChangedEventArgs args, 
                                            Point3DCollection vertices, 
                                            Vector3DCollection normals, 
                                            Int32Collection indices, 
                                            PointCollection textures)
        {
            vertices.Clear();
            normals.Clear();
            indices.Clear();
            textures.Clear();

            MeshGeometry3D mesh = MeshGenerator.Geometry;

            foreach (Point3D vertex in mesh.Positions)
                vertices.Add(vertex);

            foreach (Vector3D normal in mesh.Normals)
                normals.Add(normal);

            foreach (int index in mesh.TriangleIndices)
                indices.Add(index);

            foreach (Point texture in mesh.TextureCoordinates)
                textures.Add(texture);
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:25,代码来源:ModelVisual.cs


示例2: Triangulate

        protected override void Triangulate(
                                    DependencyPropertyChangedEventArgs args, 
                                    Point3DCollection vertices, 
                                    Vector3DCollection normals, 
                                    Int32Collection indices, 
                                    PointCollection textures)
        {
            // Clear all four collections.
            vertices.Clear();
            normals.Clear();
            indices.Clear();
            textures.Clear();

            // Convert TextGeometry to series of closed polylines.
            PathGeometry path =
                TextGeometry.GetFlattenedPathGeometry(0.001,
                                                ToleranceType.Relative);

            foreach (PathFigure fig in path.Figures)
            {
                list.Clear();
                list.Add(fig.StartPoint);

                foreach (PathSegment seg in fig.Segments)
                {
                    if (seg is LineSegment)
                    {
                        LineSegment lineseg = seg as LineSegment;
                        list.Add(lineseg.Point);
                    }

                    else if (seg is PolyLineSegment)
                    {
                        PolyLineSegment polyline = seg as PolyLineSegment;

                        for (int i = 0; i < polyline.Points.Count; i++)
                            list.Add(polyline.Points[i]);
                    }
                }

                // Figure is complete. Post-processing follows.
                if (list.Count > 0)
                {
                    // Remove last point if it's the same as the first.
                    if (list[0] == list[list.Count - 1])
                        list.RemoveAt(list.Count - 1);

                    // Convert points to Y increasing up.
                    for (int i = 0; i < list.Count; i++)
                    {
                        Point pt = list[i];
                        pt.Y = 2 * Origin.Y - pt.Y;
                        list[i] = pt;
                    }

                    // For each figure, process the points.
                    ProcessFigure(list, vertices, normals, indices, textures);
                }
            }
        }
开发者ID:tianweidut,项目名称:3DMap,代码行数:60,代码来源:GeometryTextBase.cs


示例3: ProcessFigure

        protected override void ProcessFigure(CircularList<Point> list,
                                              Point3DCollection vertices,
                                              Vector3DCollection normals,
                                              Int32Collection indices, 
                                              PointCollection textures)
        {
            int offset = vertices.Count;

            for (int i = 0; i <= list.Count; i++)
            {
                Point pt = list[i];

                // Set vertices.
                vertices.Add(new Point3D(pt.X, pt.Y, 0));
                vertices.Add(new Point3D(pt.X, pt.Y, -Depth));

                // Set texture coordinates.
                textures.Add(new Point((double)i / list.Count, 0));
                textures.Add(new Point((double)i / list.Count, 1));

                // Set triangle indices.
                if (i < list.Count)
                {
                    indices.Add(offset + i * 2 + 0);
                    indices.Add(offset + i * 2 + 2);
                    indices.Add(offset + i * 2 + 1);

                    indices.Add(offset + i * 2 + 1);
                    indices.Add(offset + i * 2 + 2);
                    indices.Add(offset + i * 2 + 3);
                }
            }
        }
开发者ID:tianweidut,项目名称:3DMap,代码行数:33,代码来源:RibbonText.cs


示例4: CreateRectangle

        public static MeshGeometry3D CreateRectangle(double height, double width)
        {
            var vertices = new Point3DCollection();
            var normals = new Vector3DCollection();
            var facets = new Int32Collection();
            var textureCoords = new PointCollection();
            vertices.Add(new Point3D(-width / 2, 0, -height / 2));
            vertices.Add(new Point3D(-width / 2, 0, height / 2));
            vertices.Add(new Point3D(width / 2, 0, -height / 2));
            vertices.Add(new Point3D(width / 2, 0, height / 2));

            normals.Add(new Vector3D(0, -1, 0));
            normals.Add(new Vector3D(0, -1, 0));
            normals.Add(new Vector3D(0, -1, 0));
            normals.Add(new Vector3D(0, -1, 0));

            textureCoords.Add(new Point(1,1));
            textureCoords.Add(new Point(1, 0));
            textureCoords.Add(new Point(0,1));
            textureCoords.Add(new Point(0,0));

            facets.Add(0); facets.Add(1); facets.Add(2); facets.Add(3); facets.Add(2); facets.Add(1);
            var rectangle = new MeshGeometry3D();
            rectangle.Positions = vertices;
            rectangle.Normals = normals;
            rectangle.TriangleIndices = facets;
            rectangle.TextureCoordinates = textureCoords;
            return rectangle;
        }
开发者ID:MathiasBrannstrom,项目名称:SoundToColor,代码行数:29,代码来源:SimpleGeometry3D.cs


示例5: Terrain3D

 static Terrain3D()
 {
     {
     SX = new double[17];
     SZ = new double[17];
     int i = 0;
     for (double d = 0; d < 2; d += 0.125)
     {
       i++;
       SX[i] = Math.Cos(Math.PI * d);
       SZ[i] = Math.Sin(Math.PI * d);
     }
       }
       {
     TEXTURE_COORDINATES = new PointCollection(17);
     TEXTURE_COORDINATES.Add(new Point(0, 0));
     Point p = new Point(1, 0);
     int i = -1;
     while (++i < 16) TEXTURE_COORDINATES.Add(p);
     TEXTURE_COORDINATES.Freeze();
       }
       {
     TRIANGLE_INDICES = new Int32Collection(48);
     for (int i = 1; i < 16; i++)
     {
       TRIANGLE_INDICES.Add(0);
       TRIANGLE_INDICES.Add(i + 1);
       TRIANGLE_INDICES.Add(i);
     }
     TRIANGLE_INDICES.Add(0);
     TRIANGLE_INDICES.Add(1);
     TRIANGLE_INDICES.Add(16);
     TRIANGLE_INDICES.Freeze();
       }
 }
开发者ID:sunoru,项目名称:PBO,代码行数:35,代码来源:Terrain.cs


示例6: OnNumberOfSidesChanged

		private static void OnNumberOfSidesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
		{
			WheelMesh wheel = (WheelMesh)d;

			Point3DCollection points = new Point3DCollection(3 + wheel.NumberOfSides - 2);
			Int32Collection triangles = new Int32Collection(wheel.NumberOfSides);

			// Center
			points.Add(new Point3D(wheel.Radius, wheel.Radius, wheel.Height));
			// Top
			points.Add(new Point3D(wheel.Radius, 0, 0));

			for (int i = 1; i < wheel.NumberOfSides; i++)
			{
				double beta = 2 * Math.PI / wheel.NumberOfSides * i;
				double alpha = (Math.PI - beta) / 2;
				double length = 2 * wheel.Radius * Math.Sin(beta / 2);
				double x = length * Math.Cos(Math.PI / 2 - alpha);
				double y = length * Math.Sin(Math.PI / 2 - alpha);

				points.Add(new Point3D(wheel.Radius + x, y, 0));

				triangles.Add(0);
				triangles.Add(i);
				triangles.Add(i+1);
			}
			triangles.Add(0);
			triangles.Add(wheel.NumberOfSides);
			triangles.Add(1);
			wheel.SetValue(PointsProperty, points);
			wheel.SetValue(TriangleIndicesProperty, triangles);
		}
开发者ID:mkandroid15,项目名称:Samples,代码行数:32,代码来源:WheelMesh.cs


示例7: GetArrowIndices

        public Int32Collection GetArrowIndices()
        {
            Int32Collection cArrowIndices = new Int32Collection();

            for (int i = 0; i < number_of_segments; i++)
            {
                if (i < number_of_segments - 1)
                {
                    cArrowIndices.Add(0);
                    cArrowIndices.Add(i + 2);
                    cArrowIndices.Add(i + 1);
                }
                else // last
                {
                    cArrowIndices.Add(0);
                    cArrowIndices.Add(1);
                    cArrowIndices.Add(i + 1);
                }
            }

            // annulus
            for (int i = 0; i < number_of_segments; i++)
            {
                if (i < number_of_segments - 1)
                {
                    CreateRectangle_CCW(cArrowIndices, i + 1, i + 2, i + 2 + number_of_segments, i + 1 + number_of_segments);
                }
                else // last
                {
                    CreateRectangle_CCW(cArrowIndices, i + 1, 1, 1 + number_of_segments, i + 1 + number_of_segments);
                }
            }

            return cArrowIndices;
        }
开发者ID:777ondro,项目名称:sw-en,代码行数:35,代码来源:Arrow3DTip.cs


示例8: Pokemon3D

 static Pokemon3D()
 {
     TEXTURE_COORDINATES = new PointCollection(new Point[]
     { new Point(0, 1), new Point(0, 0), new Point(1, 1), new Point(1, 0) });
       TRIANGLE_INDICES = new Int32Collection(new int[] { 0, 2, 1, 3, 1, 2 });
       TEXTURE_COORDINATES.Freeze();
       TRIANGLE_INDICES.Freeze();
 }
开发者ID:sunoru,项目名称:PBO,代码行数:8,代码来源:Pokemon.cs


示例9: CreateModel

        private void CreateModel()
        {
            var points = new Point3DCollection();
            var edges = new Int32Collection();
            var triangles = new Int32Collection();
            switch (CurrentModelType)
            {
                case ModelTypes.StellatedOctahedron:
                case ModelTypes.Tetrahedron:
                    points.Add(+1, +1, +1);
                    points.Add(-1, -1, 1);
                    points.Add(-1, +1, -1);
                    points.Add(+1, -1, -1);
                    edges.Add(0, 1, 1, 2, 2, 0, 0, 3, 1, 3, 2, 3);
                    triangles.Add(0, 1, 2, 0, 3, 1, 1, 3, 2, 2, 3, 0);
                    break;
            }
            switch (CurrentModelType)
            {
                case ModelTypes.StellatedOctahedron:
                    // http://en.wikipedia.org/wiki/Compound_of_two_tetrahedra
                    points.Add(-1, +1, +1);
                    points.Add(1, -1, 1);
                    points.Add(1, +1, -1);
                    points.Add(-1, -1, -1);
                    edges.Add(4, 5, 5, 6, 6, 4, 4, 7, 5, 7, 6, 7);
                    triangles.Add(4, 5, 6, 4, 7, 5, 5, 7, 6, 6, 7, 4);
                    break;
            }

            var m = new Model3DGroup();

            // Add the nodes
            var gm = new MeshBuilder();
            foreach (var p in points)
            {
                gm.AddSphere(p, 0.1);
            }
            m.Children.Add(new GeometryModel3D(gm.ToMesh(), Materials.Gold));

            // Add the triangles
            var tm = new MeshBuilder();
            for (int i = 0; i < triangles.Count; i += 3)
            {
                tm.AddTriangle(points[triangles[i]], points[triangles[i + 1]], points[triangles[i + 2]]);
            }
            m.Children.Add(new GeometryModel3D(tm.ToMesh(), Materials.Red) { BackMaterial = Materials.Blue });

            // Add the edges
            var em = new MeshBuilder();
            for (int i = 0; i < edges.Count; i += 2)
            {
                em.AddCylinder(points[edges[i]], points[edges[i + 1]], 0.08, 10);
            }
            m.Children.Add(new GeometryModel3D(em.ToMesh(), Materials.Gray));

            Model = m;
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:58,代码来源:MainViewModel.xaml.cs


示例10: AdaptableDateTimeAxis

 public AdaptableDateTimeAxis()
 {
     SecondIncrements = new Int32Collection(new int[] { 1, 2, 5, 15, 30 });
     MinuteIncrements = new Int32Collection(new int[] { 1, 2, 5, 15, 30 });
     HourIncrements = new Int32Collection(new int[] { 1, 2, 4, 6, 12 });
     DayIncrements = new Int32Collection(new int[] { 1, 2, 5, 10 });
     MonthIncrements = new Int32Collection(new int[] { 1, 2, 4, 6 });
     YearIncrements = new Int32Collection(new int[] { 1, 2, 5 });
 }
开发者ID:MGramolini,项目名称:Trinity,代码行数:9,代码来源:AdaptableDateTimeAxis.cs


示例11: CreateRectangle_CW

        public void CreateRectangle_CW(Int32Collection ArrowIndices, int i0, int i1, int i2, int i3)
        {
            ArrowIndices.Add(i0);
            ArrowIndices.Add(i2);
            ArrowIndices.Add(i1);

            ArrowIndices.Add(i0);
            ArrowIndices.Add(i3);
            ArrowIndices.Add(i2);
        }
开发者ID:777ondro,项目名称:sw-en,代码行数:10,代码来源:StraightLineArrow.cs


示例12: MeshBuilder

        /// <summary>
        /// Initializes a new instance of the <see cref="MeshBuilder"/> class.
        /// </summary>
        /// <param name="generateNormals">generate normals</param>
        /// <param name="generateTextureCoordinates">generate texture coordinates</param>
        public MeshBuilder(bool generateNormals, bool generateTextureCoordinates)
        {
            positions = new Point3DCollection();
            triangleIndices = new Int32Collection();

            if (generateNormals)
                normals = new Vector3DCollection();
            if (generateTextureCoordinates)
                textureCoordinates = new PointCollection();
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:15,代码来源:MeshBuilder.cs


示例13: ProcessFigure

        // ProcessFigure override.
        protected override void ProcessFigure(CircularList<Point> list,
            Point3DCollection vertices,
            Vector3DCollection normals,
            Int32Collection indices,
            PointCollection textures)
        {
            int k = Slices * list.Count;
            int offset = vertices.Count;

            for (int i = 0; i < list.Count; i++)
            {
                Point ptBefore = list[i - 1];
                Point pt = list[i];
                Point ptAfter = list[i + 1];

                Vector v1 = pt - ptBefore;
                v1.Normalize();
                Vector v1Rotated = new Vector(-v1.Y, v1.X);

                Vector v2 = ptAfter - pt;
                v2.Normalize();
                Vector v2Rotated = new Vector(-v2.Y, v2.X);

                Line2D line1 = new Line2D(pt, ptBefore);
                Line2D line2 = new Line2D(pt, ptAfter);

                for (int slice = 0; slice < Slices; slice++)
                {
                    // Angle ranges from 0 to 360 degrees.
                    double angle = slice * 2 * Math.PI / Slices;
                    double scale = EllipseWidth / 2 * Math.Sin(angle);
                    double depth = -Depth / 2 * (1 - Math.Cos(angle));

                    Line2D line1Shifted = line1 + scale * v1Rotated;
                    Line2D line2Shifted = line2 + scale * v2Rotated;
                    Point ptIntersect = line1Shifted * line2Shifted;

                    // Set vertex.
                    vertices.Add(new Point3D(ptIntersect.X, ptIntersect.Y, depth));

                    // Set texture coordinate.
                    textures.Add(new Point((double)i / list.Count,
                                           Math.Sin(angle / 2)));

                    // Set triangle indices.
                    indices.Add(offset + (Slices * i + slice + 0) % k);
                    indices.Add(offset + (Slices * i + slice + 1) % k);
                    indices.Add(offset + (Slices * i + slice + 0 + Slices) % k);

                    indices.Add(offset + (Slices * i + slice + 0 + Slices) % k);
                    indices.Add(offset + (Slices * i + slice + 1) % k);
                    indices.Add(offset + (Slices * i + slice + 1 + Slices) % k);
                }
            }
        }
开发者ID:erdao,项目名称:3DText,代码行数:56,代码来源:EllipticalText.cs


示例14: SegmentCollectionVisual3D

        public SegmentCollectionVisual3D()
        {
            Positions = new Point3DCollection();
            SegmentIndices = new Int32Collection();
            Fill = Brushes.Blue;
            Diameter = 0.1;
            ThetaDiv = 37;

            _element = new ModelVisual3D();
            Children.Add(_element);
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:11,代码来源:SegmentCollectionVisual3D.cs


示例15: get3DWalls

        /// <summary>
        /// This method returns a 3D representation of this building walls
        /// </summary>
        /// <param name="nodesDict">List of all the nodes on the map</param>
        /// <param name="map">bounds of the map</param>
        /// <param name="brush">Color of these walls</param>
        /// <returns>ModelUIElement3D of these walls</returns>
        public ModelUIElement3D get3DWalls(Dictionary<long, OsmSharp.Osm.Node> nodesDict, Map map, ImageBrush brush)
        {
            // Surrounding tags of the mesh
            ModelUIElement3D model = new ModelUIElement3D();
            GeometryModel3D geometryModel = new GeometryModel3D();

            // Mesh and his his properties
            MeshGeometry3D mesh = new MeshGeometry3D();
            DiffuseMaterial material = new DiffuseMaterial((System.Windows.Media.Brush)brush);
            Point3DCollection positions = new Point3DCollection();
            PointCollection texturePoints = new PointCollection();
            Int32Collection indices = new Int32Collection();

            // Add Points of surface and with add points of surface with height 0
            positions = getScaledPositionsWall(nodesDict, map);

            // Add indices to the collection
            for (int i = 0; i < positions.Count - 2; i += 2) {
                indices.Add(i);
                indices.Add(i + 2);
                indices.Add(i + 1);
                indices.Add(i + 3);
                indices.Add(i + 1);
                indices.Add(i + 2);

                // Get the width and height of a wall
                float widthWall = (float)Math.Sqrt(Math.Pow(positions[i].X - positions[i + 2].X, 2) + Math.Pow(positions[i].Y - positions[i + 2].Y, 2));
                int imageWidth = (int)(brush.ImageSource.Width * widthWall);
                int imageHeight = (int)(brush.ImageSource.Height * height);

                // Add texture coordinates
                texturePoints.Add(new System.Windows.Point(0, imageHeight));
                texturePoints.Add(new System.Windows.Point(0, 0));
                texturePoints.Add(new System.Windows.Point(imageWidth, imageHeight));
                texturePoints.Add(new System.Windows.Point(imageWidth, 0));
            }

            // Add these collections to the mesh
            mesh.Positions = positions;
            mesh.TriangleIndices = indices;
            mesh.TextureCoordinates = texturePoints;

            // Set the color of front and back of the triangle
            geometryModel.Material = material;
            geometryModel.BackMaterial = material;

            // Add the mesh to the model
            geometryModel.Geometry = mesh;
            model.Model = geometryModel;

            return model;
        }
开发者ID:whztt07,项目名称:Osm3DBuildingGenerator,代码行数:59,代码来源:Building.cs


示例16: VideoSurface

        public VideoSurface(string mediaSource)
        {
            this.ModelVisual3D = new ModelVisual3D();

            var geometryModel = new GeometryModel3D();
            this.ModelVisual3D.Content = geometryModel;

            this.geometry = new MeshGeometry3D();
            geometryModel.Geometry = geometry;

            var positions = new Point3DCollection();
            positions.Add(new Point3D(0, 0, 0));
            positions.Add(new Point3D(640, 0, 0));
            positions.Add(new Point3D(640, 480, 0));
            positions.Add(new Point3D(0, 480, 0));
            this.geometry.Positions = positions;

            var textureCoordinates = new PointCollection();
            textureCoordinates.Add(new System.Windows.Point(0, 1));
            textureCoordinates.Add(new System.Windows.Point(1, 1));
            textureCoordinates.Add(new System.Windows.Point(1, 0));
            textureCoordinates.Add(new System.Windows.Point(0, 0));
            this.geometry.TextureCoordinates = textureCoordinates;

            var triangleIndices = new Int32Collection();
            triangleIndices.Add(0);
            triangleIndices.Add(1);
            triangleIndices.Add(2);
            triangleIndices.Add(2);
            triangleIndices.Add(3);
            triangleIndices.Add(0);
            this.geometry.TriangleIndices = triangleIndices;

            var material = new EmissiveMaterial();
            var brush = new VisualBrush();
            this.border = new Border();
            this.border.BorderBrush = Brushes.White;
            this.border.BorderThickness = new Thickness(10);
            this.border.Opacity = 0;

            this.mediaElement = new MediaElement();
            mediaElement.LoadedBehavior = MediaState.Manual;
            mediaElement.Source = new Uri(mediaSource);

            this.border.Child = mediaElement;
            brush.Visual = border;
            material.Brush = brush;
            geometryModel.Material = material;

            this.mediaElement.MediaEnded += new RoutedEventHandler(mediaElement_MediaEnded);
        }
开发者ID:an83,项目名称:KinectTouch2,代码行数:51,代码来源:VideoSurface.cs


示例17: CalculateGeometry

        protected override void CalculateGeometry()
        {
            int e;
            double segmentRad = Math.PI / 2 / (n + 1);

            points = new Point3DCollection();
            triangleIndices = new Int32Collection();

            for (e = -n; e <= n; e++)
            {
                double r_e = r * Math.Cos(segmentRad * e);
                double y_e = r * Math.Sin(segmentRad * e);

                for (int s = 0; s <= (4 * n + 4 - 1); s++)
                {
                    double z_s = r_e * Math.Sin(segmentRad * s) * (-1);
                    double x_s = r_e * Math.Cos(segmentRad * s);
                    points.Add(new Point3D(x_s, y_e, z_s));
                }
            }
            points.Add(new Point3D(0, r, 0));
            points.Add(new Point3D(0, -1 * r, 0));

            for (e = 0; e < 2 * n; e++)
            {
                for (int i = 0; i < (4 * n + 4); i++)
                {
                    triangleIndices.Add(e * (4 * n + 4) + i);
                    triangleIndices.Add(e * (4 * n + 4) + i + (4 * n + 4));
                    triangleIndices.Add(e * (4 * n + 4) + (i + 1) % (4 * n + 4) + (4 * n + 4));

                    triangleIndices.Add(e * (4 * n + 4) + (i + 1) % (4 * n + 4) + (4 * n + 4));
                    triangleIndices.Add(e * (4 * n + 4) + (i + 1) % (4 * n + 4));
                    triangleIndices.Add(e * (4 * n + 4) + i);
                }
            }

            for (int i = 0; i < (4 * n + 4); i++)
            {
                triangleIndices.Add(e * (4 * n + 4) + i);
                triangleIndices.Add(e * (4 * n + 4) + (i + 1) % (4 * n + 4));
                triangleIndices.Add((4 * n + 4) * (2 * n + 1));
            }

            for (int i = 0; i < (4 * n + 4); i++)
            {
                triangleIndices.Add(i);
                triangleIndices.Add((i + 1) % (4 * n + 4));
                triangleIndices.Add((4 * n + 4) * (2 * n + 1) + 1);
            }
        }
开发者ID:hcilab-um,项目名称:STim,代码行数:51,代码来源:SphereGeometry3D.cs


示例18: TriangleMeshAdapater

        public TriangleMeshAdapater(MFnMesh mesh)
        {
            MIntArray indices = new MIntArray();
            MIntArray triangleCounts = new MIntArray();
            MPointArray points = new MPointArray();

            mesh.getTriangles(triangleCounts, indices);
            mesh.getPoints(points);

            // Get the triangle indices
            Indices = new Int32Collection((int)indices.length);
            for (int i = 0; i < indices.length; ++i)
                Indices.Add(indices[i]);

            // Get the control points (vertices)
            Points = new Point3DCollection((int)points.length);
            for (int i = 0; i < (int)points.length; ++i)
            {
                MPoint pt = points[i];
                Points.Add(new Point3D(pt.x, pt.y, pt.z));
            }

            // Get the number of triangle faces and polygon faces 
            Debug.Assert(indices.length % 3 == 0);
            int triFaces = (int)indices.length / 3;
            int polyFaces = mesh.numPolygons;

            // We have normals per polygon, we want one per triangle. 
            Normals = new Vector3DCollection(triFaces);
            int nCurrentTriangle = 0;

            // Iterate over each polygon
            for (int i = 0; i < polyFaces; ++i)
            {
                // Get the polygon normal
                var maya_normal = new MVector();
                mesh.getPolygonNormal((int)i, maya_normal);
                System.Windows.Media.Media3D.Vector3D normal = new System.Windows.Media.Media3D.Vector3D(maya_normal.x, maya_normal.y, maya_normal.z);

                // Iterate over each tri in the current polygon
                int nTrisAtFace = triangleCounts[i];
                for (int j = 0; j < nTrisAtFace; ++j)
                {
                    Debug.Assert(nCurrentTriangle < triFaces);
                    Normals.Add(normal);
                    nCurrentTriangle++;
                }
            }
            Debug.Assert(nCurrentTriangle == triFaces);
        }
开发者ID:meshdgp,项目名称:MeshDGP,代码行数:50,代码来源:TriangleMeshAdapater.cs


示例19: CombineIndexCollection

        public static Int32Collection CombineIndexCollection(Int32Collection initialIndices, List<int> addingIndices, int offset)
        {

            var ret = new Int32Collection(initialIndices.Count + addingIndices.Count);
            foreach (var origIndex in initialIndices)
            {
                ret.Add(origIndex);
            }
            foreach (var origIndex in addingIndices)
            {
                ret.Add(origIndex + offset);
            }
            return ret;
        }
开发者ID:tnesser,项目名称:XbimWindowsUI,代码行数:14,代码来源:GeomUtils.cs


示例20: updateMesh

 public void updateMesh( Point3DCollection verticies,
                         Vector3DCollection normals)
 {
     Int32Collection triangleIndices = new Int32Collection();
     for (int i = 0; i < verticies.Count/3; i++)
     {
         triangleIndices.Add(i*3);
         triangleIndices.Add(i*3+1);
         triangleIndices.Add(i*3+2);
     }
     
     this.mesh.TriangleIndices = triangleIndices; 
     this.mesh.Positions = verticies;
     this.mesh.Normals = normals;
     this.InvalidateVisual();
 }
开发者ID:yeuchi,项目名称:DecoderExercise,代码行数:16,代码来源:Wireframe.xaml.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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