2017-04-21 21:14:11 +10:00
|
|
|
/*
|
|
|
|
* Copyright 2016, Blender Foundation.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Institute
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file draw_cache_impl.h
|
|
|
|
* \ingroup draw
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DRAW_CACHE_IMPL_H__
|
|
|
|
#define __DRAW_CACHE_IMPL_H__
|
|
|
|
|
2017-11-17 19:02:38 +11:00
|
|
|
struct CurveCache;
|
2017-06-28 13:38:24 +10:00
|
|
|
struct GPUMaterial;
|
2018-05-31 18:43:19 +02:00
|
|
|
struct GPUTexture;
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch;
|
|
|
|
struct GPUIndexBuf;
|
|
|
|
struct GPUVertBuf;
|
2017-04-21 21:14:11 +10:00
|
|
|
struct ListBase;
|
2017-06-22 19:19:55 +02:00
|
|
|
struct ModifierData;
|
2017-11-17 19:02:38 +11:00
|
|
|
struct ParticleSystem;
|
2018-05-09 11:14:27 +02:00
|
|
|
struct PTCacheEdit;
|
2018-09-29 19:42:09 +02:00
|
|
|
struct SpaceImage;
|
2018-12-22 21:00:23 +01:00
|
|
|
struct ToolSettings;
|
2017-04-21 21:14:11 +10:00
|
|
|
|
|
|
|
struct Curve;
|
|
|
|
struct Lattice;
|
|
|
|
struct Mesh;
|
2017-12-14 12:21:38 -02:00
|
|
|
struct MetaBall;
|
2018-07-31 10:22:19 +02:00
|
|
|
struct bGPdata;
|
2017-04-21 21:14:11 +10:00
|
|
|
|
|
|
|
/* Expose via BKE callbacks */
|
2018-08-23 10:14:29 -03:00
|
|
|
void DRW_mball_batch_cache_dirty_tag(struct MetaBall *mb, int mode);
|
2017-11-16 15:12:32 -02:00
|
|
|
void DRW_mball_batch_cache_free(struct MetaBall *mb);
|
|
|
|
|
2018-08-23 10:14:29 -03:00
|
|
|
void DRW_curve_batch_cache_dirty_tag(struct Curve *cu, int mode);
|
2017-04-21 21:14:11 +10:00
|
|
|
void DRW_curve_batch_cache_free(struct Curve *cu);
|
|
|
|
|
2018-08-23 10:14:29 -03:00
|
|
|
void DRW_mesh_batch_cache_dirty_tag(struct Mesh *me, int mode);
|
2017-04-21 21:14:11 +10:00
|
|
|
void DRW_mesh_batch_cache_free(struct Mesh *me);
|
|
|
|
|
2018-08-23 10:14:29 -03:00
|
|
|
void DRW_lattice_batch_cache_dirty_tag(struct Lattice *lt, int mode);
|
2017-04-21 21:14:11 +10:00
|
|
|
void DRW_lattice_batch_cache_free(struct Lattice *lt);
|
|
|
|
|
2018-08-23 10:14:29 -03:00
|
|
|
void DRW_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode);
|
2017-05-09 16:23:47 +02:00
|
|
|
void DRW_particle_batch_cache_free(struct ParticleSystem *psys);
|
|
|
|
|
2018-08-23 10:14:29 -03:00
|
|
|
void DRW_gpencil_batch_cache_dirty_tag(struct bGPdata *gpd);
|
2018-07-31 10:22:19 +02:00
|
|
|
void DRW_gpencil_batch_cache_free(struct bGPdata *gpd);
|
|
|
|
|
2017-04-21 21:14:11 +10:00
|
|
|
/* Curve */
|
2018-12-13 01:26:07 +01:00
|
|
|
void DRW_curve_batch_cache_create_requested(struct Object *ob);
|
|
|
|
|
|
|
|
struct GPUBatch *DRW_curve_batch_cache_get_wire_edge(struct Curve *cu);
|
|
|
|
struct GPUBatch *DRW_curve_batch_cache_get_normal_edge(struct Curve *cu);
|
2018-12-10 15:29:04 +01:00
|
|
|
struct GPUBatch *DRW_curve_batch_cache_get_edit_edges(struct Curve *cu);
|
|
|
|
struct GPUBatch *DRW_curve_batch_cache_get_edit_verts(struct Curve *cu, bool handles);
|
2017-04-21 21:14:11 +10:00
|
|
|
|
2018-12-13 01:26:07 +01:00
|
|
|
struct GPUBatch *DRW_curve_batch_cache_get_triangles_with_normals(struct Curve *cu);
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch **DRW_curve_batch_cache_get_surface_shaded(
|
2018-12-13 01:26:07 +01:00
|
|
|
struct Curve *cu, struct GPUMaterial **gpumat_array, uint gpumat_array_len);
|
|
|
|
struct GPUBatch *DRW_curve_batch_cache_get_wireframes_face(struct Curve *cu);
|
2017-04-21 21:14:11 +10:00
|
|
|
|
2017-11-16 15:12:32 -02:00
|
|
|
/* Metaball */
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_metaball_batch_cache_get_triangles_with_normals(struct Object *ob);
|
2018-12-21 10:46:26 +11:00
|
|
|
struct GPUBatch **DRW_metaball_batch_cache_get_surface_shaded(
|
|
|
|
struct Object *ob, struct MetaBall *mb, struct GPUMaterial **gpumat_array, uint gpumat_array_len);
|
2018-12-07 05:03:01 +01:00
|
|
|
struct GPUBatch *DRW_metaball_batch_cache_get_wireframes_face(struct Object *ob);
|
2017-11-16 15:12:32 -02:00
|
|
|
|
2017-04-21 21:14:11 +10:00
|
|
|
/* DispList */
|
2018-12-14 00:42:16 +01:00
|
|
|
void DRW_displist_vertbuf_create_pos_and_nor(struct ListBase *lb, struct GPUVertBuf *vbo);
|
|
|
|
void DRW_displist_vertbuf_create_pos_and_nor_and_uv_tess(
|
|
|
|
struct ListBase *lb, struct GPUVertBuf *vbo_pos_nor, struct GPUVertBuf *vbo_uv);
|
|
|
|
void DRW_displist_vertbuf_create_wireframe_data_tess(struct ListBase *lb, struct GPUVertBuf *vbo);
|
|
|
|
void DRW_displist_indexbuf_create_triangles_in_order(struct ListBase *lb, struct GPUIndexBuf *vbo);
|
|
|
|
void DRW_displist_indexbuf_create_triangles_tess_split_by_material(
|
|
|
|
struct ListBase *lb, struct GPUIndexBuf **ibo_mat, uint mat_len);
|
2017-04-21 21:14:11 +10:00
|
|
|
|
|
|
|
/* Lattice */
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_lattice_batch_cache_get_all_edges(struct Lattice *lt, bool use_weight, const int actdef);
|
|
|
|
struct GPUBatch *DRW_lattice_batch_cache_get_all_verts(struct Lattice *lt);
|
2018-12-10 15:29:04 +01:00
|
|
|
struct GPUBatch *DRW_lattice_batch_cache_get_edit_verts(struct Lattice *lt);
|
2017-04-21 21:14:11 +10:00
|
|
|
|
2018-09-23 20:41:10 +03:00
|
|
|
/* Mesh */
|
2018-12-22 21:00:23 +01:00
|
|
|
void DRW_mesh_batch_cache_create_requested(
|
|
|
|
struct Object *ob, struct Mesh *me,
|
|
|
|
const struct ToolSettings *ts, const bool is_paint_mode, const bool use_hide);
|
2018-12-08 20:10:20 +01:00
|
|
|
|
2018-12-18 17:10:38 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_all_verts(struct Mesh *me);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_all_edges(struct Mesh *me);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_loose_edges(struct Mesh *me);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edge_detection(struct Mesh *me, bool *r_is_manifold);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_surface(struct Mesh *me);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_surface_edges(struct Mesh *me);
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch **DRW_mesh_batch_cache_get_surface_shaded(
|
2018-12-16 15:17:31 +01:00
|
|
|
struct Mesh *me, struct GPUMaterial **gpumat_array, uint gpumat_array_len,
|
2018-05-02 15:36:09 +02:00
|
|
|
char **auto_layer_names, int **auto_layer_is_srgb, int *auto_layer_count);
|
2018-12-16 15:17:31 +01:00
|
|
|
struct GPUBatch **DRW_mesh_batch_cache_get_surface_texpaint(struct Mesh *me);
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_surface_texpaint_single(struct Mesh *me);
|
2018-12-18 02:18:55 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_surface_vertpaint(struct Mesh *me);
|
2018-12-18 17:10:38 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_surface_weights(struct Mesh *me);
|
|
|
|
/* edit-mesh drawing */
|
2018-12-10 15:29:04 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_triangles(struct Mesh *me);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_triangles_nor(struct Mesh *me);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_triangles_lnor(struct Mesh *me);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_vertices(struct Mesh *me);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_loose_edges(struct Mesh *me);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_loose_edges_nor(struct Mesh *me);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_loose_verts(struct Mesh *me);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_facedots(struct Mesh *me);
|
2018-12-18 17:10:38 +01:00
|
|
|
/* edit-mesh selection */
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me, bool use_hide, uint select_id_offset);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_triangles_with_select_mask(struct Mesh *me, bool use_hide);
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_facedots_with_select_id(struct Mesh *me, uint select_id_offset);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edges_with_select_id(struct Mesh *me, uint select_id_offset);
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_verts_with_select_id(struct Mesh *me, uint select_id_offset);
|
2018-05-31 18:43:19 +02:00
|
|
|
/* Object mode Wireframe overlays */
|
2018-12-07 05:03:01 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_wireframes_face(struct Mesh *me);
|
2017-04-21 21:14:11 +10:00
|
|
|
|
2017-07-13 00:27:06 +10:00
|
|
|
void DRW_mesh_cache_sculpt_coords_ensure(struct Mesh *me);
|
|
|
|
|
2018-09-29 19:42:09 +02:00
|
|
|
enum {
|
|
|
|
UVEDIT_EDGES = (1 << 0),
|
|
|
|
UVEDIT_DATA = (1 << 1),
|
|
|
|
UVEDIT_FACEDOTS = (1 << 2),
|
|
|
|
UVEDIT_FACES = (1 << 3),
|
|
|
|
UVEDIT_STRETCH_ANGLE = (1 << 4),
|
|
|
|
UVEDIT_STRETCH_AREA = (1 << 5),
|
|
|
|
UVEDIT_SYNC_SEL = (1 << 6),
|
|
|
|
};
|
|
|
|
|
2018-10-01 14:55:35 +02:00
|
|
|
/* For Image UV editor. */
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_texpaint_loop_wire(struct Mesh *me);
|
2018-09-29 19:42:09 +02:00
|
|
|
void DRW_mesh_cache_uvedit(
|
|
|
|
struct Object *me, struct SpaceImage *sima, struct Scene *scene, uchar state,
|
|
|
|
struct GPUBatch **faces, struct GPUBatch **edges, struct GPUBatch **verts, struct GPUBatch **facedots);
|
|
|
|
|
2018-09-05 17:02:00 +02:00
|
|
|
/* Edit mesh bitflags (is this the right place?) */
|
|
|
|
|
|
|
|
enum {
|
|
|
|
VFLAG_VERTEX_ACTIVE = 1 << 0,
|
|
|
|
VFLAG_VERTEX_SELECTED = 1 << 1,
|
2018-10-11 13:45:50 +11:00
|
|
|
VFLAG_VERTEX_EXISTS = 1 << 2,
|
|
|
|
VFLAG_FACE_ACTIVE = 1 << 3,
|
|
|
|
VFLAG_FACE_SELECTED = 1 << 4,
|
|
|
|
VFLAG_FACE_FREESTYLE = 1 << 5,
|
2018-09-05 17:02:00 +02:00
|
|
|
/* Beware to not go over 1 << 7 (it's a byte flag)
|
|
|
|
* (see gpu_shader_edit_mesh_overlay_geom.glsl) */
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
VFLAG_EDGE_EXISTS = 1 << 0,
|
|
|
|
VFLAG_EDGE_ACTIVE = 1 << 1,
|
|
|
|
VFLAG_EDGE_SELECTED = 1 << 2,
|
|
|
|
VFLAG_EDGE_SEAM = 1 << 3,
|
|
|
|
VFLAG_EDGE_SHARP = 1 << 4,
|
|
|
|
VFLAG_EDGE_FREESTYLE = 1 << 5,
|
|
|
|
/* Beware to not go over 1 << 7 (it's a byte flag)
|
|
|
|
* (see gpu_shader_edit_mesh_overlay_geom.glsl) */
|
|
|
|
};
|
|
|
|
|
2017-05-09 16:23:47 +02:00
|
|
|
/* Particles */
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_particles_batch_cache_get_hair(
|
2018-05-26 10:41:25 +02:00
|
|
|
struct Object *object, struct ParticleSystem *psys, struct ModifierData *md);
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_particles_batch_cache_get_dots(
|
2018-05-26 10:41:25 +02:00
|
|
|
struct Object *object, struct ParticleSystem *psys);
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_particles_batch_cache_get_edit_strands(
|
2018-11-27 13:49:00 +01:00
|
|
|
struct Object *object, struct ParticleSystem *psys, struct PTCacheEdit *edit, bool use_weight);
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_particles_batch_cache_get_edit_inner_points(
|
2018-05-26 10:41:25 +02:00
|
|
|
struct Object *object, struct ParticleSystem *psys, struct PTCacheEdit *edit);
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_particles_batch_cache_get_edit_tip_points(
|
2018-05-26 10:41:25 +02:00
|
|
|
struct Object *object, struct ParticleSystem *psys, struct PTCacheEdit *edit);
|
2017-05-09 16:23:47 +02:00
|
|
|
|
2018-12-08 20:10:20 +01:00
|
|
|
/* Common */
|
2018-12-21 10:46:26 +11:00
|
|
|
#define DRW_ADD_FLAG_FROM_VBO_REQUEST(flag, vbo, value) (flag |= DRW_vbo_requested(vbo) ? (value) : 0)
|
|
|
|
#define DRW_ADD_FLAG_FROM_IBO_REQUEST(flag, ibo, value) (flag |= DRW_ibo_requested(ibo) ? (value) : 0)
|
2018-12-08 20:10:20 +01:00
|
|
|
|
2018-12-13 01:26:07 +01:00
|
|
|
/* Test and assign NULL if test fails */
|
2018-12-21 10:46:26 +11:00
|
|
|
#define DRW_TEST_ASSIGN_VBO(v) (v = (DRW_vbo_requested(v) ? (v) : NULL))
|
|
|
|
#define DRW_TEST_ASSIGN_IBO(v) (v = (DRW_ibo_requested(v) ? (v) : NULL))
|
2018-12-13 01:26:07 +01:00
|
|
|
|
2018-12-08 20:10:20 +01:00
|
|
|
struct GPUBatch *DRW_batch_request(struct GPUBatch **batch);
|
|
|
|
bool DRW_batch_requested(struct GPUBatch *batch, int prim_type);
|
|
|
|
void DRW_ibo_request(struct GPUBatch *batch, struct GPUIndexBuf **ibo);
|
|
|
|
bool DRW_ibo_requested(struct GPUIndexBuf *ibo);
|
|
|
|
void DRW_vbo_request(struct GPUBatch *batch, struct GPUVertBuf **vbo);
|
|
|
|
bool DRW_vbo_requested(struct GPUVertBuf *vbo);
|
|
|
|
|
2017-04-21 21:14:11 +10:00
|
|
|
#endif /* __DRAW_CACHE_IMPL_H__ */
|