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


C# IMesh.GetVertPtr方法代码示例

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


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

示例1: SetPositionVertices

        public bool SetPositionVertices(IMesh maxMesh, MyMesh myMesh)
        {
            bool countChanged = false;

            if (maxMesh.NumVerts != myMesh.NumVertices)
            {
                maxMesh.SetNumVerts(myMesh.NumVertices, false, false);
                countChanged = true;
            }

            IPoint3 p3 = maxMesh.GetVertPtr(0);
            Marshal.Copy(myMesh.Vertices.ToArray(), 0, p3.NativePointer, myMesh.NumVertices * 3);

            return countChanged;
        }
开发者ID:sebjf,项目名称:dazmaxbridge,代码行数:15,代码来源:Geometry.cs

示例2: GetTriMeshFacesAndPositions

        protected unsafe TriMeshFacesAndPositions GetTriMeshFacesAndPositions(IMesh mesh)
        {
            VertexChannel channel = new VertexChannel();
            channel.m_type = VertexChannelType.Positions;

            channel.m_vertices = new Point3[mesh.NumVerts];
            fixed (Point3* vertexData = channel.m_vertices)
            {
                CopyMemory((IntPtr)vertexData, mesh.GetVertPtr(0).Handle, (uint)(sizeof(Point3) * mesh.NumVerts));
            }

            var faces = new Face[mesh.NumFaces];
            fixed (Face* faceData = faces)
            {
                CopyMemory((IntPtr)faceData, mesh.Faces[0].Handle, (uint)(sizeof(Face) * mesh.NumFaces));
            }

            /* Split the face data into seperate arrays. Put the face indices in one with the channel, the others to one side to filter into groups later if the user wants */

            TriMeshFacesAndPositions faces_data = new TriMeshFacesAndPositions();

            faces_data.face_flags = new short[faces.Length];
            faces_data.face_materialIds = new short[faces.Length];

            channel.m_faces = new Indices3[faces.Length];

            for (int i = 0; i < faces.Length; i++)
            {
                short materialid = (short)((faces[i].flags & 0xFFFF0000) >> 16); //in Max the high word of the flags member contains the material id.
                short flags = (short)(faces[i].flags & 0x0000FFFF);

                faces_data.face_flags[i] = flags;
                faces_data.face_materialIds[i] = materialid;

                channel.m_faces[i] = faces[i].v;
            }

            faces_data.positions_channel = channel;

            return faces_data;
        }
开发者ID:sebjf,项目名称:maxbridge,代码行数:41,代码来源:Geometry.cs


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