Blender  V2.93
draw_cache.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  * Copyright 2016, Blender Foundation.
17  */
18 
23 #pragma once
24 
25 struct GPUBatch;
26 struct GPUMaterial;
27 struct ModifierData;
28 struct Object;
29 struct PTCacheEdit;
30 struct ParticleSystem;
31 struct Volume;
32 struct VolumeGrid;
33 struct bGPDstroke;
34 
35 /* Shape resolution level of detail */
36 typedef enum eDRWLevelOfDetail {
40 
41  DRW_LOD_MAX, /* Max number of level of detail */
43 
44 void DRW_shape_cache_free(void);
45 
46 /* 3D cursor */
47 struct GPUBatch *DRW_cache_cursor_get(bool crosshair_lines);
48 
49 /* Common Shapes */
51 struct GPUBatch *DRW_cache_grid_get(void);
53 struct GPUBatch *DRW_cache_quad_get(void);
55 struct GPUBatch *DRW_cache_cube_get(void);
57 
58 struct GPUBatch *DRW_cache_sphere_get(const eDRWLevelOfDetail level_of_detail);
59 
60 /* Dummy VBOs */
62 
63 /* Common Object */
65 struct GPUBatch *DRW_cache_object_edge_detection_get(struct Object *ob, bool *r_is_manifold);
66 struct GPUBatch *DRW_cache_object_surface_get(struct Object *ob);
69  struct GPUMaterial **gpumat_array,
70  uint gpumat_array_len);
73 
75 
76 /* Empties */
80 struct GPUBatch *DRW_cache_circle_get(void);
86 
87 /* Force Field */
95 
96 /* Lights */
103 
104 /* Camera */
109 struct GPUBatch *DRW_cache_camera_tria_get(void);
111 
112 /* Speaker */
113 struct GPUBatch *DRW_cache_speaker_get(void);
114 
115 /* Probe */
119 
120 /* Bones */
123 struct GPUBatch *DRW_cache_bone_box_get(void);
127 struct GPUBatch *DRW_cache_bone_point_get(void);
129 struct GPUBatch *DRW_cache_bone_stick_get(void);
130 struct GPUBatch *DRW_cache_bone_arrows_get(void);
133 
134 /* Meshes */
135 struct GPUBatch *DRW_cache_mesh_all_verts_get(struct Object *ob);
136 struct GPUBatch *DRW_cache_mesh_all_edges_get(struct Object *ob);
138 struct GPUBatch *DRW_cache_mesh_edge_detection_get(struct Object *ob, bool *r_is_manifold);
139 struct GPUBatch *DRW_cache_mesh_surface_get(struct Object *ob);
142  struct GPUMaterial **gpumat_array,
143  uint gpumat_array_len);
151 
152 /* Curve */
153 struct GPUBatch *DRW_cache_curve_surface_get(struct Object *ob);
155  struct GPUMaterial **gpumat_array,
156  uint gpumat_array_len);
158 struct GPUBatch *DRW_cache_curve_edge_wire_get(struct Object *ob);
160 struct GPUBatch *DRW_cache_curve_edge_detection_get(struct Object *ob, bool *r_is_manifold);
161 /* edit-mode */
165 
166 /* Font */
167 struct GPUBatch *DRW_cache_text_surface_get(struct Object *ob);
168 struct GPUBatch *DRW_cache_text_edge_detection_get(struct Object *ob, bool *r_is_manifold);
170 struct GPUBatch *DRW_cache_text_edge_wire_get(struct Object *ob);
172  struct GPUMaterial **gpumat_array,
173  uint gpumat_array_len);
175 
176 /* Surface */
177 struct GPUBatch *DRW_cache_surf_surface_get(struct Object *ob);
178 struct GPUBatch *DRW_cache_surf_edge_wire_get(struct Object *ob);
181  struct GPUMaterial **gpumat_array,
182  uint gpumat_array_len);
184 struct GPUBatch *DRW_cache_surf_edge_detection_get(struct Object *ob, bool *r_is_manifold);
185 
186 /* Lattice */
187 struct GPUBatch *DRW_cache_lattice_verts_get(struct Object *ob);
188 struct GPUBatch *DRW_cache_lattice_wire_get(struct Object *ob, bool use_weight);
190 
191 /* Particles */
192 struct GPUBatch *DRW_cache_particles_get_hair(struct Object *object,
193  struct ParticleSystem *psys,
194  struct ModifierData *md);
195 struct GPUBatch *DRW_cache_particles_get_dots(struct Object *object, struct ParticleSystem *psys);
197  struct ParticleSystem *psys,
198  struct PTCacheEdit *edit,
199  bool use_weight);
201  struct ParticleSystem *psys,
202  struct PTCacheEdit *edit);
204  struct ParticleSystem *psys,
205  struct PTCacheEdit *edit);
207 
208 /* Metaball */
209 struct GPUBatch *DRW_cache_mball_surface_get(struct Object *ob);
211  struct GPUMaterial **gpumat_array,
212  uint gpumat_array_len);
214 struct GPUBatch *DRW_cache_mball_edge_detection_get(struct Object *ob, bool *r_is_manifold);
215 
216 /* Hair */
219  struct GPUMaterial **gpumat_array,
220  uint gpumat_array_len);
222 struct GPUBatch *DRW_cache_hair_edge_detection_get(struct Object *ob, bool *r_is_manifold);
223 
224 /* PointCloud */
225 struct GPUBatch *DRW_cache_pointcloud_get_dots(struct Object *obj);
227 
228 /* Volume */
229 typedef struct DRWVolumeGrid {
231 
232  /* Grid name. */
233  char *name;
234 
235  /* 3D texture. */
237 
238  /* Transform between 0..1 texture space and object space. */
239  float texture_to_object[4][4];
240  float object_to_texture[4][4];
241 
242  /* Transform from bounds to texture space. */
243  float object_to_bounds[4][4];
244  float bounds_to_texture[4][4];
246 
248  const struct VolumeGrid *grid);
251 
252 /* GPencil */
253 struct GPUBatch *DRW_cache_gpencil_strokes_get(struct Object *ob, int cfra);
254 struct GPUBatch *DRW_cache_gpencil_fills_get(struct Object *ob, int cfra);
255 struct GPUBatch *DRW_cache_gpencil_edit_lines_get(struct Object *ob, int cfra);
256 struct GPUBatch *DRW_cache_gpencil_edit_points_get(struct Object *ob, int cfra);
257 struct GPUBatch *DRW_cache_gpencil_edit_curve_handles_get(struct Object *ob, int cfra);
258 struct GPUBatch *DRW_cache_gpencil_edit_curve_points_get(struct Object *ob, int cfra);
261 
263 
265 void DRW_cache_gpencil_sbuffer_clear(struct Object *ob);
unsigned int uint
Definition: BLI_sys_types.h:83
GPUBatch
Definition: GPU_batch.h:93
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
struct GPUTexture GPUTexture
Definition: GPU_texture.h:33
struct GPUVertBuf GPUVertBuf
struct GPUBatch * DRW_cache_surf_surface_get(struct Object *ob)
Definition: draw_cache.c:3174
struct GPUBatch * DRW_cache_object_loose_edges_get(struct Object *ob)
Definition: draw_cache.c:862
struct GPUBatch * DRW_cache_field_vortex_get(void)
Definition: draw_cache.c:1306
struct GPUBatch * DRW_cache_bone_arrows_get(void)
Definition: draw_cache.c:2519
struct GPUBatch * DRW_cache_gpencil_strokes_get(struct Object *ob, int cfra)
struct GPUBatch ** DRW_cache_text_surface_shaded_get(struct Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len)
Definition: draw_cache.c:3151
struct GPUBatch ** DRW_cache_hair_surface_shaded_get(struct Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len)
struct GPUBatch * DRW_cache_mesh_surface_mesh_analysis_get(struct Object *ob)
Definition: draw_cache.c:2917
struct GPUBatch * DRW_cache_mesh_surface_edges_get(struct Object *ob)
Definition: draw_cache.c:2865
struct GPUBatch * DRW_cache_hair_face_wireframe_get(struct Object *ob)
struct GPUBatch * DRW_cache_mesh_surface_get(struct Object *ob)
Definition: draw_cache.c:2859
struct GPUBatch * DRW_cache_mesh_surface_weights_get(struct Object *ob)
Definition: draw_cache.c:2905
struct GPUBatch * DRW_cache_object_edge_detection_get(struct Object *ob, bool *r_is_manifold)
Definition: draw_cache.c:811
struct GPUBatch * DRW_cache_empty_cylinder_get(void)
Definition: draw_cache.c:1129
struct GPUBatch * DRW_cache_camera_volume_wire_get(void)
Definition: draw_cache.c:2735
struct GPUBatch * DRW_cache_light_point_lines_get(void)
Definition: draw_cache.c:1497
struct GPUBatch ** DRW_cache_mball_surface_shaded_get(struct Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len)
Definition: draw_cache.c:3059
struct GPUBatch * DRW_cache_bone_box_wire_get(void)
Definition: draw_cache.c:2124
struct GPUBatch * DRW_cache_light_area_square_lines_get(void)
Definition: draw_cache.c:1660
struct GPUBatch * DRW_gpencil_dummy_buffer_get(void)
Definition: draw_cache.c:779
struct GPUBatch * DRW_cache_mball_face_wireframe_get(struct Object *ob)
Definition: draw_cache.c:3053
struct GPUBatch * DRW_cache_empty_capsule_body_get(void)
Definition: draw_cache.c:1170
struct GPUBatch * DRW_cache_curve_edge_normal_get(struct Object *ob)
Definition: draw_cache.c:2942
struct GPUBatch * DRW_cache_field_cone_limit_get(void)
Definition: draw_cache.c:1390
struct GPUBatch * DRW_cache_object_surface_get(struct Object *ob)
Definition: draw_cache.c:886
struct GPUBatch * DRW_cache_object_face_wireframe_get(struct Object *ob)
Definition: draw_cache.c:835
struct GPUBatch * DRW_cache_field_curve_get(void)
Definition: draw_cache.c:1336
struct GPUBatch * DRW_cache_camera_tria_wire_get(void)
Definition: draw_cache.c:2759
struct GPUBatch * DRW_cache_mesh_edge_detection_get(struct Object *ob, bool *r_is_manifold)
Definition: draw_cache.c:2853
struct GPUBatch * DRW_cache_volume_face_wireframe_get(struct Object *ob)
Definition: draw_cache.c:3314
struct GPUBatch * DRW_cache_text_surface_get(struct Object *ob)
Definition: draw_cache.c:3091
struct GPUBatch * DRW_cache_curve_edge_overlay_get(struct Object *ob)
Definition: draw_cache.c:2950
struct GPUBatch * DRW_cache_mball_surface_get(struct Object *ob)
Definition: draw_cache.c:3041
struct GPUBatch * DRW_cache_camera_distances_get(void)
Definition: draw_cache.c:2803
struct bGPDstroke * DRW_cache_gpencil_sbuffer_stroke_data_get(struct Object *ob)
struct GPUBatch * DRW_cache_sphere_get(const eDRWLevelOfDetail level_of_detail)
Definition: draw_cache.c:487
struct GPUBatch * DRW_cache_speaker_get(void)
Definition: draw_cache.c:1709
struct GPUBatch * DRW_cache_mball_edge_detection_get(struct Object *ob, bool *r_is_manifold)
Definition: draw_cache.c:3047
struct GPUBatch * DRW_cache_bone_dof_lines_get(void)
Definition: draw_cache.c:2638
struct GPUBatch * DRW_cache_bone_stick_get(void)
Definition: draw_cache.c:2376
struct GPUBatch * DRW_cache_bone_octahedral_wire_get(void)
Definition: draw_cache.c:2066
struct GPUBatch * DRW_cache_gpencil_face_wireframe_get(struct Object *ob)
struct GPUBatch * DRW_cache_bone_point_get(void)
Definition: draw_cache.c:2253
struct GPUBatch * DRW_cache_surf_edge_wire_get(struct Object *ob)
Definition: draw_cache.c:3187
struct GPUBatch * DRW_cache_bone_dof_sphere_get(void)
Definition: draw_cache.c:2585
struct GPUBatch * DRW_cache_text_face_wireframe_get(struct Object *ob)
Definition: draw_cache.c:3136
struct GPUBatch * DRW_cache_bone_point_wire_outline_get(void)
Definition: draw_cache.c:2328
struct GPUBatch * DRW_cache_cursor_get(bool crosshair_lines)
Definition: draw_cache.c:3438
struct GPUBatch * DRW_cache_mesh_all_verts_get(struct Object *ob)
Definition: draw_cache.c:2835
struct GPUBatch ** DRW_cache_object_surface_material_get(struct Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len)
Definition: draw_cache.c:969
eDRWLevelOfDetail
Definition: draw_cache.h:36
@ DRW_LOD_MEDIUM
Definition: draw_cache.h:38
@ DRW_LOD_LOW
Definition: draw_cache.h:37
@ DRW_LOD_HIGH
Definition: draw_cache.h:39
@ DRW_LOD_MAX
Definition: draw_cache.h:41
struct GPUBatch * DRW_cache_text_edge_detection_get(struct Object *ob, bool *r_is_manifold)
Definition: draw_cache.c:3106
struct GPUBatch * DRW_cache_field_sphere_limit_get(void)
Definition: draw_cache.c:1425
struct GPUBatch * DRW_cache_lightprobe_cube_get(void)
Definition: draw_cache.c:1774
struct GPUBatch * DRW_cache_lattice_vert_overlay_get(struct Object *ob)
Definition: draw_cache.c:3284
struct GPUBatch ** DRW_cache_mesh_surface_texpaint_get(struct Object *ob)
Definition: draw_cache.c:2881
struct GPUBatch * DRW_cache_curve_face_wireframe_get(struct Object *ob)
Definition: draw_cache.c:2994
struct GPUBatch * DRW_cache_grid_get(void)
Definition: draw_cache.c:434
struct GPUBatch * DRW_cache_volume_selection_surface_get(struct Object *ob)
Definition: draw_cache.c:3320
struct GPUBatch * DRW_cache_object_all_edges_get(struct Object *ob)
Definition: draw_cache.c:799
struct GPUBatch * DRW_cache_empty_cone_get(void)
Definition: draw_cache.c:1090
struct GPUBatch * DRW_cache_curve_loose_edges_get(struct Object *ob)
Definition: draw_cache.c:2979
struct GPUBatch * DRW_cache_groundline_get(void)
Definition: draw_cache.c:1476
struct GPUBatch * DRW_cache_lattice_verts_get(struct Object *ob)
Definition: draw_cache.c:3262
struct GPUBatch * DRW_cache_mesh_face_wireframe_get(struct Object *ob)
Definition: draw_cache.c:2911
struct GPUVertBuf * DRW_cache_object_pos_vertbuf_get(struct Object *ob)
Definition: draw_cache.c:911
struct GPUBatch * DRW_cache_hair_edge_detection_get(struct Object *ob, bool *r_is_manifold)
struct GPUBatch * DRW_cache_curve_edge_detection_get(struct Object *ob, bool *r_is_manifold)
Definition: draw_cache.c:3007
struct GPUBatch * DRW_cache_particles_get_hair(struct Object *object, struct ParticleSystem *psys, struct ModifierData *md)
Definition: draw_cache.c:3332
struct GPUBatch * DRW_cache_gpencil_sbuffer_fill_get(struct Object *ob)
struct GPUBatch * DRW_cache_particles_get_edit_strands(struct Object *object, struct ParticleSystem *psys, struct PTCacheEdit *edit, bool use_weight)
Definition: draw_cache.c:3342
struct GPUBatch * DRW_cache_circle_get(void)
Definition: draw_cache.c:733
struct GPUBatch * DRW_cache_mesh_loose_edges_get(struct Object *ob)
Definition: draw_cache.c:2847
struct GPUBatch * DRW_cache_bone_octahedral_get(void)
Definition: draw_cache.c:2030
struct GPUBatch * DRW_cache_normal_arrow_get(void)
Definition: draw_cache.c:756
struct GPUBatch * DRW_cache_gpencil_edit_lines_get(struct Object *ob, int cfra)
struct GPUBatch * DRW_cache_quad_get(void)
Definition: draw_cache.c:392
struct GPUBatch * DRW_cache_text_loose_edges_get(struct Object *ob)
Definition: draw_cache.c:3121
struct GPUBatch * DRW_cache_particles_get_prim(int type)
Definition: draw_cache.c:3364
struct GPUBatch * DRW_cache_empty_capsule_cap_get(void)
Definition: draw_cache.c:1203
struct GPUBatch * DRW_cache_lattice_wire_get(struct Object *ob, bool use_weight)
Definition: draw_cache.c:3270
struct GPUBatch * DRW_cache_fullscreen_quad_get(void)
Definition: draw_cache.c:358
struct GPUBatch ** DRW_cache_surf_surface_shaded_get(struct Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len)
Definition: draw_cache.c:3241
struct GPUBatch * DRW_cache_single_arrow_get(void)
Definition: draw_cache.c:1043
void DRW_shape_cache_free(void)
Definition: draw_cache.c:156
struct DRWVolumeGrid DRWVolumeGrid
struct GPUBatch * DRW_cache_lightprobe_grid_get(void)
Definition: draw_cache.c:1828
struct GPUBatch * DRW_cache_gpencil_edit_curve_points_get(struct Object *ob, int cfra)
struct GPUBatch * DRW_cache_surf_edge_detection_get(struct Object *ob, bool *r_is_manifold)
Definition: draw_cache.c:3213
struct GPUBatch * DRW_cache_mesh_surface_vertpaint_get(struct Object *ob)
Definition: draw_cache.c:2893
struct GPUBatch * DRW_cache_quad_wires_get(void)
Definition: draw_cache.c:413
struct GPUBatch ** DRW_cache_mesh_surface_shaded_get(struct Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len)
Definition: draw_cache.c:2872
struct GPUBatch * DRW_cache_gpencil_edit_curve_handles_get(struct Object *ob, int cfra)
struct GPUBatch * DRW_cache_curve_edge_wire_get(struct Object *ob)
Definition: draw_cache.c:2929
struct GPUBatch * DRW_cache_empty_sphere_get(void)
Definition: draw_cache.c:1081
struct GPUBatch * DRW_cache_particles_get_edit_inner_points(struct Object *object, struct ParticleSystem *psys, struct PTCacheEdit *edit)
Definition: draw_cache.c:3350
DRWVolumeGrid * DRW_volume_batch_cache_get_grid(struct Volume *volume, const struct VolumeGrid *grid)
struct GPUBatch * DRW_cache_curve_surface_get(struct Object *ob)
Definition: draw_cache.c:2966
struct GPUBatch * DRW_cache_camera_tria_get(void)
Definition: draw_cache.c:2783
struct GPUBatch * DRW_cache_light_area_disk_lines_get(void)
Definition: draw_cache.c:1628
struct GPUBatch * DRW_cache_bone_envelope_outline_get(void)
Definition: draw_cache.c:2208
struct GPUBatch * DRW_cache_surf_loose_edges_get(struct Object *ob)
Definition: draw_cache.c:3225
struct GPUBatch * DRW_cache_empty_cube_get(void)
Definition: draw_cache.c:1023
struct GPUBatch * DRW_cache_gpencil_fills_get(struct Object *ob, int cfra)
struct GPUBatch * DRW_cache_light_spot_volume_get(void)
Definition: draw_cache.c:1601
struct GPUBatch * DRW_cache_surf_face_wireframe_get(struct Object *ob)
Definition: draw_cache.c:3200
struct GPUBatch * DRW_cache_light_sun_lines_get(void)
Definition: draw_cache.c:1521
struct GPUBatch * DRW_cache_bone_envelope_solid_get(void)
Definition: draw_cache.c:2158
struct GPUBatch * DRW_cache_mesh_surface_texpaint_single_get(struct Object *ob)
Definition: draw_cache.c:2887
struct GPUBatch * DRW_cache_camera_volume_get(void)
Definition: draw_cache.c:2710
struct GPUBatch * DRW_cache_pointcloud_surface_get(struct Object *obj)
Definition: draw_cache.c:3304
struct GPUBatch * DRW_cache_particles_get_dots(struct Object *object, struct ParticleSystem *psys)
Definition: draw_cache.c:3337
struct GPUBatch * DRW_cache_lightprobe_planar_get(void)
Definition: draw_cache.c:1890
struct GPUBatch * DRW_cache_pointcloud_get_dots(struct Object *obj)
Definition: draw_cache.c:3298
struct GPUBatch * DRW_cache_cube_get(void)
Definition: draw_cache.c:700
int DRW_cache_object_material_count_get(struct Object *ob)
Definition: draw_cache.c:936
struct GPUBatch ** DRW_cache_curve_surface_shaded_get(struct Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len)
Definition: draw_cache.c:3020
struct GPUBatch * DRW_cache_gpencil_edit_points_get(struct Object *ob, int cfra)
struct GPUBatch * DRW_cache_particles_get_edit_tip_points(struct Object *object, struct ParticleSystem *psys, struct PTCacheEdit *edit)
Definition: draw_cache.c:3357
struct GPUBatch * DRW_cache_mesh_surface_sculptcolors_get(struct Object *ob)
Definition: draw_cache.c:2899
struct GPUBatch * DRW_cache_hair_surface_get(struct Object *ob)
void DRW_cache_gpencil_sbuffer_clear(struct Object *ob)
struct GPUBatch * DRW_cache_text_edge_wire_get(struct Object *ob)
Definition: draw_cache.c:3074
struct GPUBatch * DRW_cache_curve_vert_overlay_get(struct Object *ob)
Definition: draw_cache.c:2958
struct GPUBatch * DRW_cache_field_wind_get(void)
Definition: draw_cache.c:1260
struct GPUBatch * DRW_cache_mesh_all_edges_get(struct Object *ob)
Definition: draw_cache.c:2841
struct GPUBatch * DRW_cache_plain_axes_get(void)
Definition: draw_cache.c:1001
struct GPUBatch * DRW_cache_bone_box_get(void)
Definition: draw_cache.c:2091
struct GPUBatch * DRW_cache_camera_frame_get(void)
Definition: draw_cache.c:2678
struct GPUBatch * DRW_cache_field_tube_limit_get(void)
Definition: draw_cache.c:1356
struct GPUBatch * DRW_cache_gpencil_sbuffer_stroke_get(struct Object *ob)
struct GPUBatch * DRW_cache_field_force_get(void)
Definition: draw_cache.c:1283
struct GPUBatch * DRW_cache_light_spot_lines_get(void)
Definition: draw_cache.c:1555
float texture_to_object[4][4]
Definition: draw_cache.h:239
float bounds_to_texture[4][4]
Definition: draw_cache.h:244
struct DRWVolumeGrid * prev
Definition: draw_cache.h:230
float object_to_bounds[4][4]
Definition: draw_cache.h:243
struct DRWVolumeGrid * next
Definition: draw_cache.h:230
struct GPUTexture * texture
Definition: draw_cache.h:236
float object_to_texture[4][4]
Definition: draw_cache.h:240