Cleanup: move draw-cache creation from BKE to DRW

Creating draw-cache should only ever be used by the draw-manager.
This commit is contained in:
Campbell Barton 2017-04-21 21:14:11 +10:00
parent c7f00feaba
commit bfa888cef2
24 changed files with 346 additions and 318 deletions

View File

@ -219,4 +219,12 @@ void BKE_curve_eval_geometry(struct EvaluationContext *eval_ctx,
void BKE_curve_eval_path(struct EvaluationContext *eval_ctx,
struct Curve *curve);
/* Draw Cache */
enum {
BKE_CURVE_BATCH_DIRTY_ALL = 0,
BKE_CURVE_BATCH_DIRTY_SELECT,
};
void BKE_curve_batch_cache_dirty(struct Curve *cu, int mode);
void BKE_curve_batch_cache_free(struct Curve *cu);
#endif /* __BKE_CURVE_H__ */

View File

@ -1,46 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_CURVE_RENDER_H__
#define __BKE_CURVE_RENDER_H__
/** \file BKE_curve_render.h
* \ingroup bke
*/
struct Batch;
struct Curve;
void BKE_curve_batch_cache_dirty(struct Curve *cu);
void BKE_curve_batch_selection_dirty(struct Curve *cu);
void BKE_curve_batch_cache_clear(struct Curve *cu);
void BKE_curve_batch_cache_free(struct Curve *cu);
struct Batch *BKE_curve_batch_cache_get_wire_edge(struct Curve *cu, struct CurveCache *ob_curve_cache);
struct Batch *BKE_curve_batch_cache_get_normal_edge(
struct Curve *cu, struct CurveCache *ob_curve_cache, float normal_size);
struct Batch *BKE_curve_batch_cache_get_overlay_edges(struct Curve *cu);
struct Batch *BKE_curve_batch_cache_get_overlay_verts(struct Curve *cu);
struct Batch *BKE_curve_batch_cache_get_triangles_with_normals(struct Curve *cu, struct CurveCache *ob_curve_cache);
/* OB_FONT */
struct Batch *BKE_curve_batch_cache_get_overlay_cursor(struct Curve *cu);
struct Batch *BKE_curve_batch_cache_get_overlay_select(struct Curve *cu);
#endif /* __BKE_CURVE_RENDER_H__ */

View File

@ -1,33 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_DISPLIST_RENDER_H__
#define __BKE_DISPLIST_RENDER_H__
/** \file BKE_displist_render.h
* \ingroup bke
*/
struct Batch;
struct ListBase;
struct VertexBuffer;
struct Batch *BLI_displist_batch_calc_surface(struct ListBase *lb);
#endif /* __BKE_DISPLIST_RENDER_H__ */

View File

@ -103,4 +103,12 @@ struct EvaluationContext;
void BKE_lattice_eval_geometry(struct EvaluationContext *eval_ctx,
struct Lattice *latt);
/* Draw Cache */
enum {
BKE_LATTICE_BATCH_DIRTY_ALL = 0,
BKE_LATTICE_BATCH_DIRTY_SELECT,
};
void BKE_lattice_batch_cache_dirty(struct Lattice *lt, int mode);
void BKE_lattice_batch_cache_free(struct Lattice *lt);
#endif /* __BKE_LATTICE_H__ */

View File

@ -1,38 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_LATTICE_RENDER_H__
#define __BKE_LATTICE_RENDER_H__
/** \file BKE_lattice_render.h
* \ingroup bke
*/
struct Batch;
struct Lattice;
void BKE_lattice_batch_cache_dirty(struct Lattice *lt);
void BKE_lattice_batch_selection_dirty(struct Lattice *lt);
void BKE_lattice_batch_cache_clear(struct Lattice *lt);
void BKE_lattice_batch_cache_free(struct Lattice *lt);
struct Batch *BKE_lattice_batch_cache_get_all_edges(struct Lattice *lt);
struct Batch *BKE_lattice_batch_cache_get_all_verts(struct Lattice *lt);
struct Batch *BKE_lattice_batch_cache_get_overlay_verts(struct Lattice *lt);
#endif /* __BKE_LATTICE_RENDER_H__ */

View File

@ -407,6 +407,14 @@ struct EvaluationContext;
void BKE_mesh_eval_geometry(struct EvaluationContext *eval_ctx,
struct Mesh *mesh);
/* Draw Cache */
enum {
BKE_MESH_BATCH_DIRTY_ALL = 0,
BKE_MESH_BATCH_DIRTY_SELECT,
};
void BKE_mesh_batch_cache_dirty(struct Mesh *me, int mode);
void BKE_mesh_batch_cache_free(struct Mesh *me);
#ifdef __cplusplus
}
#endif

View File

@ -1,50 +0,0 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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.
*
* The Original Code is Copyright (C) 2017 by Blender Foundation.
* All rights reserved.
*
* Contributor(s): Blender Foundation, Mike Erwin, Dalai Felinto
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __BKE_MESH_RENDER_H__
#define __BKE_MESH_RENDER_H__
/** \file BKE_mesh_render.h
* \ingroup bke
*/
struct Batch;
struct Mesh;
void BKE_mesh_batch_cache_dirty(struct Mesh *me);
void BKE_mesh_batch_selection_dirty(struct Mesh *me);
void BKE_mesh_batch_cache_clear(struct Mesh *me);
void BKE_mesh_batch_cache_free(struct Mesh *me);
struct Batch *BKE_mesh_batch_cache_get_all_edges(struct Mesh *me);
struct Batch *BKE_mesh_batch_cache_get_all_triangles(struct Mesh *me);
struct Batch *BKE_mesh_batch_cache_get_triangles_with_normals(struct Mesh *me);
struct Batch *BKE_mesh_batch_cache_get_points_with_normals(struct Mesh *me);
struct Batch *BKE_mesh_batch_cache_get_all_verts(struct Mesh *me);
struct Batch *BKE_mesh_batch_cache_get_fancy_edges(struct Mesh *me);
struct Batch *BKE_mesh_batch_cache_get_overlay_triangles(struct Mesh *me);
struct Batch *BKE_mesh_batch_cache_get_overlay_loose_edges(struct Mesh *me);
struct Batch *BKE_mesh_batch_cache_get_overlay_loose_verts(struct Mesh *me);
struct Batch *BKE_mesh_batch_cache_get_overlay_facedots(struct Mesh *me);
#endif /* __BKE_MESH_RENDER_H__ */

