From f5d3649d17690522f67edbe3e5b860d1924bf9f2 Mon Sep 17 00:00:00 2001 From: Johnny Matthews Date: Tue, 9 Mar 2004 17:06:21 +0000 Subject: [PATCH] Added Simple Image Background Exporting for Yafray Add an image texture to the world (in any channel, the first one with an image will be used) and it will be exported as an image background The texture 'bright' slider is connected to the 'power' variable If the image selected ends in hdr, it will be exported into an HDRI block. The texture 'bright' slider effects exposure adjust (it is slider value - 1) so a value of 1 == no expousre adjust. (this needs a better solution in a later implementation) --- source/blender/yafray/intern/export_File.cpp | 38 +++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp index 991d9ce5012..ae2313fac03 100755 --- a/source/blender/yafray/intern/export_File.cpp +++ b/source/blender/yafray/intern/export_File.cpp @@ -1222,7 +1222,7 @@ void yafrayFileRender_t::writePathlight() bool yafrayFileRender_t::writeWorld() { World *world = G.scene->world; - + short i=0,j=0; if (R.r.GIquality!=0) { if (R.r.GImethod==1) { if (world==NULL) cout << "WARNING: need world background for skydome!\n"; @@ -1233,6 +1233,42 @@ bool yafrayFileRender_t::writeWorld() if (world==NULL) return false; + for(i=0;i<8;i++){ + if(world->mtex[i] != NULL){ + if(world->mtex[i]->tex->type == TEX_IMAGE && world->mtex[i]->tex->ima != NULL){ + + for(j=0;j<160;j++){ + if(world->mtex[i]->tex->ima->name[j] == '\0' && j > 3){ + if( + (world->mtex[i]->tex->ima->name[j-3] == 'h' || world->mtex[i]->tex->ima->name[j-3] == 'H' ) && + (world->mtex[i]->tex->ima->name[j-2] == 'd' || world->mtex[i]->tex->ima->name[j-2] == 'D' ) && + (world->mtex[i]->tex->ima->name[j-1] == 'r' || world->mtex[i]->tex->ima->name[j-1] == 'R' ) + ){ + ostr.str(""); + ostr << "mtex[i]->tex->bright-1) << "\""; + ostr << " mapping = \"probe\" "; + ostr << ">\n"; + ostr << "mtex[i]->tex->ima->name << "\"/>\n"; + ostr << "\n\n"; + xmlfile << ostr.str(); + return true; + } + } + } + + ostr.str(""); + ostr << "mtex[i]->tex->bright << "\">\n"; + ostr << "mtex[i]->tex->ima->name << "\"/>\n"; + ostr << "\n\n"; + xmlfile << ostr.str(); + return true; + } + } + } + ostr.str(""); ostr << "\n"; // if no GI used, the GIpower parameter is not always initialized, so in that case ignore it (have to change method to init yafray vars in Blender)