Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/eevee_engine.c
| Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
| /* *********** FUNCTIONS *********** */ | /* *********** FUNCTIONS *********** */ | ||||
| static void EEVEE_engine_init(void *ved) | static void EEVEE_engine_init(void *ved) | ||||
| { | { | ||||
| EEVEE_Data *vedata = (EEVEE_Data *)ved; | EEVEE_Data *vedata = (EEVEE_Data *)ved; | ||||
| EEVEE_TextureList *txl = vedata->txl; | EEVEE_TextureList *txl = vedata->txl; | ||||
| EEVEE_FramebufferList *fbl = vedata->fbl; | EEVEE_FramebufferList *fbl = vedata->fbl; | ||||
| EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl; | EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl; | ||||
| EEVEE_SceneLayerData *sldata = EEVEE_scene_layer_data_get(); | EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_get(); | ||||
| if (!stl->g_data) { | if (!stl->g_data) { | ||||
| /* Alloc transient pointers */ | /* Alloc transient pointers */ | ||||
| stl->g_data = MEM_callocN(sizeof(*stl->g_data), __func__); | stl->g_data = MEM_callocN(sizeof(*stl->g_data), __func__); | ||||
| } | } | ||||
| stl->g_data->background_alpha = 1.0f; | stl->g_data->background_alpha = 1.0f; | ||||
| stl->g_data->valid_double_buffer = (txl->color_double_buffer != NULL); | stl->g_data->valid_double_buffer = (txl->color_double_buffer != NULL); | ||||
| Show All 18 Lines | if (stl->effects->taa_current_sample > 1) { | ||||
| DRW_viewport_matrix_override_unset(DRW_MAT_WIN); | DRW_viewport_matrix_override_unset(DRW_MAT_WIN); | ||||
| DRW_viewport_matrix_override_unset(DRW_MAT_WININV); | DRW_viewport_matrix_override_unset(DRW_MAT_WININV); | ||||
| } | } | ||||
| } | } | ||||
| static void EEVEE_cache_init(void *vedata) | static void EEVEE_cache_init(void *vedata) | ||||
| { | { | ||||
| EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl; | EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl; | ||||
| EEVEE_SceneLayerData *sldata = EEVEE_scene_layer_data_get(); | EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_get(); | ||||
| EEVEE_bloom_cache_init(sldata, vedata); | EEVEE_bloom_cache_init(sldata, vedata); | ||||
| EEVEE_depth_of_field_cache_init(sldata, vedata); | EEVEE_depth_of_field_cache_init(sldata, vedata); | ||||
| EEVEE_effects_cache_init(sldata, vedata); | EEVEE_effects_cache_init(sldata, vedata); | ||||
| EEVEE_lightprobes_cache_init(sldata, vedata); | EEVEE_lightprobes_cache_init(sldata, vedata); | ||||
| EEVEE_lights_cache_init(sldata, psl); | EEVEE_lights_cache_init(sldata, psl); | ||||
| EEVEE_materials_cache_init(vedata); | EEVEE_materials_cache_init(vedata); | ||||
| EEVEE_motion_blur_cache_init(sldata, vedata); | EEVEE_motion_blur_cache_init(sldata, vedata); | ||||
| EEVEE_occlusion_cache_init(sldata, vedata); | EEVEE_occlusion_cache_init(sldata, vedata); | ||||
| EEVEE_screen_raytrace_cache_init(sldata, vedata); | EEVEE_screen_raytrace_cache_init(sldata, vedata); | ||||
| EEVEE_subsurface_cache_init(sldata, vedata); | EEVEE_subsurface_cache_init(sldata, vedata); | ||||
| EEVEE_temporal_sampling_cache_init(sldata, vedata); | EEVEE_temporal_sampling_cache_init(sldata, vedata); | ||||
| EEVEE_volumes_cache_init(sldata, vedata); | EEVEE_volumes_cache_init(sldata, vedata); | ||||
| } | } | ||||
| static void EEVEE_cache_populate(void *vedata, Object *ob) | static void EEVEE_cache_populate(void *vedata, Object *ob) | ||||
| { | { | ||||
| EEVEE_SceneLayerData *sldata = EEVEE_scene_layer_data_get(); | EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_get(); | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| const bool is_active = (ob == draw_ctx->obact); | const bool is_active = (ob == draw_ctx->obact); | ||||
| if (is_active) { | if (is_active) { | ||||
| if (DRW_object_is_mode_shade(ob) == true) { | if (DRW_object_is_mode_shade(ob) == true) { | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| Show All 33 Lines | else if (ob->type == OB_LAMP) { | ||||
| else { | else { | ||||
| EEVEE_lights_cache_add(sldata, ob); | EEVEE_lights_cache_add(sldata, ob); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void EEVEE_cache_finish(void *vedata) | static void EEVEE_cache_finish(void *vedata) | ||||
| { | { | ||||
| EEVEE_SceneLayerData *sldata = EEVEE_scene_layer_data_get(); | EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_get(); | ||||
| EEVEE_materials_cache_finish(vedata); | EEVEE_materials_cache_finish(vedata); | ||||
| EEVEE_lights_cache_finish(sldata); | EEVEE_lights_cache_finish(sldata); | ||||
| EEVEE_lightprobes_cache_finish(sldata, vedata); | EEVEE_lightprobes_cache_finish(sldata, vedata); | ||||
| } | } | ||||
| static void EEVEE_draw_scene(void *vedata) | static void EEVEE_draw_scene(void *vedata) | ||||
| { | { | ||||
| EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl; | EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl; | ||||
| EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl; | EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl; | ||||
| EEVEE_FramebufferList *fbl = ((EEVEE_Data *)vedata)->fbl; | EEVEE_FramebufferList *fbl = ((EEVEE_Data *)vedata)->fbl; | ||||
| EEVEE_SceneLayerData *sldata = EEVEE_scene_layer_data_get(); | EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_get(); | ||||
| /* Default framebuffer and texture */ | /* Default framebuffer and texture */ | ||||
| DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); | DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); | ||||
| /* Number of iteration: needed for all temporal effect (SSR, TAA) | /* Number of iteration: needed for all temporal effect (SSR, TAA) | ||||
| * when using opengl render. */ | * when using opengl render. */ | ||||
| int loop_ct = DRW_state_is_image_render() ? 4 : 1; | int loop_ct = DRW_state_is_image_render() ? 4 : 1; | ||||
| ▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| BLI_assert(props && | BLI_assert(props && | ||||
| props->type == IDP_GROUP && | props->type == IDP_GROUP && | ||||
| props->subtype == IDP_GROUP_SUB_ENGINE_RENDER); | props->subtype == IDP_GROUP_SUB_ENGINE_RENDER); | ||||
| // BKE_collection_engine_property_add_int(props, "high_quality_sphere_lamps", false); | // BKE_collection_engine_property_add_int(props, "high_quality_sphere_lamps", false); | ||||
| UNUSED_VARS_NDEBUG(props); | UNUSED_VARS_NDEBUG(props); | ||||
| } | } | ||||
| static void EEVEE_scene_layer_settings_create(RenderEngine *UNUSED(engine), IDProperty *props) | static void EEVEE_view_layer_settings_create(RenderEngine *UNUSED(engine), IDProperty *props) | ||||
| { | { | ||||
| BLI_assert(props && | BLI_assert(props && | ||||
| props->type == IDP_GROUP && | props->type == IDP_GROUP && | ||||
| props->subtype == IDP_GROUP_SUB_ENGINE_RENDER); | props->subtype == IDP_GROUP_SUB_ENGINE_RENDER); | ||||
| BKE_collection_engine_property_add_int(props, "gi_diffuse_bounces", 3); | BKE_collection_engine_property_add_int(props, "gi_diffuse_bounces", 3); | ||||
| BKE_collection_engine_property_add_int(props, "gi_cubemap_resolution", 512); | BKE_collection_engine_property_add_int(props, "gi_cubemap_resolution", 512); | ||||
| ▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | DrawEngineType draw_engine_eevee_type = { | ||||
| NULL, //&EEVEE_draw_scene | NULL, //&EEVEE_draw_scene | ||||
| &EEVEE_view_update, | &EEVEE_view_update, | ||||
| }; | }; | ||||
| RenderEngineType DRW_engine_viewport_eevee_type = { | RenderEngineType DRW_engine_viewport_eevee_type = { | ||||
| NULL, NULL, | NULL, NULL, | ||||
| EEVEE_ENGINE, N_("Eevee"), RE_INTERNAL | RE_USE_SHADING_NODES, | EEVEE_ENGINE, N_("Eevee"), RE_INTERNAL | RE_USE_SHADING_NODES, | ||||
| NULL, NULL, NULL, NULL, NULL, NULL, NULL, | NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||||
| &EEVEE_layer_collection_settings_create, &EEVEE_scene_layer_settings_create, | &EEVEE_layer_collection_settings_create, &EEVEE_view_layer_settings_create, | ||||
| &draw_engine_eevee_type, | &draw_engine_eevee_type, | ||||
| {NULL, NULL, NULL} | {NULL, NULL, NULL} | ||||
| }; | }; | ||||
| #undef EEVEE_ENGINE | #undef EEVEE_ENGINE | ||||