arealight now can be used without global photonmap

fixed problem with spotlights not rendering
This commit is contained in:
Alfredo de Greef 2004-01-25 20:28:46 +00:00
parent 82f8155c3c
commit 8b53b30563
1 changed files with 15 additions and 6 deletions

View File

@ -368,7 +368,8 @@ void yafrayFileRender_t::writeTextures()
ostr << "\t<modulator value=\"" << cb->data[i].pos << "\" >\n";
ostr << "\t\t<color r=\"" << cb->data[i].r << "\"" <<
" g=\"" << cb->data[i].g << "\"" <<
" b=\"" << cb->data[i].b << "\" />\n";
" b=\"" << cb->data[i].b << "\"" <<
" a=\"" << cb->data[i].a << "\" />\n";
ostr << "\t</modulator>\n";
}
ostr << "</shader>\n\n";
@ -1000,7 +1001,15 @@ 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=\"on\" power=\"" << lamp->dist <<"\">\n";
string md = "off";
if (R.r.GIphotons) md = "on";
ostr << "<light type=\"arealight\" name=\"LAMP" << num+1 << "\" dummy=\""<< md << "\" power=\"" << lamp->dist << "\" ";
if (!R.r.GIphotons) {
int psm=0, sm = lamp->ray_totsamp;
if (sm>=16) psm = sm/4;
ostr << "samples=\"" << sm << "\" psamples=\"" << psm << "\" ";
}
ostr << ">\n";
ostr << "\t<a x=\""<< a[0] <<"\" y=\""<< a[1] <<"\" z=\"" << a[2] <<"\" />\n";
ostr << "\t<b x=\""<< b[0] <<"\" y=\""<< b[1] <<"\" z=\"" << b[2] <<"\" />\n";
ostr << "\t<c x=\""<< c[0] <<"\" y=\""<< c[1] <<"\" z=\"" << c[2] <<"\" />\n";
@ -1017,7 +1026,7 @@ void yafrayFileRender_t::writeLamps()
{
ostr.str("");
LampRen* lamp = R.la[i];
if (lamp->type==LA_AREA) { writeAreaLamp(lamp,i); continue; }
if (lamp->type==LA_AREA) { writeAreaLamp(lamp, i); continue; }
// TODO: add decay setting in yafray
ostr << "<light type=\"";
if (lamp->type==LA_LOCAL)
@ -1064,9 +1073,9 @@ void yafrayFileRender_t::writeLamps()
ostr << "\t<from x=\"" << lamp->co[0] << "\" y=\"" << lamp->co[1] << "\" z=\"" << lamp->co[2] << "\" />\n";
// 'to' for spot, already calculated by Blender
if (lamp->type==LA_SPOT)
ostr << "\t<to x=\"" << lamp->co[0] //+1e6*lamp->vec[0]
<< "\" y=\"" << lamp->co[1] //+1e6*lamp->vec[1]
<< "\" z=\"" << lamp->co[2] //+1e6*lamp->vec[2]
ostr << "\t<to x=\"" << lamp->co[0]+lamp->vec[0]
<< "\" y=\"" << lamp->co[1]+lamp->vec[1]
<< "\" z=\"" << lamp->co[2]+lamp->vec[2]
<< "\" />\n";
// color
// rgb in LampRen is premultiplied by energy, power is compensated for that above