Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano <germano.costa@ig.com.br>2017-11-16 20:12:32 +0300
committerGermano <germano.costa@ig.com.br>2017-11-16 20:12:32 +0300
commit88c88c4610260ef3d00420c3e9fc3c1cd56aad14 (patch)
treeb9e49f253fd37c773c2098b583019e2240655885 /source/blender/draw/modes/object_mode.c
parent562da211c21bc57e35d7b2dba2f36c2472de90a2 (diff)
Fix T51210: Draw Manager: Support for Metaball Drawing
Differential Revision: D2914
Diffstat (limited to 'source/blender/draw/modes/object_mode.c')
-rw-r--r--source/blender/draw/modes/object_mode.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index a981a51a846..534ef9fb5bd 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -31,6 +31,7 @@
#include "DNA_camera_types.h"
#include "DNA_curve_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_meta_types.h"
#include "DNA_object_force.h"
#include "DNA_lightprobe_types.h"
#include "DNA_particle_types.h"
@@ -43,6 +44,7 @@
#include "BKE_camera.h"
#include "BKE_curve.h"
#include "BKE_global.h"
+#include "BKE_mball.h"
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_image.h"
@@ -149,6 +151,9 @@ typedef struct OBJECT_PrivateData {
DRWShadingGroup *probe_planar;
DRWShadingGroup *probe_grid;
+ /* MetaBalls */
+ DRWShadingGroup *mball_circle;
+
/* Lamps */
DRWShadingGroup *lamp_center;
DRWShadingGroup *lamp_center_group;
@@ -950,6 +955,13 @@ static void OBJECT_cache_init(void *vedata)
}
{
+ /* Metaballs Helpers */
+ struct Gwn_Batch *geom;
+ geom = DRW_cache_screenspace_circle_get();
+ stl->g_data->mball_circle = shgroup_instance_mball_helpers(psl->non_meshes, geom);
+ }
+
+ {
/* Lamps */
/* TODO
* for now we create multiple times the same VBO with only lamp center coordinates
@@ -1077,6 +1089,20 @@ static void OBJECT_cache_init(void *vedata)
}
}
+static void DRW_shgroup_mball_helpers(OBJECT_StorageList *stl, Object *ob, SceneLayer *scene_layer)
+{
+ MetaBall *mb = ob->data;
+
+ float *color;
+ DRW_object_wire_theme_get(ob, scene_layer, &color);
+
+ 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);
+ }
+}
+
static void DRW_shgroup_lamp(OBJECT_StorageList *stl, Object *ob, SceneLayer *scene_layer)
{
Lamp *la = ob->data;
@@ -1812,6 +1838,14 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
}
break;
}
+ case OB_MBALL:
+ {
+ Object *obedit = scene->obedit;
+ if (ob != obedit) {
+ DRW_shgroup_mball_helpers(stl, ob, scene_layer);
+ }
+ break;
+ }
case OB_LAMP:
DRW_shgroup_lamp(stl, ob, scene_layer);
break;