Update of /cvsroot/plib/plib/src/ssg
In directory sc8-pr-cvs1:/tmp/cvs-serv12641
Modified Files:
ssgBranch.cxx
Log Message:
mergeHNodes: New function that merges hierarchy nodes that are "compatible" (same texture, name etc)
For more information, see the comment at the definition.
Index: ssgBranch.cxx
===================================================================
RCS file: /cvsroot/plib/plib/src/ssg/ssgBranch.cxx,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- ssgBranch.cxx 4 Dec 2002 20:15:22 -0000 1.23
+++ ssgBranch.cxx 13 Dec 2003 22:19:04 -0000 1.24
@@ -383,4 +383,249 @@
return TRUE ;
}
+// ----------------------- code by W.K for merging hierarchy nodes ------------------------------
+
+
+// #define VERBOSE
+int maxTriangles = 100; // Thats a nice value for handling MDL files for BoB.
+ // You might want to assign another value, possibly -1 before calling mergeHNodes
+
+
[...218 lines suppressed...]
+// b) the same name
+// c) the result would not have more than maxTriangles triangles (if maxTriangles is negative, this is not checked).
+// d) both are of type GL_TRIANGLE_FAN or GL_TRIANGLES
+{
+
+
+int deltas[] = { 1 ,2 ,1 ,3 ,2 ,1 ,2 ,4 ,2 ,1 ,5 ,1 ,2 ,6 ,2 ,1 ,2 ,7 ,2 ,1 ,2 ,1 ,8 ,1 ,2 ,1 ,2 ,9 ,2 ,1 ,2 ,1,
+ 10 ,1 ,2 ,1 ,2 ,11 ,1 ,12 ,1 ,2 ,13 ,1 ,2 ,14 ,2 ,1 ,1 ,15 ,1 ,16 ,1 ,17 ,2 ,1 ,18 ,1 ,22 ,2 ,25 ,
+ 2 ,1 ,30 ,2 ,1 ,2 ,1 ,13 ,2 ,1 ,2 ,1 };
+ noOfMergedNodes = 0;
+ for(int i=0; i < sizeof(deltas)/sizeof(int); i++)
+ {
+ recursiveMergeHNodes ( this, deltas[i] );
+#ifdef VERBOSE
+ printf("############################################### ^%d\n". deltas[i]);
+#endif
+ }
+ printf("%d nodes were merged!\n", noOfMergedNodes);
+}
|