Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-08-21 11:40:19 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-08-21 11:40:19 +0400
commit785a67f396337cc17dd2df8de307932f1f8195ba (patch)
tree2103fce5fb5b03a7a666bf4ccda7b05b05a683fd /source/blender/blenkernel/intern/displist.c
parent8937a8b8395cc233a78e6a838676ddc3511b7b98 (diff)
Partial revert of recenr cu->disp merge commit
That ended up in tricky code trying to mimic depsgraph branch behavior API-wise preserving texspace and bound box calculation compatible with previous releases. So for now bring cu->disp back to the trunk but keep texpsace and boundbox APIs the same as in the branch. This keeps texpsapce and boundbox behavior fully compatible with previous releases and still makes API the same as for meshes.
Diffstat (limited to 'source/blender/blenkernel/intern/displist.c')
-rw-r--r--source/blender/blenkernel/intern/displist.c51
1 files changed, 19 insertions, 32 deletions
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 40aabadc3c0..f90a489ee1a 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -62,7 +62,6 @@
#include "BLI_sys_types.h" // for intptr_t support
-static void boundbox_dispbase(BoundBox *bb, ListBase *dispbase);
static void boundbox_displist_object(Object *ob);
void BKE_displist_elem_free(DispList *dl)
@@ -1269,16 +1268,10 @@ void BKE_displist_make_surf(Scene *scene, Object *ob, ListBase *dispbase,
}
}
- /* Calculate curve's boundig box from non-modified display list. */
- /* TODO(sergey): not thread-safe. */
- if (cu->bb == NULL) {
- cu->bb = MEM_callocN(sizeof(BoundBox), "boundbox");
- }
- boundbox_dispbase(cu->bb, dispbase);
-
- if (!forRender) {
- BKE_curve_texspace_calc(cu);
- }
+ /* 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);
if (!forOrco) {
curve_calc_modifiers_post(scene, ob, &nubase, dispbase, derivedFinal,
@@ -1579,16 +1572,10 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
if ((cu->flag & CU_PATH) && !forOrco)
calc_curvepath(ob, &nubase);
- /* Calculate curve's boundig box from non-modified display list. */
- /* TODO(sergey): not thread-safe. */
- if (cu->bb == NULL) {
- cu->bb = MEM_callocN(sizeof(BoundBox), "boundbox");
- }
- boundbox_dispbase(cu->bb, dispbase);
-
- if (!forRender) {
- BKE_curve_texspace_calc(cu);
- }
+ /* 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);
if (!forOrco)
curve_calc_modifiers_post(scene, ob, &nubase, dispbase, derivedFinal, forRender, renderResolution);
@@ -1603,6 +1590,7 @@ 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.
@@ -1611,10 +1599,10 @@ void BKE_displist_make_curveTypes(Scene *scene, Object *ob, int forOrco)
if (!ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT))
return;
- if (ob->curve_cache) {
- BKE_displist_free(&(ob->curve_cache->disp));
- }
- else {
+ BKE_displist_free(&cu->disp);
+ BKE_object_free_derived_caches(ob);
+
+ if (!ob->curve_cache) {
ob->curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for curve types");
}
@@ -1665,16 +1653,13 @@ float *BKE_displist_make_orco(Scene *scene, Object *ob, DerivedMesh *derivedFina
return orco;
}
-static void boundbox_dispbase(BoundBox *bb, ListBase *dispbase)
+void BKE_displist_minmax(ListBase *dispbase, float min[3], float max[3])
{
- float min[3], max[3];
DispList *dl;
float *vert;
int a, tot = 0;
int doit = 0;
- INIT_MINMAX(min, max);
-
for (dl = dispbase->first; dl; dl = dl->next) {
tot = (dl->type == DL_INDEX3) ? dl->nr : dl->nr * dl->parts;
vert = dl->verts;
@@ -1689,8 +1674,6 @@ static void boundbox_dispbase(BoundBox *bb, ListBase *dispbase)
zero_v3(min);
zero_v3(max);
}
-
- BKE_boundbox_init_from_minmax(bb, min, max);
}
/* this is confusing, there's also min_max_object, appplying the obmat... */
@@ -1709,7 +1692,11 @@ static void boundbox_displist_object(Object *ob)
DM_set_object_boundbox(ob, ob->derivedFinal);
}
else {
- boundbox_dispbase(ob->bb, &ob->curve_cache->disp);
+ float min[3], max[3];
+
+ INIT_MINMAX(min, max);
+ BKE_displist_minmax(&ob->curve_cache->disp, min, max);
+ BKE_boundbox_init_from_minmax(ob->bb, min, max);
}
}
}