Code clean-up change naming of gpu buffers used by pbvh to better
authorAntony Riakiotakis <kalast@gmail.com>
Thu, 2 Jan 2014 20:22:36 +0000 (22:22 +0200)
committerAntony Riakiotakis <kalast@gmail.com>
Fri, 3 Jan 2014 10:48:12 +0000 (12:48 +0200)
reflect that. Previous name GPU_Buffers was very similar to GPU_Buffer,
renamed to GPU_PBVH_Buffers

source/blender/blenkernel/intern/pbvh.c
source/blender/blenkernel/intern/pbvh_bmesh.c
source/blender/blenkernel/intern/pbvh_intern.h
source/blender/editors/sculpt_paint/sculpt.c
source/blender/gpu/GPU_buffers.h
source/blender/gpu/intern/gpu_buffers.c

index 27e52614a404b8e0402758a80a906f8c2f00e7e9..90447db511398127ea2b817bb88ee468b5331e3f 100644 (file)
@@ -332,7 +332,7 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node)
 
        if (!G.background) {
                node->draw_buffers =
-                       GPU_build_mesh_buffers(node->face_vert_indices,
+                               GPU_build_pbvh_mesh_buffers(node->face_vert_indices,
                                               bvh->faces, bvh->verts,
                                               node->prim_indices,
                                               node->totprim);
@@ -347,7 +347,7 @@ static void build_grids_leaf_node(PBVH *bvh, PBVHNode *node)
 {
        if (!G.background) {
                node->draw_buffers =
-                   GPU_build_grid_buffers(node->prim_indices,
+                       GPU_build_grid_pbvh_buffers(node->prim_indices,
                                           node->totprim, bvh->grid_hidden, bvh->gridkey.grid_size);
        }
        node->flag |= PBVH_UpdateDrawBuffers;
@@ -604,7 +604,7 @@ void BKE_pbvh_free(PBVH *bvh)
 
                if (node->flag & PBVH_Leaf) {
                        if (node->draw_buffers)
-                               GPU_free_buffers(node->draw_buffers);
+                               GPU_free_pbvh_buffers(node->draw_buffers);
                        if (node->vert_indices)
                                MEM_freeN(node->vert_indices);
                        if (node->face_vert_indices)
@@ -1043,25 +1043,25 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
                node = nodes[n];
 
                if (node->flag & PBVH_RebuildDrawBuffers) {
-                       GPU_free_buffers(node->draw_buffers);
+                       GPU_free_pbvh_buffers(node->draw_buffers);
                        switch (bvh->type) {
                                case PBVH_GRIDS:
                                        node->draw_buffers =
-                                           GPU_build_grid_buffers(node->prim_indices,
+                                               GPU_build_grid_pbvh_buffers(node->prim_indices,
                                                                   node->totprim,
                                                                   bvh->grid_hidden,
                                                                   bvh->gridkey.grid_size);
                                        break;
                                case PBVH_FACES:
                                        node->draw_buffers =
-                                           GPU_build_mesh_buffers(node->face_vert_indices,
+                                               GPU_build_pbvh_mesh_buffers(node->face_vert_indices,
                                                                   bvh->faces, bvh->verts,
                                                                   node->prim_indices,
                                                                   node->totprim);
                                        break;
                                case PBVH_BMESH:
                                        node->draw_buffers =
-                                           GPU_build_bmesh_buffers(bvh->flags &
+                                               GPU_build_bmesh_pbvh_buffers(bvh->flags &
                                                                    PBVH_DYNTOPO_SMOOTH_SHADING);
                                        break;
                        }
@@ -1072,7 +1072,7 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
                if (node->flag & PBVH_UpdateDrawBuffers) {
                        switch (bvh->type) {
                                case PBVH_GRIDS:
-                                       GPU_update_grid_buffers(node->draw_buffers,
+                                       GPU_update_grid_pbvh_buffers(node->draw_buffers,
                                                                bvh->grids,
                                                                bvh->grid_flag_mats,
                                                                node->prim_indices,
@@ -1081,7 +1081,7 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
                                                                bvh->show_diffuse_color);
                                        break;
                                case PBVH_FACES:
-                                       GPU_update_mesh_buffers(node->draw_buffers,
+                                       GPU_update_mesh_pbvh_buffers(node->draw_buffers,
                                                                bvh->verts,
                                                                node->vert_indices,
                                                                node->uniq_verts +
@@ -1092,7 +1092,7 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
                                                                bvh->show_diffuse_color);
                                        break;
                                case PBVH_BMESH:
-                                       GPU_update_bmesh_buffers(node->draw_buffers,
+                                       GPU_update_bmesh_pbvh_buffers(node->draw_buffers,
                                                                 bvh->bm,
                                                                 node->bm_faces,
                                                                 node->bm_unique_verts,
@@ -1613,7 +1613,7 @@ void BKE_pbvh_node_draw(PBVHNode *node, void *data_v)
 #endif
 
        if (!(node->flag & PBVH_FullyHidden)) {
-               GPU_draw_buffers(node->draw_buffers,
+               GPU_draw_pbvh_buffers(node->draw_buffers,
                                 data->setMaterial,
                                 data->wireframe);
        }
@@ -1680,7 +1680,7 @@ static void pbvh_node_check_diffuse_changed(PBVH *bvh, PBVHNode *node)
        if (!node->draw_buffers)
                return;
 
-       if (GPU_buffers_diffuse_changed(node->draw_buffers, bvh->show_diffuse_color))
+       if (GPU_pbvh_buffers_diffuse_changed(node->draw_buffers, bvh->show_diffuse_color))
                node->flag |= PBVH_UpdateDrawBuffers;
 }
 
index 296f931e2fb251c2d1da40176693dd90cafd8837..4bd2114ee791218bf331db0296c2e75efbde65ef 100644 (file)
@@ -94,7 +94,7 @@ static void pbvh_bmesh_node_finalize(PBVH *bvh, int node_index)
        /* Build GPU buffers */
        if (!G.background) {
                int smooth = bvh->flags & PBVH_DYNTOPO_SMOOTH_SHADING;
-               n->draw_buffers = GPU_build_bmesh_buffers(smooth);
+               n->draw_buffers = GPU_build_bmesh_pbvh_buffers(smooth);
                n->flag |= PBVH_UpdateDrawBuffers | PBVH_UpdateNormals;
        }
 }
@@ -207,7 +207,7 @@ static void pbvh_bmesh_node_split(PBVH *bvh, GHash *prim_bbc, int node_index)
        n->layer_disp = NULL;
        
        if (n->draw_buffers) {
-               GPU_free_buffers(n->draw_buffers);
+               GPU_free_pbvh_buffers(n->draw_buffers);
                n->draw_buffers = NULL;
        }
        n->flag &= ~PBVH_Leaf;
index 89bfbc252a8da373691eb7488302f39c4fbbfce5..bd72b0339c7d0c2a120c1c6731cf94f52996e58c 100644 (file)
@@ -39,7 +39,7 @@ typedef struct {
  * union'd structs */
 struct PBVHNode {
        /* Opaque handle for drawing code */
-       struct GPU_Buffers *draw_buffers;
+       struct GPU_PBVH_Buffers *draw_buffers;
 
        /* Voxel bounds */
        BB vb;
index 0507cfcf37d44f93772a5931ad8e0b81c69b0eb7..24093a4aa571d99f12e8ede788281985f89c236b 100644 (file)
@@ -4307,7 +4307,7 @@ int sculpt_stroke_get_location(bContext *C, float out[3], const float mouse[2])
        dist = normalize_v3(ray_normal);
 
        if (!rv3d->is_persp) {
-               BKE_pbvh_raycast_project_ray_root(ss->pbvh, srd.original, ray_start, ray_end, ray_normal);
+               BKE_pbvh_raycast_project_ray_root(ss->pbvh, original, ray_start, ray_end, ray_normal);
 
                /* recalculate the normal */
                sub_v3_v3v3(ray_normal, ray_end, ray_start);
index cc22063a83c24eb9348234a2b9e033d7a9b1d0b1..516fbedf2aec5d3bbb21ad9455a92cb39e197282 100644 (file)
@@ -160,37 +160,37 @@ void GPU_buffer_unbind(void);
 int GPU_buffer_legacy(struct DerivedMesh *dm);
 
 /* Buffers for non-DerivedMesh drawing */
-typedef struct GPU_Buffers GPU_Buffers;
+typedef struct GPU_PBVH_Buffers GPU_PBVH_Buffers;
 
-GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
+GPU_PBVH_Buffers *GPU_build_pbvh_mesh_buffers(int (*face_vert_indices)[4],
                                     struct MFace *mface, struct MVert *mvert,
                                     int *face_indices, int totface);
 
-void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
+void GPU_update_mesh_pbvh_buffers(GPU_PBVH_Buffers *buffers, MVert *mvert,
                              int *vert_indices, int totvert, const float *vmask,
                              int (*face_vert_indices)[4], int show_diffuse_color);
 
-GPU_Buffers *GPU_build_grid_buffers(int *grid_indices, int totgrid,
+GPU_PBVH_Buffers *GPU_build_grid_pbvh_buffers(int *grid_indices, int totgrid,
                                     unsigned int **grid_hidden, int gridsize);
 
-GPU_Buffers *GPU_build_bmesh_buffers(int smooth_shading);
+GPU_PBVH_Buffers *GPU_build_bmesh_pbvh_buffers(int smooth_shading);
 
-void GPU_update_bmesh_buffers(GPU_Buffers *buffers,
+void GPU_update_bmesh_pbvh_buffers(GPU_PBVH_Buffers *buffers,
                               struct BMesh *bm,
                               struct GHash *bm_faces,
                               struct GSet *bm_unique_verts,
                               struct GSet *bm_other_verts);
 
-void GPU_update_grid_buffers(GPU_Buffers *buffers, struct CCGElem **grids,
+void GPU_update_grid_pbvh_buffers(GPU_PBVH_Buffers *buffers, struct CCGElem **grids,
                              const struct DMFlagMat *grid_flag_mats,
                              int *grid_indices, int totgrid, const struct CCGKey *key,
                              int show_diffuse_color);
 
-void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial,
+void GPU_draw_pbvh_buffers(GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial,
                                          int wireframe);
 
-int GPU_buffers_diffuse_changed(GPU_Buffers *buffers, int show_diffuse_color);
+int GPU_pbvh_buffers_diffuse_changed(GPU_PBVH_Buffers *buffers, int show_diffuse_color);
 
-void GPU_free_buffers(GPU_Buffers *buffers);
+void GPU_free_pbvh_buffers(GPU_PBVH_Buffers *buffers);
 
 #endif
index 384b7cce2ff5cd5ab067e13324e3fe492ed185ad..4a509b7278baa4187ef65baf8a7cf9dd60a4d3ac 100644 (file)
@@ -1308,7 +1308,7 @@ typedef struct {
        unsigned char color[3];
 } VertexBufferFormat;
 
-struct GPU_Buffers {
+struct GPU_PBVH_Buffers {
        /* opengl buffer handles */
        GLuint vert_buf, index_buf;
        GLenum index_type;
@@ -1418,7 +1418,7 @@ static void gpu_color_from_mask_quad_set(const CCGKey *key,
        glColor3f(diffuse_color[0] * color, diffuse_color[1] * color, diffuse_color[2] * color);
 }
 
-void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
+void GPU_update_mesh_pbvh_buffers(GPU_PBVH_Buffers *buffers, MVert *mvert,
                              int *vert_indices, int totvert, const float *vmask,
                              int (*face_vert_indices)[4], int show_diffuse_color)
 {
@@ -1553,16 +1553,16 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
        buffers->mvert = mvert;
 }
 
-GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
+GPU_PBVH_Buffers *GPU_build_pbvh_mesh_buffers(int (*face_vert_indices)[4],
                                     MFace *mface, MVert *mvert,
                                     int *face_indices,
                                     int totface)
 {
-       GPU_Buffers *buffers;
+       GPU_PBVH_Buffers *buffers;
        unsigned short *tri_data;
        int i, j, k, tottri;
 
-       buffers = MEM_callocN(sizeof(GPU_Buffers), "GPU_Buffers");
+       buffers = MEM_callocN(sizeof(GPU_PBVH_Buffers), "GPU_Buffers");
        buffers->index_type = GL_UNSIGNED_SHORT;
        buffers->smooth = mface[face_indices[0]].flag & ME_SMOOTH;
 
@@ -1634,7 +1634,7 @@ GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
        return buffers;
 }
 
-void GPU_update_grid_buffers(GPU_Buffers *buffers, CCGElem **grids,
+void GPU_update_grid_pbvh_buffers(GPU_PBVH_Buffers *buffers, CCGElem **grids,
                              const DMFlagMat *grid_flag_mats, int *grid_indices,
                              int totgrid, const CCGKey *key, int show_diffuse_color)
 {
@@ -1872,14 +1872,14 @@ static GLuint gpu_get_grid_buffer(int gridsize, GLenum *index_type, unsigned *to
        return buffer;
 }
 
-GPU_Buffers *GPU_build_grid_buffers(int *grid_indices, int totgrid,
+GPU_PBVH_Buffers *GPU_build_grid_pbvh_buffers(int *grid_indices, int totgrid,
                                     BLI_bitmap **grid_hidden, int gridsize)
 {
-       GPU_Buffers *buffers;
+       GPU_PBVH_Buffers *buffers;
        int totquad;
        int fully_visible_totquad = (gridsize - 1) * (gridsize - 1) * totgrid;
 
-       buffers = MEM_callocN(sizeof(GPU_Buffers), "GPU_Buffers");
+       buffers = MEM_callocN(sizeof(GPU_PBVH_Buffers), "GPU_Buffers");
        buffers->grid_hidden = grid_hidden;
        buffers->totgrid = totgrid;
 
@@ -2001,7 +2001,7 @@ static int gpu_bmesh_face_visible_count(GHash *bm_faces)
 
 /* Creates a vertex buffer (coordinate, normal, color) and, if smooth
  * shading, an element index buffer. */
-void GPU_update_bmesh_buffers(GPU_Buffers *buffers,
+void GPU_update_bmesh_pbvh_buffers(GPU_PBVH_Buffers *buffers,
                               BMesh *bm,
                               GHash *bm_faces,
                               GSet *bm_unique_verts,
@@ -2161,11 +2161,11 @@ void GPU_update_bmesh_buffers(GPU_Buffers *buffers,
        }
 }
 
-GPU_Buffers *GPU_build_bmesh_buffers(int smooth_shading)
+GPU_PBVH_Buffers *GPU_build_bmesh_pbvh_buffers(int smooth_shading)
 {
-       GPU_Buffers *buffers;
+       GPU_PBVH_Buffers *buffers;
 
-       buffers = MEM_callocN(sizeof(GPU_Buffers), "GPU_Buffers");
+       buffers = MEM_callocN(sizeof(GPU_PBVH_Buffers), "GPU_Buffers");
        if (smooth_shading)
                glGenBuffersARB(1, &buffers->index_buf);
        glGenBuffersARB(1, &buffers->vert_buf);
@@ -2175,7 +2175,7 @@ GPU_Buffers *GPU_build_bmesh_buffers(int smooth_shading)
        return buffers;
 }
 
-static void gpu_draw_buffers_legacy_mesh(GPU_Buffers *buffers)
+static void gpu_draw_buffers_legacy_mesh(GPU_PBVH_Buffers *buffers)
 {
        const MVert *mvert = buffers->mvert;
        int i, j;
@@ -2247,7 +2247,7 @@ static void gpu_draw_buffers_legacy_mesh(GPU_Buffers *buffers)
        }
 }
 
-static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers)
+static void gpu_draw_buffers_legacy_grids(GPU_PBVH_Buffers *buffers)
 {
        const CCGKey *key = &buffers->gridkey;
        int i, j, x, y, gridsize = buffers->gridkey.grid_size;
@@ -2373,7 +2373,7 @@ static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers)
        }
 }
 
-void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial,
+void GPU_draw_pbvh_buffers(GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial,
                                          int wireframe)
 {
        /* sets material from the first face, to solve properly face would need to
@@ -2466,7 +2466,7 @@ void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial,
        }
 }
 
-int GPU_buffers_diffuse_changed(GPU_Buffers *buffers, int show_diffuse_color)
+int GPU_pbvh_buffers_diffuse_changed(GPU_PBVH_Buffers *buffers, int show_diffuse_color)
 {
        float diffuse_color[4];
 
@@ -2492,7 +2492,7 @@ int GPU_buffers_diffuse_changed(GPU_Buffers *buffers, int show_diffuse_color)
               diffuse_color[2] != buffers->diffuse_color[2];
 }
 
-void GPU_free_buffers(GPU_Buffers *buffers)
+void GPU_free_pbvh_buffers(GPU_PBVH_Buffers *buffers)
 {
        if (buffers) {
                if (buffers->vert_buf)