Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/smoke.c
| Show First 20 Lines • Show All 689 Lines • ▼ Show 20 Lines | void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData *tsmd) | ||||
| else if (tsmd->coll) { | else if (tsmd->coll) { | ||||
| /* leave it as initialized, collision settings is mostly caches */ | /* leave it as initialized, collision settings is mostly caches */ | ||||
| } | } | ||||
| } | } | ||||
| #ifdef WITH_SMOKE | #ifdef WITH_SMOKE | ||||
| // forward decleration | // forward decleration | ||||
| static void smoke_calc_transparency(SmokeDomainSettings *sds, SceneLayer *sl); | static void smoke_calc_transparency(SmokeDomainSettings *sds, ViewLayer *sl); | ||||
| static float calc_voxel_transp(float *result, float *input, int res[3], int *pixel, float *tRay, float correct); | static float calc_voxel_transp(float *result, float *input, int res[3], int *pixel, float *tRay, float correct); | ||||
| static int get_lamp(SceneLayer *sl, float *light) | static int get_lamp(ViewLayer *sl, float *light) | ||||
| { | { | ||||
| Base *base_tmp = NULL; | Base *base_tmp = NULL; | ||||
| int found_lamp = 0; | int found_lamp = 0; | ||||
| // try to find a lamp, preferably local | // try to find a lamp, preferably local | ||||
| for (base_tmp = FIRSTBASE(sl); base_tmp; base_tmp = base_tmp->next) { | for (base_tmp = FIRSTBASE(sl); base_tmp; base_tmp = base_tmp->next) { | ||||
| if (base_tmp->object->type == OB_LAMP) { | if (base_tmp->object->type == OB_LAMP) { | ||||
| Lamp *la = base_tmp->object->data; | Lamp *la = base_tmp->object->data; | ||||
| ▲ Show 20 Lines • Show All 2,096 Lines • ▼ Show 20 Lines | if (framenr != startframe) | ||||
| } | } | ||||
| } | } | ||||
| step(eval_ctx, scene, ob, smd, dm, scene->r.frs_sec / scene->r.frs_sec_base); | step(eval_ctx, scene, ob, smd, dm, scene->r.frs_sec / scene->r.frs_sec_base); | ||||
| } | } | ||||
| // create shadows before writing cache so they get stored | // create shadows before writing cache so they get stored | ||||
| smoke_calc_transparency(sds, eval_ctx->scene_layer); | smoke_calc_transparency(sds, eval_ctx->view_layer); | ||||
| if (sds->wt && sds->total_cells > 1) { | if (sds->wt && sds->total_cells > 1) { | ||||
| smoke_turbulence_step(sds->wt, sds->fluid); | smoke_turbulence_step(sds->wt, sds->fluid); | ||||
| } | } | ||||
| BKE_ptcache_validate(cache, framenr); | BKE_ptcache_validate(cache, framenr); | ||||
| if (framenr != startframe) | if (framenr != startframe) | ||||
| BKE_ptcache_write(&pid, framenr); | BKE_ptcache_write(&pid, framenr); | ||||
| ▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | for (i = 0; i < n; i++) { | ||||
| err_1 += dy2; | err_1 += dy2; | ||||
| err_2 += dx2; | err_2 += dx2; | ||||
| pixel[2] += z_inc; | pixel[2] += z_inc; | ||||
| } | } | ||||
| } | } | ||||
| cb(result, input, res, pixel, tRay, correct); | cb(result, input, res, pixel, tRay, correct); | ||||
| } | } | ||||
| static void smoke_calc_transparency(SmokeDomainSettings *sds, SceneLayer *sl) | static void smoke_calc_transparency(SmokeDomainSettings *sds, ViewLayer *sl) | ||||
| { | { | ||||
| float bv[6] = {0}; | float bv[6] = {0}; | ||||
| float light[3]; | float light[3]; | ||||
| int a, z, slabsize = sds->res[0] * sds->res[1], size = sds->res[0] * sds->res[1] * sds->res[2]; | int a, z, slabsize = sds->res[0] * sds->res[1], size = sds->res[0] * sds->res[1] * sds->res[2]; | ||||
| float *density = smoke_get_density(sds->fluid); | float *density = smoke_get_density(sds->fluid); | ||||
| float correct = -7.0f * sds->dx; | float correct = -7.0f * sds->dx; | ||||
| if (!get_lamp(sl, light)) return; | if (!get_lamp(sl, light)) return; | ||||
| ▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines | |||||