示例#1
0
 public void AddFaceTriangle(int t)
 {
     if (currentFaceCount >= faceCount)
     {
         int     newFaceCount = faceCount * 2;
         Pointer newData      = new Pointer();
         newData.Malloc(newFaceCount * intSize, intAlignment, triangleAllocatorLabel);
         newData.CopyFrom(pfaces, currentFaceCount * intSize);
         pfaces.Dispose();
         pfaces    = newData;
         faceCount = newFaceCount;
     }
     pfaces.Set <int>(currentFaceCount++, t);
 }
示例#2
0
 public void AddNeighborVertex(int t)
 {
     if (currentNeightCount >= neightborsCount)
     {
         //开始扩充长度为原来得两倍
         int     newNeightborsCount = neightborsCount * 2; //+Add 先这样修改一下
         Pointer newData            = new Pointer();
         newData.Malloc(newNeightborsCount * intSize, intAlignment, vertexAllocatorLabel);
         newData.CopyFrom(pneighbors, currentNeightCount * intSize);
         pneighbors.Dispose();
         pneighbors      = newData;
         neightborsCount = newNeightborsCount;
     }
     //UnsafeUtility.MemCpy((VertexStruct*)pneighbors._ptr + currentNeightCount++, UnsafeUtility.AddressOf<VertexStruct>(ref t), vertexSize);
     pneighbors.Set <int>(currentNeightCount++, t);
 }