Yafray panel splitted in two so we can add more settings.

Also preliminar square arealight export, not usable yet, will be usefull
as soon as photon export is added.
This commit is contained in:
Alejandro Conty Estevez 2004-01-12 16:46:47 +00:00
parent 3ed49f3299
commit 501adfba42
4 changed files with 43 additions and 12 deletions

@ -1220,11 +1220,7 @@ static void render_panel_yafrayGI()
if (G.scene->r.GIpower==0) G.scene->r.GIpower=1; if (G.scene->r.GIpower==0) G.scene->r.GIpower=1;
uiDefButF(block, NUM, 0, "Power:", 5,35,154,20, &G.scene->r.GIpower, 0.01, 100.0, 0, 0, "GI lighting intensity scale, 1 is normal"); uiDefButF(block, NUM, 0, "Power:", 5,35,154,20, &G.scene->r.GIpower, 0.01, 100.0, 0, 0, "GI lighting intensity scale, 1 is normal");
} }
uiDefButF(block, NUMSLI, 0, "Gam ", 5,10,154,20, &G.scene->r.YF_gamma, 0.001, 5.0, 0, 0, "Gamma correction, 1 is off");
uiDefButF(block, NUMSLI, 0, "Exp ", 159,10,154,20, &G.scene->r.YF_exposure, 0.0, 10.0, 0, 0, "Exposure adjustment, 0 is off");
uiDefButI(block, NUM, 0, "Processors:", 159,35,154,20,
&G.scene->r.YF_numprocs, 1.0, 8.0, 10, 10, "Number of processors to use");
if (G.scene->r.GImethod==2) { if (G.scene->r.GImethod==2) {
if (G.scene->r.GIdepth==0) G.scene->r.GIdepth=2; if (G.scene->r.GIdepth==0) G.scene->r.GIdepth=2;
@ -1242,6 +1238,26 @@ static void render_panel_yafrayGI()
} }
} }
/* yafray: global options panel */
static void render_panel_yafrayGlobal()
{
uiBlock *block;
block= uiNewBlock(&curarea->uiblocks, "render_panel_yafrayGlobal", UI_EMBOSS, UI_HELV, curarea->win);
uiNewPanelTabbed("Render", "Render");
if(uiNewPanel(curarea, block, "YafRay", "Render", 320, 0, 318, 204)==0) return;
// label to force a boundbox for buttons not to be centered
uiDefBut(block, LABEL, 0, " ", 305,180,10,10, 0, 0, 0, 0, 0, "");
uiDefButF(block, NUMSLI, 0, "Gam ", 5,10,154,20, &G.scene->r.YF_gamma, 0.001, 5.0, 0, 0, "Gamma correction, 1 is off");
uiDefButF(block, NUMSLI, 0, "Exp ", 159,10,154,20,&G.scene->r.YF_exposure, 0.0, 10.0, 0, 0, "Exposure adjustment, 0 is off");
uiDefButI(block, NUM, 0, "Processors:", 159,35,154,20,
&G.scene->r.YF_numprocs, 1.0, 8.0, 10, 10, "Number of processors to use");
}
void render_panels() void render_panels()
{ {
@ -1253,6 +1269,7 @@ void render_panels()
/* yafray: GI panel only available when yafray enabled for rendering */ /* yafray: GI panel only available when yafray enabled for rendering */
if (G.scene->r.mode & R_YAFRAY) { if (G.scene->r.mode & R_YAFRAY) {
if (G.scene->r.YF_gamma==0.0) G.scene->r.YF_gamma=1.0; if (G.scene->r.YF_gamma==0.0) G.scene->r.YF_gamma=1.0;
render_panel_yafrayGlobal();
render_panel_yafrayGI(); render_panel_yafrayGI();
} }

@ -239,7 +239,7 @@ void yafrayFileRender_t::writeTextures()
{ {
for (map<string, pair<Material*, MTex*> >::const_iterator blendtex=used_textures.begin(); for (map<string, pair<Material*, MTex*> >::const_iterator blendtex=used_textures.begin();
blendtex!=used_textures.end();++blendtex) { blendtex!=used_textures.end();++blendtex) {
Material* matr = blendtex->second.first; //Material* matr = blendtex->second.first;
MTex* mtex = blendtex->second.second; MTex* mtex = blendtex->second.second;
Tex* tex = mtex->tex; Tex* tex = mtex->tex;
switch (tex->type) { switch (tex->type) {
@ -921,7 +921,7 @@ void yafrayFileRender_t::writeAllObjects()
writeObject(obj, all_objects[obj], obmat); writeObject(obj, all_objects[obj], obmat);
// all others instances of first // all others instances of first
for (int curmtx=16;curmtx<dupMtx->second.size();curmtx+=16) { // number of 4x4 matrices for (unsigned int curmtx=16;curmtx<dupMtx->second.size();curmtx+=16) { // number of 4x4 matrices
// new mtx // new mtx
for (int i=0;i<4;i++) for (int i=0;i<4;i++)
@ -954,6 +954,21 @@ void yafrayFileRender_t::writeAllObjects()
} }
void yafrayFileRender_t::writeAreaLamp(LampRen* lamp,int num)
{
if(lamp->area_shape != LA_AREA_SQUARE) return;
float *a=lamp->area[0],*b=lamp->area[1],*c=lamp->area[2],*d=lamp->area[3];
ostr.str("");
ostr << "<light type=\"arealight\" name=\"LAMP" << num+1 << "\" dummy=\"off\" " <<endl;
ostr << "\tpower=\"" << lamp->energy <<"\">" <<endl;
ostr << "\t<color r=\""<<lamp->r<<"\" g=\""<<lamp->g<<"\" b=\""<<lamp->b<<"\"/>"<<endl;
ostr << "\t<a x=\""<<a[0]<<"\" y=\""<<a[1]<<"\" z=\""<<a[2]<<"\"/>"<<endl;
ostr << "\t<b x=\""<<b[0]<<"\" y=\""<<b[1]<<"\" z=\""<<b[2]<<"\"/>"<<endl;
ostr << "\t<c x=\""<<c[0]<<"\" y=\""<<c[1]<<"\" z=\""<<c[2]<<"\"/>"<<endl;
ostr << "\t<d x=\""<<d[0]<<"\" y=\""<<d[1]<<"\" z=\""<<d[2]<<"\"/>"<<endl;
ostr << "</light>"<<endl<<endl;
xmlfile << ostr.str();
}
void yafrayFileRender_t::writeLamps() void yafrayFileRender_t::writeLamps()
{ {
@ -962,6 +977,7 @@ void yafrayFileRender_t::writeLamps()
{ {
ostr.str(""); ostr.str("");
LampRen* lamp = R.la[i]; LampRen* lamp = R.la[i];
if(lamp->type==LA_AREA) {writeAreaLamp(lamp,i);continue;}
// TODO: add decay setting in yafray // TODO: add decay setting in yafray
ostr << "<light type=\""; ostr << "<light type=\"";
if (lamp->type==LA_LOCAL) if (lamp->type==LA_LOCAL)
@ -970,12 +986,6 @@ void yafrayFileRender_t::writeLamps()
ostr << "spotlight"; ostr << "spotlight";
else if (lamp->type==LA_SUN) // for now, hemi == sun else if (lamp->type==LA_SUN) // for now, hemi == sun
ostr << "sunlight"; ostr << "sunlight";
/* TODO
else if (lamp->type==LA_AREA) {
// new blender area light
ostr << "arealight";
}
*/
else { else {
// possibly unknown type, ignore // possibly unknown type, ignore
cout << "Unknown Blender lamp type: " << lamp->type << endl; cout << "Unknown Blender lamp type: " << lamp->type << endl;

@ -20,6 +20,7 @@ class yafrayFileRender_t : public yafrayRender_t
virtual void writeObject(Object* obj, virtual void writeObject(Object* obj,
const std::vector<VlakRen*> &VLR_list, const float obmat[4][4]); const std::vector<VlakRen*> &VLR_list, const float obmat[4][4]);
virtual void writeAllObjects(); virtual void writeAllObjects();
void writeAreaLamp(LampRen* lamp,int num);
virtual void writeLamps(); virtual void writeLamps();
virtual void writeCamera(); virtual void writeCamera();
virtual void writeHemilight(); virtual void writeHemilight();

@ -59,7 +59,10 @@ bool yafrayRender_t::exportScene()
clearAll(); clearAll();
if(!finishExport()) if(!finishExport())
{
G.afbreek = 1; //stop render and anim if doing so G.afbreek = 1; //stop render and anim if doing so
return false;
}
else return true; else return true;
} }