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:
authorHans Goudey <h.goudey@me.com>2022-04-19 07:48:43 +0300
committerHans Goudey <h.goudey@me.com>2022-04-19 07:48:43 +0300
commit8c25889bb67db4c1d2f94bf85ca6d1c2a050fcfe (patch)
tree772697b82ecd172e577ef11779543c523b4e86f8 /source/blender/draw
parent775f0d76d55b2977c30dcd0f9306437ae520d63f (diff)
Refactor: Move mesh face dot tag out of MVert
Continuing the refactors described in T93602, this commit moves the face dot tag set by the subdivision surface modifier out of `MVert` to `MeshRuntime`. This clarifies its status as runtime data and allows further refactoring of mesh positions in the future. Before, `BKE_modifiers_uses_subsurf_facedots` was used to check whether subsurf face dots should be drawn, but now we can just check if the tags exist on the mesh. Modifiers that create new new geometry or modify topology will already remove the array by clearing mesh runtime data. Differential Revision: https://developer.blender.org/D14680
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.c2
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc10
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc10
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc8
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc7
5 files changed, 19 insertions, 18 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index ec33d2b5361..c4fa60ef51d 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -2121,7 +2121,7 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph,
MDEPS_ASSERT_MAP_INDEX(TRIS_PER_MAT_INDEX);
- const bool use_subsurf_fdots = scene ? BKE_modifiers_uses_subsurf_facedots(scene, ob) : false;
+ const bool use_subsurf_fdots = me->runtime.subsurf_face_dot_tags != NULL;
if (do_uvcage) {
mesh_buffer_cache_create_requested(task_graph,
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
index 27149a80f9b..43aa52f08c8 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
@@ -5,9 +5,7 @@
* \ingroup draw
*/
-#include "BLI_vector.hh"
-
-#include "MEM_guardedalloc.h"
+#include "BLI_bitmap.h"
#include "extract_mesh.h"
@@ -538,7 +536,8 @@ static void extract_edituv_fdots_iter_poly_mesh(const MeshRenderData *mr,
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
if (mr->use_subsurf_fdots) {
- /* Check #ME_VERT_FACEDOT. */
+ const BLI_bitmap *facedot_tags = mr->me->runtime.subsurf_face_dot_tags;
+
const MLoop *mloop = mr->mloop;
const int ml_index_end = mp->loopstart + mp->totloop;
for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) {
@@ -546,8 +545,7 @@ static void extract_edituv_fdots_iter_poly_mesh(const MeshRenderData *mr,
const bool real_fdot = (mr->extract_type == MR_EXTRACT_MAPPED && mr->p_origindex &&
mr->p_origindex[mp_index] != ORIGINDEX_NONE);
- const bool subd_fdot = (!mr->use_subsurf_fdots ||
- (mr->mvert[ml->v].flag & ME_VERT_FACEDOT) != 0);
+ const bool subd_fdot = BLI_BITMAP_TEST(facedot_tags, ml->v);
edituv_facedot_add(data,
((mp->flag & ME_HIDE) != 0) || !real_fdot || !subd_fdot,
(mp->flag & ME_FACE_SEL) != 0,
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc
index 8db1660b9d0..4bf732caf0a 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc
@@ -5,9 +5,7 @@
* \ingroup draw
*/
-#include "BLI_vector.hh"
-
-#include "MEM_guardedalloc.h"
+#include "BLI_bitmap.h"
#include "extract_mesh.h"
@@ -46,13 +44,13 @@ static void extract_fdots_iter_poly_mesh(const MeshRenderData *mr,
{
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(_userdata);
if (mr->use_subsurf_fdots) {
- /* Check #ME_VERT_FACEDOT. */
+ const BLI_bitmap *facedot_tags = mr->me->runtime.subsurf_face_dot_tags;
+
const MLoop *mloop = mr->mloop;
const int ml_index_end = mp->loopstart + mp->totloop;
for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) {
const MLoop *ml = &mloop[ml_index];
- const MVert *mv = &mr->mvert[ml->v];
- if ((mv->flag & ME_VERT_FACEDOT) && !(mr->use_hide && (mp->flag & ME_HIDE))) {
+ if (BLI_BITMAP_TEST(facedot_tags, ml->v) && !(mr->use_hide && (mp->flag & ME_HIDE))) {
GPU_indexbuf_set_point_vert(elb, mp_index, mp_index);
return;
}
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc
index 0a34cfa012d..c2b4d389b7c 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc
@@ -5,6 +5,8 @@
* \ingroup draw
*/
+#include "BLI_bitmap.h"
+
#include "extract_mesh.h"
#include "draw_subdivision.h"
@@ -75,14 +77,14 @@ static void extract_fdots_pos_iter_poly_mesh(const MeshRenderData *mr,
const MVert *mvert = mr->mvert;
const MLoop *mloop = mr->mloop;
+ const BLI_bitmap *facedot_tags = mr->me->runtime.subsurf_face_dot_tags;
const int ml_index_end = mp->loopstart + mp->totloop;
for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) {
const MLoop *ml = &mloop[ml_index];
if (mr->use_subsurf_fdots) {
- const MVert *mv = &mr->mvert[ml->v];
- if (mv->flag & ME_VERT_FACEDOT) {
- copy_v3_v3(center[mp_index], mv->co);
+ if (BLI_BITMAP_TEST(facedot_tags, ml->v)) {
+ copy_v3_v3(center[mp_index], mvert[ml->v].co);
break;
}
}
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc
index 7a3c108b75a..26f0b07f676 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc
@@ -5,6 +5,8 @@
* \ingroup draw
*/
+#include "BLI_bitmap.h"
+
#include "extract_mesh.h"
namespace blender::draw {
@@ -72,13 +74,14 @@ static void extract_fdots_uv_iter_poly_mesh(const MeshRenderData *mr,
void *_data)
{
MeshExtract_FdotUV_Data *data = static_cast<MeshExtract_FdotUV_Data *>(_data);
+ const BLI_bitmap *facedot_tags = mr->me->runtime.subsurf_face_dot_tags;
+
const MLoop *mloop = mr->mloop;
const int ml_index_end = mp->loopstart + mp->totloop;
for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) {
const MLoop *ml = &mloop[ml_index];
if (mr->use_subsurf_fdots) {
- const MVert *mv = &mr->mvert[ml->v];
- if (mv->flag & ME_VERT_FACEDOT) {
+ if (BLI_BITMAP_TEST(facedot_tags, ml->v)) {
copy_v2_v2(data->vbo_data[mp_index], data->uv_data[ml_index].uv);
}
}