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:
authorAlfredo de Greef <eeshlo@yahoo.com>2004-12-30 04:34:42 +0300
committerAlfredo de Greef <eeshlo@yahoo.com>2004-12-30 04:34:42 +0300
commita970419d0ea2a2c6a8ba8de6046782367d054b87 (patch)
tree16abf3f5d9939bbeb517ef8f34a8ce4c07778c7d /source/blender/yafray
parentfcb00bf294a0e0cda699bd85fd340087ed8e3180 (diff)
If YFexport directory is not set, it will now attempt to use the temp directory.
(/tmp or $TEMP for win.) Probably too early still, but now in plugin mode the floatbuffer will be used too, including postprocessing.
Diffstat (limited to 'source/blender/yafray')
-rwxr-xr-xsource/blender/yafray/intern/export_File.cpp11
-rw-r--r--source/blender/yafray/intern/export_Plugin.cpp69
2 files changed, 45 insertions, 35 deletions
diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp
index 43b4f6298e9..b865096477a 100755
--- a/source/blender/yafray/intern/export_File.cpp
+++ b/source/blender/yafray/intern/export_File.cpp
@@ -119,8 +119,12 @@ bool yafrayFileRender_t::initExport()
// try the user setting setting first, export dir must be set and exist
if (strlen(U.yfexportdir)==0)
{
- cout << "No export directory set in user defaults!\n";
- dir_failed = true;
+ cout << "No export directory set in user defaults!" << endl;
+ char* temp = getenv("TEMP");
+ // if no envar, use /tmp
+ xmlpath = temp ? temp : "/tmp";
+ cout << "Will try TEMP instead: " << xmlpath << endl;
+ // no fail here, but might fail when opening file...
}
else
{
@@ -256,9 +260,6 @@ void yafrayFileRender_t::displayImage()
// although it is possible to load the image using blender,
// maybe it is best to just do a read here, for now the yafray output is always a raw tga anyway
- // rectot already freed in initrender
- R.rectot = (unsigned int *)MEM_callocN(sizeof(int)*R.rectx*R.recty, "rectot");
-
FILE* fp = fopen(imgout.c_str(), "rb");
if (fp==NULL) {
cout << "YAF_displayImage(): Could not open image file\n";
diff --git a/source/blender/yafray/intern/export_Plugin.cpp b/source/blender/yafray/intern/export_Plugin.cpp
index 5463016ea65..79286429b7a 100644
--- a/source/blender/yafray/intern/export_Plugin.cpp
+++ b/source/blender/yafray/intern/export_Plugin.cpp
@@ -189,20 +189,18 @@ bool yafrayPluginRender_t::initExport()
plugin_loaded = true;
}
- if (R.rectot==NULL) {
- R.rectot = (unsigned int *)MEM_callocN(sizeof(int)*R.rectx*R.recty, "rectot");
- unsigned int *bpt=R.rectot, count=R.rectx*R.recty;
- while (--count) bpt[count] = 0xff800000;
- cout << "Image allocated" << endl;
- }
+ // all buffers allocated in initrender.c
+ unsigned int *bpt=R.rectot, count=R.rectx*R.recty;
+ while (--count) bpt[count] = 0xff800000;
+ cout << "Image initialized" << endl;
- if (R.rectz==NULL) {
- R.rectz = (unsigned int *)MEM_mallocN(sizeof(int)*R.rectx*R.recty, "rectz");
- unsigned int *zbuf=R.rectz, count=R.rectx*R.recty;
- while (--count) zbuf[count] = 0x7fffffff;
- cout << "Zbuffer allocated" << endl;
- }
+ unsigned int *zbuf=R.rectz;
+ count = R.rectx*R.recty;
+ while (--count) zbuf[count] = 0x7fffffff;
+ cout << "Zbuffer initialized" << endl;
+ // no need to fill ftot
+
return true;
}
@@ -1690,30 +1688,41 @@ bool yafrayPluginRender_t::writeWorld()
#include "RE_callbacks.h"
-bool blenderYafrayOutput_t::putPixel(int x, int y,const yafray::color_t &c,
- yafray::CFLOAT alpha,yafray::PFLOAT depth)
+bool blenderYafrayOutput_t::putPixel(int x, int y, const yafray::color_t &c,
+ yafray::CFLOAT alpha, yafray::PFLOAT depth)
{
- unsigned char* bpt = (unsigned char*)R.rectot + ((((R.recty-1)-y)*R.rectx)<<2);
- int temp=(int)(c.R*255.0+0.5);
- if(temp>255) temp=255;
- bpt[4*x]=temp;
- temp=(int)(c.G*255.0+0.5);
- if(temp>255) temp=255;
- bpt[4*x+1]=temp;
- temp=(int)(c.B*255.0+0.5);
- if(temp>255) temp=255;
- bpt[4*x+2]=temp;
- temp=(int)(alpha*255.0+0.5);
- if(temp>255) temp=255;
- bpt[4*x+3]=temp;
+ unsigned int px = ((R.recty-1)-y)*R.rectx;
+ unsigned char* bpt = (unsigned char*)R.rectot + (px<<2);
+ int x4 = x<<2;
+ int temp = (int)(c.R*255.f+0.5f);
+ if (temp>255) temp=255;
+ bpt[x4] = temp;
+ temp=(int)(c.G*255.f+0.5f);
+ if (temp>255) temp=255;
+ bpt[x4+1] = temp;
+ temp=(int)(c.B*255.f+0.5f);
+ if (temp>255) temp=255;
+ bpt[x4+2] = temp;
+ temp=(int)(alpha*255.f+0.5f);
+ if (temp>255) temp=255;
+ bpt[x4+3] = temp;
+
+ // float buffer
+ if ((R.r.mode & R_FBUF) && R.rectftot) {
+ float* fpt = R.rectftot + (px<<2);
+ fpt[x4] = c.R;
+ fpt[x4+1] = c.G;
+ fpt[x4+2] = c.B;
+ fpt[x4+3] = alpha;
+ }
// depth values
- unsigned int* zbuf = R.rectz + ((R.recty-1)-y)*R.rectx;
+ unsigned int* zbuf = R.rectz + px;
depth -= R.near;
float mz = R.far - R.near;
if (depth<0) depth=0; else if (depth>mz) depth=mz;
- if (mz!=0.f) mz = 1.f/mz;
- zbuf[x] = (unsigned int)(depth*mz*2147483647.f);
+ if (mz!=0.f) mz = 2147483647.f/mz;
+ zbuf[x] = (unsigned int)(depth*mz);
out++;
if(out==4096)