[Bf-blender-cvs] [99fb654ffda] blender2.8: DRW: Cleanup / Renaming of mesh batch cache functions

Clément Foucault noreply at git.blender.org
Tue Dec 18 20:52:04 CET 2018


Commit: 99fb654ffda3bacdb25d9955fe31c82b54fa3dd1
Author: Clément Foucault
Date:   Tue Dec 18 17:10:38 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB99fb654ffda3bacdb25d9955fe31c82b54fa3dd1

DRW: Cleanup / Renaming of mesh batch cache functions

THis is in order to avoid the jungle of names being different at each
step of the API.

Also removes some unused functions.

===================================================================

M	source/blender/draw/engines/basic/basic_engine.c
M	source/blender/draw/intern/draw_armature.c
M	source/blender/draw/intern/draw_cache.c
M	source/blender/draw/intern/draw_cache.h
M	source/blender/draw/intern/draw_cache_impl.h
M	source/blender/draw/intern/draw_cache_impl_mesh.c
M	source/blender/draw/modes/object_mode.c
M	source/blender/draw/modes/overlay_mode.c
M	source/blender/draw/modes/paint_texture_mode.c
M	source/blender/draw/modes/paint_vertex_mode.c
M	source/blender/draw/modes/paint_weight_mode.c

===================================================================

diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c
index eea41c932e2..f64d345c52f 100644
--- a/source/blender/draw/engines/basic/basic_engine.c
+++ b/source/blender/draw/engines/basic/basic_engine.c
@@ -152,7 +152,7 @@ static void basic_cache_populate(void *vedata, Object *ob)
 
 		if (is_flat_object_viewed_from_side) {
 			/* Avoid losing flat objects when in ortho views (see T56549) */
-			struct GPUBatch *geom = DRW_cache_object_wire_outline_get(ob);
+			struct GPUBatch *geom = DRW_cache_object_all_edges_get(ob);
 			DRW_shgroup_call_object_add(stl->g_data->depth_shgrp, geom, ob);
 			return;
 		}
diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c
index 8d0cae3cc4a..e5a15a9d01d 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -363,7 +363,7 @@ static void drw_shgroup_bone_custom_wire(
         const float color[4], Object *custom)
 {
 	/* grr, not re-using instances! */
-	struct GPUBatch *geom = DRW_cache_object_wire_outline_get(custom);
+	struct GPUBatch *geom = DRW_cache_object_all_edges_get(custom);
 
 	/* XXXXXXX needs to be moved elsewhere. */
 	drw_batch_cache_generate_requested(custom);
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index 945de6e8176..ff4fb0c85f6 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -670,11 +670,11 @@ GPUBatch *DRW_cache_gpencil_axes_get(void)
 /** \name Common Object API
 * \{ */
 
-GPUBatch *DRW_cache_object_wire_outline_get(Object *ob)
+GPUBatch *DRW_cache_object_all_edges_get(Object *ob)
 {
 	switch (ob->type) {
 		case OB_MESH:
-			return DRW_cache_mesh_wire_outline_get(ob);
+			return DRW_cache_mesh_all_edges_get(ob);
 
 		/* TODO, should match 'DRW_cache_object_surface_get' */
 		default:
@@ -694,7 +694,6 @@ GPUBatch *DRW_cache_object_edge_detection_get(Object *ob, bool *r_is_manifold)
 	}
 }
 
-/* Returns a buffer texture. */
 GPUBatch *DRW_cache_object_face_wireframe_get(Object *ob)
 {
 	switch (ob->type) {
@@ -2992,121 +2991,81 @@ GPUBatch *DRW_cache_single_vert_get(void)
 /** \name Meshes
  * \{ */
 
-GPUBatch *DRW_cache_mesh_wire_outline_get(Object *ob)
+GPUBatch *DRW_cache_mesh_all_verts_get(Object *ob)
 {
 	BLI_assert(ob->type == OB_MESH);
-
-	Mesh *me = ob->data;
-	return DRW_mesh_batch_cache_get_fancy_edges(me);
-}
-
-GPUBatch *DRW_cache_mesh_edge_detection_get(Object *ob, bool *r_is_manifold)
-{
-	BLI_assert(ob->type == OB_MESH);
-
-	Mesh *me = ob->data;
-	return DRW_mesh_batch_cache_get_edge_detection(me, r_is_manifold);
-}
-
-GPUBatch *DRW_cache_mesh_surface_get(Object *ob)
-{
-	BLI_assert(ob->type == OB_MESH);
-
-	Mesh *me = ob->data;
-	return DRW_mesh_batch_cache_get_triangles_with_normals(me);
+	return DRW_mesh_batch_cache_get_all_verts(ob->data);
 }
 
-GPUBatch *DRW_cache_mesh_wire_get(Object *ob)
+GPUBatch *DRW_cache_mesh_all_edges_get(Object *ob)
 {
 	BLI_assert(ob->type == OB_MESH);
-
-	Mesh *me = ob->data;
-	return DRW_mesh_batch_cache_get_wire_loops(me);
+	return DRW_mesh_batch_cache_get_all_edges(ob->data);
 }
 
-GPUBatch *DRW_cache_mesh_face_wireframe_get(Object *ob)
+GPUBatch *DRW_cache_mesh_loose_edges_get(Object *ob)
 {
 	BLI_assert(ob->type == OB_MESH);
-
-	Mesh *me = ob->data;
-	return DRW_mesh_batch_cache_get_wireframes_face(me);
+	return DRW_mesh_batch_cache_get_loose_edges(ob->data);
 }
 
-GPUBatch *DRW_cache_mesh_loose_edges_get(Object *ob)
+GPUBatch *DRW_cache_mesh_edge_detection_get(Object *ob, bool *r_is_manifold)
 {
 	BLI_assert(ob->type == OB_MESH);
-
-	Mesh *me = ob->data;
-	return DRW_mesh_batch_cache_get_loose_edges_with_normals(me);
+	return DRW_mesh_batch_cache_get_edge_detection(ob->data, r_is_manifold);
 }
 
-GPUBatch *DRW_cache_mesh_surface_weights_get(Object *ob)
+GPUBatch *DRW_cache_mesh_surface_get(Object *ob)
 {
 	BLI_assert(ob->type == OB_MESH);
-
-	Mesh *me = ob->data;
-	return DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(me);
+	return DRW_mesh_batch_cache_get_surface(ob->data);
 }
 
-GPUBatch *DRW_cache_mesh_surface_vert_colors_get(Object *ob)
+GPUBatch *DRW_cache_mesh_surface_edges_get(Object *ob)
 {
 	BLI_assert(ob->type == OB_MESH);
-
-	Mesh *me = ob->data;
-	return DRW_mesh_batch_cache_get_surface_vertpaint(me);
+	return DRW_mesh_batch_cache_get_surface_edges(ob->data);
 }
 
-/* Return list of batches */
+/* Return list of batches with length equal to max(1, totcol). */
 GPUBatch **DRW_cache_mesh_surface_shaded_get(
         Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len,
         char **auto_layer_names, int **auto_layer_is_srgb, int *auto_layer_count)
 {
 	BLI_assert(ob->type == OB_MESH);
-
-	Mesh *me = ob->data;
-	return DRW_mesh_batch_cache_get_surface_shaded(me, gpumat_array, gpumat_array_len,
+	return DRW_mesh_batch_cache_get_surface_shaded(ob->data, gpumat_array, gpumat_array_len,
 	                                               auto_layer_names, auto_layer_is_srgb, auto_layer_count);
 }
 
-/* Return list of batches */
+/* Return list of batches with length equal to max(1, totcol). */
 GPUBatch **DRW_cache_mesh_surface_texpaint_get(Object *ob)
 {
 	BLI_assert(ob->type == OB_MESH);
-
-	Mesh *me = ob->data;
-	return DRW_mesh_batch_cache_get_surface_texpaint(me);
+	return DRW_mesh_batch_cache_get_surface_texpaint(ob->data);
 }
 
 GPUBatch *DRW_cache_mesh_surface_texpaint_single_get(Object *ob)
 {
 	BLI_assert(ob->type == OB_MESH);
-
-	Mesh *me = ob->data;
-	return DRW_mesh_batch_cache_get_surface_texpaint_single(me);
+	return DRW_mesh_batch_cache_get_surface_texpaint_single(ob->data);
 }
 
-GPUBatch *DRW_cache_mesh_surface_verts_get(Object *ob)
+GPUBatch *DRW_cache_mesh_surface_vertpaint_get(Object *ob)
 {
 	BLI_assert(ob->type == OB_MESH);
-
-	Mesh *me = ob->data;
-	return DRW_mesh_batch_cache_get_points_with_normals(me);
+	return DRW_mesh_batch_cache_get_surface_vertpaint(ob->data);
 }
 
-GPUBatch *DRW_cache_mesh_edges_get(Object *ob)
+GPUBatch *DRW_cache_mesh_surface_weights_get(Object *ob)
 {
 	BLI_assert(ob->type == OB_MESH);
-
-	Mesh *me = ob->data;
-	return DRW_mesh_batch_cache_get_all_edges(me);
+	return DRW_mesh_batch_cache_get_surface_weights(ob->data);
 }
 
-GPUBatch *DRW_cache_mesh_verts_get(Object *ob)
+GPUBatch *DRW_cache_mesh_face_wireframe_get(Object *ob)
 {
 	BLI_assert(ob->type == OB_MESH);
-
-	Mesh *me = ob->data;
-	return DRW_mesh_batch_cache_get_all_verts(me);
+	return DRW_mesh_batch_cache_get_wireframes_face(ob->data);
 }
 
 void DRW_cache_mesh_sculpt_coords_ensure(Object *ob)
@@ -3163,7 +3122,7 @@ GPUBatch *DRW_cache_curve_surface_get(Object *ob)
 	struct Curve *cu = ob->data;
 	struct Mesh *mesh_eval = ob->runtime.mesh_eval;
 	if (mesh_eval != NULL) {
-		return DRW_mesh_batch_cache_get_triangles_with_normals(mesh_eval);
+		return DRW_mesh_batch_cache_get_surface(mesh_eval);
 	}
 	else {
 		return DRW_curve_batch_cache_get_triangles_with_normals(cu);
@@ -3177,7 +3136,7 @@ GPUBatch *DRW_cache_curve_loose_edges_get(Object *ob)
 	struct Curve *cu = ob->data;
 	struct Mesh *mesh_eval = ob->runtime.mesh_eval;
 	if (mesh_eval != NULL) {
-		return DRW_mesh_batch_cache_get_loose_edges_with_normals(mesh_eval);
+		return DRW_mesh_batch_cache_get_loose_edges(mesh_eval);
 	}
 	else {
 		/* TODO */
@@ -3267,7 +3226,7 @@ GPUBatch *DRW_cache_text_surface_get(Object *ob)
 		return NULL;
 	}
 	if (mesh_eval != NULL) {
-		return DRW_mesh_batch_cache_get_triangles_with_normals(mesh_eval);
+		return DRW_mesh_batch_cache_get_surface(mesh_eval);
 	}
 	else {
 		return DRW_curve_batch_cache_get_triangles_with_normals(cu);
@@ -3283,7 +3242,7 @@ GPUBatch *DRW_cache_text_loose_edges_get(Object *ob)
 		return NULL;
 	}
 	if (mesh_eval != NULL) {
-		return DRW_mesh_batch_cache_get_loose_edges_with_normals(mesh_eval);
+		return DRW_mesh_batch_cache_get_loose_edges(mesh_eval);
 	}
 	else {
 		/* TODO */
@@ -3338,7 +3297,7 @@ GPUBatch *DRW_cache_surf_surface_get(Object *ob)
 	struct Curve *cu = ob->data;
 	struct Mesh *mesh_eval = ob->runtime.mesh_eval;
 	if (mesh_eval != NULL) {
-		return DRW_mesh_batch_cache_get_triangles_with_normals(mesh_eval);
+		return DRW_mesh_batch_cache_get_surface(mesh_eval);
 	}
 	else {
 		return DRW_curve_batch_cache_get_triangles_with_normals(cu);
@@ -3374,7 +3333,7 @@ GPUBatch *DRW_cache_surf_loose_edges_get(Object *ob)
 	struct Curve *cu = ob->data;
 	struct Mesh *mesh_eval = ob->runtime.mesh_eval;
 	if (mesh_eval != NULL) {
-		return DRW_mesh_batch_cache_get_loose_edges_with_normals(mesh_eval);
+		return DRW_mesh_batch_cache_get_loose_edges(mesh_eval);
 	}
 	else {
 		/* TODO */
diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h
index 6387d9efaa2..b2843ed3cda 100644
--- a/source/blender/draw/intern/draw_cache.h
+++ b/source/blender/draw/intern/draw_cache.h
@@ -50,7 +50,7 @@ struct GPUBatch *DRW_cache_single_line_endpoints_get(void);
 struct GPUBatch *DRW_cache_screenspace_circle_get(void);
 
 /* Common Object */
-struct GPUBatch *DRW_cache_object_wire_outline_get(struct Object *ob);
+struct GPUBatch *DRW_cache_object_all_edges_get(struct Object *ob);
 struct GPUBatch *DRW_cache_object_edge_detection_get(struct Object *ob, bool *r_is_manifold);
 struct GPUBatch *DRW_cache_object_surface_get(struct Object *ob);
 struct GPUBatch *DRW_cache_object_loose_edges_get(struct Object *ob);
@@ -124,22 +124,19 @@ struct GPUBatch *DRW_cache_bone_dof_sphere_get(void);
 struct GPUBatch *DRW_cache_bone_dof_lines_get(void);
 
 /* Meshes */
-struct GPUBatch *DRW_cache_mesh_wire_outline_get(struct Object *ob);
+struct GPUBatch *DRW_cache_mesh_all_verts_get(struct Object *ob);
+struct GPUBatch *DRW_cache_mesh_all_edges_get(struct Object *ob);
+struct GPUBatch *DRW_cache_mesh_loose_edges_get(struct Object *ob);
 struct GPUBatch *DRW_cache_mesh_edge_detection_get(struct Object *ob, bool *r_is_manifold);
 struct GPUBatch *DRW_cache_mesh_surface_get(struct Object *ob);
-struct GPUBatch *DRW_cache_mesh_wire_get(struct Object *ob);
-struct GPUBatch *DRW_cache_mesh_loose_edges_get(struct Object *ob);
-struct GPUBatch *DRW_cache_mesh_surface_weights_get(struct Object *ob);
-struct GPUBatch *DRW_cac

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list