Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/eevee_volumes.c
| Show First 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | int EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) | ||||
| 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; | ||||
| EEVEE_CommonUniformBuffer *common_data = &sldata->common_data; | EEVEE_CommonUniformBuffer *common_data = &sldata->common_data; | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph); | const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph); | ||||
| const float *viewport_size = DRW_viewport_size_get(); | const float *viewport_size = DRW_viewport_render_size_get(); | ||||
| BLI_listbase_clear(&e_data.smoke_domains); | BLI_listbase_clear(&e_data.smoke_domains); | ||||
| if (scene_eval->eevee.flag & SCE_EEVEE_VOLUMETRIC_ENABLED) { | if (scene_eval->eevee.flag & SCE_EEVEE_VOLUMETRIC_ENABLED) { | ||||
| /* Shaders */ | /* Shaders */ | ||||
| if (!e_data.volumetric_scatter_sh) { | if (!e_data.volumetric_scatter_sh) { | ||||
| eevee_create_shader_volumes(); | eevee_create_shader_volumes(); | ||||
| ▲ Show 20 Lines • Show All 412 Lines • ▼ Show 20 Lines | 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) { | ||||
| DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); | DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); | ||||
| GPUTexture *depth = txl->depth ? txl->depth : dtxl->depth; | |||||
| e_data.color_src = txl->color; | e_data.color_src = txl->color; | ||||
| e_data.depth_src = dtxl->depth; | e_data.depth_src = depth; | ||||
| /* Step 4: Apply for opaque */ | /* Step 4: Apply for opaque */ | ||||
| GPU_framebuffer_bind(fbl->effect_color_fb); | GPU_framebuffer_bind(fbl->effect_color_fb); | ||||
| DRW_draw_pass(psl->volumetric_resolve_ps); | DRW_draw_pass(psl->volumetric_resolve_ps); | ||||
| /* Swap the buffers and rebind depth to the current buffer */ | /* Swap the buffers and rebind depth to the current buffer */ | ||||
| SWAP(GPUFrameBuffer *, fbl->main_fb, fbl->effect_fb); | SWAP(GPUFrameBuffer *, fbl->main_fb, fbl->effect_fb); | ||||
| SWAP(GPUFrameBuffer *, fbl->main_color_fb, fbl->effect_color_fb); | SWAP(GPUFrameBuffer *, fbl->main_color_fb, fbl->effect_color_fb); | ||||
| SWAP(GPUTexture *, txl->color, txl->color_post); | SWAP(GPUTexture *, txl->color, txl->color_post); | ||||
| /* Restore */ | /* Restore */ | ||||
| GPU_framebuffer_texture_detach(fbl->effect_fb, dtxl->depth); | GPU_framebuffer_texture_detach(fbl->effect_fb, depth); | ||||
| GPU_framebuffer_texture_attach(fbl->main_fb, dtxl->depth, 0, 0); | GPU_framebuffer_texture_attach(fbl->main_fb, depth, 0, 0); | ||||
| GPU_framebuffer_bind(fbl->main_fb); | GPU_framebuffer_bind(fbl->main_fb); | ||||
| } | } | ||||
| } | } | ||||
| void EEVEE_volumes_free_smoke_textures(void) | void EEVEE_volumes_free_smoke_textures(void) | ||||
| { | { | ||||
| /* Free Smoke Textures after rendering */ | /* Free Smoke Textures after rendering */ | ||||
| for (LinkData *link = e_data.smoke_domains.first; link; link = link->next) { | for (LinkData *link = e_data.smoke_domains.first; link; link = link->next) { | ||||
| Show All 17 Lines | |||||