Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Matthews <johnny.matthews@gmail.com>2004-03-09 20:06:21 +0300
committerJohnny Matthews <johnny.matthews@gmail.com>2004-03-09 20:06:21 +0300
commitf5d3649d17690522f67edbe3e5b860d1924bf9f2 (patch)
tree23ce016b70047c15d0aca77400fac3a65fcf481e /source/blender/yafray
parent22d1a84968a3598ccb64a1fe4940c22193de7995 (diff)
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)
Diffstat (limited to 'source/blender/yafray')
-rwxr-xr-xsource/blender/yafray/intern/export_File.cpp38
1 files changed, 37 insertions, 1 deletions
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 << "<background type=\"HDRI\" name=\"world_background\" ";
+ ostr << "exposure_adjust = \"";
+ ostr << (world->mtex[i]->tex->bright-1) << "\"";
+ ostr << " mapping = \"probe\" ";
+ ostr << ">\n";
+ ostr << "<filename value=\"" << world->mtex[i]->tex->ima->name << "\"/>\n";
+ ostr << "</background>\n\n";
+ xmlfile << ostr.str();
+ return true;
+ }
+ }
+ }
+
+ ostr.str("");
+ ostr << "<background type=\"image\" name=\"world_background\" power=\"";
+ ostr << world->mtex[i]->tex->bright << "\">\n";
+ ostr << "<filename value=\"" << world->mtex[i]->tex->ima->name << "\"/>\n";
+ ostr << "</background>\n\n";
+ xmlfile << ostr.str();
+ return true;
+ }
+ }
+ }
+
ostr.str("");
ostr << "<background type=\"constant\" name=\"world_background\" >\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)