diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-19 13:13:15 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-19 13:13:15 +0400 |
commit | 0312b183194e703d778e6b989caccdfa35059d13 (patch) | |
tree | 7760904b11743798783ec84092a9320607cc53fc /source/blender/blenkernel/intern/displist.c | |
parent | 2acf0a13546ab0f12774174f18d373e163f0f19a (diff) |
Get rid of a display list stored in Curve datablock
This display list was only used for texture space calculation,
and even there this display list was only used for bounding
box calculation.
Since we already do have bounding box in a curve datablock
there's no reason to duplicate non-modified display list
just to calculate bounding box later, let's just calculate
bounding box at the first point.
This makes code a little be more thread-safe but curves are
still not safe for threads at all because of bevel list and
path. That would be solved later.
--
svn merge -r57939:57940 ^/branches/soc-2013-depsgraph_mt
Diffstat (limited to 'source/blender/blenkernel/intern/displist.c')
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 60 |
1 files changed, 24 insertions, 36 deletions
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index f728d06d88d..cfd89e91fdd 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -62,8 +62,8 @@ #include "BLI_sys_types.h" // for intptr_t support -static void boundbox_displist(Object *ob); static void boundbox_dispbase(BoundBox *bb, ListBase *dispbase); +static void boundbox_displist_object(Object *ob); void BKE_displist_elem_free(DispList *dl) { @@ -727,9 +727,9 @@ void BKE_displist_make_mball(Scene *scene, Object *ob) object_deform_mball(ob, &ob->disp); } - } - boundbox_displist(ob); + boundbox_displist_object(ob); + } } void BKE_displist_make_mball_forRender(Scene *scene, Object *ob, ListBase *dispbase) @@ -1285,10 +1285,11 @@ void BKE_displist_make_surf(Scene *scene, Object *ob, ListBase *dispbase, } } - /* make copy of 'undeformed" displist for texture space calculation - * actually, it's not totally undeformed -- pre-tessellation modifiers are - * already applied, thats how it worked for years, so keep for compatibility (sergey) */ - BKE_displist_copy(&cu->disp, dispbase); + /* Calculate curve's boundig box from non-modified display list. */ + if (cu->bb == NULL) { + cu->bb = MEM_callocN(sizeof(BoundBox), "boundbox"); + } + boundbox_dispbase(cu->bb, dispbase); if (!forRender) { BKE_curve_texspace_calc(cu); @@ -1595,10 +1596,11 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba if ((cu->flag & CU_PATH) && !forOrco) calc_curvepath(ob); - /* make copy of 'undeformed" displist for texture space calculation - * actually, it's not totally undeformed -- pre-tessellation modifiers are - * already applied, thats how it worked for years, so keep for compatibility (sergey) */ - BKE_displist_copy(&cu->disp, dispbase); + /* Calculate curve's boundig box from non-modified display list. */ + if (cu->bb == NULL) { + cu->bb = MEM_callocN(sizeof(BoundBox), "boundbox"); + } + boundbox_dispbase(cu->bb, dispbase); if (!forRender) { BKE_curve_texspace_calc(cu); @@ -1615,7 +1617,6 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba void BKE_displist_make_curveTypes(Scene *scene, Object *ob, int forOrco) { - Curve *cu = ob->data; ListBase *dispbase; /* The same check for duplis as in do_makeDispListCurveTypes. @@ -1628,23 +1629,9 @@ void BKE_displist_make_curveTypes(Scene *scene, Object *ob, int forOrco) dispbase = &(ob->disp); BKE_displist_free(dispbase); - /* free displist used for textspace */ - BKE_displist_free(&cu->disp); - do_makeDispListCurveTypes(scene, ob, dispbase, &ob->derivedFinal, 0, forOrco, 0); - if (ob->derivedFinal) { - DM_set_object_boundbox(ob, ob->derivedFinal); - - /* always keep curve's BB in sync with non-deformed displist */ - if (cu->bb == NULL) - cu->bb = MEM_callocN(sizeof(BoundBox), "boundbox"); - - boundbox_dispbase(cu->bb, &cu->disp); - } - else { - boundbox_displist(ob); - } + boundbox_displist_object(ob); } void BKE_displist_make_curveTypes_forRender(Scene *scene, Object *ob, ListBase *dispbase, @@ -1708,21 +1695,22 @@ static void boundbox_dispbase(BoundBox *bb, ListBase *dispbase) } /* this is confusing, there's also min_max_object, appplying the obmat... */ -static void boundbox_displist(Object *ob) +static void boundbox_displist_object(Object *ob) { if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { - Curve *cu = ob->data; - - /* calculate curve's BB based on non-deformed displist */ - if (cu->bb == NULL) - cu->bb = MEM_callocN(sizeof(BoundBox), "boundbox"); - - boundbox_dispbase(cu->bb, &cu->disp); + /* Curver's BB is already calculated as a part of modifier stack, + * here we only calculate object BB based on final display list. + */ /* object's BB is calculated from final displist */ if (ob->bb == NULL) ob->bb = MEM_callocN(sizeof(BoundBox), "boundbox"); - boundbox_dispbase(ob->bb, &ob->disp); + if (ob->derivedFinal) { + DM_set_object_boundbox(ob, ob->derivedFinal); + } + else { + boundbox_dispbase(ob->bb, &ob->disp); + } } } |