Bugfix for crashes when rendering with yafray when the render

size was not 100%
This commit is contained in:
Alfredo de Greef
2006-06-04 01:29:41 +00:00
parent a6c97c90fb
commit 3a0274769b
2 changed files with 14 additions and 10 deletions

View File

@@ -280,6 +280,8 @@ void yafrayFileRender_t::displayImage()
unsigned short height = (unsigned short)(header[14] + (header[15]<<8));
// don't do anything if resolution doesn't match that of rectot
if ((width!=re->rectx) || (height!=re->recty)) {
cout << "Wrong image width/height: " << width << "/" << height <<
" expected " << re->rectx << "/" << re->recty << endl;
fclose(fp);
fp = NULL;
return;
@@ -1709,11 +1711,12 @@ void yafrayFileRender_t::writeCamera()
else
ostr << "type=\"perspective\"";
// render resolution including the percentage buttons (aleady calculated in initrender for R renderdata)
ostr << " resx=\"" << re->r.xsch << "\" resy=\"" << re->r.ysch << "\"";
// render resolution including the percentage buttons
ostr << " resx=\"" << re->rectx << "\" resy=\"" << re->recty << "\"";
float f_aspect = 1;
if ((re->r.xsch*re->r.xasp)<=(re->r.ysch*re->r.yasp)) f_aspect = float(re->r.xsch*re->r.xasp)/float(re->r.ysch*re->r.yasp);
if ((re->rectx * re->r.xasp) <= (re->recty * re->r.yasp))
f_aspect = float(re->rectx * re->r.xasp) / float(re->recty * re->r.yasp);
ostr << "\n\tfocal=\"" << mainCamLens/(f_aspect*32.f);
ostr << "\" aspect_ratio=\"" << re->ycor << "\"";
@@ -1786,7 +1789,7 @@ void yafrayFileRender_t::writeHemilight()
if (re->r.GIcache) {
ostr << "<light type=\"pathlight\" name=\"path_LT\" power=\"" << re->r.GIpower << "\" mode=\"occlusion\"";
ostr << "\n\tcache=\"on\" use_QMC=\"on\" threshold=\"" << re->r.GIrefinement << "\" "
<< "cache_size=\"" << ((2.0/float(re->r.xsch))*re->r.GIpixelspersample) << "\"";
<< "cache_size=\"" << ((2.0/float(re->rectx))*re->r.GIpixelspersample) << "\"";
ostr << "\n\tshadow_threshold=\"" << (1.0-re->r.GIshadowquality) << "\" grid=\"82\" search=\"35\"";
ostr << "\n\tignore_bumpnormals=\"" << (re->r.YF_nobump ? "on" : "off") << "\"";
if (fromAO) {
@@ -1855,7 +1858,7 @@ void yafrayFileRender_t::writePathlight()
}
ostr << " cache=\"on\" use_QMC=\"on\" threshold=\"" << re->r.GIrefinement << "\"" << endl;
ostr << "\tignore_bumpnormals=\"" << (re->r.YF_nobump ? "on" : "off") << "\"\n";
float sbase = 2.0/float(re->r.xsch);
float sbase = 2.0/float(re->rectx);
ostr << "\tcache_size=\"" << sbase*re->r.GIpixelspersample << "\" shadow_threshold=\"" <<
1.0-re->r.GIshadowquality << "\" grid=\"82\" search=\"35\" >\n";
}

View File

@@ -1620,11 +1620,12 @@ void yafrayPluginRender_t::writeCamera()
params["type"] = yafray::parameter_t("ortho");
else
params["type"] = yafray::parameter_t("perspective");
params["resx"]=yafray::parameter_t(re->r.xsch);
params["resy"]=yafray::parameter_t(re->r.ysch);
params["resx"] = yafray::parameter_t(re->rectx);
params["resy"] = yafray::parameter_t(re->recty);
float f_aspect = 1;
if ((re->r.xsch*re->r.xasp)<=(re->r.ysch*re->r.yasp)) f_aspect = float(re->r.xsch*re->r.xasp)/float(re->r.ysch*re->r.yasp);
if ((re->rectx * re->r.xasp) <= (re->recty * re->r.yasp))
f_aspect = float(re->rectx * re->r.xasp) / float(re->recty * re->r.yasp);
params["focal"] = yafray::parameter_t(mainCamLens/(f_aspect*32.f));
params["aspect_ratio"] = yafray::parameter_t(re->ycor);
@@ -1716,7 +1717,7 @@ void yafrayPluginRender_t::writeHemilight()
params["cache"] = yafray::parameter_t("on");
params["use_QMC"] = yafray::parameter_t("on");
params["threshold"] = yafray::parameter_t(re->r.GIrefinement);
params["cache_size"] = yafray::parameter_t((2.0/float(re->r.xsch))*re->r.GIpixelspersample);
params["cache_size"] = yafray::parameter_t((2.0/float(re->rectx))*re->r.GIpixelspersample);
params["shadow_threshold"] = yafray::parameter_t(1.0 - re->r.GIshadowquality);
params["grid"] = yafray::parameter_t(82);
params["search"] = yafray::parameter_t(35);
@@ -1781,7 +1782,7 @@ void yafrayPluginRender_t::writePathlight()
params["cache"] = yafray::parameter_t("on");
params["use_QMC"] = yafray::parameter_t("on");
params["threshold"] = yafray::parameter_t(re->r.GIrefinement);
params["cache_size"] = yafray::parameter_t((2.0/float(re->r.xsch))*re->r.GIpixelspersample);
params["cache_size"] = yafray::parameter_t((2.0/float(re->recty))*re->r.GIpixelspersample);
params["shadow_threshold"] = yafray::parameter_t(1.0 - re->r.GIshadowquality);
params["grid"] = yafray::parameter_t(82);
params["search"] = yafray::parameter_t(35);