View File

@ -93,14 +93,12 @@ set(SRC
intern/context.c
intern/crazyspace.c
intern/curve.c
intern/curve_render.c
intern/customdata.c
intern/customdata_file.c
intern/data_transfer.c
intern/deform.c
intern/depsgraph.c
intern/displist.c
intern/displist_render.c
intern/dynamicpaint.c
intern/editderivedmesh.c
intern/editmesh.c
@ -122,7 +120,6 @@ set(SRC
intern/key.c
intern/lamp.c
intern/lattice.c
intern/lattice_render.c
intern/library.c
intern/library_idmap.c
intern/library_query.c
@ -138,7 +135,6 @@ set(SRC
intern/mesh_evaluate.c
intern/mesh_mapping.c
intern/mesh_remap.c
intern/mesh_render.c
intern/mesh_validate.c
intern/modifier.c
intern/modifiers_bmesh.c
@ -227,14 +223,12 @@ set(SRC
BKE_context.h
BKE_crazyspace.h
BKE_curve.h
BKE_curve_render.h
BKE_customdata.h
BKE_customdata_file.h
BKE_data_transfer.h
BKE_deform.h
BKE_depsgraph.h
BKE_displist.h
BKE_displist_render.h
BKE_dynamicpaint.h
BKE_editmesh.h
BKE_editmesh_bvh.h
@ -254,7 +248,6 @@ set(SRC
BKE_key.h
BKE_lamp.h
BKE_lattice.h
BKE_lattice_render.h
BKE_library.h
BKE_library_idmap.h
BKE_library_query.h
@ -268,7 +261,6 @@ set(SRC
BKE_mesh.h
BKE_mesh_mapping.h
BKE_mesh_remap.h
BKE_mesh_render.h
BKE_modifier.h
BKE_movieclip.h
BKE_multires.h

View File

@ -52,7 +52,6 @@
#include "BKE_animsys.h"
#include "BKE_curve.h"
#include "BKE_curve_render.h"
#include "BKE_displist.h"
#include "BKE_font.h"
#include "BKE_global.h"
@ -4660,3 +4659,20 @@ void BKE_curve_eval_path(EvaluationContext *UNUSED(eval_ctx),
printf("%s on %s\n", __func__, curve->id.name);
}
}
/* Draw Engine */
void (*BKE_curve_batch_cache_dirty_cb)(Curve *cu, int mode) = NULL;
void (*BKE_curve_batch_cache_free_cb)(Curve *cu) = NULL;
void BKE_curve_batch_cache_dirty(Curve *cu, int mode)
{
if (cu->batch_cache) {
BKE_curve_batch_cache_dirty_cb(cu, mode);
}
}
void BKE_curve_batch_cache_free(Curve *cu)
{
if (cu->batch_cache) {
BKE_curve_batch_cache_free_cb(cu);
}
}

View File

@ -57,7 +57,6 @@
#include "BKE_global.h"
#include "BKE_key.h"
#include "BKE_lattice.h"
#include "BKE_lattice_render.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_library_remap.h"
@ -1234,3 +1233,19 @@ void BKE_lattice_eval_geometry(struct EvaluationContext *UNUSED(eval_ctx),
{
}
/* Draw Engine */
void (*BKE_lattice_batch_cache_dirty_cb)(Lattice *lt, int mode) = NULL;
void (*BKE_lattice_batch_cache_free_cb)(Lattice *lt) = NULL;
void BKE_lattice_batch_cache_dirty(Lattice *lt, int mode)
{
if (lt->batch_cache) {
BKE_lattice_batch_cache_dirty_cb(lt, mode);
}
}
void BKE_lattice_batch_cache_free(Lattice *lt)
{
if (lt->batch_cache) {
BKE_lattice_batch_cache_free_cb(lt);
}
}

View File

@ -50,7 +50,6 @@
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_mesh_render.h"
#include "BKE_displist.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
@ -2679,3 +2678,20 @@ void BKE_mesh_eval_geometry(EvaluationContext *UNUSED(eval_ctx),
BKE_mesh_texspace_calc(mesh);
}
}
/* Draw Engine */
void (*BKE_mesh_batch_cache_dirty_cb)(Mesh *me, int mode) = NULL;
void (*BKE_mesh_batch_cache_free_cb)(Mesh *me) = NULL;
void BKE_mesh_batch_cache_dirty(Mesh *me, int mode)
{
if (me->batch_cache) {
BKE_mesh_batch_cache_dirty_cb(me, mode);
}
}
void BKE_mesh_batch_cache_free(Mesh *me)
{
if (me->batch_cache) {
BKE_mesh_batch_cache_free_cb(me);
}
}

View File

@ -43,6 +43,7 @@
#include "BKE_armature.h"
#include "BKE_action.h"
#include "BKE_constraint.h"
#include "BKE_curve.h"
#include "BKE_DerivedMesh.h"
#include "BKE_animsys.h"
#include "BKE_displist.h"
@ -56,12 +57,9 @@
#include "BKE_pointcache.h"
#include "BKE_scene.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
#include "BKE_image.h"
#include "BKE_curve_render.h"
#include "BKE_lattice_render.h"
#include "BKE_mesh_render.h"
#include "DEG_depsgraph.h"
#define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH) printf
@ -347,15 +345,15 @@ void BKE_object_eval_uber_data(EvaluationContext *eval_ctx,
switch (ob->type) {
case OB_MESH:
BKE_mesh_batch_cache_dirty(ob->data);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
break;
case OB_LATTICE:
BKE_lattice_batch_cache_dirty(ob->data);
BKE_lattice_batch_cache_dirty(ob->data, BKE_LATTICE_BATCH_DIRTY_ALL);
break;
case OB_CURVE:
case OB_FONT:
case OB_SURF:
BKE_curve_batch_cache_dirty(ob->data);
BKE_curve_batch_cache_dirty(ob->data, BKE_CURVE_BATCH_DIRTY_ALL);
break;
}

View File

@ -34,13 +34,14 @@ set(INC
../blenkernel
../blenlib
../blentranslation
../imbuf
../bmesh
../depsgraph
../makesdna
../makesrna
../gpu
../editors/include
../editors/space_view3d
../gpu
../imbuf
../makesdna
../makesrna
../render/extern/include
../render/intern/include
../windowmanager
@ -60,6 +61,11 @@ set(SRC
intern/draw_view.c
intern/draw_armature.c
intern/draw_cache_impl_curve.c
intern/draw_cache_impl_displist.c
intern/draw_cache_impl_lattice.c
intern/draw_cache_impl_mesh.c
engines/clay/clay.c
engines/clay/clay.h
@ -87,6 +93,7 @@ set(SRC
intern/DRW_render.h
intern/draw_common.h
intern/draw_cache.h
intern/draw_cache_impl.h
intern/draw_view.h
modes/draw_mode_engines.h

View File

@ -32,13 +32,10 @@
#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BKE_curve_render.h"
#include "BKE_lattice_render.h"
#include "BKE_mesh_render.h"
#include "GPU_batch.h"
#include "draw_cache.h"
#include "draw_cache_impl.h"
static struct DRWShapeCache {
Batch *drw_single_vertice;
@ -1544,6 +1541,13 @@ Batch *DRW_cache_single_vert_get(void)
/** \name Meshes
* \{ */
Batch *DRW_cache_mesh_surface_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
Mesh *me = ob->data;
return DRW_mesh_batch_cache_get_all_triangles(me);
}
void DRW_cache_mesh_wire_overlay_get(
Object *ob,
Batch **r_tris, Batch **r_ledges, Batch **r_lverts)
@ -1552,9 +1556,9 @@ void DRW_cache_mesh_wire_overlay_get(
Mesh *me = ob->data;
*r_tris = BKE_mesh_batch_cache_get_overlay_triangles(me);
*r_ledges = BKE_mesh_batch_cache_get_overlay_loose_edges(me);
*r_lverts = BKE_mesh_batch_cache_get_overlay_loose_verts(me);
*r_tris = DRW_mesh_batch_cache_get_overlay_triangles(me);
*r_ledges = DRW_mesh_batch_cache_get_overlay_loose_edges(me);
*r_lverts = DRW_mesh_batch_cache_get_overlay_loose_verts(me);
}
Batch *DRW_cache_face_centers_get(Object *ob)
@ -1563,7 +1567,7 @@ Batch *DRW_cache_face_centers_get(Object *ob)
Mesh *me = ob->data;
return BKE_mesh_batch_cache_get_overlay_facedots(me);
return DRW_mesh_batch_cache_get_overlay_facedots(me);
}
Batch *DRW_cache_mesh_wire_outline_get(Object *ob)
@ -1571,7 +1575,7 @@ Batch *DRW_cache_mesh_wire_outline_get(Object *ob)
BLI_assert(ob->type == OB_MESH);
Mesh *me = ob->data;
return BKE_mesh_batch_cache_get_fancy_edges(me);
return DRW_mesh_batch_cache_get_fancy_edges(me);
}
Batch *DRW_cache_mesh_surface_get(Object *ob)
@ -1579,7 +1583,7 @@ Batch *DRW_cache_mesh_surface_get(Object *ob)
BLI_assert(ob->type == OB_MESH);
Mesh *me = ob->data;
return BKE_mesh_batch_cache_get_triangles_with_normals(me);
return DRW_mesh_batch_cache_get_triangles_with_normals(me);
}
Batch *DRW_cache_mesh_surface_verts_get(Object *ob)
@ -1587,7 +1591,7 @@ Batch *DRW_cache_mesh_surface_verts_get(Object *ob)
BLI_assert(ob->type == OB_MESH);
Mesh *me = ob->data;
return BKE_mesh_batch_cache_get_points_with_normals(me);
return DRW_mesh_batch_cache_get_points_with_normals(me);
}
Batch *DRW_cache_mesh_verts_get(Object *ob)
@ -1595,7 +1599,7 @@ Batch *DRW_cache_mesh_verts_get(Object *ob)
BLI_assert(ob->type == OB_MESH);
Mesh *me = ob->data;
return BKE_mesh_batch_cache_get_all_verts(me);
return DRW_mesh_batch_cache_get_all_verts(me);
}
/** \} */
@ -1610,7 +1614,7 @@ Batch *DRW_cache_curve_edge_wire_get(Object *ob)
BLI_assert(ob->type == OB_CURVE);
struct Curve *cu = ob->data;
return BKE_curve_batch_cache_get_wire_edge(cu, ob->curve_cache);
return DRW_curve_batch_cache_get_wire_edge(cu, ob->curve_cache);
}
Batch *DRW_cache_curve_edge_normal_get(Object *ob, float normal_size)
@ -1618,7 +1622,7 @@ Batch *DRW_cache_curve_edge_normal_get(Object *ob, float normal_size)
BLI_assert(ob->type == OB_CURVE);
struct Curve *cu = ob->data;
return BKE_curve_batch_cache_get_normal_edge(cu, ob->curve_cache, normal_size);
return DRW_curve_batch_cache_get_normal_edge(cu, ob->curve_cache, normal_size);
}
Batch *DRW_cache_curve_edge_overlay_get(Object *ob)
@ -1626,7 +1630,7 @@ Batch *DRW_cache_curve_edge_overlay_get(Object *ob)
BLI_assert(ob->type == OB_CURVE);
struct Curve *cu = ob->data;
return BKE_curve_batch_cache_get_overlay_edges(cu);
return DRW_curve_batch_cache_get_overlay_edges(cu);
}
Batch *DRW_cache_curve_vert_overlay_get(Object *ob)
@ -1634,7 +1638,7 @@ Batch *DRW_cache_curve_vert_overlay_get(Object *ob)
BLI_assert(ob->type == OB_CURVE);
struct Curve *cu = ob->data;
return BKE_curve_batch_cache_get_overlay_verts(cu);
return DRW_curve_batch_cache_get_overlay_verts(cu);
}
Batch *DRW_cache_curve_surface_get(Object *ob)
@ -1642,7 +1646,7 @@ Batch *DRW_cache_curve_surface_get(Object *ob)
BLI_assert(ob->type == OB_CURVE);
struct Curve *cu = ob->data;
return BKE_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache);
return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache);
}
/** \} */
@ -1657,7 +1661,7 @@ Batch *DRW_cache_text_edge_wire_get(Object *ob)
BLI_assert(ob->type == OB_FONT);
struct Curve *cu = ob->data;
return BKE_curve_batch_cache_get_wire_edge(cu, ob->curve_cache);
return DRW_curve_batch_cache_get_wire_edge(cu, ob->curve_cache);
}
Batch *DRW_cache_text_surface_get(Object *ob)
@ -1667,21 +1671,21 @@ Batch *DRW_cache_text_surface_get(Object *ob)
if (cu->editfont && (cu->flag & CU_FAST)) {
return NULL;
}
return BKE_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache);
return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache);
}
Batch *DRW_cache_text_cursor_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_FONT);
struct Curve *cu = ob->data;
return BKE_curve_batch_cache_get_overlay_cursor(cu);
return DRW_curve_batch_cache_get_overlay_cursor(cu);
}
Batch *DRW_cache_text_select_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_FONT);
struct Curve *cu = ob->data;
return BKE_curve_batch_cache_get_overlay_select(cu);
return DRW_curve_batch_cache_get_overlay_select(cu);
}
/** \} */
@ -1696,7 +1700,7 @@ Batch *DRW_cache_surf_surface_get(Object *ob)
BLI_assert(ob->type == OB_SURF);
struct Curve *cu = ob->data;
return BKE_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache);
return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache);
}
/** \} */
@ -1711,7 +1715,7 @@ Batch *DRW_cache_lattice_verts_get(Object *ob)
BLI_assert(ob->type == OB_LATTICE);
struct Lattice *lt = ob->data;
return BKE_lattice_batch_cache_get_all_verts(lt);
return DRW_lattice_batch_cache_get_all_verts(lt);
}
Batch *DRW_cache_lattice_wire_get(Object *ob)
@ -1719,7 +1723,7 @@ Batch *DRW_cache_lattice_wire_get(Object *ob)
BLI_assert(ob->type == OB_LATTICE);
struct Lattice *lt = ob->data;
return BKE_lattice_batch_cache_get_all_edges(lt);
return DRW_lattice_batch_cache_get_all_edges(lt);
}
Batch *DRW_cache_lattice_vert_overlay_get(Object *ob)
@ -1727,7 +1731,7 @@ Batch *DRW_cache_lattice_vert_overlay_get(Object *ob)
BLI_assert(ob->type == OB_LATTICE);
struct Lattice *lt = ob->data;
return BKE_lattice_batch_cache_get_overlay_verts(lt);
return DRW_lattice_batch_cache_get_overlay_verts(lt);
}
/** \} */

