- fixed another oldie... displaylists for MBall was generated FAR too often.

even for each redraw! Now its all smooth & fast again.

  introduced new kernel API call: int is_basis_mball(ob), this provides a
  quick check of the object is the actual basis for the displaylist and
  polygonization.
This commit is contained in:
2003-11-21 12:30:15 +00:00
parent 94496ca80f
commit 71500a2df1
4 changed files with 32 additions and 18 deletions

View File

@@ -52,6 +52,7 @@ void make_local_mball(struct MetaBall *mb);
void tex_space_mball( struct Object *ob);
void make_orco_mball( struct Object *ob);
struct Object *find_basis_mball( struct Object *ob);
int is_basis_mball(struct Object *ob);
void metaball_polygonize(struct Object *ob);
void calc_mballco(struct MetaElem *ml, float *vec);
float densfunc(struct MetaElem *ball, float x, float y, float z);

View File

@@ -1488,6 +1488,7 @@ void makeDispList(Object *ob)
}
}
else if(ob->type==OB_MBALL) {
ob= find_basis_mball(ob);
metaball_polygonize(ob);

View File

@@ -265,6 +265,15 @@ void make_orco_mball(Object *ob)
}
}
int is_basis_mball(Object *ob)
{
int len;
/* just a quick test */
len= strlen(ob->id.name);
if( isdigit(ob->id.name[len-1]) ) return 0;
return 1;
}
Object *find_basis_mball(Object *basis)
{

View File

@@ -77,6 +77,7 @@
#include "BKE_global.h"
#include "BKE_displist.h"
#include "BKE_material.h"
#include "BKE_mball.h"
#include "BKE_ipo.h"
#include "BKE_mesh.h"
#include "BKE_effect.h"
@@ -2196,6 +2197,7 @@ static void drawDispList(Object *ob, int dt)
break;
case OB_MBALL:
if( is_basis_mball(ob)) {
lb= &ob->disp;
if(lb->first==0) makeDispList(ob);
@@ -2214,6 +2216,7 @@ static void drawDispList(Object *ob, int dt)
}
}
else drawDispListwire(lb);
}
break;
}