Blender
V3.3
|
Go to the source code of this file.
Typedefs | |
typedef struct PBVHGPUFormat | PBVHGPUFormat |
typedef struct GPU_PBVH_Buffers | GPU_PBVH_Buffers |
Enumerations | |
enum | { GPU_PBVH_BUFFERS_SHOW_MASK = (1 << 1) , GPU_PBVH_BUFFERS_SHOW_VCOL = (1 << 2) , GPU_PBVH_BUFFERS_SHOW_SCULPT_FACE_SETS = (1 << 3) } |
Functions | |
GPU_PBVH_Buffers * | GPU_pbvh_mesh_buffers_build (const struct MPoly *mpoly, const struct MLoop *mloop, const struct MLoopTri *looptri, const struct MVert *mvert, const int *face_indices, const int *sculpt_face_sets, int face_indices_len, const struct Mesh *mesh) |
GPU_PBVH_Buffers * | GPU_pbvh_grid_buffers_build (int totgrid, unsigned int **grid_hidden, bool smooth) |
GPU_PBVH_Buffers * | GPU_pbvh_bmesh_buffers_build (bool smooth_shading) |
void | GPU_pbvh_bmesh_buffers_update_free (GPU_PBVH_Buffers *buffers) |
void | GPU_pbvh_grid_buffers_update_free (GPU_PBVH_Buffers *buffers, const struct DMFlagMat *grid_flag_mats, const int *grid_indices) |
void | GPU_pbvh_mesh_buffers_update (PBVHGPUFormat *vbo_id, GPU_PBVH_Buffers *buffers, const struct MVert *mvert, const CustomData *vdata, const CustomData *ldata, const float *vmask, const int *sculpt_face_sets, const int face_sets_color_seed, const int face_sets_color_default, const int update_flags, const float(*vert_normals)[3]) |
bool | GPU_pbvh_attribute_names_update (PBVHType pbvh_type, PBVHGPUFormat *vbo_id, const struct CustomData *vdata, const struct CustomData *ldata, bool active_attrs_only) |
void | GPU_pbvh_bmesh_buffers_update (PBVHGPUFormat *vbo_id, struct GPU_PBVH_Buffers *buffers, struct BMesh *bm, struct GSet *bm_faces, struct GSet *bm_unique_verts, struct GSet *bm_other_verts, const int update_flags) |
void | GPU_pbvh_grid_buffers_update (PBVHGPUFormat *vbo_id, GPU_PBVH_Buffers *buffers, struct SubdivCCG *subdiv_ccg, struct CCGElem **grids, const struct DMFlagMat *grid_flag_mats, int *grid_indices, int totgrid, const int *sculpt_face_sets, int face_sets_color_seed, int face_sets_color_default, const struct CCGKey *key, int update_flags) |
void | GPU_pbvh_buffers_update_flush (GPU_PBVH_Buffers *buffers) |
void | GPU_pbvh_buffers_free (GPU_PBVH_Buffers *buffers) |
struct GPUBatch * | GPU_pbvh_buffers_batch_get (GPU_PBVH_Buffers *buffers, bool fast, bool wires) |
short | GPU_pbvh_buffers_material_index_get (GPU_PBVH_Buffers *buffers) |
bool | GPU_pbvh_buffers_has_overlays (GPU_PBVH_Buffers *buffers) |
PBVHGPUFormat * | GPU_pbvh_make_format (void) |
void | GPU_pbvh_free_format (PBVHGPUFormat *vbo_id) |
typedef struct GPU_PBVH_Buffers GPU_PBVH_Buffers |
Buffers for drawing from PBVH grids.
Definition at line 1 of file GPU_buffers.h.
typedef struct PBVHGPUFormat PBVHGPUFormat |
Definition at line 1 of file GPU_buffers.h.
anonymous enum |
Update mesh buffers without topology changes. Threaded.
Enumerator | |
---|---|
GPU_PBVH_BUFFERS_SHOW_MASK | |
GPU_PBVH_BUFFERS_SHOW_VCOL | |
GPU_PBVH_BUFFERS_SHOW_SCULPT_FACE_SETS |
Definition at line 81 of file GPU_buffers.h.
bool GPU_pbvh_attribute_names_update | ( | PBVHType | pbvh_type, |
PBVHGPUFormat * | vbo_id, | ||
const struct CustomData * | vdata, | ||
const struct CustomData * | ldata, | ||
bool | active_attrs_only | ||
) |
Referenced by pbvh_check_draw_layout().
GPU_PBVH_Buffers* GPU_pbvh_bmesh_buffers_build | ( | bool | smooth_shading | ) |
Threaded: do not call any functions that use OpenGL calls!
Definition at line 1169 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 | ( | PBVHGPUFormat * | vbo_id, |
struct GPU_PBVH_Buffers * | buffers, | ||
struct BMesh * | bm, | ||
struct GSet * | bm_faces, | ||
struct GSet * | bm_unique_verts, | ||
struct GSet * | bm_other_verts, | ||
const int | update_flags | ||
) |
Creates a vertex buffer (coordinate, normal, color) and, if smooth shading, an element index buffer. Threaded: do not call any functions that use OpenGL calls!
Definition at line 999 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 | ) |
Free part of data for update. Not thread safe, must run in OpenGL main thread.
Definition at line 984 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().
struct GPUBatch* GPU_pbvh_buffers_batch_get | ( | GPU_PBVH_Buffers * | buffers, |
bool | fast, | ||
bool | wires | ||
) |
Draw.
Definition at line 1425 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().
void GPU_pbvh_buffers_free | ( | GPU_PBVH_Buffers * | buffers | ) |
Free buffers. Not thread safe, must run in OpenGL main thread.
Definition at line 1471 of file gpu_buffers.c.
References gpu_pbvh_buffers_clear(), and MEM_freeN.
Referenced by BKE_pbvh_free(), and pbvh_free_draw_buffers().
bool GPU_pbvh_buffers_has_overlays | ( | GPU_PBVH_Buffers * | buffers | ) |
Definition at line 1434 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 1439 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 | ) |
Finish update. Not thread safe, must run in OpenGL main thread.
Definition at line 1457 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_free_format | ( | PBVHGPUFormat * | vbo_id | ) |
Definition at line 113 of file gpu_buffers.c.
References MEM_SAFE_FREE.
Referenced by BKE_pbvh_free().
GPU_PBVH_Buffers* GPU_pbvh_grid_buffers_build | ( | int | totgrid, |
unsigned int ** | grid_hidden, | ||
bool | smooth | ||
) |
Threaded: do not call any functions that use OpenGL calls!
Definition at line 884 of file gpu_buffers.c.
References GPU_PBVH_Buffers::grid_hidden, MEM_callocN, GPU_PBVH_Buffers::show_overlay, smooth(), GPU_PBVH_Buffers::smooth, and GPU_PBVH_Buffers::totgrid.
Referenced by pbvh_update_draw_buffer_cb().
void GPU_pbvh_grid_buffers_update | ( | PBVHGPUFormat * | vbo_id, |
GPU_PBVH_Buffers * | buffers, | ||
struct SubdivCCG * | subdiv_ccg, | ||
struct CCGElem ** | grids, | ||
const struct DMFlagMat * | grid_flag_mats, | ||
int * | grid_indices, | ||
int | totgrid, | ||
const int * | sculpt_face_sets, | ||
int | face_sets_color_seed, | ||
int | face_sets_color_default, | ||
const struct CCGKey * | key, | ||
int | update_flags | ||
) |
Threaded: do not call any functions that use OpenGL calls!
Definition at line 706 of file gpu_buffers.c.
References blender::math::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(), PBVHGPUFormat::col, PBVHGPUFormat::fset, 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, PBVHGPUFormat::msk, PBVHGPUFormat::nor, normal_float_to_short_v3(), normal_quad_v3(), NULL, PBVHGPUFormat::pos, 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 686 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, smooth(), GPU_PBVH_Buffers::smooth, GPU_PBVH_Buffers::triangles, and GPU_PBVH_Buffers::triangles_fast.
Referenced by pbvh_update_draw_buffers().
PBVHGPUFormat* GPU_pbvh_make_format | ( | void | ) |
Definition at line 104 of file gpu_buffers.c.
References GPU_pbvh_attribute_names_update(), MEM_callocN, NULL, and PBVH_FACES.
Referenced by pbvh_check_draw_layout(), and pbvh_update_draw_buffers().
GPU_PBVH_Buffers* GPU_pbvh_mesh_buffers_build | ( | const struct MPoly * | mpoly, |
const struct MLoop * | mloop, | ||
const struct MLoopTri * | looptri, | ||
const struct MVert * | mvert, | ||
const int * | face_indices, | ||
const int * | sculpt_face_sets, | ||
int | face_indices_len, | ||
const struct Mesh * | mesh | ||
) |
Build must be called once before using the other functions, used every time mesh topology changes.
Threaded: do not call any functions that use OpenGL calls!
Referenced by pbvh_update_draw_buffer_cb().
void GPU_pbvh_mesh_buffers_update | ( | PBVHGPUFormat * | vbo_id, |
GPU_PBVH_Buffers * | buffers, | ||
const struct MVert * | mvert, | ||
const CustomData * | vdata, | ||
const CustomData * | ldata, | ||
const float * | vmask, | ||
const int * | sculpt_face_sets, | ||
const int | face_sets_color_seed, | ||
const int | face_sets_color_default, | ||
const int | update_flags, | ||
const float(*) | vert_normals[3] | ||
) |
Creates a vertex buffer (coordinate, normal, color) and, if smooth shading, an element index buffer. Threaded: do not call any functions that use OpenGL calls!
Referenced by pbvh_update_draw_buffer_cb().