- bug fix #694
when using linked-duplicated mesh, with subsurf and tfaces (UV texture) the render crashed. Found out the renderloop makes a new displaylist for each Mesh, also when it is linked multiple times. That way pointers to previous created elements in displaylists become invalid. Crash! Result now it even renders faster for linked-duplis. :)
This commit is contained in:
@@ -143,9 +143,9 @@ typedef struct Mesh {
|
||||
float rot[3];
|
||||
|
||||
short smoothresh, flag;
|
||||
short subdiv, subdivr;
|
||||
short subdiv, subdivr, subdivdone;
|
||||
short totcol;
|
||||
short reserved1, reserved2, reserved3; /* Padding */
|
||||
short reserved1, reserved2; /* Padding */
|
||||
|
||||
float cubemapsize, rtf;
|
||||
|
||||
|
||||
@@ -1114,23 +1114,17 @@ static void init_render_displist_mesh(Object *ob)
|
||||
dl= me->disp.first;
|
||||
|
||||
/* Force a displist rebuild if this is a subsurf and we have a different subdiv level */
|
||||
#if 1
|
||||
if((dl==0) || ((me->subdiv != me->subdivr))){
|
||||
object_deform(ob);
|
||||
subsurf_make_mesh(ob, me->subdivr);
|
||||
dl = me->disp.first;
|
||||
|
||||
|
||||
if((dl==0) || ((me->subdiv != me->subdivr))) {
|
||||
/* prevent subsurf called again for duplicate use of mesh, tface pointers change */
|
||||
if(me->subdivdone!=me->subdivr) {
|
||||
object_deform(ob);
|
||||
subsurf_make_mesh(ob, me->subdivr);
|
||||
me->subdivdone= me->subdivr;
|
||||
dl = me->disp.first;
|
||||
}
|
||||
}
|
||||
else{
|
||||
makeDispList(ob);
|
||||
dl= me->disp.first;
|
||||
}
|
||||
#else
|
||||
tempdiv = me->subdiv;
|
||||
me->subdiv = me->subdivr;
|
||||
makeDispList(ob);
|
||||
dl= me->disp.first;
|
||||
#endif
|
||||
|
||||
if(dl==0) return;
|
||||
|
||||
if(need_orco) {
|
||||
@@ -1138,10 +1132,6 @@ static void init_render_displist_mesh(Object *ob)
|
||||
orco= me->orco;
|
||||
}
|
||||
|
||||
#if 0
|
||||
me->subdiv = tempdiv;
|
||||
#endif
|
||||
|
||||
while(dl) {
|
||||
if(dl->type==DL_SURF) {
|
||||
startvert= R.totvert;
|
||||
@@ -1767,8 +1757,8 @@ static void init_render_mesh(Object *ob)
|
||||
/* If lar takes more lamp data, the decoupling will be better. */
|
||||
void RE_add_render_lamp(Object *ob, int doshadbuf)
|
||||
{
|
||||
Lamp *la, **temp;
|
||||
LampRen *lar;
|
||||
Lamp *la;
|
||||
LampRen *lar, **temp;
|
||||
float mat[4][4], hoek, xn, yn;
|
||||
int c;
|
||||
static int rlalen=LAMPINITSIZE; /*number of currently allocated lampren pointers*/
|
||||
@@ -2770,8 +2760,9 @@ void RE_freeRotateBlenderScene(void)
|
||||
MEM_freeN(me->orco);
|
||||
me->orco= 0;
|
||||
}
|
||||
if (rendermesh_uses_displist(me) && (me->subdiv!=me->subdivr)){
|
||||
if (rendermesh_uses_displist(me) && (me->subdiv!=me->subdivr)) {
|
||||
makeDispList(ob);
|
||||
me->subdivdone= 0; /* needed to prevent multiple used meshes being recalculated */
|
||||
}
|
||||
}
|
||||
else if(ob->type==OB_MBALL) {
|
||||
|
||||
Reference in New Issue
Block a user