View File

@ -82,6 +82,7 @@ struct Batch *DRW_cache_bone_point_wire_outline_get(void);
struct Batch *DRW_cache_bone_arrows_get(void);
/* Meshes */
struct Batch *DRW_cache_mesh_surface_overlay_get(struct Object *ob);
void DRW_cache_mesh_wire_overlay_get(
struct Object *ob,
struct Batch **r_tris, struct Batch **r_ledges, struct Batch **r_lverts);
@ -91,6 +92,7 @@ struct Batch *DRW_cache_mesh_surface_get(struct Object *ob);
struct Batch *DRW_cache_mesh_surface_verts_get(struct Object *ob);
struct Batch *DRW_cache_mesh_verts_get(struct Object *ob);
/* Curve */
struct Batch *DRW_cache_curve_surface_get(struct Object *ob);
struct Batch *DRW_cache_curve_surface_verts_get(struct Object *ob);

View File

@ -0,0 +1,81 @@
/*
* 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__
struct Batch;
struct ListBase;
struct CurveCache;
struct Curve;
struct Lattice;
struct Mesh;
/* Expose via BKE callbacks */
void DRW_curve_batch_cache_dirty(struct Curve *cu, int mode);
void DRW_curve_batch_cache_free(struct Curve *cu);
void DRW_mesh_batch_cache_dirty(struct Mesh *me, int mode);
void DRW_mesh_batch_cache_free(struct Mesh *me);
void DRW_lattice_batch_cache_dirty(struct Lattice *lt, int mode);
void DRW_lattice_batch_cache_free(struct Lattice *lt);
/* Curve */
struct Batch *DRW_curve_batch_cache_get_wire_edge(struct Curve *cu, struct CurveCache *ob_curve_cache);
struct Batch *DRW_curve_batch_cache_get_normal_edge(
struct Curve *cu, struct CurveCache *ob_curve_cache, float normal_size);
struct Batch *DRW_curve_batch_cache_get_overlay_edges(struct Curve *cu);
struct Batch *DRW_curve_batch_cache_get_overlay_verts(struct Curve *cu);
struct Batch *DRW_curve_batch_cache_get_triangles_with_normals(struct Curve *cu, struct CurveCache *ob_curve_cache);
/* Curve (Font) */
struct Batch *DRW_curve_batch_cache_get_overlay_cursor(struct Curve *cu);
struct Batch *DRW_curve_batch_cache_get_overlay_select(struct Curve *cu);
/* DispList */
struct Batch *BLI_displist_batch_calc_surface(struct ListBase *lb);
/* Lattice */
struct Batch *DRW_lattice_batch_cache_get_all_edges(struct Lattice *lt);
struct Batch *DRW_lattice_batch_cache_get_all_verts(struct Lattice *lt);
struct Batch *DRW_lattice_batch_cache_get_overlay_verts(struct Lattice *lt);
/* Mesh */
struct Batch *DRW_mesh_batch_cache_get_all_edges(struct Mesh *me);
struct Batch *DRW_mesh_batch_cache_get_all_triangles(struct Mesh *me);
struct Batch *DRW_mesh_batch_cache_get_triangles_with_normals(struct Mesh *me);
struct Batch *DRW_mesh_batch_cache_get_points_with_normals(struct Mesh *me);
struct Batch *DRW_mesh_batch_cache_get_all_verts(struct Mesh *me);
struct Batch *DRW_mesh_batch_cache_get_fancy_edges(struct Mesh *me);
struct Batch *DRW_mesh_batch_cache_get_overlay_triangles(struct Mesh *me);
struct Batch *DRW_mesh_batch_cache_get_overlay_loose_edges(struct Mesh *me);
struct Batch *DRW_mesh_batch_cache_get_overlay_loose_verts(struct Mesh *me);
struct Batch *DRW_mesh_batch_cache_get_overlay_facedots(struct Mesh *me);
#endif /* __DRAW_CACHE_IMPL_H__ */

