BMesh: remove BMEditMesh.ob use for draw manager
This commit is contained in:
@@ -253,6 +253,7 @@ typedef struct MeshBatchCache {
|
||||
void mesh_buffer_cache_create_requested(MeshBatchCache *cache,
|
||||
MeshBufferCache mbc,
|
||||
Mesh *me,
|
||||
const float obmat[4][4],
|
||||
const bool do_final,
|
||||
const bool do_uvedit,
|
||||
const bool use_subsurf_fdots,
|
||||
|
||||
@@ -95,6 +95,9 @@ typedef struct MeshRenderData {
|
||||
bool use_subsurf_fdots;
|
||||
bool use_final_mesh;
|
||||
|
||||
/** Use for #MeshStatVis calculation which use world-space coords. */
|
||||
float obmat[4][4];
|
||||
|
||||
const ToolSettings *toolsettings;
|
||||
/* HACK not supposed to be there but it's needed. */
|
||||
struct MeshBatchCache *cache;
|
||||
@@ -125,6 +128,7 @@ typedef struct MeshRenderData {
|
||||
} MeshRenderData;
|
||||
|
||||
static MeshRenderData *mesh_render_data_create(Mesh *me,
|
||||
const float obmat[4][4],
|
||||
const bool do_final,
|
||||
const bool do_uvedit,
|
||||
const eMRIterType iter_type,
|
||||
@@ -136,6 +140,8 @@ static MeshRenderData *mesh_render_data_create(Mesh *me,
|
||||
mr->toolsettings = ts;
|
||||
mr->mat_len = mesh_render_mat_len_get(me);
|
||||
|
||||
copy_m4_m4(mr->obmat, obmat);
|
||||
|
||||
const bool is_auto_smooth = (me->flag & ME_AUTOSMOOTH) != 0;
|
||||
const float split_angle = is_auto_smooth ? me->smoothresh : (float)M_PI;
|
||||
|
||||
@@ -3102,11 +3108,9 @@ static void statvis_calc_overhang(const MeshRenderData *mr, float *r_overhang)
|
||||
|
||||
axis_from_enum_v3(dir, axis);
|
||||
|
||||
if (em && LIKELY(em->ob)) {
|
||||
/* now convert into global space */
|
||||
mul_transposed_mat3_m4_v3(em->ob->obmat, dir);
|
||||
normalize_v3(dir);
|
||||
}
|
||||
/* now convert into global space */
|
||||
mul_transposed_mat3_m4_v3(mr->obmat, dir);
|
||||
normalize_v3(dir);
|
||||
|
||||
if (mr->extract_type == MR_EXTRACT_BMESH) {
|
||||
int l = 0;
|
||||
@@ -3164,7 +3168,7 @@ static void statvis_calc_thickness(const MeshRenderData *mr, float *r_thickness)
|
||||
/* cheating to avoid another allocation */
|
||||
float *face_dists = r_thickness + (mr->loop_len - mr->poly_len);
|
||||
BMEditMesh *em = mr->edit_bmesh;
|
||||
const float scale = 1.0f / mat4_to_scale(em->ob->obmat);
|
||||
const float scale = 1.0f / mat4_to_scale(mr->obmat);
|
||||
const MeshStatVis *statvis = &mr->toolsettings->statvis;
|
||||
const float min = statvis->thickness_min * scale;
|
||||
const float max = statvis->thickness_max * scale;
|
||||
@@ -4374,6 +4378,7 @@ static void extract_task_create(TaskPool *task_pool,
|
||||
void mesh_buffer_cache_create_requested(MeshBatchCache *cache,
|
||||
MeshBufferCache mbc,
|
||||
Mesh *me,
|
||||
const float obmat[4][4],
|
||||
const bool do_final,
|
||||
const bool do_uvedit,
|
||||
const bool use_subsurf_fdots,
|
||||
@@ -4434,7 +4439,7 @@ void mesh_buffer_cache_create_requested(MeshBatchCache *cache,
|
||||
#endif
|
||||
|
||||
MeshRenderData *mr = mesh_render_data_create(
|
||||
me, do_final, do_uvedit, iter_flag, data_flag, cd_layer_used, ts);
|
||||
me, obmat, do_final, do_uvedit, iter_flag, data_flag, cd_layer_used, ts);
|
||||
mr->cache = cache; /* HACK */
|
||||
mr->use_hide = use_hide;
|
||||
mr->use_subsurf_fdots = use_subsurf_fdots;
|
||||
|
||||
@@ -1399,16 +1399,32 @@ void DRW_mesh_batch_cache_create_requested(
|
||||
|
||||
if (do_uvcage) {
|
||||
mesh_buffer_cache_create_requested(
|
||||
cache, cache->uv_cage, me, false, true, false, &cache->cd_used, ts, true);
|
||||
cache, cache->uv_cage, me, ob->obmat, false, true, false, &cache->cd_used, ts, true);
|
||||
}
|
||||
|
||||
if (do_cage) {
|
||||
mesh_buffer_cache_create_requested(
|
||||
cache, cache->cage, me, false, false, use_subsurf_fdots, &cache->cd_used, ts, true);
|
||||
mesh_buffer_cache_create_requested(cache,
|
||||
cache->cage,
|
||||
me,
|
||||
ob->obmat,
|
||||
false,
|
||||
false,
|
||||
use_subsurf_fdots,
|
||||
&cache->cd_used,
|
||||
ts,
|
||||
true);
|
||||
}
|
||||
|
||||
mesh_buffer_cache_create_requested(
|
||||
cache, cache->final, me, true, false, use_subsurf_fdots, &cache->cd_used, ts, use_hide);
|
||||
mesh_buffer_cache_create_requested(cache,
|
||||
cache->final,
|
||||
me,
|
||||
ob->obmat,
|
||||
true,
|
||||
false,
|
||||
use_subsurf_fdots,
|
||||
&cache->cd_used,
|
||||
ts,
|
||||
use_hide);
|
||||
|
||||
#ifdef DEBUG
|
||||
check:
|
||||
|
||||
@@ -253,7 +253,7 @@ void DRW_text_edit_mesh_measure_stats(ARegion *ar,
|
||||
BoundBox bb;
|
||||
const rcti rect = {0, ar->winx, 0, ar->winy};
|
||||
|
||||
ED_view3d_clipping_calc(&bb, clip_planes, ar, em->ob, &rect);
|
||||
ED_view3d_clipping_calc(&bb, clip_planes, ar, ob, &rect);
|
||||
}
|
||||
|
||||
if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_LEN) {
|
||||
|
||||
Reference in New Issue
Block a user