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 10:20:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-04 10:20:10 +0400
commitd0cdefd9fa37bf6788dad27b87d8d569c58ad94a (patch)
tree8807f7717662ad96cf6ad1d8df0a5caa12162361 /source/blender/modifiers/intern/MOD_util.c
parent8d8403c15ec8694d7d71d8a9f4a9e3a1fade666e (diff)
parent434c1e6df82a082fe03034a3ad3825f7b50ea533 (diff)
svn merge ^/trunk/blender -r43092:43092
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 8c2b86094f1..6d2e2b42405 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);