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:
authorCampbell Barton <ideasman42@gmail.com>2019-11-08 14:16:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-11-08 14:16:25 +0300
commit5cf5dfcfadf5d276931ea4e5f634b92cccdba124 (patch)
treec8e7e5caedfd752cf00c5f74e415d9a38f514c87
parent326b25ae8e54777cb666d6692850ff7443e7bedf (diff)
Fix T71194: UV Face centers wrong location with sub-surface mesh
-rw-r--r--source/blender/draw/intern/draw_cache_extract_mesh.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.c b/source/blender/draw/intern/draw_cache_extract_mesh.c
index c30cf9f6328..7bc5c0ca91e 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh.c
+++ b/source/blender/draw/intern/draw_cache_extract_mesh.c
@@ -3709,6 +3709,7 @@ static const MeshExtract extract_fdots_nor = {
typedef struct MeshExtract_FdotUV_Data {
float (*vbo_data)[2];
MLoopUV *uv_data;
+ int cd_ofs;
} MeshExtract_FdotUV_Data;
static void *extract_fdots_uv_init(const MeshRenderData *mr, void *buf)
@@ -3728,22 +3729,27 @@ static void *extract_fdots_uv_init(const MeshRenderData *mr, void *buf)
memset(vbo->data, 0x0, mr->poly_len * vbo->format.stride);
}
- CustomData *cd_ldata = &mr->me->ldata;
-
MeshExtract_FdotUV_Data *data = MEM_callocN(sizeof(*data), __func__);
data->vbo_data = (float(*)[2])vbo->data;
- data->uv_data = CustomData_get_layer(cd_ldata, CD_MLOOPUV);
+
+ if (mr->extract_type == MR_EXTRACT_BMESH) {
+ data->cd_ofs = CustomData_get_offset(&mr->bm->ldata, CD_MLOOPUV);
+ }
+ else {
+ data->uv_data = CustomData_get_layer(&mr->me->ldata, CD_MLOOPUV);
+ }
return data;
}
static void extract_fdots_uv_loop_bmesh(const MeshRenderData *UNUSED(mr),
- int l,
+ int UNUSED(l),
BMLoop *loop,
void *_data)
{
MeshExtract_FdotUV_Data *data = (MeshExtract_FdotUV_Data *)_data;
float w = 1.0f / (float)loop->f->len;
- madd_v2_v2fl(data->vbo_data[BM_elem_index_get(loop->f)], data->uv_data[l].uv, w);
+ const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(loop, data->cd_ofs);
+ madd_v2_v2fl(data->vbo_data[BM_elem_index_get(loop->f)], luv->uv, w);
}
static void extract_fdots_uv_loop_mesh(