Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/workbench/workbench_volume.c
| Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | void workbench_volume_cache_populate(WORKBENCH_Data *vedata, Scene *scene, Object *ob, ModifierData *md) | ||||
| SmokeModifierData *smd = (SmokeModifierData *)md; | SmokeModifierData *smd = (SmokeModifierData *)md; | ||||
| SmokeDomainSettings *sds = smd->domain; | SmokeDomainSettings *sds = smd->domain; | ||||
| WORKBENCH_PrivateData *wpd = vedata->stl->g_data; | WORKBENCH_PrivateData *wpd = vedata->stl->g_data; | ||||
| WORKBENCH_EffectInfo *effect_info = vedata->stl->effects; | WORKBENCH_EffectInfo *effect_info = vedata->stl->effects; | ||||
| DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); | DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); | ||||
| DRWShadingGroup *grp = NULL; | DRWShadingGroup *grp = NULL; | ||||
| /* Don't show smoke before simulation starts, this could be made an option in the future. */ | /* Don't show smoke before simulation starts, this could be made an option in the future. */ | ||||
| if (!sds->fluid || CFRA < sds->point_cache[0]->startframe) { | if (!sds->fluid || !(sds->type == FLUID_DOMAIN_TYPE_GAS) /* || CFRA < sds->point_cache[0]->startframe*/ ) { | ||||
| return; | return; | ||||
| } | } | ||||
| wpd->volumes_do = true; | wpd->volumes_do = true; | ||||
| const bool show_highres = BKE_smoke_show_highres(scene, sds); | |||||
| if (sds->use_coba) { | if (sds->use_coba) { | ||||
| GPU_create_smoke_coba_field(smd); | GPU_create_smoke_coba_field(smd); | ||||
| } | } | ||||
| else if (!sds->wt || !show_highres) { | else if (!(sds->flags & FLUID_DOMAIN_USE_NOISE)) { | ||||
| GPU_create_smoke(smd, 0); | GPU_create_smoke(smd, 0); | ||||
| } | } | ||||
| else if (sds->wt && show_highres) { | else if (sds->flags & FLUID_DOMAIN_USE_NOISE) { | ||||
| GPU_create_smoke(smd, 1); | GPU_create_smoke(smd, 1); | ||||
| } | } | ||||
| if ((!sds->use_coba && sds->tex == NULL) || | if ((!sds->use_coba && sds->tex == NULL) || | ||||
| (sds->use_coba && sds->tex_field == NULL)) | (sds->use_coba && sds->tex_field == NULL)) | ||||
| { | { | ||||
| return; | return; | ||||
| } | } | ||||
| const bool use_slice = (sds->slice_method == MOD_SMOKE_SLICE_AXIS_ALIGNED && | const bool use_slice = (sds->slice_method == FLUID_DOMAIN_SLICE_AXIS_ALIGNED && | ||||
| sds->axis_slice_method == AXIS_SLICE_SINGLE); | sds->axis_slice_method == AXIS_SLICE_SINGLE); | ||||
| const bool cubic_interp = (sds->interp_method == VOLUME_INTERP_CUBIC); | const bool cubic_interp = (sds->interp_method == VOLUME_INTERP_CUBIC); | ||||
| GPUShader *sh = volume_shader_get(use_slice, sds->use_coba, cubic_interp); | GPUShader *sh = volume_shader_get(use_slice, sds->use_coba, cubic_interp); | ||||
| if (use_slice) { | if (use_slice) { | ||||
| float invviewmat[4][4]; | float invviewmat[4][4]; | ||||
| DRW_viewport_matrix_get(invviewmat, DRW_MAT_VIEWINV); | DRW_viewport_matrix_get(invviewmat, DRW_MAT_VIEWINV); | ||||
| Show All 32 Lines | void workbench_volume_cache_populate(WORKBENCH_Data *vedata, Scene *scene, Object *ob, ModifierData *md) | ||||
| } | } | ||||
| if (sds->use_coba) { | if (sds->use_coba) { | ||||
| DRW_shgroup_uniform_texture(grp, "densityTexture", sds->tex_field); | DRW_shgroup_uniform_texture(grp, "densityTexture", sds->tex_field); | ||||
| DRW_shgroup_uniform_texture(grp, "transferTexture", sds->tex_coba); | DRW_shgroup_uniform_texture(grp, "transferTexture", sds->tex_coba); | ||||
| } | } | ||||
| else { | else { | ||||
| static float white[3] = {1.0f, 1.0f, 1.0f}; | static float white[3] = {1.0f, 1.0f, 1.0f}; | ||||
| bool use_constant_color = ((sds->active_fields & SM_ACTIVE_COLORS) == 0 && | bool use_constant_color = ((sds->active_fields & FLUID_DOMAIN_ACTIVE_COLORS) == 0 && | ||||
| (sds->active_fields & SM_ACTIVE_COLOR_SET) != 0); | (sds->active_fields & FLUID_DOMAIN_ACTIVE_COLOR_SET) != 0); | ||||
| DRW_shgroup_uniform_texture(grp, "densityTexture", sds->tex); | DRW_shgroup_uniform_texture(grp, "densityTexture", sds->tex); | ||||
| DRW_shgroup_uniform_texture(grp, "shadowTexture", sds->tex_shadow); | DRW_shgroup_uniform_texture(grp, "shadowTexture", sds->tex_shadow); | ||||
| DRW_shgroup_uniform_texture(grp, "flameTexture", (sds->tex_flame) ? sds->tex_flame : e_data.dummy_tex); | DRW_shgroup_uniform_texture(grp, "flameTexture", (sds->tex_flame) ? sds->tex_flame : e_data.dummy_tex); | ||||
| DRW_shgroup_uniform_texture(grp, "flameColorTexture", (sds->tex_flame) ? sds->tex_flame_coba : e_data.dummy_coba_tex); | DRW_shgroup_uniform_texture(grp, "flameColorTexture", (sds->tex_flame) ? sds->tex_flame_coba : e_data.dummy_coba_tex); | ||||
| DRW_shgroup_uniform_vec3(grp, "activeColor", (use_constant_color) ? sds->active_color : white, 1); | DRW_shgroup_uniform_vec3(grp, "activeColor", (use_constant_color) ? sds->active_color : white, 1); | ||||
| } | } | ||||
| DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth); | DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth); | ||||
| DRW_shgroup_uniform_float_copy(grp, "densityScale", 10.0f * sds->display_thickness); | DRW_shgroup_uniform_float_copy(grp, "densityScale", 10.0f * sds->display_thickness); | ||||
| Show All 25 Lines | |||||