Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/eevee_volumes.c
| Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | e_data.volumetric_integration_sh = DRW_shader_create_with_lib( | ||||
| datatoc_volumetric_integration_frag_glsl, | datatoc_volumetric_integration_frag_glsl, | ||||
| e_data.volumetric_common_lib, NULL); | e_data.volumetric_common_lib, NULL); | ||||
| e_data.volumetric_resolve_sh = DRW_shader_create_with_lib( | e_data.volumetric_resolve_sh = DRW_shader_create_with_lib( | ||||
| datatoc_gpu_shader_fullscreen_vert_glsl, NULL, | datatoc_gpu_shader_fullscreen_vert_glsl, NULL, | ||||
| datatoc_volumetric_resolve_frag_glsl, | datatoc_volumetric_resolve_frag_glsl, | ||||
| e_data.volumetric_common_lib, NULL); | e_data.volumetric_common_lib, NULL); | ||||
| } | } | ||||
| int EEVEE_volumes_init(EEVEE_SceneLayerData *sldata, EEVEE_Data *vedata) | int EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) | ||||
| { | { | ||||
| EEVEE_StorageList *stl = vedata->stl; | EEVEE_StorageList *stl = vedata->stl; | ||||
| EEVEE_FramebufferList *fbl = vedata->fbl; | EEVEE_FramebufferList *fbl = vedata->fbl; | ||||
| EEVEE_TextureList *txl = vedata->txl; | EEVEE_TextureList *txl = vedata->txl; | ||||
| EEVEE_EffectsInfo *effects = stl->effects; | EEVEE_EffectsInfo *effects = stl->effects; | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| SceneLayer *scene_layer = draw_ctx->scene_layer; | ViewLayer *view_layer = draw_ctx->view_layer; | ||||
| IDProperty *props = BKE_scene_layer_engine_evaluated_get(scene_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); | IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); | ||||
| const float *viewport_size = DRW_viewport_size_get(); | const float *viewport_size = DRW_viewport_size_get(); | ||||
| BLI_listbase_clear(&e_data.smoke_domains); | BLI_listbase_clear(&e_data.smoke_domains); | ||||
| if (BKE_collection_engine_property_value_get_bool(props, "volumetric_enable")) { | if (BKE_collection_engine_property_value_get_bool(props, "volumetric_enable")) { | ||||
| /* Shaders */ | /* Shaders */ | ||||
| ▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | int EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) | ||||
| DRW_TEXTURE_FREE_SAFE(txl->volume_transmittance_history); | DRW_TEXTURE_FREE_SAFE(txl->volume_transmittance_history); | ||||
| DRW_FRAMEBUFFER_FREE_SAFE(fbl->volumetric_fb); | DRW_FRAMEBUFFER_FREE_SAFE(fbl->volumetric_fb); | ||||
| DRW_FRAMEBUFFER_FREE_SAFE(fbl->volumetric_scat_fb); | DRW_FRAMEBUFFER_FREE_SAFE(fbl->volumetric_scat_fb); | ||||
| DRW_FRAMEBUFFER_FREE_SAFE(fbl->volumetric_integ_fb); | DRW_FRAMEBUFFER_FREE_SAFE(fbl->volumetric_integ_fb); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| void EEVEE_volumes_cache_init(EEVEE_SceneLayerData *sldata, EEVEE_Data *vedata) | void EEVEE_volumes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) | ||||
| { | { | ||||
| EEVEE_PassList *psl = vedata->psl; | EEVEE_PassList *psl = vedata->psl; | ||||
| EEVEE_StorageList *stl = vedata->stl; | EEVEE_StorageList *stl = vedata->stl; | ||||
| EEVEE_TextureList *txl = vedata->txl; | EEVEE_TextureList *txl = vedata->txl; | ||||
| EEVEE_EffectsInfo *effects = stl->effects; | EEVEE_EffectsInfo *effects = stl->effects; | ||||
| if ((effects->enabled_effects & EFFECT_VOLUMETRIC) != 0) { | if ((effects->enabled_effects & EFFECT_VOLUMETRIC) != 0) { | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| ▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | if ((effects->enabled_effects & EFFECT_VOLUMETRIC) != 0) { | ||||
| DRW_shgroup_uniform_buffer(grp, "inScattering", &txl->volume_scatter); | DRW_shgroup_uniform_buffer(grp, "inScattering", &txl->volume_scatter); | ||||
| DRW_shgroup_uniform_buffer(grp, "inTransmittance", &txl->volume_transmittance); | DRW_shgroup_uniform_buffer(grp, "inTransmittance", &txl->volume_transmittance); | ||||
| DRW_shgroup_uniform_buffer(grp, "inSceneColor", &e_data.color_src); | DRW_shgroup_uniform_buffer(grp, "inSceneColor", &e_data.color_src); | ||||
| DRW_shgroup_uniform_buffer(grp, "inSceneDepth", &e_data.depth_src); | DRW_shgroup_uniform_buffer(grp, "inSceneDepth", &e_data.depth_src); | ||||
| DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL); | DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL); | ||||
| } | } | ||||
| } | } | ||||
| void EEVEE_volumes_cache_object_add(EEVEE_SceneLayerData *sldata, EEVEE_Data *vedata, Scene *scene, Object *ob) | void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, Scene *scene, Object *ob) | ||||
| { | { | ||||
| float *texcoloc = NULL; | float *texcoloc = NULL; | ||||
| float *texcosize = NULL; | float *texcosize = NULL; | ||||
| struct ModifierData *md = NULL; | struct ModifierData *md = NULL; | ||||
| EEVEE_VolumetricsInfo *volumetrics = sldata->volumetrics; | EEVEE_VolumetricsInfo *volumetrics = sldata->volumetrics; | ||||
| Material *ma = give_current_material(ob, 1); | Material *ma = give_current_material(ob, 1); | ||||
| if (ma == NULL) { | if (ma == NULL) { | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | if (sds->tex != NULL) { | ||||
| DRW_shgroup_uniform_buffer(grp, "sampdensity", &sds->tex); | DRW_shgroup_uniform_buffer(grp, "sampdensity", &sds->tex); | ||||
| } | } | ||||
| if (sds->tex_flame != NULL) { | if (sds->tex_flame != NULL) { | ||||
| DRW_shgroup_uniform_buffer(grp, "sampflame", &sds->tex_flame); | DRW_shgroup_uniform_buffer(grp, "sampflame", &sds->tex_flame); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void EEVEE_volumes_compute(EEVEE_SceneLayerData *UNUSED(sldata), EEVEE_Data *vedata) | void EEVEE_volumes_compute(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) | ||||
| { | { | ||||
| EEVEE_PassList *psl = vedata->psl; | EEVEE_PassList *psl = vedata->psl; | ||||
| EEVEE_TextureList *txl = vedata->txl; | EEVEE_TextureList *txl = vedata->txl; | ||||
| EEVEE_FramebufferList *fbl = vedata->fbl; | EEVEE_FramebufferList *fbl = vedata->fbl; | ||||
| EEVEE_StorageList *stl = vedata->stl; | EEVEE_StorageList *stl = vedata->stl; | ||||
| EEVEE_EffectsInfo *effects = stl->effects; | EEVEE_EffectsInfo *effects = stl->effects; | ||||
| if ((effects->enabled_effects & EFFECT_VOLUMETRIC) != 0) { | if ((effects->enabled_effects & EFFECT_VOLUMETRIC) != 0) { | ||||
| DRW_stats_group_start("Volumetrics"); | DRW_stats_group_start("Volumetrics"); | ||||
| Show All 18 Lines | if ((effects->enabled_effects & EFFECT_VOLUMETRIC) != 0) { | ||||
| /* Restore */ | /* Restore */ | ||||
| DRW_framebuffer_bind(fbl->main); | DRW_framebuffer_bind(fbl->main); | ||||
| DRW_stats_group_end(); | DRW_stats_group_end(); | ||||
| } | } | ||||
| } | } | ||||
| void EEVEE_volumes_resolve(EEVEE_SceneLayerData *UNUSED(sldata), EEVEE_Data *vedata) | void EEVEE_volumes_resolve(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) | ||||
| { | { | ||||
| EEVEE_PassList *psl = vedata->psl; | EEVEE_PassList *psl = vedata->psl; | ||||
| EEVEE_TextureList *txl = vedata->txl; | EEVEE_TextureList *txl = vedata->txl; | ||||
| EEVEE_FramebufferList *fbl = vedata->fbl; | EEVEE_FramebufferList *fbl = vedata->fbl; | ||||
| EEVEE_StorageList *stl = vedata->stl; | EEVEE_StorageList *stl = vedata->stl; | ||||
| EEVEE_EffectsInfo *effects = stl->effects; | EEVEE_EffectsInfo *effects = stl->effects; | ||||
| if ((effects->enabled_effects & EFFECT_VOLUMETRIC) != 0) { | if ((effects->enabled_effects & EFFECT_VOLUMETRIC) != 0) { | ||||
| Show All 37 Lines | |||||