~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/render/intern/source/pointdensity.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-02-19 11:24:23 UTC
  • mfrom: (14.2.23 sid)
  • Revision ID: package-import@ubuntu.com-20140219112423-rkmaz2m7ha06d4tk
Tags: 2.69-3ubuntu1
* Merge with Debian; remaining changes:
  - Configure without OpenImageIO on armhf, as it is not available on
    Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
107
107
{
108
108
        DerivedMesh* dm;
109
109
        ParticleKey state;
 
110
        ParticleCacheKey *cache;
110
111
        ParticleSimulationData sim= {NULL};
111
112
        ParticleData *pa=NULL;
112
113
        float cfra = BKE_scene_frame_get(re->scene);
139
140
        invert_m4_m4(ob->imat, ob->obmat);
140
141
        
141
142
        total_particles = psys->totpart+psys->totchild;
142
 
        psys->lattice=psys_get_lattice(&sim);
 
143
        psys->lattice_deform_data = psys_create_lattice_deform_data(&sim);
143
144
        
144
145
        pd->point_tree = BLI_bvhtree_new(total_particles, 0.0, 4, 6);
145
146
        alloc_point_data(pd, total_particles, data_used);
153
154
 
154
155
        for (i=0, pa=psys->particles; i < total_particles; i++, pa++) {
155
156
 
156
 
                state.time = cfra;
157
 
                if (psys_get_particle_state(&sim, i, &state, 0)) {
158
 
                        
159
 
                        copy_v3_v3(partco, state.co);
160
 
                        
161
 
                        if (pd->psys_cache_space == TEX_PD_OBJECTSPACE)
162
 
                                mul_m4_v3(ob->imat, partco);
163
 
                        else if (pd->psys_cache_space == TEX_PD_OBJECTLOC) {
164
 
                                sub_v3_v3(partco, ob->loc);
165
 
                        }
166
 
                        else {
167
 
                                /* TEX_PD_WORLDSPACE */
168
 
                        }
169
 
                        
170
 
                        BLI_bvhtree_insert(pd->point_tree, i, partco, 1);
171
 
                        
172
 
                        if (data_used & POINT_DATA_VEL) {
173
 
                                pd->point_data[i*3 + 0] = state.vel[0];
174
 
                                pd->point_data[i*3 + 1] = state.vel[1];
175
 
                                pd->point_data[i*3 + 2] = state.vel[2];
176
 
                        }
 
157
                if (psys->part->type == PART_HAIR) {
 
158
                        /* hair particles */
 
159
                        if (i < psys->totpart && psys->pathcache)
 
160
                                cache = psys->pathcache[i];
 
161
                        else if (i >= psys->totpart && psys->childcache)
 
162
                                cache = psys->childcache[i - psys->totpart];
 
163
                        else
 
164
                                continue;
 
165
 
 
166
                        cache += cache->steps; /* use endpoint */
 
167
 
 
168
                        copy_v3_v3(state.co, cache->co);
 
169
                        zero_v3(state.vel);
 
170
                        state.time = 0.0f;
 
171
                }
 
172
                else {
 
173
                        /* emitter particles */
 
174
                        state.time = cfra;
 
175
 
 
176
                        if (!psys_get_particle_state(&sim, i, &state, 0))
 
177
                                continue;
 
178
 
177
179
                        if (data_used & POINT_DATA_LIFE) {
178
 
                                float pa_time;
179
 
                                
180
180
                                if (i < psys->totpart) {
181
 
                                        pa_time = (cfra - pa->time)/pa->lifetime;
 
181
                                        state.time = (cfra - pa->time)/pa->lifetime;
182
182
                                }
183
183
                                else {
184
184
                                        ChildParticle *cpa= (psys->child + i) - psys->totpart;
185
185
                                        float pa_birthtime, pa_dietime;
186
186
                                        
187
 
                                        pa_time = psys_get_child_time(psys, cpa, cfra, &pa_birthtime, &pa_dietime);
 
187
                                        state.time = psys_get_child_time(psys, cpa, cfra, &pa_birthtime, &pa_dietime);
188
188
                                }
189
 
                                
190
 
                                pd->point_data[offset + i] = pa_time;
191
 
                                
192
189
                        }
193
190
                }
 
191
 
 
192
                copy_v3_v3(partco, state.co);
 
193
                
 
194
                if (pd->psys_cache_space == TEX_PD_OBJECTSPACE)
 
195
                        mul_m4_v3(ob->imat, partco);
 
196
                else if (pd->psys_cache_space == TEX_PD_OBJECTLOC) {
 
197
                        sub_v3_v3(partco, ob->loc);
 
198
                }
 
199
                else {
 
200
                        /* TEX_PD_WORLDSPACE */
 
201
                }
 
202
                
 
203
                BLI_bvhtree_insert(pd->point_tree, i, partco, 1);
 
204
                
 
205
                if (data_used & POINT_DATA_VEL) {
 
206
                        pd->point_data[i*3 + 0] = state.vel[0];
 
207
                        pd->point_data[i*3 + 1] = state.vel[1];
 
208
                        pd->point_data[i*3 + 2] = state.vel[2];
 
209
                }
 
210
                if (data_used & POINT_DATA_LIFE) {
 
211
                        pd->point_data[offset + i] = state.time;
 
212
                }
194
213
        }
195
214
        
196
215
        BLI_bvhtree_balance(pd->point_tree);
197
216
        dm->release(dm);
198
217
        
199
 
        if (psys->lattice) {
200
 
                end_latt_deform(psys->lattice);
201
 
                psys->lattice=0;
 
218
        if (psys->lattice_deform_data) {
 
219
                end_latt_deform(psys->lattice_deform_data);
 
220
                psys->lattice_deform_data = NULL;
202
221
        }
203
222
        
204
223
        psys_render_restore(ob, psys);