Fix T66949: Can't select bones from multiple objects in wpaint mode
[blender.git] / source / blender / gpu / GPU_buffers.h
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
20 /** \file
21  * \ingroup gpu
22  */
23
24 #ifndef __GPU_BUFFERS_H__
25 #define __GPU_BUFFERS_H__
26
27 #include <stddef.h>
28
29 struct BMesh;
30 struct CCGElem;
31 struct CCGKey;
32 struct DMFlagMat;
33 struct GSet;
34 struct MLoop;
35 struct MLoopCol;
36 struct MLoopTri;
37 struct MPoly;
38 struct MVert;
39 struct PBVH;
40
41 /* Buffers for drawing from PBVH grids. */
42 typedef struct GPU_PBVH_Buffers GPU_PBVH_Buffers;
43
44 /* build */
45 GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const int (*face_vert_indices)[3],
46                                               const struct MPoly *mpoly,
47                                               const struct MLoop *mloop,
48                                               const struct MLoopTri *looptri,
49                                               const struct MVert *verts,
50                                               const int *face_indices,
51                                               const int face_indices_len);
52
53 GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(int totgrid, unsigned int **grid_hidden);
54
55 GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading);
56
57 /* update */
58
59 enum {
60   GPU_PBVH_BUFFERS_SHOW_MASK = (1 << 1),
61   GPU_PBVH_BUFFERS_SHOW_VCOL = (1 << 1),
62 };
63
64 void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers,
65                                   const struct MVert *mvert,
66                                   const int *vert_indices,
67                                   int totvert,
68                                   const float *vmask,
69                                   const struct MLoopCol *vcol,
70                                   const int (*face_vert_indices)[3],
71                                   const int update_flags);
72
73 void GPU_pbvh_bmesh_buffers_update(GPU_PBVH_Buffers *buffers,
74                                    struct BMesh *bm,
75                                    struct GSet *bm_faces,
76                                    struct GSet *bm_unique_verts,
77                                    struct GSet *bm_other_verts,
78                                    const int update_flags);
79
80 void GPU_pbvh_grid_buffers_update(GPU_PBVH_Buffers *buffers,
81                                   struct CCGElem **grids,
82                                   const struct DMFlagMat *grid_flag_mats,
83                                   int *grid_indices,
84                                   int totgrid,
85                                   const struct CCGKey *key,
86                                   const int update_flags);
87
88 /* draw */
89 struct GPUBatch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast, bool wires);
90
91 short GPU_pbvh_buffers_material_index_get(GPU_PBVH_Buffers *buffers);
92
93 bool GPU_pbvh_buffers_has_mask(GPU_PBVH_Buffers *buffers);
94
95 void GPU_pbvh_buffers_free(GPU_PBVH_Buffers *buffers);
96
97 void GPU_pbvh_fix_linking(void);
98
99 #endif