From a2e7226fe9de9245fcb917a3b1853919a647646b Mon Sep 17 00:00:00 2001
From: Amorilia <amorilia@users.sourceforge.net>
Date: Sat, 24 Sep 2011 09:11:16 +0100
Subject: [PATCH] Add first vertex in match group to the head of the group, so
 indices are consequetive (might have a small performance benefit, and looks
 more like official nifs).

---
 src/obj/NiTriShapeData.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/obj/NiTriShapeData.cpp b/src/obj/NiTriShapeData.cpp
index 8ef3f8f1..98d38c40 100644
--- a/src/obj/NiTriShapeData.cpp
+++ b/src/obj/NiTriShapeData.cpp
@@ -213,6 +213,8 @@ void NiTriShapeData::DoMatchDetection() {
 
 		/* we may find a valid group for this vertex */
 		MatchGroup group;
+		/* this vertex belongs to the group as well */
+		group.vertexIndices.push_back(i);
 
 		// Find all vertices that match this one.
 		for ( unsigned short j = i + 1; j < vertices.size(); ++j ) {
@@ -234,10 +236,7 @@ void NiTriShapeData::DoMatchDetection() {
 		}
 
 		/* the currently observed vertex shares a normal with others */
-		if ( ( group.numVertices = group.vertexIndices.size() ) > 0 ) {
-			/* this vertex belongs to the group as well */
-			group.vertexIndices.push_back(i);
-			
+		if ( ( group.numVertices = group.vertexIndices.size() ) > 1 ) {
 			/* mark all of the participating vertices to belong to a group */
 			int groupid = matchGroups.size() + 1;
 			for ( int n = 0; n < group.numVertices; n++ )
-- 
GitLab