diff options
-rw-r--r-- | source/blender/blenlib/intern/pbvh.c | 6 | ||||
-rw-r--r-- | source/blender/gpu/GPU_buffers.h | 11 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 32 |
3 files changed, 23 insertions, 26 deletions
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index 7d57dd7d546..81332dfba6a 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -420,10 +420,10 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node) 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; diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h index 5c567c31163..e244b20bbb0 100644 --- a/source/blender/gpu/GPU_buffers.h +++ b/source/blender/gpu/GPU_buffers.h @@ -159,16 +159,21 @@ int GPU_buffer_legacy( struct DerivedMesh *dm ); /* 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 diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 0a4970a6a91..9a5585d4ace 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -1334,9 +1334,12 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert, 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 @@ GPU_Buffers *GPU_build_mesh_buffers(GHash *map, MFace *mface, 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); |