[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19949] trunk/blender/source/gameengine/ Rasterizer: TexVert sharing was disabled for flat faces, this is silly since a building or any other model with flat faces will often be able to share texverts .

Campbell Barton ideasman42 at gmail.com
Mon Apr 27 19:53:41 CEST 2009


Revision: 19949
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19949
Author:   campbellbarton
Date:     2009-04-27 19:53:41 +0200 (Mon, 27 Apr 2009)

Log Message:
-----------
TexVert sharing was disabled for flat faces, this is silly since a building or any other model with flat faces will often be able to share texverts.

Simple testcase with a subdivided cube used 1/3 as many texverts and spend half as much time in the rasterizer while profiling.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Rasterizer/RAS_MeshObject.cpp
    trunk/blender/source/gameengine/Rasterizer/RAS_TexVert.cpp

Modified: trunk/blender/source/gameengine/Rasterizer/RAS_MeshObject.cpp
===================================================================
--- trunk/blender/source/gameengine/Rasterizer/RAS_MeshObject.cpp	2009-04-27 16:44:02 UTC (rev 19948)
+++ trunk/blender/source/gameengine/Rasterizer/RAS_MeshObject.cpp	2009-04-27 17:53:41 UTC (rev 19949)
@@ -304,7 +304,7 @@
 	slot = mmat->m_baseslot;
 	darray = slot->CurrentDisplayArray();
 
-	if(!flat) {
+	{ /* Shared Vertex! */
 		/* find vertices shared between faces, with the restriction
 		 * that they exist in the same display array, and have the
 		 * same uv coordinate etc */
@@ -332,7 +332,7 @@
 		slot->AddPolygonVertex(offset);
 	poly->SetVertexOffset(i, offset);
 
-	if(!flat) {
+	{ /* Shared Vertex! */
 		SharedVertex shared;
 		shared.m_darray = darray;
 		shared.m_offset = offset;

Modified: trunk/blender/source/gameengine/Rasterizer/RAS_TexVert.cpp
===================================================================
--- trunk/blender/source/gameengine/Rasterizer/RAS_TexVert.cpp	2009-04-27 16:44:02 UTC (rev 19948)
+++ trunk/blender/source/gameengine/Rasterizer/RAS_TexVert.cpp	2009-04-27 17:53:41 UTC (rev 19949)
@@ -117,7 +117,9 @@
 // compare two vertices, and return TRUE if both are almost identical (they can be shared)
 bool RAS_TexVert::closeTo(const RAS_TexVert* other)
 {
-	return (m_flag == other->m_flag &&
+	return (
+		/* m_flag == other->m_flag && */
+		/* at the moment the face only stores the smooth/flat setting so dont bother comparing it */
 		m_rgba == other->m_rgba &&
 		MT_fuzzyEqual(MT_Vector3(m_normal), MT_Vector3(other->m_normal)) &&
 		MT_fuzzyEqual(MT_Vector3(m_tangent), MT_Vector3(other->m_tangent)) &&





More information about the Bf-blender-cvs mailing list