[Bf-blender-cvs] [fa0e89b9e85] blender2.8: Metalball drawing: rename mball helpers to handles

Germano noreply at git.blender.org
Fri Feb 16 05:01:47 CET 2018


Commit: fa0e89b9e857b8696dbecdfe82aa7adea6d5a947
Author: Germano
Date:   Fri Feb 16 02:01:09 2018 -0200
Branches: blender2.8
https://developer.blender.org/rBfa0e89b9e857b8696dbecdfe82aa7adea6d5a947

Metalball drawing: rename mball helpers to handles

and also rename some related functions

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

M	source/blender/blenkernel/BKE_mball.h
M	source/blender/blenkernel/intern/mball.c
M	source/blender/draw/intern/draw_common.c
M	source/blender/draw/intern/draw_common.h
M	source/blender/draw/modes/edit_metaball_mode.c
M	source/blender/draw/modes/object_mode.c
M	source/blender/gpu/CMakeLists.txt
M	source/blender/gpu/GPU_shader.h
M	source/blender/gpu/intern/gpu_shader.c
R100	source/blender/gpu/shaders/gpu_shader_instance_mball_helpers_vert.glsl	source/blender/gpu/shaders/gpu_shader_instance_mball_handles_vert.glsl
M	source/blender/makesdna/DNA_meta_types.h

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

diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h
index 9db277f95fb..d4776d890d2 100644
--- a/source/blender/blenkernel/BKE_mball.h
+++ b/source/blender/blenkernel/BKE_mball.h
@@ -77,9 +77,9 @@ void BKE_mball_eval_geometry(const struct EvaluationContext *eval_ctx,
                              struct MetaBall *mball);
 /* Draw Cache */
 
