public int CompareTo(object obj) { FaceDepth f = obj as FaceDepth; if (depth < f.depth) { return(-1); } if (depth > f.depth) { return(1); } return(0); }
private void SortFaces() { Mesh m = currMeshRecord.Mesh; Matrix4d tran = ball.GetMatrix() * currTransformation; //sort faces FaceDepth[] d = new FaceDepth[m.FaceCount]; for (int i = 0; i < m.FaceCount; i++) { Vector4d v = new Vector4d(new Vector3d(m.DualVertexPos, i * 3), 1.0); v = tran * v; d[i] = new FaceDepth(i, v.z); } Array.Sort(d); faceDepth = new int[m.FaceCount]; for (int i = 0; i < m.FaceCount; i++) { faceDepth[i] = d[i].index; } }
private void SortFaces() { Mesh m = currMeshRecord.Mesh; Matrix4d tran = ball.GetMatrix() * currTransformation; //sort faces FaceDepth[] d = new FaceDepth[m.FaceCount]; for (int i = 0; i < m.FaceCount; i++) { Vector4d v = new Vector4d(new Vector3d(m.DualVertexPos, i * 3), 1.0); v = tran * v; d[i] = new FaceDepth(i, v.z); } Array.Sort(d); faceDepth = new int[m.FaceCount]; for (int i = 0; i < m.FaceCount; i++) faceDepth[i] = d[i].index; }