Fix for bug #12526: object instancing didn't restore matrices
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 23 May 2008 10:06:06 +0000 (10:06 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 23 May 2008 10:06:06 +0000 (10:06 +0000)
correct for envmap, could give objects rendering in the wrong
position.

source/blender/render/intern/source/envmap.c

index 12d0efa59e85b8f2dac90cc95bce3ccaf96a77e5..73db5c4b0be798e09cf7ac940f024075d07c772c 100644 (file)
@@ -225,7 +225,7 @@ static void env_rotate_scene(Render *re, float mat[][4], int mode)
        ObjectInstanceRen *obi;
        LampRen *lar = NULL;
        HaloRen *har = NULL;
-       float imat[3][3], pmat[4][4], smat[4][4], tmat[4][4], cmat[3][3];
+       float imat[3][3], pmat[4][4], smat[4][4], tmat[4][4], cmat[3][3], tmpmat[4][4];
        int a;
        
        if(mode==0) {
@@ -239,8 +239,10 @@ static void env_rotate_scene(Render *re, float mat[][4], int mode)
 
        for(obi=re->instancetable.first; obi; obi=obi->next) {
                /* append or set matrix depending on dupli */
-               if(obi->flag & R_DUPLI_TRANSFORMED)
-                       Mat4MulMat4(obi->mat, tmat, obi->mat);
+               if(obi->flag & R_DUPLI_TRANSFORMED) {
+                       Mat4CpyMat4(tmpmat, obi->mat);
+                       Mat4MulMat4(obi->mat, tmat, tmpmat);
+               }
                else if(mode==1)
                        Mat4CpyMat4(obi->mat, tmat);
                else