|
Blender
V2.93
|
#include <limits.h>#include <stddef.h>#include <string.h>#include "MEM_guardedalloc.h"#include "BLI_bitmap.h"#include "BLI_ghash.h"#include "BLI_hash.h"#include "BLI_math.h"#include "BLI_math_color.h"#include "BLI_math_color_blend.h"#include "BLI_utildefines.h"#include "DNA_meshdata_types.h"#include "DNA_userdef_types.h"#include "BKE_DerivedMesh.h"#include "BKE_ccg.h"#include "BKE_mesh.h"#include "BKE_paint.h"#include "BKE_pbvh.h"#include "BKE_subdiv_ccg.h"#include "GPU_batch.h"#include "GPU_buffers.h"#include "gpu_private.h"#include "bmesh.h"Go to the source code of this file.
Classes | |
| struct | GPU_PBVH_Buffers |
Functions | |
PBVH Utils | |
| void | gpu_pbvh_init () |
| void | gpu_pbvh_exit () |
| static bool | gpu_pbvh_vert_buf_data_set (GPU_PBVH_Buffers *buffers, uint vert_len) |
| static void | gpu_pbvh_batch_init (GPU_PBVH_Buffers *buffers, GPUPrimType prim) |
Mesh PBVH | |
| static bool | gpu_pbvh_is_looptri_visible (const MLoopTri *lt, const MVert *mvert, const MLoop *mloop, const int *sculpt_face_sets) |
| void | GPU_pbvh_mesh_buffers_update (GPU_PBVH_Buffers *buffers, const MVert *mvert, const float *vmask, const MLoopCol *vcol, const int *sculpt_face_sets, const int face_sets_color_seed, const int face_sets_color_default, const MPropCol *vtcol, const int update_flags) |
| GPU_PBVH_Buffers * | GPU_pbvh_mesh_buffers_build (const MPoly *mpoly, const MLoop *mloop, const MLoopTri *looptri, const MVert *mvert, const int *face_indices, const int *sculpt_face_sets, const int face_indices_len, const struct Mesh *mesh) |
Grid PBVH | |
| static void | gpu_pbvh_grid_fill_index_buffers (GPU_PBVH_Buffers *buffers, SubdivCCG *UNUSED(subdiv_ccg), const int *UNUSED(face_sets), const int *grid_indices, uint visible_quad_len, int totgrid, int gridsize) |
| void | GPU_pbvh_grid_buffers_update_free (GPU_PBVH_Buffers *buffers, const struct DMFlagMat *grid_flag_mats, const int *grid_indices) |
| void | GPU_pbvh_grid_buffers_update (GPU_PBVH_Buffers *buffers, SubdivCCG *subdiv_ccg, CCGElem **grids, const struct DMFlagMat *grid_flag_mats, int *grid_indices, int totgrid, const int *sculpt_face_sets, const int face_sets_color_seed, const int face_sets_color_default, const struct CCGKey *key, const int update_flags) |
| GPU_PBVH_Buffers * | GPU_pbvh_grid_buffers_build (int totgrid, BLI_bitmap **grid_hidden) |
BMesh PBVH | |
| static void | gpu_bmesh_vert_to_buffer_copy (BMVert *v, GPUVertBuf *vert_buf, int v_index, const float fno[3], const float *fmask, const int cd_vert_mask_offset, const bool show_mask, const bool show_vcol, bool *empty_mask) |
| static int | gpu_bmesh_vert_visible_count (GSet *bm_unique_verts, GSet *bm_other_verts) |
| static int | gpu_bmesh_face_visible_count (GSet *bm_faces) |
| void | GPU_pbvh_bmesh_buffers_update_free (GPU_PBVH_Buffers *buffers) |
| void | GPU_pbvh_bmesh_buffers_update (GPU_PBVH_Buffers *buffers, BMesh *bm, GSet *bm_faces, GSet *bm_unique_verts, GSet *bm_other_verts, const int update_flags) |
Generic | |
| GPU_PBVH_Buffers * | GPU_pbvh_bmesh_buffers_build (bool smooth_shading) |
| GPUBatch * | GPU_pbvh_buffers_batch_get (GPU_PBVH_Buffers *buffers, bool fast, bool wires) |
| bool | GPU_pbvh_buffers_has_overlays (GPU_PBVH_Buffers *buffers) |
| short | GPU_pbvh_buffers_material_index_get (GPU_PBVH_Buffers *buffers) |
| static void | gpu_pbvh_buffers_clear (GPU_PBVH_Buffers *buffers) |
| void | GPU_pbvh_buffers_update_flush (GPU_PBVH_Buffers *buffers) |
| void | GPU_pbvh_buffers_free (GPU_PBVH_Buffers *buffers) |
Variables | |
| struct { | |
| GPUVertFormat format | |
| uint pos | |
| uint nor | |
| uint msk | |
| uint col | |
| uint fset | |
| } | g_vbo_id = {{0}} |
Mesh drawing using OpenGL VBO (Vertex Buffer Objects)
Definition in file gpu_buffers.c.
|
static |
Definition at line 850 of file gpu_buffers.c.
References BLI_gsetIterator_getKey(), BM_elem_flag_test, BM_ELEM_HIDDEN, and GSET_ITER.
Referenced by GPU_pbvh_bmesh_buffers_update().
|
static |
Definition at line 790 of file gpu_buffers.c.
References BLI_assert, BM_ELEM_CD_GET_FLOAT, BM_elem_flag_test, BM_ELEM_HIDDEN, BMVert::co, g_vbo_id, GPU_vertbuf_attr_set(), BMVert::no, normal_float_to_short_v3(), and v.
Referenced by GPU_pbvh_bmesh_buffers_update().
Definition at line 828 of file gpu_buffers.c.
References BLI_gsetIterator_getKey(), BM_elem_flag_test, BM_ELEM_HIDDEN, GSET_ITER, and v.
Referenced by GPU_pbvh_bmesh_buffers_update().
|
static |
Definition at line 166 of file gpu_buffers.c.
References GPU_batch_create, GPU_PRIM_LINES, GPU_PBVH_Buffers::index_buf, GPU_PBVH_Buffers::index_buf_fast, GPU_PBVH_Buffers::index_lines_buf, GPU_PBVH_Buffers::index_lines_buf_fast, GPU_PBVH_Buffers::lines, GPU_PBVH_Buffers::lines_fast, NULL, GPU_PBVH_Buffers::triangles, GPU_PBVH_Buffers::triangles_fast, and GPU_PBVH_Buffers::vert_buf.
Referenced by GPU_pbvh_bmesh_buffers_update(), GPU_pbvh_grid_buffers_update(), and GPU_pbvh_mesh_buffers_update().
| GPU_PBVH_Buffers* GPU_pbvh_bmesh_buffers_build | ( | bool | smooth_shading | ) |
Definition at line 1052 of file gpu_buffers.c.
References MEM_callocN, GPU_PBVH_Buffers::show_overlay, GPU_PBVH_Buffers::smooth, and GPU_PBVH_Buffers::use_bmesh.
Referenced by pbvh_update_draw_buffer_cb().
| void GPU_pbvh_bmesh_buffers_update | ( | GPU_PBVH_Buffers * | buffers, |
| BMesh * | bm, | ||
| GSet * | bm_faces, | ||
| GSet * | bm_unique_verts, | ||
| GSet * | bm_other_verts, | ||
| const int | update_flags | ||
| ) |
Definition at line 884 of file gpu_buffers.c.
References BLI_assert, BLI_ghash_ensure_p(), BLI_ghash_free(), BLI_ghash_int_new_ex(), BLI_gset_len(), BLI_gsetIterator_getKey(), bm, BM_ELEM_CD_GET_FLOAT, BM_elem_flag_test, BM_ELEM_HIDDEN, BM_face_as_array_vert_tri(), CD_PAINT_MASK, GPU_PBVH_Buffers::clear_bmesh_on_flush, CustomData_get_offset(), gpu_bmesh_face_visible_count(), gpu_bmesh_vert_to_buffer_copy(), gpu_bmesh_vert_visible_count(), GPU_indexbuf_add_line_verts(), GPU_indexbuf_add_tri_verts(), GPU_indexbuf_build(), GPU_indexbuf_build_in_place(), GPU_indexbuf_init(), gpu_pbvh_batch_init(), GPU_PBVH_BUFFERS_SHOW_MASK, GPU_PBVH_BUFFERS_SHOW_VCOL, gpu_pbvh_vert_buf_data_set(), GPU_PRIM_LINES, GPU_PRIM_TRIS, GSET_ITER, GPU_PBVH_Buffers::index_buf, GPU_PBVH_Buffers::index_lines_buf, BMFace::len, BMFace::mat_nr, GPU_PBVH_Buffers::material_index, BMFace::no, NULL, POINTER_AS_UINT, POINTER_FROM_UINT, GPU_PBVH_Buffers::show_overlay, GPU_PBVH_Buffers::smooth, GPU_PBVH_Buffers::tot_tri, v, BMesh::vdata, and GPU_PBVH_Buffers::vert_buf.
Referenced by pbvh_update_draw_buffer_cb().
| void GPU_pbvh_bmesh_buffers_update_free | ( | GPU_PBVH_Buffers * | buffers | ) |
Definition at line 866 of file gpu_buffers.c.
References GPU_BATCH_DISCARD_SAFE, GPU_INDEXBUF_DISCARD_SAFE, GPU_PBVH_Buffers::index_buf, GPU_PBVH_Buffers::index_lines_buf, GPU_PBVH_Buffers::lines, GPU_PBVH_Buffers::smooth, and GPU_PBVH_Buffers::triangles.
Referenced by pbvh_update_draw_buffers().
| GPUBatch* GPU_pbvh_buffers_batch_get | ( | GPU_PBVH_Buffers * | buffers, |
| bool | fast, | ||
| bool | wires | ||
| ) |
Definition at line 1064 of file gpu_buffers.c.
References GPU_PBVH_Buffers::lines, GPU_PBVH_Buffers::lines_fast, GPU_PBVH_Buffers::triangles, and GPU_PBVH_Buffers::triangles_fast.
Referenced by sculpt_draw_cb().
|
static |
Definition at line 1083 of file gpu_buffers.c.
References GPU_BATCH_DISCARD_SAFE, GPU_INDEXBUF_DISCARD_SAFE, GPU_VERTBUF_DISCARD_SAFE, GPU_PBVH_Buffers::index_buf, GPU_PBVH_Buffers::index_buf_fast, GPU_PBVH_Buffers::index_lines_buf, GPU_PBVH_Buffers::index_lines_buf_fast, GPU_PBVH_Buffers::lines, GPU_PBVH_Buffers::lines_fast, GPU_PBVH_Buffers::triangles, GPU_PBVH_Buffers::triangles_fast, and GPU_PBVH_Buffers::vert_buf.
Referenced by GPU_pbvh_buffers_free(), and GPU_pbvh_buffers_update_flush().
| void GPU_pbvh_buffers_free | ( | GPU_PBVH_Buffers * | buffers | ) |
Definition at line 1110 of file gpu_buffers.c.
References gpu_pbvh_buffers_clear(), and MEM_freeN.
Referenced by BKE_pbvh_free(), pbvh_bmesh_node_split(), and pbvh_update_draw_buffers().
| bool GPU_pbvh_buffers_has_overlays | ( | GPU_PBVH_Buffers * | buffers | ) |
Definition at line 1073 of file gpu_buffers.c.
References GPU_PBVH_Buffers::show_overlay.
Referenced by sculpt_draw_cb().
| short GPU_pbvh_buffers_material_index_get | ( | GPU_PBVH_Buffers * | buffers | ) |
Definition at line 1078 of file gpu_buffers.c.
References GPU_PBVH_Buffers::material_index.
Referenced by sculpt_draw_cb().
| void GPU_pbvh_buffers_update_flush | ( | GPU_PBVH_Buffers * | buffers | ) |
Definition at line 1096 of file gpu_buffers.c.
References GPU_PBVH_Buffers::clear_bmesh_on_flush, gpu_pbvh_buffers_clear(), GPU_vertbuf_get_data(), GPU_vertbuf_use(), and GPU_PBVH_Buffers::vert_buf.
Referenced by pbvh_update_draw_buffers().
| void gpu_pbvh_exit | ( | void | ) |
Definition at line 130 of file gpu_buffers.c.
Referenced by GPU_exit().
| GPU_PBVH_Buffers* GPU_pbvh_grid_buffers_build | ( | int | totgrid, |
| BLI_bitmap ** | grid_hidden | ||
| ) |
Definition at line 768 of file gpu_buffers.c.
References GPU_PBVH_Buffers::grid_hidden, MEM_callocN, GPU_PBVH_Buffers::show_overlay, and GPU_PBVH_Buffers::totgrid.
Referenced by pbvh_update_draw_buffer_cb().
| void GPU_pbvh_grid_buffers_update | ( | GPU_PBVH_Buffers * | buffers, |
| SubdivCCG * | subdiv_ccg, | ||
| CCGElem ** | grids, | ||
| const struct DMFlagMat * | grid_flag_mats, | ||
| int * | grid_indices, | ||
| int | totgrid, | ||
| const int * | sculpt_face_sets, | ||
| const int | face_sets_color_seed, | ||
| const int | face_sets_color_default, | ||
| const struct CCGKey * | key, | ||
| const int | update_flags | ||
| ) |
Definition at line 588 of file gpu_buffers.c.
References abs(), BKE_paint_face_set_overlay_color_get(), BKE_pbvh_count_grid_quads(), BKE_subdiv_ccg_grid_to_face_index(), CCG_elem_co(), CCG_elem_mask(), CCG_elem_no(), CCG_grid_elem(), DMFlagMat::flag, fset, g_vbo_id, GPU_indexbuf_init(), gpu_pbvh_batch_init(), GPU_PBVH_BUFFERS_SHOW_MASK, GPU_PBVH_BUFFERS_SHOW_SCULPT_FACE_SETS, GPU_PBVH_BUFFERS_SHOW_VCOL, gpu_pbvh_grid_fill_index_buffers(), gpu_pbvh_vert_buf_data_set(), GPU_PRIM_LINES, GPU_PRIM_TRIS, GPU_vertbuf_attr_set(), CCGKey::grid_area, GPU_PBVH_Buffers::grid_flag_mats, GPU_PBVH_Buffers::grid_hidden, GPU_PBVH_Buffers::grid_indices, CCGKey::grid_size, GPU_PBVH_Buffers::gridkey, GPU_PBVH_Buffers::grids, CCGKey::has_mask, GPU_PBVH_Buffers::index_buf, GPU_PBVH_Buffers::index_lines_buf, DMFlagMat::mat_nr, GPU_PBVH_Buffers::material_index, ME_SMOOTH, normal_float_to_short_v3(), normal_quad_v3(), NULL, GPU_PBVH_Buffers::show_overlay, GPU_PBVH_Buffers::smooth, square_i(), GPU_PBVH_Buffers::totgrid, GPU_PBVH_Buffers::vert_buf, x, and y.
Referenced by pbvh_update_draw_buffer_cb().
| void GPU_pbvh_grid_buffers_update_free | ( | GPU_PBVH_Buffers * | buffers, |
| const struct DMFlagMat * | grid_flag_mats, | ||
| const int * | grid_indices | ||
| ) |
Definition at line 567 of file gpu_buffers.c.
References DMFlagMat::flag, GPU_BATCH_DISCARD_SAFE, GPU_INDEXBUF_DISCARD_SAFE, GPU_PBVH_Buffers::index_buf, GPU_PBVH_Buffers::index_buf_fast, GPU_PBVH_Buffers::index_lines_buf, GPU_PBVH_Buffers::index_lines_buf_fast, GPU_PBVH_Buffers::lines, GPU_PBVH_Buffers::lines_fast, ME_SMOOTH, GPU_PBVH_Buffers::smooth, GPU_PBVH_Buffers::triangles, and GPU_PBVH_Buffers::triangles_fast.
Referenced by pbvh_update_draw_buffers().
|
static |
Definition at line 435 of file gpu_buffers.c.
References GPU_indexbuf_add_line_verts(), GPU_indexbuf_add_tri_verts(), GPU_indexbuf_build(), GPU_indexbuf_init(), GPU_PRIM_LINES, GPU_PRIM_TRIS, GPU_PBVH_Buffers::grid_hidden, GPU_PBVH_Buffers::index_buf, GPU_PBVH_Buffers::index_buf_fast, GPU_PBVH_Buffers::index_lines_buf, GPU_PBVH_Buffers::index_lines_buf_fast, paint_is_grid_face_hidden(), GPU_PBVH_Buffers::smooth, square_uint(), v1, and v2.
Referenced by GPU_pbvh_grid_buffers_update().
| void gpu_pbvh_init | ( | void | ) |
Definition at line 112 of file gpu_buffers.c.
References g_vbo_id, GPU_COMP_F32, GPU_COMP_I16, GPU_COMP_U16, GPU_COMP_U8, GPU_FETCH_FLOAT, GPU_FETCH_INT_TO_FLOAT_UNIT, and GPU_vertformat_attr_add().
Referenced by GPU_init().
|
static |
Definition at line 198 of file gpu_buffers.c.
References paint_is_face_hidden(), MLoopTri::poly, and SCULPT_FACE_SET_NONE.
Referenced by GPU_pbvh_mesh_buffers_build(), and GPU_pbvh_mesh_buffers_update().
| GPU_PBVH_Buffers* GPU_pbvh_mesh_buffers_build | ( | const MPoly * | mpoly, |
| const MLoop * | mloop, | ||
| const MLoopTri * | looptri, | ||
| const MVert * | mvert, | ||
| const int * | face_indices, | ||
| const int * | sculpt_face_sets, | ||
| const int | face_indices_len, | ||
| const struct Mesh * | mesh | ||
| ) |
Definition at line 341 of file gpu_buffers.c.
References BKE_mesh_looptri_get_real_edges(), GPU_PBVH_Buffers::face_indices, GPU_PBVH_Buffers::face_indices_len, MPoly::flag, GPU_indexbuf_add_line_verts(), GPU_indexbuf_build(), GPU_indexbuf_init(), gpu_pbvh_is_looptri_visible(), GPU_PRIM_LINES, GPU_PBVH_Buffers::index_lines_buf, GPU_PBVH_Buffers::looptri, ME_SMOOTH, MEM_callocN, mesh, GPU_PBVH_Buffers::mloop, GPU_PBVH_Buffers::mpoly, MLoopTri::poly, GPU_PBVH_Buffers::show_overlay, GPU_PBVH_Buffers::smooth, and GPU_PBVH_Buffers::tot_tri.
| void GPU_pbvh_mesh_buffers_update | ( | GPU_PBVH_Buffers * | buffers, |
| const MVert * | mvert, | ||
| const float * | vmask, | ||
| const MLoopCol * | vcol, | ||
| const int * | sculpt_face_sets, | ||
| const int | face_sets_color_seed, | ||
| const int | face_sets_color_default, | ||
| const MPropCol * | vtcol, | ||
| const int | update_flags | ||
| ) |
Definition at line 208 of file gpu_buffers.c.
References MLoopCol::a, abs(), MLoopCol::b, BKE_mesh_calc_poly_normal(), BKE_paint_face_set_overlay_color_get(), BLI_color_from_srgb_table, BMVert::co, copy_v3_v3(), copy_v3_v3_short(), GPU_PBVH_Buffers::face_indices, GPU_PBVH_Buffers::face_indices_len, fset, MLoopCol::g, g_vbo_id, gpu_pbvh_batch_init(), GPU_PBVH_BUFFERS_SHOW_MASK, GPU_PBVH_BUFFERS_SHOW_SCULPT_FACE_SETS, GPU_PBVH_BUFFERS_SHOW_VCOL, gpu_pbvh_is_looptri_visible(), gpu_pbvh_vert_buf_data_set(), GPU_PRIM_TRIS, GPU_vertbuf_attr_get_raw_data(), GPU_vertbuf_raw_step(), MPoly::loopstart, GPU_PBVH_Buffers::looptri, MPoly::mat_nr, GPU_PBVH_Buffers::material_index, GPU_PBVH_Buffers::mloop, GPU_PBVH_Buffers::mpoly, GPU_PBVH_Buffers::mvert, BMVert::no, normal_float_to_short_v3(), MLoopTri::poly, MLoopCol::r, GPU_PBVH_Buffers::show_overlay, GPU_PBVH_Buffers::smooth, GPU_PBVH_Buffers::tot_tri, MLoopTri::tri, UINT_MAX, unit_float_to_ushort_clamp(), v, MLoop::v, and GPU_PBVH_Buffers::vert_buf.
|
static |
Definition at line 137 of file gpu_buffers.c.
References g_vbo_id, GPU_USAGE_DYNAMIC, GPU_USAGE_STATIC, GPU_vertbuf_create_with_format_ex(), GPU_vertbuf_data_alloc(), GPU_vertbuf_data_resize(), GPU_vertbuf_get_data(), GPU_vertbuf_get_vertex_len(), NULL, and GPU_PBVH_Buffers::vert_buf.
Referenced by GPU_pbvh_bmesh_buffers_update(), GPU_pbvh_grid_buffers_update(), and GPU_pbvh_mesh_buffers_update().
| uint col |
Definition at line 103 of file gpu_buffers.c.
Definition at line 102 of file gpu_buffers.c.
| uint fset |
Definition at line 103 of file gpu_buffers.c.
Referenced by GPU_pbvh_grid_buffers_update(), and GPU_pbvh_mesh_buffers_update().
| struct { ... } g_vbo_id |
| uint msk |
Definition at line 103 of file gpu_buffers.c.
| uint nor |
Definition at line 103 of file gpu_buffers.c.
| uint pos |
Definition at line 103 of file gpu_buffers.c.