Cleanup: GPU PBVH naming
Use GPU_pbvh prefix.
This commit is contained in:
@@ -620,7 +620,7 @@ void BKE_pbvh_free(PBVH *bvh)
|
||||
|
||||
if (node->flag & PBVH_Leaf) {
|
||||
if (node->draw_buffers)
|
||||
GPU_free_pbvh_buffers(node->draw_buffers);
|
||||
GPU_pbvh_buffers_free(node->draw_buffers);
|
||||
if (node->vert_indices)
|
||||
MEM_freeN((void *)node->vert_indices);
|
||||
if (node->face_vert_indices)
|
||||
@@ -635,7 +635,7 @@ void BKE_pbvh_free(PBVH *bvh)
|
||||
BLI_gset_free(node->bm_other_verts, NULL);
|
||||
}
|
||||
}
|
||||
GPU_free_pbvh_buffer_multires(&bvh->grid_common_gpu_buffer);
|
||||
GPU_pbvh_multires_buffers_free(&bvh->grid_common_gpu_buffer);
|
||||
|
||||
if (bvh->deformed) {
|
||||
if (bvh->verts) {
|
||||
@@ -1090,11 +1090,11 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
|
||||
PBVHNode *node = nodes[n];
|
||||
|
||||
if (node->flag & PBVH_RebuildDrawBuffers) {
|
||||
GPU_free_pbvh_buffers(node->draw_buffers);
|
||||
GPU_pbvh_buffers_free(node->draw_buffers);
|
||||
switch (bvh->type) {
|
||||
case PBVH_GRIDS:
|
||||
node->draw_buffers =
|
||||
GPU_build_grid_pbvh_buffers(node->prim_indices,
|
||||
GPU_pbvh_grid_buffers_build(node->prim_indices,
|
||||
node->totprim,
|
||||
bvh->grid_hidden,
|
||||
bvh->gridkey.grid_size,
|
||||
@@ -1102,7 +1102,7 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
|
||||
break;
|
||||
case PBVH_FACES:
|
||||
node->draw_buffers =
|
||||
GPU_build_mesh_pbvh_buffers(node->face_vert_indices,
|
||||
GPU_pbvh_mesh_buffers_build(node->face_vert_indices,
|
||||
bvh->mpoly, bvh->mloop, bvh->looptri,
|
||||
bvh->verts,
|
||||
node->prim_indices,
|
||||
@@ -1110,7 +1110,7 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
|
||||
break;
|
||||
case PBVH_BMESH:
|
||||
node->draw_buffers =
|
||||
GPU_build_bmesh_pbvh_buffers(bvh->flags & PBVH_DYNTOPO_SMOOTH_SHADING);
|
||||
GPU_pbvh_bmesh_buffers_build(bvh->flags & PBVH_DYNTOPO_SMOOTH_SHADING);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1120,32 +1120,34 @@ 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_pbvh_buffers(node->draw_buffers,
|
||||
bvh->grids,
|
||||
bvh->grid_flag_mats,
|
||||
node->prim_indices,
|
||||
node->totprim,
|
||||
&bvh->gridkey,
|
||||
bvh->show_diffuse_color);
|
||||
GPU_pbvh_grid_buffers_update(
|
||||
node->draw_buffers,
|
||||
bvh->grids,
|
||||
bvh->grid_flag_mats,
|
||||
node->prim_indices,
|
||||
node->totprim,
|
||||
&bvh->gridkey,
|
||||
bvh->show_diffuse_color);
|
||||
break;
|
||||
case PBVH_FACES:
|
||||
GPU_update_mesh_pbvh_buffers(node->draw_buffers,
|
||||
bvh->verts,
|
||||
node->vert_indices,
|
||||
node->uniq_verts +
|
||||
node->face_verts,
|
||||
CustomData_get_layer(bvh->vdata,
|
||||
CD_PAINT_MASK),
|
||||
node->face_vert_indices,
|
||||
bvh->show_diffuse_color);
|
||||
GPU_pbvh_mesh_buffers_update(
|
||||
node->draw_buffers,
|
||||
bvh->verts,
|
||||
node->vert_indices,
|
||||
node->uniq_verts +
|
||||
node->face_verts,
|
||||
CustomData_get_layer(bvh->vdata, CD_PAINT_MASK),
|
||||
node->face_vert_indices,
|
||||
bvh->show_diffuse_color);
|
||||
break;
|
||||
case PBVH_BMESH:
|
||||
GPU_update_bmesh_pbvh_buffers(node->draw_buffers,
|
||||
bvh->bm,
|
||||
node->bm_faces,
|
||||
node->bm_unique_verts,
|
||||
node->bm_other_verts,
|
||||
bvh->show_diffuse_color);
|
||||
GPU_pbvh_bmesh_buffers_update(
|
||||
node->draw_buffers,
|
||||
bvh->bm,
|
||||
node->bm_faces,
|
||||
node->bm_unique_verts,
|
||||
node->bm_other_verts,
|
||||
bvh->show_diffuse_color);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1156,15 +1158,15 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
|
||||
|
||||
static void pbvh_draw_BB(PBVH *bvh)
|
||||
{
|
||||
GPU_init_draw_pbvh_BB();
|
||||
GPU_pbvh_BB_draw_init();
|
||||
|
||||
for (int a = 0; a < bvh->totnode; a++) {
|
||||
PBVHNode *node = &bvh->nodes[a];
|
||||
|
||||
GPU_draw_pbvh_BB(node->vb.bmin, node->vb.bmax, ((node->flag & PBVH_Leaf) != 0));
|
||||
GPU_pbvh_BB_draw(node->vb.bmin, node->vb.bmax, ((node->flag & PBVH_Leaf) != 0));
|
||||
}
|
||||
|
||||
GPU_end_draw_pbvh_BB();
|
||||
GPU_pbvh_BB_draw_end();
|
||||
}
|
||||
|
||||
static int pbvh_flush_bb(PBVH *bvh, PBVHNode *node, int flag)
|
||||
@@ -1756,7 +1758,7 @@ void BKE_pbvh_node_draw(PBVHNode *node, void *data_v)
|
||||
#endif
|
||||
|
||||
if (!(node->flag & PBVH_FullyHidden)) {
|
||||
GPU_draw_pbvh_buffers(node->draw_buffers,
|
||||
GPU_pbvh_buffers_draw(node->draw_buffers,
|
||||
data->setMaterial,
|
||||
data->wireframe,
|
||||
data->fast);
|
||||
|
||||
@@ -352,7 +352,7 @@ static void pbvh_bmesh_node_split(PBVH *bvh, const BBC *bbc_array, int node_inde
|
||||
n->layer_disp = NULL;
|
||||
|
||||
if (n->draw_buffers) {
|
||||
GPU_free_pbvh_buffers(n->draw_buffers);
|
||||
GPU_pbvh_buffers_free(n->draw_buffers);
|
||||
n->draw_buffers = NULL;
|
||||
}
|
||||
n->flag &= ~PBVH_Leaf;
|
||||
|
||||
@@ -222,50 +222,53 @@ void GPU_interleaved_attrib_unbind(void);
|
||||
typedef struct GPU_PBVH_Buffers GPU_PBVH_Buffers;
|
||||
|
||||
/* build */
|
||||
GPU_PBVH_Buffers *GPU_build_mesh_pbvh_buffers(
|
||||
GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(
|
||||
const int (*face_vert_indices)[3],
|
||||
const struct MPoly *mpoly, const struct MLoop *mloop, const struct MLoopTri *looptri,
|
||||
const struct MVert *verts,
|
||||
const int *face_indices,
|
||||
const int face_indices_len);
|
||||
|
||||
GPU_PBVH_Buffers *GPU_build_grid_pbvh_buffers(
|
||||
GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(
|
||||
int *grid_indices, int totgrid, unsigned int **grid_hidden, int gridsize, const struct CCGKey *key,
|
||||
struct GridCommonGPUBuffer **grid_common_gpu_buffer);
|
||||
|
||||
GPU_PBVH_Buffers *GPU_build_bmesh_pbvh_buffers(bool smooth_shading);
|
||||
GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading);
|
||||
|
||||
/* update */
|
||||
|
||||
void GPU_update_mesh_pbvh_buffers(
|
||||
void GPU_pbvh_mesh_buffers_update(
|
||||
GPU_PBVH_Buffers *buffers, const struct MVert *mvert,
|
||||
const int *vert_indices, int totvert, const float *vmask,
|
||||
const int (*face_vert_indices)[3], bool show_diffuse_color);
|
||||
|
||||
void GPU_update_bmesh_pbvh_buffers(GPU_PBVH_Buffers *buffers,
|
||||
struct BMesh *bm,
|
||||
struct GSet *bm_faces,
|
||||
struct GSet *bm_unique_verts,
|
||||
struct GSet *bm_other_verts,
|
||||
bool show_diffuse_color);
|
||||
void GPU_pbvh_bmesh_buffers_update(
|
||||
GPU_PBVH_Buffers *buffers,
|
||||
struct BMesh *bm,
|
||||
struct GSet *bm_faces,
|
||||
struct GSet *bm_unique_verts,
|
||||
struct GSet *bm_other_verts,
|
||||
bool show_diffuse_color);
|
||||
|
||||
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,
|
||||
bool show_diffuse_color);
|
||||
void GPU_pbvh_grid_buffers_update(
|
||||
GPU_PBVH_Buffers *buffers, struct CCGElem **grids,
|
||||
const struct DMFlagMat *grid_flag_mats,
|
||||
int *grid_indices, int totgrid, const struct CCGKey *key,
|
||||
bool show_diffuse_color);
|
||||
|
||||
/* draw */
|
||||
void GPU_draw_pbvh_buffers(GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial,
|
||||
bool wireframe, bool fast);
|
||||
void GPU_pbvh_buffers_draw(
|
||||
GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial,
|
||||
bool wireframe, bool fast);
|
||||
|
||||
/* debug PBVH draw*/
|
||||
void GPU_draw_pbvh_BB(float min[3], float max[3], bool leaf);
|
||||
void GPU_end_draw_pbvh_BB(void);
|
||||
void GPU_init_draw_pbvh_BB(void);
|
||||
void GPU_pbvh_BB_draw(float min[3], float max[3], bool leaf);
|
||||
void GPU_pbvh_BB_draw_init(void);
|
||||
void GPU_pbvh_BB_draw_end(void);
|
||||
|
||||
bool GPU_pbvh_buffers_diffuse_changed(GPU_PBVH_Buffers *buffers, struct GSet *bm_faces, bool show_diffuse_color);
|
||||
|
||||
void GPU_free_pbvh_buffers(GPU_PBVH_Buffers *buffers);
|
||||
void GPU_free_pbvh_buffer_multires(struct GridCommonGPUBuffer **grid_common_gpu_buffer);
|
||||
void GPU_pbvh_buffers_free(GPU_PBVH_Buffers *buffers);
|
||||
void GPU_pbvh_multires_buffers_free(struct GridCommonGPUBuffer **grid_common_gpu_buffer);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1030,7 +1030,7 @@ static void gpu_color_from_mask_quad_copy(const CCGKey *key,
|
||||
out[2] = diffuse_color[2] * mask_color;
|
||||
}
|
||||
|
||||
void GPU_update_mesh_pbvh_buffers(
|
||||
void GPU_pbvh_mesh_buffers_update(
|
||||
GPU_PBVH_Buffers *buffers, const MVert *mvert,
|
||||
const int *vert_indices, int totvert, const float *vmask,
|
||||
const int (*face_vert_indices)[3], bool show_diffuse_color)
|
||||
@@ -1152,7 +1152,7 @@ void GPU_update_mesh_pbvh_buffers(
|
||||
buffers->mvert = mvert;
|
||||
}
|
||||
|
||||
GPU_PBVH_Buffers *GPU_build_mesh_pbvh_buffers(
|
||||
GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(
|
||||
const int (*face_vert_indices)[3],
|
||||
const MPoly *mpoly, const MLoop *mloop, const MLoopTri *looptri,
|
||||
const MVert *mvert,
|
||||
@@ -1236,9 +1236,10 @@ GPU_PBVH_Buffers *GPU_build_mesh_pbvh_buffers(
|
||||
return buffers;
|
||||
}
|
||||
|
||||
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, bool show_diffuse_color)
|
||||
void GPU_pbvh_grid_buffers_update(
|
||||
GPU_PBVH_Buffers *buffers, CCGElem **grids,
|
||||
const DMFlagMat *grid_flag_mats, int *grid_indices,
|
||||
int totgrid, const CCGKey *key, bool show_diffuse_color)
|
||||
{
|
||||
VertexBufferFormat *vert_data;
|
||||
int i, j, k, x, y;
|
||||
@@ -1458,7 +1459,7 @@ static GPUBuffer *gpu_get_grid_buffer(
|
||||
} \
|
||||
} (void)0
|
||||
|
||||
GPU_PBVH_Buffers *GPU_build_grid_pbvh_buffers(
|
||||
GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(
|
||||
int *grid_indices, int totgrid, BLI_bitmap **grid_hidden, int gridsize, const CCGKey *key,
|
||||
GridCommonGPUBuffer **grid_common_gpu_buffer)
|
||||
{
|
||||
@@ -1604,12 +1605,13 @@ static int gpu_bmesh_face_visible_count(GSet *bm_faces)
|
||||
|
||||
/* Creates a vertex buffer (coordinate, normal, color) and, if smooth
|
||||
* shading, an element index buffer. */
|
||||
void GPU_update_bmesh_pbvh_buffers(GPU_PBVH_Buffers *buffers,
|
||||
BMesh *bm,
|
||||
GSet *bm_faces,
|
||||
GSet *bm_unique_verts,
|
||||
GSet *bm_other_verts,
|
||||
bool show_diffuse_color)
|
||||
void GPU_pbvh_bmesh_buffers_update(
|
||||
GPU_PBVH_Buffers *buffers,
|
||||
BMesh *bm,
|
||||
GSet *bm_faces,
|
||||
GSet *bm_unique_verts,
|
||||
GSet *bm_other_verts,
|
||||
bool show_diffuse_color)
|
||||
{
|
||||
VertexBufferFormat *vert_data;
|
||||
void *tri_data;
|
||||
@@ -1795,7 +1797,7 @@ void GPU_update_bmesh_pbvh_buffers(GPU_PBVH_Buffers *buffers,
|
||||
}
|
||||
}
|
||||
|
||||
GPU_PBVH_Buffers *GPU_build_bmesh_pbvh_buffers(bool smooth_shading)
|
||||
GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading)
|
||||
{
|
||||
GPU_PBVH_Buffers *buffers;
|
||||
|
||||
@@ -1808,8 +1810,9 @@ GPU_PBVH_Buffers *GPU_build_bmesh_pbvh_buffers(bool smooth_shading)
|
||||
return buffers;
|
||||
}
|
||||
|
||||
void GPU_draw_pbvh_buffers(GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial,
|
||||
bool wireframe, bool fast)
|
||||
void GPU_pbvh_buffers_draw(
|
||||
GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial,
|
||||
bool wireframe, bool fast)
|
||||
{
|
||||
bool do_fast = fast && buffers->index_buf_fast;
|
||||
/* sets material from the first face, to solve properly face would need to
|
||||
@@ -1948,7 +1951,8 @@ void GPU_draw_pbvh_buffers(GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial,
|
||||
}
|
||||
}
|
||||
|
||||
bool GPU_pbvh_buffers_diffuse_changed(GPU_PBVH_Buffers *buffers, GSet *bm_faces, bool show_diffuse_color)
|
||||
bool GPU_pbvh_buffers_diffuse_changed(
|
||||
GPU_PBVH_Buffers *buffers, GSet *bm_faces, bool show_diffuse_color)
|
||||
{
|
||||
float diffuse_color[4];
|
||||
bool use_matcaps = GPU_material_use_matcaps_get();
|
||||
@@ -1991,7 +1995,7 @@ bool GPU_pbvh_buffers_diffuse_changed(GPU_PBVH_Buffers *buffers, GSet *bm_faces,
|
||||
return !equals_v3v3(diffuse_color, buffers->diffuse_color);
|
||||
}
|
||||
|
||||
void GPU_free_pbvh_buffers(GPU_PBVH_Buffers *buffers)
|
||||
void GPU_pbvh_buffers_free(GPU_PBVH_Buffers *buffers)
|
||||
{
|
||||
if (buffers) {
|
||||
if (buffers->vert_buf)
|
||||
@@ -2009,7 +2013,7 @@ void GPU_free_pbvh_buffers(GPU_PBVH_Buffers *buffers)
|
||||
}
|
||||
}
|
||||
|
||||
void GPU_free_pbvh_buffer_multires(GridCommonGPUBuffer **grid_common_gpu_buffer)
|
||||
void GPU_pbvh_multires_buffers_free(GridCommonGPUBuffer **grid_common_gpu_buffer)
|
||||
{
|
||||
GridCommonGPUBuffer *gridbuff = *grid_common_gpu_buffer;
|
||||
|
||||
@@ -2025,7 +2029,7 @@ void GPU_free_pbvh_buffer_multires(GridCommonGPUBuffer **grid_common_gpu_buffer)
|
||||
}
|
||||
|
||||
/* debug function, draws the pbvh BB */
|
||||
void GPU_draw_pbvh_BB(float min[3], float max[3], bool leaf)
|
||||
void GPU_pbvh_BB_draw(float min[3], float max[3], bool leaf)
|
||||
{
|
||||
const float quads[4][4][3] = {
|
||||
{
|
||||
@@ -2066,7 +2070,7 @@ void GPU_draw_pbvh_BB(float min[3], float max[3], bool leaf)
|
||||
glDrawArrays(GL_QUADS, 0, 16);
|
||||
}
|
||||
|
||||
void GPU_init_draw_pbvh_BB(void)
|
||||
void GPU_pbvh_BB_draw_init(void)
|
||||
{
|
||||
glPushAttrib(GL_ENABLE_BIT);
|
||||
glDisable(GL_CULL_FACE);
|
||||
@@ -2076,7 +2080,7 @@ void GPU_init_draw_pbvh_BB(void)
|
||||
glEnable(GL_BLEND);
|
||||
}
|
||||
|
||||
void GPU_end_draw_pbvh_BB(void)
|
||||
void GPU_pbvh_BB_draw_end(void)
|
||||
{
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
glPopAttrib();
|
||||
|
||||
Reference in New Issue
Block a user