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-04 08:56:06 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-04 08:56:06 +0400
commita02f89c2ad722761f34ec68ef60573ec2cbc7c1f (patch)
tree83cbfd926dbc71119259ce9e7d54cea1c1352590 /source/blender/modifiers/intern/MOD_util.c
parent9a0bf1ffa41c9fc3193c975e1f99282837d41e67 (diff)
bugfix - get_texture_coords() used by wave/warp/weight modifiers could initialize a verts coords from the 4th UV of a triangle face.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_util.c')
-rw-r--r--source/blender/modifiers/intern/MOD_util.c41
1 files changed, 12 insertions, 29 deletions
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index cc7a5e54fbd..5be7eb6af3d 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -107,36 +107,19 @@ void get_texture_coords(MappingInfoModifierData *dmd, Object *ob,
/* verts are given the UV from the first face that uses them */
for(i = 0, mf = mface; i < numFaces; ++i, ++mf, ++tf) {
- if(!done[mf->v1]) {
- texco[mf->v1][0] = tf->uv[0][0];
- texco[mf->v1][1] = tf->uv[0][1];
- texco[mf->v1][2] = 0;
- done[mf->v1] = 1;
- }
- if(!done[mf->v2]) {
- texco[mf->v2][0] = tf->uv[1][0];
- texco[mf->v2][1] = tf->uv[1][1];
- texco[mf->v2][2] = 0;
- done[mf->v2] = 1;
- }
- if(!done[mf->v3]) {
- texco[mf->v3][0] = tf->uv[2][0];
- texco[mf->v3][1] = tf->uv[2][1];
- texco[mf->v3][2] = 0;
- done[mf->v3] = 1;
- }
- if(!done[mf->v4]) {
- texco[mf->v4][0] = tf->uv[3][0];
- texco[mf->v4][1] = tf->uv[3][1];
- texco[mf->v4][2] = 0;
- done[mf->v4] = 1;
- }
- }
+ unsigned int fidx= mf->v4 ? 3:2;
+
+ do {
+ unsigned int vidx = *(&mf->v1 + fidx);
+
+ 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;
+ done[vidx] = 1;
+ }
- /* remap UVs from [0, 1] to [-1, 1] */
- for(i = 0; i < numVerts; ++i) {
- texco[i][0] = texco[i][0] * 2 - 1;
- texco[i][1] = texco[i][1] * 2 - 1;
+ } while (fidx--);
}
MEM_freeN(done);