~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/modifiers/intern/MOD_displace.c

  • Committer: Package Import Robot
  • Author(s): Kevin Roy
  • Date: 2011-10-21 14:21:47 UTC
  • mfrom: (14.2.10 sid)
  • Revision ID: package-import@ubuntu.com-20111021142147-2yjgibwwnmqibacp
Tags: 2.59-1
* New Upstream Release 2.59 (Closes: #641085)
* debian/control: libglew dependency changed
  - changed Depends libglew1.5-dev to libglew1.6-dev
   due to transition. (Closes: #636177)
* update manpages
* change depends yafray to new yafaray packages 
      (Thanks to Matteo F. Vescovi)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
* $Id: MOD_displace.c 36861 2011-05-24 11:20:33Z jesterking $
 
2
* $Id: MOD_displace.c 38300 2011-07-11 09:15:20Z blendix $
3
3
*
4
4
* ***** BEGIN GPL LICENSE BLOCK *****
5
5
*
169
169
{
170
170
        int i;
171
171
        MVert *mvert;
172
 
        MDeformVert *dvert = NULL;
 
172
        MDeformVert *dvert;
173
173
        int defgrp_index;
174
174
        float (*tex_co)[3];
 
175
        float weight= 1.0f; /* init value unused but some compilers may complain */
175
176
 
176
177
        if(!dmd->texture) return;
177
178
        if(dmd->strength == 0.0f) return;
178
179
 
179
 
        defgrp_index = defgroup_name_index(ob, dmd->defgrp_name);
180
 
 
181
180
        mvert = CDDM_get_verts(dm);
182
 
        if(defgrp_index >= 0)
183
 
                dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
 
181
        modifier_get_vgroup(ob, dm, dmd->defgrp_name, &dvert, &defgrp_index);
184
182
 
185
183
        tex_co = MEM_callocN(sizeof(*tex_co) * numVerts,
186
184
                                 "displaceModifier_do tex_co");
189
187
        for(i = 0; i < numVerts; ++i) {
190
188
                TexResult texres;
191
189
                float delta = 0, strength = dmd->strength;
192
 
                MDeformWeight *def_weight = NULL;
193
190
 
194
191
                if(dvert) {
195
 
                        int j;
196
 
                        for(j = 0; j < dvert[i].totweight; ++j) {
197
 
                                if(dvert[i].dw[j].def_nr == defgrp_index) {
198
 
                                        def_weight = &dvert[i].dw[j];
199
 
                                        break;
200
 
                                }
201
 
                        }
202
 
                        if(!def_weight || def_weight->weight==0.0f) continue;
 
192
                        weight= defvert_find_weight(dvert + i, defgrp_index);
 
193
                        if(weight == 0.0f) continue;
203
194
                }
204
195
 
205
196
                texres.nor = NULL;
207
198
 
208
199
                delta = texres.tin - dmd->midlevel;
209
200
 
210
 
                if(def_weight) strength *= def_weight->weight;
 
201
                if(dvert) strength *= weight;
211
202
 
212
203
                delta *= strength;
213
204
                CLAMP(delta, -10000, 10000);