static int FindOrAddObjVertex(ref Vector3 vertex, ref Vector2 texCoord, ref Vector3 normal) { ObjMesh.ObjVertex newObjVertex = new ObjMesh.ObjVertex(); newObjVertex.Vertex = vertex; newObjVertex.TexCoord = texCoord; newObjVertex.Normal = normal; int index; if (objVerticesIndexDictionary.TryGetValue(newObjVertex, out index)) { return index; } else { objVertices.Add(newObjVertex); objVerticesIndexDictionary[newObjVertex] = objVertices.Count - 1; return objVertices.Count - 1; } }
static int FindOrAddObjVertex(ref Vector3 vertex, ref Vector2 texCoord, ref Vector3 normal) { ObjMesh.ObjVertex newObjVertex = new ObjMesh.ObjVertex(); newObjVertex.Vertex = vertex; newObjVertex.TexCoord = texCoord; newObjVertex.Normal = normal; int index; if (objVerticesIndexDictionary.TryGetValue(newObjVertex, out index)) { return(index); } else { objVertices.Add(newObjVertex); objVerticesIndexDictionary[newObjVertex] = objVertices.Count - 1; return(objVertices.Count - 1); } }