Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/eevee_data.c
| Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | for (int i = 0; i < 2; i++) { | ||||
| if (mb->hair_motion_step_cache[i]) { | if (mb->hair_motion_step_cache[i]) { | ||||
| BLI_ghash_free( | BLI_ghash_free( | ||||
| mb->hair_motion_step_cache[i], NULL, (GHashValFreeFP)EEVEE_motion_hair_step_free); | mb->hair_motion_step_cache[i], NULL, (GHashValFreeFP)EEVEE_motion_hair_step_free); | ||||
| mb->hair_motion_step_cache[i] = NULL; | mb->hair_motion_step_cache[i] = NULL; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| EEVEE_ObjectMotionData *EEVEE_motion_blur_object_data_get(EEVEE_MotionBlurData *mb, Object *ob) | EEVEE_ObjectMotionData *EEVEE_motion_blur_object_data_get(EEVEE_MotionBlurData *mb, | ||||
| Object *ob, | |||||
| bool is_psys) | |||||
| { | { | ||||
| if (mb->object == NULL) { | if (mb->object == NULL) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| EEVEE_ObjectKey key, *key_p; | EEVEE_ObjectKey key, *key_p; | ||||
| /* Assumes that all instances have the same object pointer. This is currently the case because | /* Assumes that all instances have the same object pointer. This is currently the case because | ||||
| * instance objects are temporary objects on the stack. */ | * instance objects are temporary objects on the stack. */ | ||||
| key.ob = ob; | /* WORKAROUND: Duplicate object key for particle system (hairs) to be able to store dupli offset | ||||
JacquesLucke: Think this should be mentioned in a comment on `EEVEE_ObjectKey.ob`, because it changes the… | |||||
| * matrix along with the emitter obmat. (see T97380) */ | |||||
| key.ob = (void *)((char *)ob + is_psys); | |||||
| DupliObject *dup = DRW_object_get_dupli(ob); | DupliObject *dup = DRW_object_get_dupli(ob); | ||||
| if (dup) { | if (dup) { | ||||
| key.parent = DRW_object_get_dupli_parent(ob); | key.parent = DRW_object_get_dupli_parent(ob); | ||||
| memcpy(key.id, dup->persistent_id, sizeof(key.id)); | memcpy(key.id, dup->persistent_id, sizeof(key.id)); | ||||
| } | } | ||||
| else { | else { | ||||
| key.parent = key.ob; | key.parent = ob; | ||||
| memset(key.id, 0, sizeof(key.id)); | memset(key.id, 0, sizeof(key.id)); | ||||
| } | } | ||||
| EEVEE_ObjectMotionData *ob_step = BLI_ghash_lookup(mb->object, &key); | EEVEE_ObjectMotionData *ob_step = BLI_ghash_lookup(mb->object, &key); | ||||
| if (ob_step == NULL) { | if (ob_step == NULL) { | ||||
| key_p = MEM_mallocN(sizeof(*key_p), __func__); | key_p = MEM_mallocN(sizeof(*key_p), __func__); | ||||
| memcpy(key_p, &key, sizeof(*key_p)); | memcpy(key_p, &key, sizeof(*key_p)); | ||||
| ▲ Show 20 Lines • Show All 227 Lines • Show Last 20 Lines | |||||
Think this should be mentioned in a comment on EEVEE_ObjectKey.ob, because it changes the meaning of those a bit.
Arguably, EEVEE_ObjectKey.ob shouldn't even be a Object * with this change anymore. You could also store a separate bool in EEVEE_ObjectKey.