Merge branch 'blender2.7'
[blender.git] / source / blender / draw / intern / draw_cache_impl_metaball.c
index 10f5db42bf11893a04f4178e714fb6089b892bd6..62e57c9cfc955318be103c2389645cf7916635f1 100644 (file)
@@ -39,7 +39,6 @@
 
 #include "GPU_batch.h"
 
-#include "DRW_render.h"
 
 #include "draw_cache_impl.h"  /* own include */
 
@@ -143,13 +142,13 @@ static GPUVertBuf *mball_batch_cache_get_pos_and_normals(Object *ob, MetaBallBat
 {
        if (cache->pos_nor_in_order == NULL) {
                ListBase *lb = &ob->runtime.curve_cache->disp;
-               cache->pos_nor_in_order = DRW_displist_vertbuf_calc_pos_with_normals(lb);
+               cache->pos_nor_in_order = MEM_callocN(sizeof(GPUVertBuf), __func__);
+               DRW_displist_vertbuf_create_pos_and_nor(lb, cache->pos_nor_in_order);
        }
        return cache->pos_nor_in_order;
 }
 
 /* -------------------------------------------------------------------- */
-
 /** \name Public Object/MetaBall API
  * \{ */
 
@@ -164,10 +163,12 @@ GPUBatch *DRW_metaball_batch_cache_get_triangles_with_normals(Object *ob)
 
        if (cache->batch == NULL) {
                ListBase *lb = &ob->runtime.curve_cache->disp;
+               GPUIndexBuf *ibo = MEM_callocN(sizeof(GPUIndexBuf), __func__);
+               DRW_displist_indexbuf_create_triangles_in_order(lb, ibo);
                cache->batch = GPU_batch_create_ex(
                        GPU_PRIM_TRIS,
                        mball_batch_cache_get_pos_and_normals(ob, cache),
-                       DRW_displist_indexbuf_calc_triangles_in_order(lb),
+                       ibo,
                        GPU_BATCH_OWNS_INDEX);
        }
 
@@ -204,7 +205,15 @@ GPUBatch *DRW_metaball_batch_cache_get_wireframes_face(Object *ob)
 
        if (cache->face_wire.batch == NULL) {
                ListBase *lb = &ob->runtime.curve_cache->disp;
-               cache->face_wire.batch = DRW_displist_create_edges_overlay_batch(lb);
+
+               GPUVertBuf *vbo_pos_nor = MEM_callocN(sizeof(GPUVertBuf), __func__);
+               GPUVertBuf *vbo_wireframe_data = MEM_callocN(sizeof(GPUVertBuf), __func__);
+
+               DRW_displist_vertbuf_create_pos_and_nor_and_uv_tess(lb, vbo_pos_nor, NULL);
+               DRW_displist_vertbuf_create_wireframe_data_tess(lb, vbo_wireframe_data);
+
+               cache->face_wire.batch = GPU_batch_create_ex(GPU_PRIM_TRIS, vbo_pos_nor, NULL, GPU_BATCH_OWNS_VBO);
+               GPU_batch_vertbuf_add_ex(cache->face_wire.batch, vbo_wireframe_data, true);
        }
 
        return cache->face_wire.batch;