diff options
author | Hans Goudey <h.goudey@me.com> | 2022-08-17 17:20:25 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-08-17 17:20:25 +0300 |
commit | eaa87101cd5a20e577748bfff95b7cb06b04dd4b (patch) | |
tree | 8243ee6bd1479299f23819ef2765720fc9a18889 /source/blender/blenkernel/intern/object_update.c | |
parent | 71f091a631c2deae08ff289184f928538b527cb3 (diff) |
Metaball: Evaluate metaball objects as mesh components
With the ultimate goal of simplifying drawing and evaluation,
this patch makes the following changes and removes code:
- Use `Mesh` instead of `DispList` for evaluated basis metaballs.
- Remove all `DispList` drawing code, which is now unused.
- Simplify code that converts evaluated metaballs to meshes.
- Store the evaluated mesh in the evaluated geometry set.
This has the following indirect benefits:
- Evaluated meshes from metaball objects can be used in geometry nodes.
- Renderers can ignore evaluated metaball objects completely
- Cycles rendering no longer has to convert to mesh from `DispList`.
- We get closer to removing `DispList` completely.
- Optimizations to mesh rendering will also apply to metaball objects.
The vertex normals on the evaluated mesh are technically invalid;
the regular calculation wouldn't reproduce them. Metaball objects
don't support modifiers though, so it shouldn't be a problem.
Eventually we can support per-vertex custom normals (T93551).
Differential Revision: https://developer.blender.org/D14593
Diffstat (limited to 'source/blender/blenkernel/intern/object_update.c')
-rw-r--r-- | source/blender/blenkernel/intern/object_update.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index af0c5107348..5656a9f6c92 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -168,7 +168,7 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o break; case OB_MBALL: - BKE_displist_make_mball(depsgraph, scene, ob); + BKE_mball_data_update(depsgraph, scene, ob); break; case OB_CURVES_LEGACY: @@ -292,9 +292,15 @@ void BKE_object_batch_cache_dirty_tag(Object *ob) case OB_CURVES_LEGACY: BKE_curve_batch_cache_dirty_tag((struct Curve *)ob->data, BKE_CURVE_BATCH_DIRTY_ALL); break; - case OB_MBALL: - BKE_mball_batch_cache_dirty_tag((struct MetaBall *)ob->data, BKE_MBALL_BATCH_DIRTY_ALL); + case OB_MBALL: { + /* This function is currently called on original objects, so to properly + * clear the actual displayed geometry, we have to tag the evaluated mesh. */ + Mesh *mesh = BKE_object_get_evaluated_mesh_no_subsurf(ob); + if (mesh) { + BKE_mesh_batch_cache_dirty_tag(mesh, BKE_MESH_BATCH_DIRTY_ALL); + } break; + } case OB_GPENCIL: BKE_gpencil_batch_cache_dirty_tag((struct bGPdata *)ob->data); break; |