Blender  V2.93
GPU_buffers.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2005 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include <stddef.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 struct BMesh;
33 struct CCGElem;
34 struct CCGKey;
35 struct DMFlagMat;
36 struct GSet;
37 struct MLoop;
38 struct MLoopCol;
39 struct MLoopTri;
40 struct MPoly;
41 struct MPropCol;
42 struct MVert;
43 struct Mesh;
44 struct PBVH;
45 struct SubdivCCG;
46 
47 /* Buffers for drawing from PBVH grids. */
48 typedef struct GPU_PBVH_Buffers GPU_PBVH_Buffers;
49 
50 /* Build must be called once before using the other functions, used every time
51  * mesh topology changes. Threaded. */
53  const struct MLoop *mloop,
54  const struct MLoopTri *looptri,
55  const struct MVert *mvert,
56  const int *face_indices,
57  const int *sculpt_face_sets,
58  const int face_indices_len,
59  const struct Mesh *mesh);
60 
62 
64 
65 /* Free part of data for update. Not thread safe, must run in OpenGL main thread. */
68  const struct DMFlagMat *grid_flag_mats,
69  const int *grid_indices);
70 
71 /* Update mesh buffers without topology changes. Threaded. */
72 enum {
76 };
77 
79  const struct MVert *mvert,
80  const float *vmask,
81  const struct MLoopCol *vcol,
82  const int *sculpt_face_sets,
83  const int face_sets_color_seed,
84  const int face_sets_color_default,
85  const struct MPropCol *vtcol,
86  const int update_flags);
87 
89  struct BMesh *bm,
90  struct GSet *bm_faces,
91  struct GSet *bm_unique_verts,
92  struct GSet *bm_other_verts,
93  const int update_flags);
94 
96  struct SubdivCCG *subdiv_ccg,
97  struct CCGElem **grids,
98  const struct DMFlagMat *grid_flag_mats,
99  int *grid_indices,
100  int totgrid,
101  const int *sculpt_face_sets,
102  const int face_sets_color_seed,
103  const int face_sets_color_default,
104  const struct CCGKey *key,
105  const int update_flags);
106 
107 /* Finish update. Not thread safe, must run in OpenGL main thread. */
109 
110 /* Free buffers. Not thread safe, must run in OpenGL main thread. */
112 
113 /* draw */
114 struct GPUBatch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast, bool wires);
115 
117 
119 
120 #ifdef __cplusplus
121 }
122 #endif
struct CCGElem CCGElem
Definition: BKE_ccg.h:46
struct GSet GSet
Definition: BLI_ghash.h:189
GPUBatch
Definition: GPU_batch.h:93
short GPU_pbvh_buffers_material_index_get(GPU_PBVH_Buffers *buffers)
Definition: gpu_buffers.c:1078
@ GPU_PBVH_BUFFERS_SHOW_MASK
Definition: GPU_buffers.h:73
@ GPU_PBVH_BUFFERS_SHOW_VCOL
Definition: GPU_buffers.h:74
@ GPU_PBVH_BUFFERS_SHOW_SCULPT_FACE_SETS
Definition: GPU_buffers.h:75
struct GPUBatch * GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast, bool wires)
Definition: gpu_buffers.c:1064
void GPU_pbvh_buffers_free(GPU_PBVH_Buffers *buffers)
Definition: gpu_buffers.c:1110
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, const int update_flags)
Definition: gpu_buffers.c:884
void GPU_pbvh_bmesh_buffers_update_free(GPU_PBVH_Buffers *buffers)
Definition: gpu_buffers.c:866
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, const int face_indices_len, const struct Mesh *mesh)
bool GPU_pbvh_buffers_has_overlays(GPU_PBVH_Buffers *buffers)
Definition: gpu_buffers.c:1073
void GPU_pbvh_buffers_update_flush(GPU_PBVH_Buffers *buffers)
Definition: gpu_buffers.c:1096
void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers, const struct MVert *mvert, const float *vmask, const struct MLoopCol *vcol, const int *sculpt_face_sets, const int face_sets_color_seed, const int face_sets_color_default, const struct MPropCol *vtcol, const int update_flags)
GPU_PBVH_Buffers * GPU_pbvh_bmesh_buffers_build(bool smooth_shading)
Definition: gpu_buffers.c:1052
void GPU_pbvh_grid_buffers_update_free(GPU_PBVH_Buffers *buffers, const struct DMFlagMat *grid_flag_mats, const int *grid_indices)
Definition: gpu_buffers.c:567
GPU_PBVH_Buffers * GPU_pbvh_grid_buffers_build(int totgrid, unsigned int **grid_hidden)
Definition: gpu_buffers.c:768
void GPU_pbvh_grid_buffers_update(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, const int face_sets_color_seed, const int face_sets_color_default, const struct CCGKey *key, const int update_flags)
Definition: gpu_buffers.c:588
ATTR_WARN_UNUSED_RESULT BMesh * bm
Definition: BKE_ccg.h:48
const int * grid_indices
Definition: gpu_buffers.c:84
const int * face_indices
Definition: gpu_buffers.c:76
const MVert * mvert
Definition: gpu_buffers.c:74
const MPoly * mpoly
Definition: gpu_buffers.c:71
CCGElem ** grids
Definition: gpu_buffers.c:81
const MLoopTri * looptri
Definition: gpu_buffers.c:73
const MLoop * mloop
Definition: gpu_buffers.c:72
const DMFlagMat * grid_flag_mats
Definition: gpu_buffers.c:82
BLI_bitmap *const * grid_hidden
Definition: gpu_buffers.c:83