View File

@ -21,8 +21,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/blenkernel/intern/curve_render.c
* \ingroup bke
/** \file draw_cache_impl_curve.c
* \ingroup draw
*
* \brief Curve API for render engines
*/
@ -35,13 +35,13 @@
#include "DNA_curve_types.h"
#include "BKE_curve.h"
#include "BKE_curve_render.h"
#include "BKE_font.h"
#include "BKE_displist_render.h"
#include "GPU_batch.h"
#include "draw_cache_impl.h" /* own include */
#define SELECT 1
/**
@ -51,6 +51,8 @@
* - Check if 'overlay.edges' can use single attribyte per edge, not 2 (for selection drawing).
*/
static void curve_batch_cache_clear(Curve *cu);
/* ---------------------------------------------------------------------- */
/* Curve Interface, direct access to basic data. */
@ -402,35 +404,37 @@ static void curve_batch_cache_init(Curve *cu)
static CurveBatchCache *curve_batch_cache_get(Curve *cu)
{
if (!curve_batch_cache_valid(cu)) {
BKE_curve_batch_cache_clear(cu);
curve_batch_cache_clear(cu);
curve_batch_cache_init(cu);
}
return cu->batch_cache;
}
void BKE_curve_batch_cache_dirty(Curve *cu)
void DRW_curve_batch_cache_dirty(Curve *cu, int mode)
{
CurveBatchCache *cache = cu->batch_cache;
if (cache) {
cache->is_dirty = true;
if (cache == NULL) {
return;
}
switch (mode) {
case BKE_CURVE_BATCH_DIRTY_ALL:
cache->is_dirty = true;
break;
case BKE_CURVE_BATCH_DIRTY_SELECT:
/* editnurb */
BATCH_DISCARD_ALL_SAFE(cache->overlay.verts);
BATCH_DISCARD_ALL_SAFE(cache->overlay.edges);
/* editfont */
BATCH_DISCARD_ALL_SAFE(cache->text.select);
BATCH_DISCARD_ALL_SAFE(cache->text.cursor);
break;
default:
BLI_assert(0);
}
}
void BKE_curve_batch_selection_dirty(Curve *cu)
{
CurveBatchCache *cache = cu->batch_cache;
if (cache) {
/* editnurb */
BATCH_DISCARD_ALL_SAFE(cache->overlay.verts);
BATCH_DISCARD_ALL_SAFE(cache->overlay.edges);
/* editfont */
BATCH_DISCARD_ALL_SAFE(cache->text.select);
BATCH_DISCARD_ALL_SAFE(cache->text.cursor);
}
}
void BKE_curve_batch_cache_clear(Curve *cu)
static void curve_batch_cache_clear(Curve *cu)
{
CurveBatchCache *cache = cu->batch_cache;
if (!cache) {
@ -471,9 +475,9 @@ void BKE_curve_batch_cache_clear(Curve *cu)
BATCH_DISCARD_ALL_SAFE(cache->text.select);
}
void BKE_curve_batch_cache_free(Curve *cu)
void DRW_curve_batch_cache_free(Curve *cu)
{
BKE_curve_batch_cache_clear(cu);
curve_batch_cache_clear(cu);
MEM_SAFE_FREE(cu->batch_cache);
}
@ -921,7 +925,7 @@ static Batch *curve_batch_cache_get_overlay_cursor(CurveRenderData *rdata, Curve
/** \name Public Object/Curve API
* \{ */
Batch *BKE_curve_batch_cache_get_wire_edge(Curve *cu, CurveCache *ob_curve_cache)
Batch *DRW_curve_batch_cache_get_wire_edge(Curve *cu, CurveCache *ob_curve_cache)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@ -939,7 +943,7 @@ Batch *BKE_curve_batch_cache_get_wire_edge(Curve *cu, CurveCache *ob_curve_cache
return cache->wire.batch;
}
Batch *BKE_curve_batch_cache_get_normal_edge(Curve *cu, CurveCache *ob_curve_cache, float normal_size)
Batch *DRW_curve_batch_cache_get_normal_edge(Curve *cu, CurveCache *ob_curve_cache, float normal_size)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@ -966,7 +970,7 @@ Batch *BKE_curve_batch_cache_get_normal_edge(Curve *cu, CurveCache *ob_curve_cac
return cache->normal.batch;
}
Batch *BKE_curve_batch_cache_get_overlay_edges(Curve *cu)
Batch *DRW_curve_batch_cache_get_overlay_edges(Curve *cu)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@ -977,7 +981,7 @@ Batch *BKE_curve_batch_cache_get_overlay_edges(Curve *cu)
return cache->overlay.edges;
}
Batch *BKE_curve_batch_cache_get_overlay_verts(Curve *cu)
Batch *DRW_curve_batch_cache_get_overlay_verts(Curve *cu)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@ -988,7 +992,7 @@ Batch *BKE_curve_batch_cache_get_overlay_verts(Curve *cu)
return cache->overlay.verts;
}
Batch *BKE_curve_batch_cache_get_triangles_with_normals(
Batch *DRW_curve_batch_cache_get_triangles_with_normals(
struct Curve *cu, struct CurveCache *ob_curve_cache)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@ -1010,7 +1014,7 @@ Batch *BKE_curve_batch_cache_get_triangles_with_normals(
/** \name Public Object/Font API
* \{ */
Batch *BKE_curve_batch_cache_get_overlay_select(Curve *cu)
Batch *DRW_curve_batch_cache_get_overlay_select(Curve *cu)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@ -1025,7 +1029,7 @@ Batch *BKE_curve_batch_cache_get_overlay_select(Curve *cu)
return cache->text.select;
}
Batch *BKE_curve_batch_cache_get_overlay_cursor(Curve *cu)
Batch *DRW_curve_batch_cache_get_overlay_cursor(Curve *cu)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);

View File

@ -21,8 +21,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/blenkernel/intern/displist_render.c
* \ingroup bke
/** \file draw_cache_impl_displist.c
* \ingroup draw
*
* \brief DispList API for render engines
*
@ -37,10 +37,11 @@
#include "DNA_curve_types.h"
#include "BKE_displist.h"
#include "BKE_displist_render.h"
#include "GPU_batch.h"
#include "draw_cache_impl.h" /* own include */
static int dl_vert_len(const DispList *dl)
{
switch (dl->type) {

View File

@ -23,8 +23,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/blenkernel/intern/lattice_render.c
* \ingroup bke
/** \file draw_cache_impl_lattice.c
* \ingroup draw
*
* \brief Lattice API for render engines
*/
@ -37,10 +37,12 @@
#include "DNA_curve_types.h"
#include "DNA_lattice_types.h"
#include "BKE_lattice_render.h"
#include "BKE_lattice.h"
#include "GPU_batch.h"
#include "draw_cache_impl.h" /* own include */
#define SELECT 1
/**
@ -49,6 +51,8 @@
* (we could avoid using since it will be removed)
*/
static void lattice_batch_cache_clear(Lattice *lt);
/* ---------------------------------------------------------------------- */
/* Lattice Interface, direct access to basic data. */
@ -290,30 +294,32 @@ static void lattice_batch_cache_init(Lattice *lt)
static LatticeBatchCache *lattice_batch_cache_get(Lattice *lt)
{
if (!lattice_batch_cache_valid(lt)) {
BKE_lattice_batch_cache_clear(lt);
lattice_batch_cache_clear(lt);
lattice_batch_cache_init(lt);
}
return lt->batch_cache;
}
void BKE_lattice_batch_cache_dirty(Lattice *lt)
void DRW_lattice_batch_cache_dirty(Lattice *lt, int mode)
{
LatticeBatchCache *cache = lt->batch_cache;
if (cache) {
cache->is_dirty = true;
if (cache == NULL) {
return;
}
switch (mode) {
case BKE_LATTICE_BATCH_DIRTY_ALL:
cache->is_dirty = true;
break;
case BKE_LATTICE_BATCH_DIRTY_SELECT:
/* TODO Separate Flag vbo */
BATCH_DISCARD_ALL_SAFE(cache->overlay_verts);
break;
default:
BLI_assert(0);
}
}
void BKE_lattice_batch_selection_dirty(Lattice *lt)
{
LatticeBatchCache *cache = lt->batch_cache;
if (cache) {
/* TODO Separate Flag vbo */
BATCH_DISCARD_ALL_SAFE(cache->overlay_verts);
}
}
void BKE_lattice_batch_cache_clear(Lattice *lt)
static void lattice_batch_cache_clear(Lattice *lt)
{
LatticeBatchCache *cache = lt->batch_cache;
if (!cache) {
@ -328,9 +334,9 @@ void BKE_lattice_batch_cache_clear(Lattice *lt)
ELEMENTLIST_DISCARD_SAFE(cache->edges);
}
void BKE_lattice_batch_cache_free(Lattice *lt)
void DRW_lattice_batch_cache_free(Lattice *lt)
{
BKE_lattice_batch_cache_clear(lt);
lattice_batch_cache_clear(lt);
MEM_SAFE_FREE(lt->batch_cache);
}
@ -460,7 +466,7 @@ static void lattice_batch_cache_create_overlay_batches(Lattice *lt)
lattice_render_data_free(rdata);
}
Batch *BKE_lattice_batch_cache_get_all_edges(Lattice *lt)
Batch *DRW_lattice_batch_cache_get_all_edges(Lattice *lt)
{
LatticeBatchCache *cache = lattice_batch_cache_get(lt);
@ -477,7 +483,7 @@ Batch *BKE_lattice_batch_cache_get_all_edges(Lattice *lt)
return cache->all_edges;
}
Batch *BKE_lattice_batch_cache_get_all_verts(Lattice *lt)
Batch *DRW_lattice_batch_cache_get_all_verts(Lattice *lt)
{
LatticeBatchCache *cache = lattice_batch_cache_get(lt);
@ -492,7 +498,7 @@ Batch *BKE_lattice_batch_cache_get_all_verts(Lattice *lt)
return cache->all_verts;
}
Batch *BKE_lattice_batch_cache_get_overlay_verts(Lattice *lt)
Batch *DRW_lattice_batch_cache_get_overlay_verts(Lattice *lt)
{
LatticeBatchCache *cache = lattice_batch_cache_get(lt);

View File

@ -23,8 +23,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/blenkernel/intern/mesh_render.c
* \ingroup bke
/** \file draw_cache_impl_mesh.c
* \ingroup draw
*
* \brief Mesh API for render engines
*/
@ -41,12 +41,15 @@
#include "BKE_DerivedMesh.h"
#include "BKE_editmesh.h"
#include "BKE_mesh.h"
#include "BKE_mesh_render.h"
#include "bmesh.h"
#include "GPU_batch.h"
#include "draw_cache_impl.h" /* own include */
static void mesh_batch_cache_clear(Mesh *me);
/* ---------------------------------------------------------------------- */
/* Mesh/BMesh Interface, direct access to basic data. */
@ -927,33 +930,35 @@ static void mesh_batch_cache_init(Mesh *me)
static MeshBatchCache *mesh_batch_cache_get(Mesh *me)
{
if (!mesh_batch_cache_valid(me)) {
BKE_mesh_batch_cache_clear(me);
mesh_batch_cache_clear(me);
mesh_batch_cache_init(me);
}
return me->batch_cache;
}
void BKE_mesh_batch_cache_dirty(Mesh *me)
void DRW_mesh_batch_cache_dirty(Mesh *me, int mode)
{
MeshBatchCache *cache = me->batch_cache;
if (cache) {
cache->is_dirty = true;
if (cache == NULL) {
return;
}
switch (mode) {
case BKE_MESH_BATCH_DIRTY_ALL:
cache->is_dirty = true;
break;
case BKE_MESH_BATCH_DIRTY_SELECT:
/* TODO Separate Flag vbo */
BATCH_DISCARD_ALL_SAFE(cache->overlay_triangles);
BATCH_DISCARD_ALL_SAFE(cache->overlay_loose_verts);
BATCH_DISCARD_ALL_SAFE(cache->overlay_loose_edges);
BATCH_DISCARD_ALL_SAFE(cache->overlay_facedots);
break;
default:
BLI_assert(0);
}
}
void BKE_mesh_batch_selection_dirty(Mesh *me)
{
MeshBatchCache *cache = me->batch_cache;
if (cache) {
/* TODO Separate Flag vbo */
BATCH_DISCARD_ALL_SAFE(cache->overlay_triangles);
BATCH_DISCARD_ALL_SAFE(cache->overlay_loose_verts);
BATCH_DISCARD_ALL_SAFE(cache->overlay_loose_edges);
BATCH_DISCARD_ALL_SAFE(cache->overlay_facedots);
}
}
void BKE_mesh_batch_cache_clear(Mesh *me)
static void mesh_batch_cache_clear(Mesh *me)
{
MeshBatchCache *cache = me->batch_cache;
if (!cache) {
@ -980,9 +985,9 @@ void BKE_mesh_batch_cache_clear(Mesh *me)
BATCH_DISCARD_ALL_SAFE(cache->fancy_edges);
}
void BKE_mesh_batch_cache_free(Mesh *me)
void DRW_mesh_batch_cache_free(Mesh *me)
{
BKE_mesh_batch_cache_clear(me);
mesh_batch_cache_clear(me);
MEM_SAFE_FREE(me->batch_cache);
}
@ -1113,7 +1118,7 @@ static ElementList *mesh_batch_cache_get_triangles_in_order(MeshRenderData *rdat
return cache->triangles_in_order;
}
Batch *BKE_mesh_batch_cache_get_all_edges(Mesh *me)
Batch *DRW_mesh_batch_cache_get_all_edges(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@ -1130,7 +1135,7 @@ Batch *BKE_mesh_batch_cache_get_all_edges(Mesh *me)
return cache->all_edges;
}
Batch *BKE_mesh_batch_cache_get_all_triangles(Mesh *me)
Batch *DRW_mesh_batch_cache_get_all_triangles(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@ -1147,7 +1152,7 @@ Batch *BKE_mesh_batch_cache_get_all_triangles(Mesh *me)
return cache->all_triangles;
}
Batch *BKE_mesh_batch_cache_get_triangles_with_normals(Mesh *me)
Batch *DRW_mesh_batch_cache_get_triangles_with_normals(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@ -1162,7 +1167,7 @@ Batch *BKE_mesh_batch_cache_get_triangles_with_normals(Mesh *me)
return cache->triangles_with_normals;
}
Batch *BKE_mesh_batch_cache_get_points_with_normals(Mesh *me)
Batch *DRW_mesh_batch_cache_get_points_with_normals(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@ -1177,7 +1182,7 @@ Batch *BKE_mesh_batch_cache_get_points_with_normals(Mesh *me)
return cache->points_with_normals;
}
Batch *BKE_mesh_batch_cache_get_all_verts(Mesh *me)
Batch *DRW_mesh_batch_cache_get_all_verts(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@ -1193,7 +1198,7 @@ Batch *BKE_mesh_batch_cache_get_all_verts(Mesh *me)
return cache->all_verts;
}
Batch *BKE_mesh_batch_cache_get_fancy_edges(Mesh *me)
Batch *DRW_mesh_batch_cache_get_fancy_edges(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@ -1349,7 +1354,7 @@ static void mesh_batch_cache_create_overlay_batches(Mesh *me)
mesh_render_data_free(rdata);
}
Batch *BKE_mesh_batch_cache_get_overlay_triangles(Mesh *me)
Batch *DRW_mesh_batch_cache_get_overlay_triangles(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@ -1360,7 +1365,7 @@ Batch *BKE_mesh_batch_cache_get_overlay_triangles(Mesh *me)
return cache->overlay_triangles;
}
Batch *BKE_mesh_batch_cache_get_overlay_loose_edges(Mesh *me)
Batch *DRW_mesh_batch_cache_get_overlay_loose_edges(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@ -1371,7 +1376,7 @@ Batch *BKE_mesh_batch_cache_get_overlay_loose_edges(Mesh *me)
return cache->overlay_loose_edges;
}
Batch *BKE_mesh_batch_cache_get_overlay_loose_verts(Mesh *me)
Batch *DRW_mesh_batch_cache_get_overlay_loose_verts(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@ -1382,7 +1387,7 @@ Batch *BKE_mesh_batch_cache_get_overlay_loose_verts(Mesh *me)
return cache->overlay_loose_verts;
}
Batch *BKE_mesh_batch_cache_get_overlay_facedots(Mesh *me)
Batch *DRW_mesh_batch_cache_get_overlay_facedots(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);

View File

@ -64,6 +64,9 @@
#include "UI_resources.h"
/* only for callbacks */
#include "draw_cache_impl.h"
#include "draw_mode_engines.h"
#include "clay.h"
#include "eevee.h"
@ -1919,6 +1922,28 @@ void DRW_engines_register(void)
DRW_engine_register(&draw_engine_pose_type);
DRW_engine_register(&draw_engine_sculpt_type);
#endif
/* setup callbacks */
{
/* BKE: curve.c */
extern void *BKE_curve_batch_cache_dirty_cb;
extern void *BKE_curve_batch_cache_free_cb;
/* BKE: mesh.c */
extern void *BKE_mesh_batch_cache_dirty_cb;
extern void *BKE_mesh_batch_cache_free_cb;
/* BKE: lattice.c */
extern void *BKE_lattice_batch_cache_dirty_cb;
extern void *BKE_lattice_batch_cache_free_cb;
BKE_curve_batch_cache_dirty_cb = DRW_curve_batch_cache_dirty;
BKE_curve_batch_cache_free_cb = DRW_curve_batch_cache_free;
BKE_mesh_batch_cache_dirty_cb = DRW_mesh_batch_cache_dirty;
BKE_mesh_batch_cache_free_cb = DRW_mesh_batch_cache_free;
BKE_lattice_batch_cache_dirty_cb = DRW_lattice_batch_cache_dirty;
BKE_lattice_batch_cache_free_cb = DRW_lattice_batch_cache_free;
}
}
extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */

View File

@ -49,7 +49,6 @@
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_curve_render.h"
#include "BKE_depsgraph.h"
#include "BKE_font.h"
#include "BKE_library.h"
@ -274,7 +273,7 @@ static void text_update_edited(bContext *C, Object *obedit, int mode)
}
}
BKE_curve_batch_selection_dirty(cu);
BKE_curve_batch_cache_dirty(cu, BKE_CURVE_BATCH_DIRTY_SELECT);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
}

View File

@ -65,7 +65,6 @@
#include "BKE_lattice.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_mesh_render.h"
#include "BKE_material.h"
#include "BKE_mball.h"
#include "BKE_modifier.h"
@ -110,6 +109,8 @@
#include "view3d_intern.h" /* bad level include */
#include "../../draw/intern/draw_cache_impl.h" /* bad level include (temporary) */
/* prototypes */
static void imm_draw_box(const float vec[8][3], bool solid, unsigned pos);
@ -4111,7 +4112,7 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D
Object *UNUSED(ob), Mesh *me, BMEditMesh *UNUSED(em), DerivedMesh *UNUSED(cageDM), DerivedMesh *UNUSED(finalDM), const char UNUSED(dt))
{
/* for now... something simple! */
Batch *surface = BKE_mesh_batch_cache_get_all_triangles(me);
Batch *surface = DRW_mesh_batch_cache_get_all_triangles(me);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
@ -4146,7 +4147,7 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D
if (GLEW_VERSION_3_2) {
#if 0
Batch *overlay = BKE_mesh_batch_cache_get_overlay_edges(me);
Batch *overlay = DRW_mesh_batch_cache_get_overlay_edges(me);
Batch_set_builtin_program(overlay, GPU_SHADER_EDGES_OVERLAY);
Batch_Uniform2f(overlay, "viewportSize", ar->winx, ar->winy);
Batch_draw(overlay);
@ -4165,7 +4166,7 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D
#endif
}
else {
Batch *edges = BKE_mesh_batch_cache_get_all_edges(me);
Batch *edges = DRW_mesh_batch_cache_get_all_edges(me);
Batch_set_builtin_program(edges, GPU_SHADER_3D_UNIFORM_COLOR);
Batch_Uniform4f(edges, "color", 0.0f, 0.0f, 0.0f, 1.0f);
glEnable(GL_LINE_SMOOTH);
@ -4227,7 +4228,7 @@ static void draw_mesh_object_outline_new(View3D *v3d, RegionView3D *rv3d, Object
UI_GetThemeColor4fv((is_active ? TH_ACTIVE : TH_SELECT), outline_color);
#if 1 /* new version that draws only silhouette edges */
Batch *fancy_edges = BKE_mesh_batch_cache_get_fancy_edges(me);
Batch *fancy_edges = DRW_mesh_batch_cache_get_fancy_edges(me);
if (rv3d->persp == RV3D_ORTHO) {
Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_ORTHO);
@ -4751,7 +4752,7 @@ static void draw_mesh_fancy_new(Scene *scene, SceneLayer *sl, ARegion *ar, View3
#if 1 /* fancy wireframes */
Batch *fancy_edges = BKE_mesh_batch_cache_get_fancy_edges(me);
Batch *fancy_edges = DRW_mesh_batch_cache_get_fancy_edges(me);
if (rv3d->persp == RV3D_ORTHO) {
Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_ORTHO);

View File

@ -43,18 +43,17 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_depsgraph.h"
#include "BKE_icons.h"
#include "BKE_lattice.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_curve_render.h"
#include "BKE_lattice_render.h"
#include "BKE_mesh_render.h"
#include "ED_space_api.h"
#include "ED_screen.h"
#include "ED_transform.h"
@ -932,15 +931,15 @@ static void view3d_main_region_listener(bScreen *sc, ScrArea *sa, ARegion *ar, w
Object *ob = scene->obedit;
switch (ob->type) {
case OB_MESH:
BKE_mesh_batch_selection_dirty(ob->data);
BKE_mesh_batch_cache_dirty(ob->data, BKE_CURVE_BATCH_DIRTY_SELECT);
break;
// case OB_FONT: /* handled by text_update_edited */
case OB_CURVE:
case OB_SURF:
BKE_curve_batch_selection_dirty(ob->data);
BKE_curve_batch_cache_dirty(ob->data, BKE_CURVE_BATCH_DIRTY_SELECT);
break;
case OB_LATTICE:
BKE_lattice_batch_selection_dirty(ob->data);
BKE_lattice_batch_cache_dirty(ob->data, BKE_CURVE_BATCH_DIRTY_SELECT);
break;
}
}