Displace mapping + Map-Input using Object wasn't working. This caused
by the inverse matrix of an Object potentially not being calculated when
displace was calculated.

Solved by moving imat calculus to the top of the main function.

Yafray note: the convention to hack out all transformations from
renderconverter could be implemented more elegant, by moving this to
the yafray section (and just matrix-transform back). Makes code less
unreadable, but also support displacement then (and might solve other
errors).
This commit is contained in:
Ton Roosendaal 2004-06-13 19:30:56 +00:00
parent 7f3dcd7c64
commit d56315aa18

@ -2808,6 +2808,23 @@ void RE_rotateBlenderScene(void)
init_render_textures(); init_render_textures();
init_render_materials(); init_render_materials();
/* imat objects, OB_DO_IMAT can be set in init_render_materials
has to be done here, since displace can have texture using Object map-input */
ob= G.main->object.first;
while(ob) {
if(ob->flag & OB_DO_IMAT) {
ob->flag &= ~OB_DO_IMAT;
/* yafray: set transform to identity matrix, not sure if this is needed here */
if (R.r.renderer==R_YAFRAY)
MTC_Mat4One(mat);
else
MTC_Mat4MulMat4(mat, ob->obmat, R.viewmat);
MTC_Mat4Invert(ob->imat, mat);
}
ob= ob->id.next;
}
/* MAKE RENDER DATA */ /* MAKE RENDER DATA */
/* each object should only be rendered once */ /* each object should only be rendered once */
@ -2929,7 +2946,6 @@ void RE_rotateBlenderScene(void)
MTC_Mat4Invert(ob->imat, mat); MTC_Mat4Invert(ob->imat, mat);
} }
ob->flag &= ~OB_DO_IMAT;
} }
if(blender_test_break()) break; if(blender_test_break()) break;
@ -2941,22 +2957,6 @@ void RE_rotateBlenderScene(void)
} }
/* imat objects */
ob= G.main->object.first;
while(ob) {
if(ob->flag & OB_DO_IMAT) {
ob->flag &= ~OB_DO_IMAT;
/* yafray: set transform to identity matrix, not sure if this is needed here */
if (R.r.renderer==R_YAFRAY)
MTC_Mat4One(mat);
else
MTC_Mat4MulMat4(mat, ob->obmat, R.viewmat);
MTC_Mat4Invert(ob->imat, mat);
}
ob= ob->id.next;
}
sort_halos(); sort_halos();
if(R.wrld.mode & WO_STARS) RE_make_stars(NULL, NULL, NULL); if(R.wrld.mode & WO_STARS) RE_make_stars(NULL, NULL, NULL);