Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2012-02-23 02:48:34 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2012-02-23 02:48:34 +0400
commitfd87bf3ef66cf03286de9ac136f1eaecb1160a44 (patch)
tree340d0cf31d14a14ec6e328b0eac17fab9e2199b8 /source/blender/gpu/intern
parent78e1da961c0e6eeeacffefd1ab3cca3947f4b3b6 (diff)
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.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c32
1 files changed, 12 insertions, 20 deletions
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);