[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30694] branches/soc-2010-nicolasbishop/ source/blender: == PBVH ==

Nicholas Bishop nicholasbishop at gmail.com
Sat Jul 24 20:32:57 CEST 2010


Revision: 30694
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30694
Author:   nicholasbishop
Date:     2010-07-24 20:32:57 +0200 (Sat, 24 Jul 2010)

Log Message:
-----------
== PBVH ==

* Moved glShadeModel from pbvh.c to gpu_buffers.c, also fixes bad include of glew

Modified Paths:
--------------
    branches/soc-2010-nicolasbishop/source/blender/blenlib/intern/pbvh.c
    branches/soc-2010-nicolasbishop/source/blender/gpu/GPU_buffers.h
    branches/soc-2010-nicolasbishop/source/blender/gpu/intern/gpu_buffers.c

Modified: branches/soc-2010-nicolasbishop/source/blender/blenlib/intern/pbvh.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/blenlib/intern/pbvh.c	2010-07-24 18:05:33 UTC (rev 30693)
+++ branches/soc-2010-nicolasbishop/source/blender/blenlib/intern/pbvh.c	2010-07-24 18:32:57 UTC (rev 30694)
@@ -33,7 +33,6 @@
 #include "BKE_global.h" /* for mesh_calc_normals */
 
 #include "GPU_buffers.h"
-#include <GL/glew.h>
 
 static void pbvh_free_nodes(PBVH *bvh);
 
@@ -1601,7 +1600,7 @@
 
 	glColor3f(1, 0, 0);
 #endif
-	GPU_draw_buffers(node->draw_buffers);
+	GPU_draw_buffers(node->draw_buffers, *((GPUDrawFlags*)data));
 }
 
 int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data)
@@ -1627,17 +1626,13 @@
 
 	if(nodes) MEM_freeN(nodes);
 
-	glShadeModel((flags & GPU_DRAW_SMOOTH) ? GL_SMOOTH: GL_FLAT);
-
 	if(planes) {
 		BLI_pbvh_search_callback(bvh, BLI_pbvh_node_planes_contain_AABB,
-				planes, BLI_pbvh_node_draw, NULL);
+				planes, BLI_pbvh_node_draw, &flags);
 	}
 	else {
-		BLI_pbvh_search_callback(bvh, NULL, NULL, BLI_pbvh_node_draw, NULL);
+		BLI_pbvh_search_callback(bvh, NULL, NULL, BLI_pbvh_node_draw, &flags);
 	}
-
-	glShadeModel(GL_FLAT);
 }
 
 void BLI_pbvh_grids_update(PBVH *bvh, DMGridData **grids,

Modified: branches/soc-2010-nicolasbishop/source/blender/gpu/GPU_buffers.h
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/gpu/GPU_buffers.h	2010-07-24 18:05:33 UTC (rev 30693)
+++ branches/soc-2010-nicolasbishop/source/blender/gpu/GPU_buffers.h	2010-07-24 18:32:57 UTC (rev 30694)
@@ -162,7 +162,7 @@
 				   int *grid_indices, int totgrid,
 				   int gridsize, struct GridKey *gridkey,
 				   struct CustomData *vdata, GPUDrawFlags flags);
-void GPU_draw_buffers(GPU_Buffers *buffers);
+void GPU_draw_buffers(GPU_Buffers *buffers, GPUDrawFlags flags);
 void GPU_free_buffers(GPU_Buffers *buffers);
 
 /* called before drawing */

Modified: branches/soc-2010-nicolasbishop/source/blender/gpu/intern/gpu_buffers.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/gpu/intern/gpu_buffers.c	2010-07-24 18:05:33 UTC (rev 30693)
+++ branches/soc-2010-nicolasbishop/source/blender/gpu/intern/gpu_buffers.c	2010-07-24 18:32:57 UTC (rev 30694)
@@ -912,7 +912,7 @@
 	return buffers;
 }
 
-void GPU_draw_buffers(GPU_Buffers *buffers_v)
+void GPU_draw_buffers(GPU_Buffers *buffers_v, GPUDrawFlags flags)
 {
 	GPU_Buffers *buffers = buffers_v;
 
@@ -933,6 +933,8 @@
 			glEnable(GL_COLOR_MATERIAL);
 		}
 
+		glShadeModel((flags & GPU_DRAW_SMOOTH) ? GL_SMOOTH: GL_FLAT);
+
 		if(buffers->tot_quad) {
 			glVertexPointer(3, GL_FLOAT, sizeof(GridVBO), (void*)offsetof(GridVBO, co));
 			glNormalPointer(GL_FLOAT, sizeof(GridVBO), (void*)offsetof(GridVBO, no));
@@ -959,8 +961,10 @@
 		}
 
 		if(buffers->color_buf && !colmat)
-			glDisable(GL_COLOR_MATERIAL);		
+			glDisable(GL_COLOR_MATERIAL);
 
+		glShadeModel(GL_FLAT);	
+
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
 		glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
 





More information about the Bf-blender-cvs mailing list