public static void AddVertex(Vector3 pos) { instance.vertexCount++; instance.vertices.Add(instance.vertexCount, pos); GameObject obj = ObjectManager.CreateObject("Vertex"); obj.transform.position = pos; obj.AddComponent <SphereCollider>("SphereCollider"); Form1.g_vertexList.Items.Add(obj.name); if (instance.vertexCount % 3 == 0) { NavIndex index; index.a = instance.vertexCount - 2; index.b = instance.vertexCount - 1; index.c = instance.vertexCount; instance.indices.Add(index); TriCol tri = new TriCol(); tri.SetVertexPos(instance.vertices[index.a], instance.vertices[index.b], instance.vertices[index.c]); tri.gameObject = instance; tri.transform = instance.transform; instance.cells.Add(tri); } }
public TriCol(TriCol rhs) : base(rhs) { this.device = rhs.device; this.mesh = rhs.mesh; this.vertexCount = rhs.vertexCount; this.vertexSize = rhs.vertexSize; this.faceCount = rhs.faceCount; this.vertices = new Vector3[vertexCount]; this.indices = new int[faceCount * 3]; for (int i = 0; i < vertexCount; i++) { this.vertices[i] = rhs.vertices[i]; } int indexCount = faceCount * 3; for (int i = 0; i < indexCount; i++) { this.indices[i] = rhs.indices[i]; } }