Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/fluid.c
| Show First 20 Lines • Show All 764 Lines • ▼ Show 20 Lines | for (y = output->min[1]; y < output->max[1]; y++) { | ||||
| /* Initialize with first input if in range. */ | /* Initialize with first input if in range. */ | ||||
| if (x >= bb1.min[0] && x < bb1.max[0] && y >= bb1.min[1] && y < bb1.max[1] && | if (x >= bb1.min[0] && x < bb1.max[0] && y >= bb1.min[1] && y < bb1.max[1] && | ||||
| z >= bb1.min[2] && z < bb1.max[2]) { | z >= bb1.min[2] && z < bb1.max[2]) { | ||||
| int index_in = manta_get_index( | int index_in = manta_get_index( | ||||
| x - bb1.min[0], bb1.res[0], y - bb1.min[1], bb1.res[1], z - bb1.min[2]); | x - bb1.min[0], bb1.res[0], y - bb1.min[1], bb1.res[1], z - bb1.min[2]); | ||||
| /* Values. */ | /* Values. */ | ||||
| output->numobjs[index_out] = bb1.numobjs[index_in]; | output->numobjs[index_out] = bb1.numobjs[index_in]; | ||||
| if (output->influence && bb1.influence) { | |||||
| output->influence[index_out] = bb1.influence[index_in]; | output->influence[index_out] = bb1.influence[index_in]; | ||||
| } | |||||
| output->distances[index_out] = bb1.distances[index_in]; | output->distances[index_out] = bb1.distances[index_in]; | ||||
JacquesLucke: @sebbas, should the same "fix" be applied to `distances`? Could this be necessary at some point? | |||||
sebbasUnsubmitted Not Done Inline Actions@Jacques Lucke (JacquesLucke) I think the check for incluence is sufficient. influence is only used for smoke and therefore needs the check. distances is used for smoke and liquid. It should always exist. sebbas: @JacquesLucke I think the check for `incluence` is sufficient. `influence` is only used for… | |||||
| if (output->velocity && bb1.velocity) { | if (output->velocity && bb1.velocity) { | ||||
| copy_v3_v3(&output->velocity[index_out * 3], &bb1.velocity[index_in * 3]); | copy_v3_v3(&output->velocity[index_out * 3], &bb1.velocity[index_in * 3]); | ||||
| } | } | ||||
| } | } | ||||
| /* Apply second input if in range. */ | /* Apply second input if in range. */ | ||||
| if (x >= bb2->min[0] && x < bb2->max[0] && y >= bb2->min[1] && y < bb2->max[1] && | if (x >= bb2->min[0] && x < bb2->max[0] && y >= bb2->min[1] && y < bb2->max[1] && | ||||
| z >= bb2->min[2] && z < bb2->max[2]) { | z >= bb2->min[2] && z < bb2->max[2]) { | ||||
| int index_in = manta_get_index( | int index_in = manta_get_index( | ||||
| x - bb2->min[0], bb2->res[0], y - bb2->min[1], bb2->res[1], z - bb2->min[2]); | x - bb2->min[0], bb2->res[0], y - bb2->min[1], bb2->res[1], z - bb2->min[2]); | ||||
| /* Values. */ | /* Values. */ | ||||
| output->numobjs[index_out] = MAX2(bb2->numobjs[index_in], output->numobjs[index_out]); | output->numobjs[index_out] = MAX2(bb2->numobjs[index_in], output->numobjs[index_out]); | ||||
| if (output->influence && bb2->influence) { | |||||
| if (additive) { | if (additive) { | ||||
| output->influence[index_out] += bb2->influence[index_in] * sample_size; | output->influence[index_out] += bb2->influence[index_in] * sample_size; | ||||
| } | } | ||||
| else { | else { | ||||
| output->influence[index_out] = MAX2(bb2->influence[index_in], | output->influence[index_out] = MAX2(bb2->influence[index_in], | ||||
| output->influence[index_out]); | output->influence[index_out]); | ||||
| } | } | ||||
| } | |||||
| output->distances[index_out] = MIN2(bb2->distances[index_in], | output->distances[index_out] = MIN2(bb2->distances[index_in], | ||||
| output->distances[index_out]); | output->distances[index_out]); | ||||
| if (output->velocity && bb2->velocity) { | if (output->velocity && bb2->velocity) { | ||||
| /* Last sample replaces the velocity. */ | /* Last sample replaces the velocity. */ | ||||
| output->velocity[index_out * 3] = ADD_IF_LOWER(output->velocity[index_out * 3], | output->velocity[index_out * 3] = ADD_IF_LOWER(output->velocity[index_out * 3], | ||||
| bb2->velocity[index_in * 3]); | bb2->velocity[index_in * 3]); | ||||
| output->velocity[index_out * 3 + 1] = ADD_IF_LOWER(output->velocity[index_out * 3 + 1], | output->velocity[index_out * 3 + 1] = ADD_IF_LOWER(output->velocity[index_out * 3 + 1], | ||||
| bb2->velocity[index_in * 3 + 1]); | bb2->velocity[index_in * 3 + 1]); | ||||
| ▲ Show 20 Lines • Show All 4,402 Lines • Show Last 20 Lines | |||||
@Sebastián Barschkis (sebbas), should the same "fix" be applied to distances? Could this be necessary at some point?