Cleanup: remove redundant doxygen \file argument
[blender.git] / source / blender / draw / intern / draw_cache_impl_metaball.c
index 304d93f..7ebe73b 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  *
  * The Original Code is Copyright (C) 2017 by Blender Foundation.
  * All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file draw_cache_impl_metaball.c
- *  \ingroup draw
+/** \file \ingroup draw
  *
  * \brief MetaBall API for render engines
  */
@@ -39,7 +34,6 @@
 
 #include "GPU_batch.h"
 
-#include "DRW_render.h"
 
 #include "draw_cache_impl.h"  /* own include */
 
@@ -143,13 +137,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, NULL);
+               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 +158,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, NULL),
+                       ibo,
                        GPU_BATCH_OWNS_INDEX);
        }
 
@@ -204,7 +200,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, NULL);
+
+               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;