diff options
author | Alfredo de Greef <eeshlo@yahoo.com> | 2005-05-09 07:46:21 +0400 |
---|---|---|
committer | Alfredo de Greef <eeshlo@yahoo.com> | 2005-05-09 07:46:21 +0400 |
commit | e9545cb9cdab0d7d121a2b083e5fd9a3a324b3ec (patch) | |
tree | 20358c0d2e7bf4cffdc569d0ab6812f38a6a02cd /source | |
parent | 09fb5d6b8d1aafc66d33bded48b149105be41675 (diff) |
bugfix #2494:
parented linked data lamps made the export crash.
fix for two bugs reported by Diego Pino, an endian issue with vertex colors,
and the plugin code didn't export multiple colorbands correctly.
Updated the ortho camera export code for the new Blender ortho camera model.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/renderconverter/intern/convertBlenderScene.c | 5 | ||||
-rwxr-xr-x | source/blender/yafray/intern/export_File.cpp | 26 | ||||
-rw-r--r-- | source/blender/yafray/intern/export_Plugin.cpp | 26 |
3 files changed, 26 insertions, 31 deletions
diff --git a/source/blender/renderconverter/intern/convertBlenderScene.c b/source/blender/renderconverter/intern/convertBlenderScene.c index 29782be905c..1cd0450bb7d 100644 --- a/source/blender/renderconverter/intern/convertBlenderScene.c +++ b/source/blender/renderconverter/intern/convertBlenderScene.c @@ -3127,9 +3127,10 @@ void RE_rotateBlenderScene(void) yafray only needs to know about one, the rest can be instanciated. The dupliMtx list is used for this purpose */ if (R.r.renderer==R_YAFRAY) { - /* Special case, parent object dupli's: ignore lattices & empty's */ + /* Special case, parent object dupli's: ignore if object itself is lamp or parent is lattice or empty */ if (ob->parent) { - if ((ob->parent->type!=OB_EMPTY) && (ob->parent->type!=OB_LATTICE) && YAF_objectKnownData(ob)) + if ((ob->type!=OB_LAMP) && (ob->parent->type!=OB_EMPTY) && + (ob->parent->type!=OB_LATTICE) && YAF_objectKnownData(ob)) printf("From parent: Added dupli matrix for linked data object %s\n", ob->id.name); else init_render_object(ob); diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp index ee761e6b375..948b2a210af 100755 --- a/source/blender/yafray/intern/export_File.cpp +++ b/source/blender/yafray/intern/export_File.cpp @@ -1191,19 +1191,15 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li // since Blender seems to need vcols when uvs are used, for yafray only export when the material actually uses vcols if ((EXPORT_VCOL) && (vlr->vcol)) { // vertex colors - float vr, vg, vb; - vr = ((vlr->vcol[ui1] >> 24) & 255)/255.0; - vg = ((vlr->vcol[ui1] >> 16) & 255)/255.0; - vb = ((vlr->vcol[ui1] >> 8) & 255)/255.0; - ostr << " vcol_a_r=\"" << vr << "\" vcol_a_g=\"" << vg << "\" vcol_a_b=\"" << vb << "\""; - vr = ((vlr->vcol[ui2] >> 24) & 255)/255.0; - vg = ((vlr->vcol[ui2] >> 16) & 255)/255.0; - vb = ((vlr->vcol[ui2] >> 8) & 255)/255.0; - ostr << " vcol_b_r=\"" << vr << "\" vcol_b_g=\"" << vg << "\" vcol_b_b=\"" << vb << "\""; - vr = ((vlr->vcol[ui3] >> 24) & 255)/255.0; - vg = ((vlr->vcol[ui3] >> 16) & 255)/255.0; - vb = ((vlr->vcol[ui3] >> 8) & 255)/255.0; - ostr << " vcol_c_r=\"" << vr << "\" vcol_c_g=\"" << vg << "\" vcol_c_b=\"" << vb << "\""; + unsigned char* pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui1]); + ostr << " vcol_a_r=\"" << (float)pt[3]/255.f << "\" vcol_a_g=\"" << (float)pt[2]/255.f + << "\" vcol_a_b=\"" << (float)pt[1]/255.f << "\""; + pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui2]); + ostr << " vcol_b_r=\"" << (float)pt[3]/255.f << "\" vcol_b_g=\"" << (float)pt[2]/255.f + << "\" vcol_b_b=\"" << (float)pt[1]/255.f << "\""; + pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui3]); + ostr << " vcol_c_r=\"" << (float)pt[3]/255.f << "\" vcol_c_g=\"" << (float)pt[2]/255.f + << "\" vcol_c_b=\"" << (float)pt[1]/255.f << "\""; } ostr << " shader_name=\"" << fmatname << "\" />\n"; @@ -1535,8 +1531,10 @@ void yafrayFileRender_t::writeCamera() ostr << "\" aspect_ratio=\"" << R.ycor << "\""; // dof params, only valid for real camera + float fdist = 1; // only changes for ortho if (maincam_obj->type==OB_CAMERA) { Camera* cam = (Camera*)maincam_obj->data; + if (R.r.mode & R_ORTHO) fdist = cam->ortho_scale*(mainCamLens/32.f); ostr << "\n\tdof_distance=\"" << cam->YF_dofdist << "\""; ostr << " aperture=\"" << cam->YF_aperture << "\""; string st = "on"; @@ -1573,8 +1571,6 @@ void yafrayFileRender_t::writeCamera() ostr << "\t<from x=\"" << maincam_obj->obmat[3][0] << "\"" << " y=\"" << maincam_obj->obmat[3][1] << "\"" << " z=\"" << maincam_obj->obmat[3][2] << "\" />\n"; - float fdist = fabs(R.viewmat[3][2]); - if (R.r.mode & R_ORTHO) fdist *= 0.01f; ostr << "\t<to x=\"" << maincam_obj->obmat[3][0] - fdist * R.viewmat[0][2] << "\" y=\"" << maincam_obj->obmat[3][1] - fdist * R.viewmat[1][2] << "\" z=\"" << maincam_obj->obmat[3][2] - fdist * R.viewmat[2][2] << "\" />\n"; diff --git a/source/blender/yafray/intern/export_Plugin.cpp b/source/blender/yafray/intern/export_Plugin.cpp index e12dd165511..6654059f875 100644 --- a/source/blender/yafray/intern/export_Plugin.cpp +++ b/source/blender/yafray/intern/export_Plugin.cpp @@ -363,6 +363,9 @@ void yafrayPluginRender_t::writeTextures() for (map<string, MTex*>::const_iterator blendtex=used_textures.begin(); blendtex!=used_textures.end();++blendtex) { + lparams.clear(); + params.clear(); + MTex* mtex = blendtex->second; Tex* tex = mtex->tex; // name is image name instead of texture name when type is image (see TEX_IMAGE case below) @@ -549,6 +552,7 @@ void yafrayPluginRender_t::writeTextures() ColorBand* cb = tex->coba; if (cb) { + lparams.clear(); params.clear(); params["type"]=yafray::parameter_t("colorband"); params["name"]=yafray::parameter_t(blendtex->first + "_coba"); @@ -1007,18 +1011,12 @@ void yafrayPluginRender_t::genVcol(vector<yafray::CFLOAT> &vcol, VlakRen *vlr, b ui2 = (ui2+2) & 3; ui3 = (ui3+2) & 3; } - float vr = ((vlr->vcol[ui1] >> 24) & 255)/255.0; - float vg = ((vlr->vcol[ui1] >> 16) & 255)/255.0; - float vb = ((vlr->vcol[ui1] >> 8) & 255)/255.0; - vcol.push_back(vr); vcol.push_back(vg); vcol.push_back(vb); - vr = ((vlr->vcol[ui2] >> 24) & 255)/255.0; - vg = ((vlr->vcol[ui2] >> 16) & 255)/255.0; - vb = ((vlr->vcol[ui2] >> 8) & 255)/255.0; - vcol.push_back(vr); vcol.push_back(vg); vcol.push_back(vb); - vr = ((vlr->vcol[ui3] >> 24) & 255)/255.0; - vg = ((vlr->vcol[ui3] >> 16) & 255)/255.0; - vb = ((vlr->vcol[ui3] >> 8) & 255)/255.0; - vcol.push_back(vr); vcol.push_back(vg); vcol.push_back(vb); + unsigned char* pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui1]); + vcol.push_back((float)pt[3]/255.f); vcol.push_back((float)pt[2]/255.f); vcol.push_back((float)pt[1]/255.f); + pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui2]); + vcol.push_back((float)pt[3]/255.f); vcol.push_back((float)pt[2]/255.f); vcol.push_back((float)pt[1]/255.f); + pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui3]); + vcol.push_back((float)pt[3]/255.f); vcol.push_back((float)pt[2]/255.f); vcol.push_back((float)pt[1]/255.f); } else { @@ -1514,8 +1512,10 @@ void yafrayPluginRender_t::writeCamera() params["aspect_ratio"] = yafray::parameter_t(R.ycor); // dof params, only valid for real camera + float fdist = 1; // only changes for ortho if (maincam_obj->type==OB_CAMERA) { Camera* cam = (Camera*)maincam_obj->data; + if (R.r.mode & R_ORTHO) fdist = cam->ortho_scale*(mainCamLens/32.f); params["dof_distance"] = yafray::parameter_t(cam->YF_dofdist); params["aperture"] = yafray::parameter_t(cam->YF_aperture); if (cam->flag & CAM_YF_NO_QMC) @@ -1548,8 +1548,6 @@ void yafrayPluginRender_t::writeCamera() params["from"]=yafray::parameter_t( yafray::point3d_t(maincam_obj->obmat[3][0], maincam_obj->obmat[3][1], maincam_obj->obmat[3][2])); - float fdist = fabs(R.viewmat[3][2]); - if (R.r.mode & R_ORTHO) fdist *= 0.01f; params["to"]=yafray::parameter_t( yafray::point3d_t(maincam_obj->obmat[3][0] - fdist * R.viewmat[0][2], maincam_obj->obmat[3][1] - fdist * R.viewmat[1][2], |