~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/blenkernel/intern/smoke.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:
259
259
                zero_v3_int(sds->base_res);
260
260
                copy_v3_v3(sds->cell_size, size);
261
261
        }
262
 
        mul_v3_v3(size, ob->size);
 
262
        /* apply object scale */
 
263
        for (i = 0; i < 3; i++) {
 
264
                size[i] = fabs(size[i] * ob->size[i]);
 
265
        }
263
266
        copy_v3_v3(sds->global_size, size);
264
267
        copy_v3_v3(sds->dp0, min);
265
268
 
272
275
        /* define grid resolutions from longest domain side */
273
276
        if (size[0] >= MAX2(size[1], size[2])) {
274
277
                scale = res / size[0];
275
 
                sds->scale = size[0] / ob->size[0];
 
278
                sds->scale = size[0] / fabs(ob->size[0]);
276
279
                sds->base_res[0] = res;
277
280
                sds->base_res[1] = (int)(size[1] * scale + 0.5f);
278
281
                sds->base_res[2] = (int)(size[2] * scale + 0.5f);
279
282
        }
280
283
        else if (size[1] >= MAX2(size[0], size[2])) {
281
284
                scale = res / size[1];
282
 
                sds->scale = size[1] / ob->size[1];
 
285
                sds->scale = size[1] / fabs(ob->size[1]);
283
286
                sds->base_res[0] = (int)(size[0] * scale + 0.5f);
284
287
                sds->base_res[1] = res;
285
288
                sds->base_res[2] = (int)(size[2] * scale + 0.5f);
286
289
        }
287
290
        else {
288
291
                scale = res / size[2];
289
 
                sds->scale = size[2] / ob->size[2];
 
292
                sds->scale = size[2] / fabs(ob->size[2]);
290
293
                sds->base_res[0] = (int)(size[0] * scale + 0.5f);
291
294
                sds->base_res[1] = (int)(size[1] * scale + 0.5f);
292
295
                sds->base_res[2] = res;
719
722
                DerivedMesh *dm = NULL;
720
723
                MVert *mvert = NULL;
721
724
                MFace *mface = NULL;
722
 
                BVHTreeFromMesh treeData = {0};
 
725
                BVHTreeFromMesh treeData = {NULL};
723
726
                int numverts, i, z;
724
727
 
725
728
                float surface_distance = 0.6;
1139
1142
 
1140
1143
                                        /* values */
1141
1144
                                        output->influence[index_out] = em1.influence[index_in];
1142
 
                                        if (output->velocity) {
1143
 
                                                output->velocity[index_out] = em1.velocity[index_in];
 
1145
                                        if (output->velocity && em1.velocity) {
 
1146
                                                copy_v3_v3(&output->velocity[index_out * 3], &em1.velocity[index_in * 3]);
1144
1147
                                        }
1145
1148
                                }
1146
1149
 
1157
1160
                                        else {
1158
1161
                                                output->influence[index_out] = MAX2(em2->influence[index_in], output->influence[index_out]);
1159
1162
                                        }
1160
 
                                        if (output->velocity) {
 
1163
                                        if (output->velocity && em2->velocity) {
1161
1164
                                                /* last sample replaces the velocity */
1162
 
                                                output->velocity[index_out] = ADD_IF_LOWER(output->velocity[index_out], em2->velocity[index_in]);
 
1165
                                                output->velocity[index_out * 3]         = ADD_IF_LOWER(output->velocity[index_out * 3], em2->velocity[index_in * 3]);
 
1166
                                                output->velocity[index_out * 3 + 1] = ADD_IF_LOWER(output->velocity[index_out * 3 + 1], em2->velocity[index_in * 3 + 1]);
 
1167
                                                output->velocity[index_out * 3 + 2] = ADD_IF_LOWER(output->velocity[index_out * 3 + 2], em2->velocity[index_in * 3 + 2]);
1163
1168
                                        }
1164
1169
                                }
1165
1170
        } // low res loop
1570
1575
                MVert *mvert_orig = NULL;
1571
1576
                MFace *mface = NULL;
1572
1577
                MTFace *tface = NULL;
1573
 
                BVHTreeFromMesh treeData = {0};
 
1578
                BVHTreeFromMesh treeData = {NULL};
1574
1579
                int numOfVerts, i, z;
1575
1580
                float flow_center[3] = {0};
1576
1581
 
2105
2110
                                // float scene_subframe = scene->r.subframe;  // UNUSED
2106
2111
                                int subframe;
2107
2112
                                for (subframe = 0; subframe <= subframes; subframe++) {
2108
 
                                        EmissionMap em_temp = {0};
 
2113
                                        EmissionMap em_temp = {NULL};
2109
2114
                                        float sample_size = 1.0f / (float)(subframes+1);
2110
2115
                                        float prev_frame_pos = sample_size * (float)(subframe+1);
2111
2116
                                        float sdt = dt * sample_size;
2381
2386
        if (effectors)
2382
2387
        {
2383
2388
                float *density = smoke_get_density(sds->fluid);
 
2389
                float *fuel = smoke_get_fuel(sds->fluid);
2384
2390
                float *force_x = smoke_get_force_x(sds->fluid);
2385
2391
                float *force_y = smoke_get_force_y(sds->fluid);
2386
2392
                float *force_z = smoke_get_force_z(sds->fluid);
2403
2409
                                        float voxelCenter[3] = {0, 0, 0}, vel[3] = {0, 0, 0}, retvel[3] = {0, 0, 0};
2404
2410
                                        unsigned int index = smoke_get_index(x, sds->res[0], y, sds->res[1], z);
2405
2411
 
2406
 
                                        if ((density[index] < FLT_EPSILON) || obstacle[index])
 
2412
                                        if (((fuel ? MAX2(density[index], fuel[index]) : density[index]) < FLT_EPSILON) || obstacle[index])
2407
2413
                                                continue;
2408
2414
 
2409
2415
                                        vel[0] = velocity_x[index];