diff options
author | Alfredo de Greef <eeshlo@yahoo.com> | 2005-04-12 03:23:25 +0400 |
---|---|---|
committer | Alfredo de Greef <eeshlo@yahoo.com> | 2005-04-12 03:23:25 +0400 |
commit | 8be210bd7ee7409a5e90b6fe10c8f3430d501683 (patch) | |
tree | d44849810a6dc1238c80a6496582549b8cfc0966 /source/blender | |
parent | 2123721b5b6f85188f9b48b93e912acf16be6199 (diff) |
Quick fix for bug #2393 (same as #2218), deformed meshes were not transformed
correctly anymore because of changes in other blender code.
Diffstat (limited to 'source/blender')
-rwxr-xr-x | source/blender/yafray/intern/export_File.cpp | 15 | ||||
-rw-r--r-- | source/blender/yafray/intern/export_Plugin.cpp | 15 |
2 files changed, 22 insertions, 8 deletions
diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp index 92ee9a6ec28..ee761e6b375 100755 --- a/source/blender/yafray/intern/export_File.cpp +++ b/source/blender/yafray/intern/export_File.cpp @@ -1066,6 +1066,13 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li // vertices, transformed back to world xmlfile << "\t\t<points>\n"; + + // for deformed objects, object->imat is no longer valid, + // so have to create inverse render matrix ourselves here + float mat[4][4], imat[4][4]; + MTC_Mat4MulMat4(mat, obj->obmat, R.viewmat); + MTC_Mat4Invert(imat, mat); + for (vector<VlakRen*>::const_iterator fci=VLR_list.begin(); fci!=VLR_list.end();++fci) { @@ -1078,7 +1085,7 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li vert_idx[vlr->v1] = vidx++; ver = vlr->v1; MTC_cp3Float(ver->co, tvec); - MTC_Mat4MulVecfl(obj->imat, tvec); + MTC_Mat4MulVecfl(imat, tvec); ostr << "\t\t\t<p x=\"" << tvec[0] << "\" y=\"" << tvec[1] << "\" z=\"" << tvec[2] << "\" />\n"; @@ -1093,7 +1100,7 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li vert_idx[vlr->v2] = vidx++; ver = vlr->v2; MTC_cp3Float(ver->co, tvec); - MTC_Mat4MulVecfl(obj->imat, tvec); + MTC_Mat4MulVecfl(imat, tvec); ostr << "\t\t\t<p x=\"" << tvec[0] << "\" y=\"" << tvec[1] << "\" z=\"" << tvec[2] << "\" />\n"; @@ -1108,7 +1115,7 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li vert_idx[vlr->v3] = vidx++; ver = vlr->v3; MTC_cp3Float(ver->co, tvec); - MTC_Mat4MulVecfl(obj->imat, tvec); + MTC_Mat4MulVecfl(imat, tvec); ostr << "\t\t\t<p x=\"" << tvec[0] << "\" y=\"" << tvec[1] << "\" z=\"" << tvec[2] << "\" />\n"; @@ -1123,7 +1130,7 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li vert_idx[vlr->v4] = vidx++; ver = vlr->v4; MTC_cp3Float(ver->co, tvec); - MTC_Mat4MulVecfl(obj->imat, tvec); + MTC_Mat4MulVecfl(imat, tvec); ostr << "\t\t\t<p x=\"" << tvec[0] << "\" y=\"" << tvec[1] << "\" z=\"" << tvec[2] << "\" />\n"; diff --git a/source/blender/yafray/intern/export_Plugin.cpp b/source/blender/yafray/intern/export_Plugin.cpp index 9e006381448..e12dd165511 100644 --- a/source/blender/yafray/intern/export_Plugin.cpp +++ b/source/blender/yafray/intern/export_Plugin.cpp @@ -1103,12 +1103,19 @@ void yafrayPluginRender_t::genVertices(vector<yafray::point3d_t> &verts, int &vi { VertRen* ver; float tvec[3]; // for back2world transform + + // for deformed objects, object->imat is no longer valid, + // so have to create inverse render matrix ourselves here + float mat[4][4], imat[4][4]; + MTC_Mat4MulMat4(mat, obj->obmat, R.viewmat); + MTC_Mat4Invert(imat, mat); + if (vert_idx.find(vlr->v1)==vert_idx.end()) { vert_idx[vlr->v1] = vidx++; ver = vlr->v1; MTC_cp3Float(ver->co, tvec); - MTC_Mat4MulVecfl(obj->imat, tvec); + MTC_Mat4MulVecfl(imat, tvec); verts.push_back(yafray::point3d_t(tvec[0], tvec[1], tvec[2])); if (has_orco) verts.push_back(yafray::point3d_t(ver->orco[0],ver->orco[1],ver->orco[2])); @@ -1118,7 +1125,7 @@ void yafrayPluginRender_t::genVertices(vector<yafray::point3d_t> &verts, int &vi vert_idx[vlr->v2] = vidx++; ver = vlr->v2; MTC_cp3Float(ver->co, tvec); - MTC_Mat4MulVecfl(obj->imat, tvec); + MTC_Mat4MulVecfl(imat, tvec); verts.push_back(yafray::point3d_t(tvec[0], tvec[1], tvec[2])); if (has_orco) verts.push_back(yafray::point3d_t(ver->orco[0],ver->orco[1],ver->orco[2])); @@ -1128,7 +1135,7 @@ void yafrayPluginRender_t::genVertices(vector<yafray::point3d_t> &verts, int &vi vert_idx[vlr->v3] = vidx++; ver = vlr->v3; MTC_cp3Float(ver->co, tvec); - MTC_Mat4MulVecfl(obj->imat, tvec); + MTC_Mat4MulVecfl(imat, tvec); verts.push_back(yafray::point3d_t(tvec[0], tvec[1], tvec[2])); if (has_orco) verts.push_back(yafray::point3d_t(ver->orco[0],ver->orco[1],ver->orco[2])); @@ -1138,7 +1145,7 @@ void yafrayPluginRender_t::genVertices(vector<yafray::point3d_t> &verts, int &vi vert_idx[vlr->v4] = vidx++; ver = vlr->v4; MTC_cp3Float(ver->co, tvec); - MTC_Mat4MulVecfl(obj->imat, tvec); + MTC_Mat4MulVecfl(imat, tvec); verts.push_back(yafray::point3d_t(tvec[0], tvec[1], tvec[2])); if (has_orco) verts.push_back(yafray::point3d_t(ver->orco[0],ver->orco[1],ver->orco[2])); |