[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44343] trunk/blender/source/blender: Code cleanup: don't use GHash for GPU_build_mesh_buffers().
Nicholas Bishop
nicholasbishop at gmail.com
Wed Feb 22 23:48:35 CET 2012
Revision: 44343
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44343
Author: nicholasbishop
Date: 2012-02-22 22:48:34 +0000 (Wed, 22 Feb 2012)
Log Message:
-----------
Code cleanup: don't use GHash for GPU_build_mesh_buffers().
At the point where GPU_build_mesh_buffers is called, the
face_vert_indices map has already been built; it contains the same
data in an easier-to-access format.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/pbvh.c
trunk/blender/source/blender/gpu/GPU_buffers.h
trunk/blender/source/blender/gpu/intern/gpu_buffers.c
Modified: trunk/blender/source/blender/blenlib/intern/pbvh.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/pbvh.c 2012-02-22 22:41:08 UTC (rev 44342)
+++ trunk/blender/source/blender/blenlib/intern/pbvh.c 2012-02-22 22:48:34 UTC (rev 44343)
@@ -420,10 +420,10 @@
if(!G.background) {
node->draw_buffers =
- GPU_build_mesh_buffers(map, bvh->faces,
+ GPU_build_mesh_buffers(node->face_vert_indices,
+ bvh->faces,
node->prim_indices,
- node->totprim,
- node->uniq_verts);
+ node->totprim);
}
node->flag |= PBVH_UpdateDrawBuffers;
Modified: trunk/blender/source/blender/gpu/GPU_buffers.h
===================================================================
--- trunk/blender/source/blender/gpu/GPU_buffers.h 2012-02-22 22:41:08 UTC (rev 44342)
+++ trunk/blender/source/blender/gpu/GPU_buffers.h 2012-02-22 22:48:34 UTC (rev 44343)
@@ -159,16 +159,21 @@
/* Buffers for non-DerivedMesh drawing */
typedef struct GPU_Buffers GPU_Buffers;
-GPU_Buffers *GPU_build_mesh_buffers(struct GHash *map,
- struct MFace *mface, int *face_indices,
- int totface, int uniq_verts);
+
+GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
+ struct MFace *mface, int *face_indices, int totface);
+
void GPU_update_mesh_buffers(GPU_Buffers *buffers, struct MVert *mvert,
int *vert_indices, int totvert, int smooth);
+
GPU_Buffers *GPU_build_grid_buffers(struct DMGridData **grids,
int *grid_indices, int totgrid, int gridsize);
+
void GPU_update_grid_buffers(GPU_Buffers *buffers, struct DMGridData **grids,
int *grid_indices, int totgrid, int gridsize, int smooth);
+
void GPU_draw_buffers(GPU_Buffers *buffers);
+
void GPU_free_buffers(GPU_Buffers *buffers);
#endif
Modified: trunk/blender/source/blender/gpu/intern/gpu_buffers.c
===================================================================
--- trunk/blender/source/blender/gpu/intern/gpu_buffers.c 2012-02-22 22:41:08 UTC (rev 44342)
+++ trunk/blender/source/blender/gpu/intern/gpu_buffers.c 2012-02-22 22:48:34 UTC (rev 44343)
@@ -1334,9 +1334,12 @@
buffers->smooth = smooth;
}
-GPU_Buffers *GPU_build_mesh_buffers(GHash *map, MFace *mface,
+/*GPU_Buffers *GPU_build_mesh_buffers(GHash *map, MFace *mface,
int *face_indices, int totface,
- int tot_uniq_verts)
+ int tot_uniq_verts)*/
+GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
+ MFace *mface, int *face_indices,
+ int totface)
{
GPU_Buffers *buffers;
unsigned short *tri_data;
@@ -1365,29 +1368,18 @@
MFace *f = mface + face_indices[i];
int v[3];
- v[0]= f->v1;
- v[1]= f->v2;
- v[2]= f->v3;
+ v[0]= 0;
+ v[1]= 1;
+ v[2]= 2;
for(j = 0; j < (f->v4 ? 2 : 1); ++j) {
for(k = 0; k < 3; ++k) {
- void *value, *key = SET_INT_IN_POINTER(v[k]);
- int vbo_index;
-
- value = BLI_ghash_lookup(map, key);
- vbo_index = GET_INT_FROM_POINTER(value);
-
- if(vbo_index < 0) {
- vbo_index = -vbo_index +
- tot_uniq_verts - 1;
- }
-
- *tri_data = vbo_index;
+ *tri_data = face_vert_indices[i][v[k]];
++tri_data;
}
- v[0] = f->v4;
- v[1] = f->v1;
- v[2] = f->v3;
+ v[0] = 3;
+ v[1] = 0;
+ v[2] = 2;
}
}
glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
More information about the Bf-blender-cvs
mailing list