Added some more operators to the cell color class.

develop
Japa 2013-06-24 00:14:06 +05:30
parent f415ea2100
commit fd0c053a80
2 changed files with 14 additions and 3 deletions

@ -234,15 +234,15 @@ void lightingEngineViewscreen::doOcupancyAndLights()
{ {
if(bld->mat_type == 3)//green glass if(bld->mat_type == 3)//green glass
{ {
curCell=lightCell(0.1f,0.9f,0.5f); curCell*=lightCell(0.1f,0.9f,0.5f);
} }
else if(bld->mat_type == 4)//clear glass else if(bld->mat_type == 4)//clear glass
{ {
curCell=lightCell(0.5f,0.95f,0.9f); curCell*=lightCell(0.5f,0.95f,0.9f);
} }
else if(bld->mat_type == 5)//crystal glass else if(bld->mat_type == 5)//crystal glass
{ {
curCell=lightCell(0.75f,0.95f,0.95f); curCell*=lightCell(0.75f,0.95f,0.95f);
} }
} }
} }

@ -199,6 +199,17 @@ struct lightCell
{ {
return lightCell(r*val,g*val,b*val); return lightCell(r*val,g*val,b*val);
} }
lightCell operator*(lightCell cell)
{
return lightCell(r*cell.r,g*cell.g,b*cell.b);
}
lightCell operator*=(lightCell cell)
{
r*=cell.r;
g*=cell.g;
b*=cell.b;
return lightCell(r,g,b);
}
lightCell operator+(const lightCell& other) lightCell operator+(const lightCell& other)
{ {
return lightCell(r+other.r,g+other.g,b+other.b); return lightCell(r+other.r,g+other.g,b+other.b);