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>2012-01-05 01:36:06 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-05 01:36:06 +0400
commit67db64bf818f9cc1dddbcef9dbb7213422d82feb (patch)
tree49283fb9b655ebffa38619ee73e6d1f196fe7d4b /source/blender/modifiers/intern/MOD_util.c
parent3bf419503a9f705ee1a002349903a43a70a9ac60 (diff)
get texture coords from MLoopUV's rathers then MTFace's with get_texture_coords().
Diffstat (limited to 'source/blender/modifiers/intern/MOD_util.c')
-rw-r--r--source/blender/modifiers/intern/MOD_util.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index 6d2e2b42405..85172c3527c 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -93,29 +93,31 @@ void get_texture_coords(MappingInfoModifierData *dmd, Object *ob,
/* UVs need special handling, since they come from faces */
if(texmapping == MOD_DISP_MAP_UV) {
- if(CustomData_has_layer(&dm->faceData, CD_MTFACE)) {
- MFace *mface = dm->getTessFaceArray(dm);
- MFace *mf;
+ if(CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) {
+ MPoly *mpoly = dm->getPolyArray(dm);
+ MPoly *mp;
+ MLoop *mloop = dm->getLoopArray(dm);
char *done = MEM_callocN(sizeof(*done) * numVerts,
"get_texture_coords done");
- int numFaces = dm->getNumTessFaces(dm);
+ int numPolys = dm->getNumPolys(dm);
char uvname[32];
- MTFace *tf;
+ MLoopUV *mloop_uv;
- CustomData_validate_layer_name(&dm->faceData, CD_MTFACE, dmd->uvlayer_name, uvname);
- tf = CustomData_get_layer_named(&dm->faceData, CD_MTFACE, uvname);
+ CustomData_validate_layer_name(&dm->loopData, CD_MLOOPUV, dmd->uvlayer_name, uvname);
+ mloop_uv = CustomData_get_layer_named(&dm->loopData, CD_MLOOPUV, uvname);
/* verts are given the UV from the first face that uses them */
- for(i = 0, mf = mface; i < numFaces; ++i, ++mf, ++tf) {
- unsigned int fidx= mf->v4 ? 3:2;
+ for(i = 0, mp = mpoly; i < numPolys; ++i, ++mp) {
+ unsigned int fidx= mp->totloop - 1;
do {
- unsigned int vidx = *(&mf->v1 + fidx);
+ unsigned int lidx= mp->loopstart + fidx;
+ unsigned int vidx= mloop[lidx].v;
if (done[vidx] == 0) {
/* remap UVs from [0, 1] to [-1, 1] */
- texco[vidx][0] = (tf->uv[fidx][0] * 2.0f) - 1.0f;
- texco[vidx][1] = (tf->uv[fidx][1] * 2.0f) - 1.0f;
+ texco[vidx][0] = (mloop_uv[lidx].uv[0] * 2.0f) - 1.0f;
+ texco[vidx][1] = (mloop_uv[lidx].uv[1] * 2.0f) - 1.0f;
done[vidx] = 1;
}