-void BKE_mball_element_calc_display_m3x4(float r_scale_xform[3][4],
-                                         const float obmat[4][4],
-                                         const float local_pos[3]);
+void BKE_mball_element_calc_scale_xform(float r_scale_xform[3][4],
+                                        const float obmat[4][4],
+                                        const float local_pos[3]);
 
 enum {
 	BKE_MBALL_BATCH_DIRTY_ALL = 0,
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 5a0ac86823f..cc801b2d8c3 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -549,9 +549,9 @@ void BKE_mball_eval_geometry(const struct EvaluationContext *UNUSED(eval_ctx),
 /* Draw Engine */
 
 /* use for draw-manager only. */
-void BKE_mball_element_calc_display_m3x4(float r_scale_xform[3][4],
-                                         const float obmat[4][4],
-                                         const float local_pos[3])
+void BKE_mball_element_calc_scale_xform(float r_scale_xform[3][4],
+                                        const float obmat[4][4],
+                                        const float local_pos[3])
 {
 	float world_pos[3], scamat[3][3];
 	mul_v3_m4v3(world_pos, obmat, local_pos);
diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c
index 0bf7c24193c..62166092638 100644
--- a/source/blender/draw/intern/draw_common.c
+++ b/source/blender/draw/intern/draw_common.c
@@ -168,7 +168,7 @@ static struct {
 	struct Gwn_VertFormat *instance_spot;
 	struct Gwn_VertFormat *instance_bone_envelope_wire;
 	struct Gwn_VertFormat *instance_bone_envelope_solid;
-	struct Gwn_VertFormat *instance_mball_helpers;
+	struct Gwn_VertFormat *instance_mball_handles;
 } g_formats = {NULL};
 
 void DRW_globals_free(void)
@@ -421,17 +421,17 @@ DRWShadingGroup *shgroup_instance_bone_envelope_solid(DRWPass *pass, struct Gwn_
 	return grp;
 }
 
-DRWShadingGroup *shgroup_instance_mball_helpers(DRWPass *pass, struct Gwn_Batch *geom)
+DRWShadingGroup *shgroup_instance_mball_handles(DRWPass *pass, struct Gwn_Batch *geom)
 {
-	GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_MBALL_HELPERS);
+	GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_MBALL_HANDLES);
 
-	DRW_shgroup_instance_format(g_formats.instance_mball_helpers, {
+	DRW_shgroup_instance_format(g_formats.instance_mball_handles, {
 		{"ScaleTranslationMatrix" , DRW_ATTRIB_FLOAT, 16},
 		{"radius"                 , DRW_ATTRIB_FLOAT, 1},
 		{"color"                  , DRW_ATTRIB_FLOAT, 3}
 	});
 
-	DRWShadingGroup *grp = DRW_shgroup_instance_create(sh, pass, geom, g_formats.instance_mball_helpers);
+	DRWShadingGroup *grp = DRW_shgroup_instance_create(sh, pass, geom, g_formats.instance_mball_handles);
 	DRW_shgroup_uniform_vec3(grp, "screen_vecs[0]", DRW_viewport_screenvecs_get(), 2);
 
 	return grp;
diff --git a/source/blender/draw/intern/draw_common.h b/source/blender/draw/intern/draw_common.h
index 68ab7e055f5..ec646693207 100644
--- a/source/blender/draw/intern/draw_common.h
+++ b/source/blender/draw/intern/draw_common.h
@@ -119,7 +119,7 @@ struct DRWShadingGroup *shgroup_distance_lines_instance(struct DRWPass *pass, st
 struct DRWShadingGroup *shgroup_spot_instance(struct DRWPass *pass, struct Gwn_Batch *geom);
 struct DRWShadingGroup *shgroup_instance_bone_envelope_wire(struct DRWPass *pass, struct Gwn_Batch *geom);
 struct DRWShadingGroup *shgroup_instance_bone_envelope_solid(struct DRWPass *pass, struct Gwn_Batch *geom);
-struct DRWShadingGroup *shgroup_instance_mball_helpers(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_instance_mball_handles(struct DRWPass *pass, struct Gwn_Batch *geom);
 
 int DRW_object_wire_theme_get(
         struct Object *ob, struct ViewLayer *view_layer, float **r_color);
diff --git a/source/blender/draw/modes/edit_metaball_mode.c b/source/blender/draw/modes/edit_metaball_mode.c
index b759dce5931..bcabeef5bc3 100644
--- a/source/blender/draw/modes/edit_metaball_mode.c
+++ b/source/blender/draw/modes/edit_metaball_mode.c
@@ -119,11 +119,11 @@ static void EDIT_METABALL_cache_init(void *vedata)
 		psl->pass = DRW_pass_create("My Pass", state);
 
 		/* Create a shadingGroup using a function in draw_common.c or custom one */
-		stl->g_data->group = shgroup_instance_mball_helpers(psl->pass, DRW_cache_screenspace_circle_get());
+		stl->g_data->group = shgroup_instance_mball_handles(psl->pass, DRW_cache_screenspace_circle_get());
 	}
 }
 
-static void EDIT_METABALL_cache_populate_radius_visualization(
+static void EDIT_METABALL_cache_populate_radius(
         DRWShadingGroup *group, MetaElem *ml, const float scale_xform[3][4],
         const float *radius, const int selection_id)
 {
@@ -142,7 +142,7 @@ static void EDIT_METABALL_cache_populate_radius_visualization(
 	DRW_shgroup_call_dynamic_add(group, scale_xform, radius, color);
 }
 
-static void EDIT_METABALL_cache_populate_stiffness_visualization(
+static void EDIT_METABALL_cache_populate_stiffness(
         DRWShadingGroup *group, MetaElem *ml, const float scale_xform[3][4],
         const float *radius, const int selection_id)
 {
@@ -179,13 +179,13 @@ static void EDIT_METABALL_cache_populate(void *vedata, Object *ob)
 			int selection_id = 0;
 
 			for (MetaElem *ml = mb->editelems->first; ml != NULL; ml = ml->next) {
-				BKE_mball_element_calc_display_m3x4(ml->draw_scale_xform, ob->obmat, &ml->x);
+				BKE_mball_element_calc_scale_xform(ml->draw_scale_xform, ob->obmat, &ml->x);
 				ml->draw_stiffness_radius = ml->rad * atanf(ml->s) / (float)M_PI_2;
 
-				EDIT_METABALL_cache_populate_radius_visualization(
+				EDIT_METABALL_cache_populate_radius(
 				        group, ml, ml->draw_scale_xform, &ml->rad, is_select ? ++selection_id : -1);
 
-				EDIT_METABALL_cache_populate_stiffness_visualization(
+				EDIT_METABALL_cache_populate_stiffness(
 				        group, ml, ml->draw_scale_xform, &ml->draw_stiffness_radius, is_select ? ++selection_id : -1);
 			}
 		}
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index ec43316240e..4a7a5d25b11 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -156,7 +156,7 @@ typedef struct OBJECT_PrivateData {
 	DRWShadingGroup *probe_grid;
 
 	/* MetaBalls */
-	DRWShadingGroup *mball_circle;
+	DRWShadingGroup *mball_handle;
 
 	/* Lamps */
 	DRWShadingGroup *lamp_center;
@@ -980,10 +980,10 @@ static void OBJECT_cache_init(void *vedata)
 	}
 
 	{
-		/* Metaballs Helpers */
+		/* Metaballs Handles */
 		struct Gwn_Batch *geom;
 		geom = DRW_cache_screenspace_circle_get();
-		stl->g_data->mball_circle = shgroup_instance_mball_helpers(psl->non_meshes, geom);
+		stl->g_data->mball_handle = shgroup_instance_mball_handles(psl->non_meshes, geom);
 	}
 
 	{
@@ -1115,7 +1115,7 @@ static void OBJECT_cache_init(void *vedata)
 	}
 }
 
-static void DRW_shgroup_mball_helpers(OBJECT_StorageList *stl, Object *ob, ViewLayer *view_layer)
+static void DRW_shgroup_mball_handles(OBJECT_StorageList *stl, Object *ob, ViewLayer *view_layer)
 {
 	MetaBall *mb = ob->data;
 
@@ -1124,8 +1124,8 @@ static void DRW_shgroup_mball_helpers(OBJECT_StorageList *stl, Object *ob, ViewL
 
 	for (MetaElem *ml = mb->elems.first; ml != NULL; ml = ml->next) {
 		/* draw radius */
-		BKE_mball_element_calc_display_m3x4(ml->draw_scale_xform, ob->obmat, &ml->x);
-		DRW_shgroup_call_dynamic_add(stl->g_data->mball_circle, ml->draw_scale_xform, &ml->rad, color);
+		BKE_mball_element_calc_scale_xform(ml->draw_scale_xform, ob->obmat, &ml->x);
+		DRW_shgroup_call_dynamic_add(stl->g_data->mball_handle, ml->draw_scale_xform, &ml->rad, color);
 	}
 }
 
@@ -1884,7 +1884,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
 		case OB_MBALL:
 		{
 			if (ob != draw_ctx->object_edit) {
-				DRW_shgroup_mball_helpers(stl, ob, view_layer);
+				DRW_shgroup_mball_handles(stl, ob, view_layer);
 			}
 			break;
 		}
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 9524c71be8e..189ca8e6a33 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -174,7 +174,7 @@ data_to_c_simple(shaders/gpu_shader_instance_edges_variying_color_geom.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_instance_edges_variying_color_vert.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_instance_bone_envelope_solid_vert.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_instance_bone_envelope_wire_vert.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_instance_mball_helpers_vert.glsl SRC)
+data_to_c_simple(shaders/gpu_shader_instance_mball_handles_vert.glsl SRC)
 
 data_to_c_simple(shaders/gpu_shader_3D_groundline_geom.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_3D_groundpoint_vert.glsl SRC)
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index d25ccbc6c40..ca6e8343401 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -174,7 +174,7 @@ typedef enum GPUBuiltinShader {
 	GPU_SHADER_3D_INSTANCE_BONE_ENVELOPE_SOLID,
 	GPU_SHADER_3D_INSTANCE_BONE_ENVELOPE_WIRE,
 
-	GPU_SHADER_3D_INSTANCE_MBALL_HELPERS,
+	GPU_SHADER_3D_INSTANCE_MBALL_HANDLES,
 
 	GPU_NUM_BUILTIN_SHADERS /* (not an actual shader) */
 } GPUBuiltinShader;
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index f2dbf587abe..c25d03dff2f 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -98,7 +98,7 @@ extern char datatoc_gpu_shader_instance_edges_variying_color_geom_glsl[];
 extern char datatoc_gpu_shader_instance_edges_variying_color_vert_glsl[];
 extern char datatoc_gpu_shader_instance_bone_envelope_solid_vert_glsl

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list