Metalball drawing: rename mball helpers to handles
authorGermano <germano.costa@ig.com.br>
Fri, 16 Feb 2018 04:01:09 +0000 (02:01 -0200)
committerGermano <germano.costa@ig.com.br>
Fri, 16 Feb 2018 04:01:09 +0000 (02:01 -0200)
and also rename some related functions

source/blender/blenkernel/BKE_mball.h
source/blender/blenkernel/intern/mball.c
source/blender/draw/intern/draw_common.c
source/blender/draw/intern/draw_common.h
source/blender/draw/modes/edit_metaball_mode.c
source/blender/draw/modes/object_mode.c
source/blender/gpu/CMakeLists.txt
source/blender/gpu/GPU_shader.h
source/blender/gpu/intern/gpu_shader.c
source/blender/gpu/shaders/gpu_shader_instance_mball_handles_vert.glsl [moved from source/blender/gpu/shaders/gpu_shader_instance_mball_helpers_vert.glsl with 100% similarity]
source/blender/makesdna/DNA_meta_types.h

index 9db277f95fb04101a263b865e976e083baf07801..d4776d890d2e909b0d1cbf4b836094626e8541e6 100644 (file)
@@ -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,
index 5a0ac86823f51128bbe7156fd27feb7cb9b04b31..cc801b2d8c354e9b70c16ece65494407a82342cd 100644 (file)
@@ -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);
index 0bf7c24193cd8b54230e5817c62e92204032e5f1..62166092638aaab2bd777afe136be99d84be3fb1 100644 (file)
@@ -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;
index 68ab7e055f51942cd4d56dd6dc483c5bd8c16d7d..ec646693207a40ea1199e99a36a2940ff9e76103 100644 (file)
@@ -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);
index b759dce5931fdb8065c267baf2b5d8e4bec0e17c..bcabeef5bc311741e7738f41d33e471ade52c440 100644 (file)
@@ -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);
                        }
                }
index ec43316240e7514802851730300b280dfd8989a1..4a7a5d25b11aa9d7c157fa31761b640554c2514a 100644 (file)
@@ -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;
                }
index 9524c71be8e95b78ae5ddc15bbe06f02efcc3384..189ca8e6a3326032aaa8d6b23d1c2d7451203474 100644 (file)
@@ -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)
index d25ccbc6c4026da845e2a7311c15dbaebbe2d3fa..ca6e8343401eaa2f1406620e63a496bba98d8abd 100644 (file)
@@ -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;
index f2dbf587abe515818687d64cb90fb2117de8742c..c25d03dff2fb2fd73174930d310623415804f382 100644 (file)
@@ -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[];
 extern char datatoc_gpu_shader_instance_bone_envelope_wire_vert_glsl[];
-extern char datatoc_gpu_shader_instance_mball_helpers_vert_glsl[];
+extern char datatoc_gpu_shader_instance_mball_handles_vert_glsl[];
 
 extern char datatoc_gpu_shader_3D_groundpoint_vert_glsl[];
 extern char datatoc_gpu_shader_3D_groundline_geom_glsl[];
@@ -823,7 +823,7 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
                [GPU_SHADER_3D_INSTANCE_BONE_ENVELOPE_WIRE] = { datatoc_gpu_shader_instance_bone_envelope_wire_vert_glsl,
                                                                datatoc_gpu_shader_flat_color_frag_glsl },
 
-               [GPU_SHADER_3D_INSTANCE_MBALL_HELPERS] = { datatoc_gpu_shader_instance_mball_helpers_vert_glsl,
+               [GPU_SHADER_3D_INSTANCE_MBALL_HANDLES] = { datatoc_gpu_shader_instance_mball_handles_vert_glsl,
                                                           datatoc_gpu_shader_flat_color_frag_glsl },
        };
 
index f9ba45efef8ca6a48db330f95c12efea9712ee13..d1f001fccc4f91d2f5f55b9ada5e0f60878635d3 100644 (file)
@@ -62,7 +62,7 @@ typedef struct MetaElem {
 
        /* Draw_Data: stores pointers used for shader attributes */
        float draw_scale_xform[3][4]; /* Matrix of Scale and Translation */
-       float draw_stiffness_radius; /* stiffness circle radius (only in edit mode) */
+       float draw_stiffness_radius; /* radius of the stiffness circle (only in edit mode) */
        float pad;
 } MetaElem;