diff options
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_data.c')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_data.c | 72 |
1 files changed, 44 insertions, 28 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_data.c b/source/blender/draw/engines/eevee/eevee_data.c index e9883cc3054..bf039871d52 100644 --- a/source/blender/draw/engines/eevee/eevee_data.c +++ b/source/blender/draw/engines/eevee/eevee_data.c @@ -91,9 +91,9 @@ EEVEE_ViewLayerData *EEVEE_view_layer_data_ensure(void) /* Object data. */ -static void eevee_object_data_init(ObjectEngineData *engine_data) +static void eevee_object_data_init(DrawData *dd) { - EEVEE_ObjectEngineData *eevee_data = (EEVEE_ObjectEngineData *)engine_data; + EEVEE_ObjectEngineData *eevee_data = (EEVEE_ObjectEngineData *)dd; eevee_data->shadow_caster_id = -1; } @@ -102,15 +102,15 @@ EEVEE_ObjectEngineData *EEVEE_object_data_get(Object *ob) if (ELEM(ob->type, OB_LIGHTPROBE, OB_LAMP)) { return NULL; } - return (EEVEE_ObjectEngineData *)DRW_object_engine_data_get( - ob, &draw_engine_eevee_type); + return (EEVEE_ObjectEngineData *)DRW_drawdata_get( + &ob->id, &draw_engine_eevee_type); } EEVEE_ObjectEngineData *EEVEE_object_data_ensure(Object *ob) { BLI_assert(!ELEM(ob->type, OB_LIGHTPROBE, OB_LAMP)); - return (EEVEE_ObjectEngineData *)DRW_object_engine_data_ensure( - ob, + return (EEVEE_ObjectEngineData *)DRW_drawdata_ensure( + &ob->id, &draw_engine_eevee_type, sizeof(EEVEE_ObjectEngineData), eevee_object_data_init, @@ -119,18 +119,10 @@ EEVEE_ObjectEngineData *EEVEE_object_data_ensure(Object *ob) /* Light probe data. */ -static void eevee_lightprobe_data_init(ObjectEngineData *engine_data) +static void eevee_lightprobe_data_init(DrawData *dd) { - EEVEE_LightProbeEngineData *ped = (EEVEE_LightProbeEngineData *)engine_data; - ped->need_full_update = true; - ped->need_update = true; -} - -static void eevee_lightprobe_data_free(ObjectEngineData *engine_data) -{ - EEVEE_LightProbeEngineData *ped = (EEVEE_LightProbeEngineData *)engine_data; - - BLI_freelistN(&ped->captured_object_list); + EEVEE_LightProbeEngineData *ped = (EEVEE_LightProbeEngineData *)dd; + ped->need_update = false; } EEVEE_LightProbeEngineData *EEVEE_lightprobe_data_get(Object *ob) @@ -138,26 +130,26 @@ EEVEE_LightProbeEngineData *EEVEE_lightprobe_data_get(Object *ob) if (ob->type != OB_LIGHTPROBE) { return NULL; } - return (EEVEE_LightProbeEngineData *)DRW_object_engine_data_get( - ob, &draw_engine_eevee_type); + return (EEVEE_LightProbeEngineData *)DRW_drawdata_get( + &ob->id, &draw_engine_eevee_type); } EEVEE_LightProbeEngineData *EEVEE_lightprobe_data_ensure(Object *ob) { BLI_assert(ob->type == OB_LIGHTPROBE); - return (EEVEE_LightProbeEngineData *)DRW_object_engine_data_ensure( - ob, + return (EEVEE_LightProbeEngineData *)DRW_drawdata_ensure( + &ob->id, &draw_engine_eevee_type, sizeof(EEVEE_LightProbeEngineData), eevee_lightprobe_data_init, - eevee_lightprobe_data_free); + NULL); } /* Lamp data. */ -static void eevee_lamp_data_init(ObjectEngineData *engine_data) +static void eevee_lamp_data_init(DrawData *dd) { - EEVEE_LampEngineData *led = (EEVEE_LampEngineData *)engine_data; + EEVEE_LampEngineData *led = (EEVEE_LampEngineData *)dd; led->need_update = true; led->prev_cube_shadow_id = -1; } @@ -167,17 +159,41 @@ EEVEE_LampEngineData *EEVEE_lamp_data_get(Object *ob) if (ob->type != OB_LAMP) { return NULL; } - return (EEVEE_LampEngineData *)DRW_object_engine_data_get( - ob, &draw_engine_eevee_type); + return (EEVEE_LampEngineData *)DRW_drawdata_get( + &ob->id, &draw_engine_eevee_type); } EEVEE_LampEngineData *EEVEE_lamp_data_ensure(Object *ob) { BLI_assert(ob->type == OB_LAMP); - return (EEVEE_LampEngineData *)DRW_object_engine_data_ensure( - ob, + return (EEVEE_LampEngineData *)DRW_drawdata_ensure( + &ob->id, &draw_engine_eevee_type, sizeof(EEVEE_LampEngineData), eevee_lamp_data_init, NULL); } + +/* World data. */ + +static void eevee_world_data_init(DrawData *dd) +{ + EEVEE_WorldEngineData *wed = (EEVEE_WorldEngineData *)dd; + wed->dd.recalc |= 1; +} + +EEVEE_WorldEngineData *EEVEE_world_data_get(World *wo) +{ + return (EEVEE_WorldEngineData *)DRW_drawdata_get( + &wo->id, &draw_engine_eevee_type); +} + +EEVEE_WorldEngineData *EEVEE_world_data_ensure(World *wo) +{ + return (EEVEE_WorldEngineData *)DRW_drawdata_ensure( + &wo->id, + &draw_engine_eevee_type, + sizeof(EEVEE_WorldEngineData), + eevee_world_data_init, + NULL); +} |