diff --git a/plugins/rendermax/renderer_light.cpp b/plugins/rendermax/renderer_light.cpp index 919e411e1..fc7202890 100644 --- a/plugins/rendermax/renderer_light.cpp +++ b/plugins/rendermax/renderer_light.cpp @@ -47,7 +47,7 @@ lightingEngineViewscreen::~lightingEngineViewscreen() threading.shutdown(); } -lightSource::lightSource(lightCell power,int radius):power(power),flicker(false) +lightSource::lightSource(rgbf power,int radius):power(power),flicker(false) { if(radius >= 0) this->radius = radius; @@ -118,7 +118,7 @@ void lightingEngineViewscreen::reinit() w=gps->dimx; h=gps->dimy; size_t size=w*h; - lightMap.resize(size,lightCell(1,1,1)); + lightMap.resize(size,rgbf(1,1,1)); ocupancy.resize(size); lights.resize(size); } @@ -149,7 +149,7 @@ void plotSquare(int xm, int ym, int r,std::function setPixel) setPixel(xm-x, ym+r); /* IV.2 Quadrant */ } } -void plotLine(int x0, int y0, int x1, int y1,lightCell power,std::function setPixel) +void plotLine(int x0, int y0, int x1, int y1,rgbf power,std::function setPixel) { int dx = abs(x1-x0), sx = x0 setPixelAA) +void plotLineAA(int x0, int y0, int x1, int y1,rgbf power,std::function setPixelAA) { int dx = abs(x1-x0), sx = x0 guard(myRenderer->dataMutex); if(lightMap.size()==myRenderer->lightGrid.size()) { @@ -241,8 +241,8 @@ void lightingEngineViewscreen::clear() void lightingEngineViewscreen::calculate() { rect2d vp=getMapViewport(); - const lightCell dim(levelDim,levelDim,levelDim); - lightMap.assign(lightMap.size(),lightCell(1,1,1)); + const rgbf dim(levelDim,levelDim,levelDim); + lightMap.assign(lightMap.size(),rgbf(1,1,1)); lights.assign(lights.size(),lightSource()); for(int i=vp.first.x;i 0.999 && thickness < 1.001) ocupancy[tileId]*=c; else ocupancy[tileId]*=(c.pow(thickness)); } -lightCell getStandartColor(int colorId) +rgbf getStandartColor(int colorId) { - return lightCell(df::global::enabler->ccolor[colorId][0]/255.0f, + return rgbf(df::global::enabler->ccolor[colorId][0]/255.0f, df::global::enabler->ccolor[colorId][1]/255.0f, df::global::enabler->ccolor[colorId][2]/255.0f); } @@ -343,7 +343,7 @@ void lightingEngineViewscreen::applyMaterial(int tileId,const matLightDef& mat,f addOclusion(tileId,mat.transparency,thickness); } else - ocupancy[tileId]=lightCell(0,0,0); + ocupancy[tileId]=rgbf(0,0,0); if(mat.isEmiting) addLight(tileId,mat.makeSource(size)); } @@ -361,11 +361,11 @@ bool lightingEngineViewscreen::applyMaterial(int tileId,int matType,int matIndex } return false; } -lightCell lightingEngineViewscreen::propogateSun(MapExtras::Block* b, int x,int y,const lightCell& in,bool lastLevel) +rgbf lightingEngineViewscreen::propogateSun(MapExtras::Block* b, int x,int y,const rgbf& in,bool lastLevel) { //TODO unify under addLight/addOclusion - const lightCell matStairCase(0.9f,0.9f,0.9f); - lightCell ret=in; + const rgbf matStairCase(0.9f,0.9f,0.9f); + rgbf ret=in; coord2d innerCoord(x,y); df::tiletype type = b->staticTiletypeAt(innerCoord); df::tile_designation d = b->DesignationAt(innerCoord); @@ -440,7 +440,7 @@ void lightingEngineViewscreen::doSun(const lightSource& sky,MapExtras::MapCache& for(int blockX=blockVp.first.x;blockX<=blockVp.second.x;blockX++) for(int blockY=blockVp.first.y;blockY<=blockVp.second.y;blockY++) { - lightCell cellArray[16][16]; + rgbf cellArray[16][16]; for(int block_x = 0; block_x < 16; block_x++) for(int block_y = 0; block_y < 16; block_y++) cellArray[block_x][block_y] = sky.power; @@ -455,7 +455,7 @@ void lightingEngineViewscreen::doSun(const lightSource& sky,MapExtras::MapCache& for(int block_x = 0; block_x < 16; block_x++) for(int block_y = 0; block_y < 16; block_y++) { - lightCell& curCell=cellArray[block_x][block_y]; + rgbf& curCell=cellArray[block_x][block_y]; curCell=propogateSun(b,block_x,block_y,curCell,z==window_z); if(curCell.dot(curCell)<0.003f) emptyCell++; @@ -466,7 +466,7 @@ void lightingEngineViewscreen::doSun(const lightSource& sky,MapExtras::MapCache& for(int block_x = 0; block_x < 16; block_x++) for(int block_y = 0; block_y < 16; block_y++) { - lightCell& curCell=cellArray[block_x][block_y]; + rgbf& curCell=cellArray[block_x][block_y]; df::coord2d pos; pos.x = blockX*16+block_x; pos.y = blockY*16+block_y; @@ -479,12 +479,12 @@ void lightingEngineViewscreen::doSun(const lightSource& sky,MapExtras::MapCache& } } } -lightCell lightingEngineViewscreen::getSkyColor(float v) +rgbf lightingEngineViewscreen::getSkyColor(float v) { if(dayColors.size()<2) { v=abs(fmod(v+0.5,1)-0.5)*2; - return lightCell(v,v,v); + return rgbf(v,v,v); } else { @@ -509,11 +509,11 @@ void lightingEngineViewscreen::doOcupancyAndLights() else daycol= fmod(dayHour,24.0f)/24.0f; //1->12h 0->24h - lightCell sky_col=getSkyColor(daycol); + rgbf sky_col=getSkyColor(daycol); lightSource sky(sky_col, -1);//auto calculate best size - lightSource candle(lightCell(0.96f,0.84f,0.03f),5); - lightSource torch(lightCell(0.9f,0.75f,0.3f),8); + lightSource candle(rgbf(0.96f,0.84f,0.03f),5); + lightSource torch(rgbf(0.9f,0.75f,0.3f),8); //perfectly blocking material @@ -551,7 +551,7 @@ void lightingEngineViewscreen::doOcupancyAndLights() if(!isInRect(pos,vp)) continue; int tile=getIndex(pos.x,pos.y); - lightCell& curCell=ocupancy[tile]; + rgbf& curCell=ocupancy[tile]; curCell=matAmbience.transparency; @@ -559,7 +559,7 @@ void lightingEngineViewscreen::doOcupancyAndLights() df::tile_designation d = b->DesignationAt(gpos); if(d.bits.hidden) { - curCell=lightCell(0,0,0); + curCell=rgbf(0,0,0); continue; // do not process hidden stuff, TODO other hidden stuff } //df::tile_occupancy o = b->OccupancyAt(gpos); @@ -574,7 +574,7 @@ void lightingEngineViewscreen::doOcupancyAndLights() lightDef=&matWall; if(shape==df::tiletype_shape::BROOK_BED ) { - curCell=lightCell(0,0,0); + curCell=rgbf(0,0,0); } else if(shape==df::tiletype_shape::WALL) { @@ -621,18 +621,18 @@ void lightingEngineViewscreen::doOcupancyAndLights() int tile=getIndex(pos.x,pos.y); if(isInRect(pos,vp)) { - lightCell fireColor; + rgbf fireColor; if(f->density>60) { - fireColor=lightCell(0.98f,0.91f,0.30f); + fireColor=rgbf(0.98f,0.91f,0.30f); } else if(f->density>30) { - fireColor=lightCell(0.93f,0.16f,0.16f); + fireColor=rgbf(0.93f,0.16f,0.16f); } else { - fireColor=lightCell(0.64f,0.0f,0.0f); + fireColor=rgbf(0.64f,0.0f,0.0f); } lightSource fire(fireColor,f->density/5); addLight(tile,fire); @@ -776,9 +776,9 @@ void lightingEngineViewscreen::doOcupancyAndLights() } } -lightCell lua_parseLightCell(lua_State* L) +rgbf lua_parseLightCell(lua_State* L) { - lightCell ret; + rgbf ret; lua_pushnumber(L,1); lua_gettable(L,-2); @@ -955,20 +955,20 @@ int lightingEngineViewscreen::parseBuildings(lua_State* L) } void lightingEngineViewscreen::defaultSettings() { - matAmbience=matLightDef(lightCell(0.85f,0.85f,0.85f)); - matLava=matLightDef(lightCell(0.8f,0.2f,0.2f),lightCell(0.8f,0.2f,0.2f),5); - matWater=matLightDef(lightCell(0.6f,0.6f,0.8f)); - matIce=matLightDef(lightCell(0.7f,0.7f,0.9f)); - matCursor=matLightDef(lightCell(0.96f,0.84f,0.03f),11); + matAmbience=matLightDef(rgbf(0.85f,0.85f,0.85f)); + matLava=matLightDef(rgbf(0.8f,0.2f,0.2f),rgbf(0.8f,0.2f,0.2f),5); + matWater=matLightDef(rgbf(0.6f,0.6f,0.8f)); + matIce=matLightDef(rgbf(0.7f,0.7f,0.9f)); + matCursor=matLightDef(rgbf(0.96f,0.84f,0.03f),11); matCursor.flicker=true; - matWall=matLightDef(lightCell(0,0,0)); - matCitizen=matLightDef(lightCell(0.8f,0.8f,0.9f),6); + matWall=matLightDef(rgbf(0,0,0)); + matCitizen=matLightDef(rgbf(0.8f,0.8f,0.9f),6); levelDim=0.2f; dayHour=-1; daySpeed=1; - dayColors.push_back(lightCell(0,0,0)); - dayColors.push_back(lightCell(1,1,1)); - dayColors.push_back(lightCell(0,0,0)); + dayColors.push_back(rgbf(0,0,0)); + dayColors.push_back(rgbf(1,1,1)); + dayColors.push_back(rgbf(0,0,0)); } void lightingEngineViewscreen::loadSettings() { @@ -1070,7 +1070,7 @@ void lightThread::run() void lightThread::work() { - canvas.assign(canvas.size(),lightCell(0,0,0)); + canvas.assign(canvas.size(),rgbf(0,0,0)); for(int i=myRect.first.x;i0 && dsq>0) { if(power<=ls.power) - return lightCell(); + return rgbf(); } //float dt=sqrt(dsq); - lightCell oldCol=canvas[tile]; - lightCell ncol=blendMax(power,oldCol); + rgbf oldCol=canvas[tile]; + rgbf ncol=blendMax(power,oldCol); canvas[tile]=ncol; if(wallhack) - return lightCell(); + return rgbf(); return power; } else - return lightCell(); + return rgbf(); } -void lightThread::doRay(lightCell power,int cx,int cy,int tx,int ty) +void lightThread::doRay(rgbf power,int cx,int cy,int tx,int ty) { using namespace std::placeholders; @@ -1146,7 +1146,7 @@ void lightThread::doLight( int x,int y ) lightSource& csource=dispatch.lights[x*dispatch.getH()+y]; if(csource.radius>0) { - lightCell power=csource.power; + rgbf power=csource.power; int radius =csource.radius; if(csource.flicker) { @@ -1154,7 +1154,7 @@ void lightThread::doLight( int x,int y ) radius*=flicker; power=power*flicker; } - lightCell surrounds; + rgbf surrounds; lightUpCell( power, 0, 0,x, y); for(int i=-1;i<2;i++) for(int j=-1;j<2;j++) diff --git a/plugins/rendermax/renderer_light.hpp b/plugins/rendermax/renderer_light.hpp index d14bbc33f..cb43c20be 100644 --- a/plugins/rendermax/renderer_light.hpp +++ b/plugins/rendermax/renderer_light.hpp @@ -17,7 +17,7 @@ private: float *fg = p->fg + tile * 4 * 6; float *bg = p->bg + tile * 4 * 6; float *tex = p->tex + tile * 2 * 6; - lightCell light=lightGrid[tile]; + rgbf light=lightGrid[tile]; for (int i = 0; i < 6; i++) { *(fg++) *= light.r; *(fg++) *= light.g; @@ -41,7 +41,7 @@ private: } public: tthread::fast_mutex dataMutex; - std::vector lightGrid; + std::vector lightGrid; renderer_light(renderer* parent):renderer_wrap(parent) { reinitLightGrid(); @@ -87,14 +87,14 @@ protected: }; struct lightSource { - lightCell power; + rgbf power; int radius; bool flicker; lightSource():power(0,0,0),radius(0),flicker(false) { } - lightSource(lightCell power,int radius); + lightSource(rgbf power,int radius); float powerSquared()const { return power.r*power.r+power.g*power.g+power.b*power.b; @@ -105,16 +105,16 @@ struct lightSource struct matLightDef { bool isTransparent; - lightCell transparency; + rgbf transparency; bool isEmiting; bool flicker; - lightCell emitColor; + rgbf emitColor; int radius; matLightDef():isTransparent(false),isEmiting(false),transparency(0,0,0),emitColor(0,0,0),radius(0){} - matLightDef(lightCell transparency,lightCell emit,int rad):isTransparent(true),isEmiting(true), + matLightDef(rgbf transparency,rgbf emit,int rad):isTransparent(true),isEmiting(true), transparency(transparency),emitColor(emit),radius(rad){} - matLightDef(lightCell emit,int rad):isTransparent(false),isEmiting(true),emitColor(emit),radius(rad),transparency(0,0,0){} - matLightDef(lightCell transparency):isTransparent(true),isEmiting(false),transparency(transparency){} + matLightDef(rgbf emit,int rad):isTransparent(false),isEmiting(true),emitColor(emit),radius(rad),transparency(0,0,0){} + matLightDef(rgbf transparency):isTransparent(true),isEmiting(false),transparency(transparency){} lightSource makeSource(float size=1) const { if(size>0.999 && size<1.001) @@ -147,10 +147,10 @@ public: tthread::condition_variable occlusionDone; //all threads wait for occlusion to finish tthread::mutex unprocessedMutex; std::stack unprocessed; //stack of parts of map where lighting is not finished - std::vector& occlusion; + std::vector& occlusion; tthread::mutex writeLock; //mutex for lightMap - std::vector& lightMap; + std::vector& lightMap; tthread::condition_variable writesDone; int writeCount; @@ -166,7 +166,7 @@ public: }; class lightThread { - std::vector canvas; + std::vector canvas; lightThreadDispatch& dispatch; DFHack::rect2d myRect; void work(); //main light calculation function @@ -179,8 +179,8 @@ public: void run(); private: void doLight(int x,int y); - void doRay(lightCell power,int cx,int cy,int tx,int ty); - lightCell lightUpCell(lightCell power,int dx,int dy,int tx,int ty); + void doRay(rgbf power,int cx,int cy,int tx,int ty); + rgbf lightUpCell(rgbf power,int dx,int dy,int tx,int ty); }; class lightingEngineViewscreen:public lightingEngine { @@ -203,13 +203,13 @@ private: void doSun(const lightSource& sky,MapExtras::MapCache& map); void doOcupancyAndLights(); - lightCell propogateSun(MapExtras::Block* b, int x,int y,const lightCell& in,bool lastLevel); - void doRay(std::vector & target, lightCell power,int cx,int cy,int tx,int ty); + rgbf propogateSun(MapExtras::Block* b, int x,int y,const rgbf& in,bool lastLevel); + void doRay(std::vector & target, rgbf power,int cx,int cy,int tx,int ty); void doFovs(); - void doLight(std::vector & target, int index); - lightCell lightUpCell(std::vector & target, lightCell power,int dx,int dy,int tx,int ty); + void doLight(std::vector & target, int index); + rgbf lightUpCell(std::vector & target, rgbf power,int dx,int dy,int tx,int ty); bool addLight(int tileId,const lightSource& light); - void addOclusion(int tileId,const lightCell& c,float thickness); + void addOclusion(int tileId,const rgbf& c,float thickness); matLightDef* getMaterial(int matType,int matIndex); buildingLightDef* getBuilding(df::building* bld); @@ -228,8 +228,8 @@ private: return df::coord2d(index/h, index%h); } //maps - std::vector lightMap; - std::vector ocupancy; + std::vector lightMap; + std::vector ocupancy; std::vector lights; //Threading stuff @@ -242,13 +242,13 @@ private: public: void lightWorkerThread(void * arg); private: - lightCell getSkyColor(float v); + rgbf getSkyColor(float v); bool doDebug; //settings float daySpeed; float dayHour; //<0 to cycle - std::vector dayColors; // a gradient of colors, first to 0, last to 24 + std::vector dayColors; // a gradient of colors, first to 0, last to 24 ///set up sane settings if setting file does not exist. void defaultSettings(); @@ -272,6 +272,6 @@ private: DFHack::rect2d mapPort; friend lightThreadDispatch; }; -lightCell blend(lightCell a,lightCell b); -lightCell blendMax(lightCell a,lightCell b); +rgbf blend(rgbf a,rgbf b); +rgbf blendMax(rgbf a,rgbf b); #endif diff --git a/plugins/rendermax/renderer_opengl.hpp b/plugins/rendermax/renderer_opengl.hpp index 151ff94f0..ce14f3762 100644 --- a/plugins/rendermax/renderer_opengl.hpp +++ b/plugins/rendermax/renderer_opengl.hpp @@ -185,73 +185,73 @@ public: }; }; -struct lightCell +struct rgbf { float r,g,b; - lightCell():r(0),g(0),b(0) + rgbf():r(0),g(0),b(0) { } - lightCell(float r,float g,float b):r(r),g(g),b(b) + rgbf(float r,float g,float b):r(r),g(g),b(b) { } - lightCell operator-(const lightCell& cell) const + rgbf operator-(const rgbf& cell) const { - return lightCell(r-cell.r,g-cell.g,b-cell.b); + return rgbf(r-cell.r,g-cell.g,b-cell.b); } - lightCell operator*(float val)const + rgbf operator*(float val)const { - return lightCell(r*val,g*val,b*val); + return rgbf(r*val,g*val,b*val); } - lightCell operator/(float val) const + rgbf operator/(float val) const { - return lightCell(r/val,g/val,b/val); + return rgbf(r/val,g/val,b/val); } - lightCell operator*(const lightCell& cell) const + rgbf operator*(const rgbf& cell) const { - return lightCell(r*cell.r,g*cell.g,b*cell.b); + return rgbf(r*cell.r,g*cell.g,b*cell.b); } - lightCell operator*=(float val) + rgbf operator*=(float val) { r*=val; g*=val; b*=val; return *this; } - lightCell operator*=(const lightCell& cell) + rgbf operator*=(const rgbf& cell) { r*=cell.r; g*=cell.g; b*=cell.b; return *this; } - lightCell operator+=(const lightCell& cell) + rgbf operator+=(const rgbf& cell) { r+=cell.r; g+=cell.g; b+=cell.b; return *this; } - lightCell operator+(const lightCell& other) const + rgbf operator+(const rgbf& other) const { - return lightCell(r+other.r,g+other.g,b+other.b); + return rgbf(r+other.r,g+other.g,b+other.b); } - bool operator<=(const lightCell& other) const + bool operator<=(const rgbf& other) const { return r<=other.r && g<=other.g && b<=other.b; } - float dot(const lightCell& other) const + float dot(const rgbf& other) const { return r*other.r+g*other.g+b*other.b; } - lightCell pow(const float exp) const + rgbf pow(const float exp) const { - return lightCell(std::pow(r, exp), std::pow(g, exp), std::pow(b, exp)); + return rgbf(std::pow(r, exp), std::pow(g, exp), std::pow(b, exp)); } - lightCell pow(const int exp) const + rgbf pow(const int exp) const { - return lightCell(std::pow(r, exp), std::pow(g, exp), std::pow(b, exp)); + return rgbf(std::pow(r, exp), std::pow(g, exp), std::pow(b, exp)); } }; struct renderer_test : public renderer_wrap { @@ -263,7 +263,7 @@ private: float *fg = p->fg + tile * 4 * 6; float *bg = p->bg + tile * 4 * 6; float *tex = p->tex + tile * 2 * 6; - lightCell light=lightGrid[tile]; + rgbf light=lightGrid[tile]; for (int i = 0; i < 6; i++) { *(fg++) *= light.r; *(fg++) *= light.g; @@ -287,7 +287,7 @@ private: } public: tthread::fast_mutex dataMutex; - std::vector lightGrid; + std::vector lightGrid; renderer_test(renderer* parent):renderer_wrap(parent) { reinitLightGrid(); @@ -332,11 +332,11 @@ private: float *fg = p->fg + tile * 4 * 6; float *bg = p->bg + tile * 4 * 6; float *tex = p->tex + tile * 2 * 6; - lightCell fm=foreMult[tile]; - lightCell fo=foreOffset[tile]; + rgbf fm=foreMult[tile]; + rgbf fo=foreOffset[tile]; - lightCell bm=backMult[tile]; - lightCell bo=backOffset[tile]; + rgbf bm=backMult[tile]; + rgbf bo=backOffset[tile]; for (int i = 0; i < 6; i++) { rgba* fore=reinterpret_cast(fg); fore->r=fore->r*fm.r+fo.r; @@ -365,8 +365,8 @@ private: } public: tthread::fast_mutex dataMutex; - std::vector foreOffset,foreMult; - std::vector backOffset,backMult; + std::vector foreOffset,foreMult; + std::vector backOffset,backMult; inline int xyToTile(int x, int y) { return x*(df::global::gps->dimy) + y; diff --git a/plugins/rendermax/rendermax.cpp b/plugins/rendermax/rendermax.cpp index 24ba8c4d8..e03de7ed2 100644 --- a/plugins/rendermax/rendermax.cpp +++ b/plugins/rendermax/rendermax.cpp @@ -121,10 +121,10 @@ static void resetGrids() renderer_lua* r=reinterpret_cast(df::global::enabler->renderer); for(size_t i=0;iforeMult.size();i++) { - r->foreMult[i]=lightCell(1,1,1); - r->foreOffset[i]=lightCell(0,0,0); - r->backMult[i]=lightCell(1,1,1); - r->backOffset[i]=lightCell(0,0,0); + r->foreMult[i]=rgbf(1,1,1); + r->foreOffset[i]=rgbf(0,0,0); + r->backMult[i]=rgbf(1,1,1); + r->backOffset[i]=rgbf(0,0,0); } } static int getGridsSize(lua_State* L) @@ -144,10 +144,10 @@ static int getCell(lua_State* L) int x=luaL_checknumber(L,1); int y=luaL_checknumber(L,2); int id=r->xyToTile(x,y); - lightCell fo=r->foreOffset[id]; - lightCell fm=r->foreMult[id]; - lightCell bo=r->backOffset[id]; - lightCell bm=r->backMult[id]; + rgbf fo=r->foreOffset[id]; + rgbf fm=r->foreMult[id]; + rgbf bo=r->backOffset[id]; + rgbf bm=r->backMult[id]; lua_newtable(L); lua_newtable(L); @@ -195,7 +195,7 @@ static int setCell(lua_State* L) int x=luaL_checknumber(L,1); int y=luaL_checknumber(L,2); - lightCell fo; + rgbf fo; lua_getfield(L,3,"fo"); lua_getfield(L,-1,"r"); fo.r=lua_tonumber(L,-1);lua_pop(L,1); @@ -203,7 +203,7 @@ static int setCell(lua_State* L) fo.g=lua_tonumber(L,-1);lua_pop(L,1); lua_getfield(L,-1,"b"); fo.b=lua_tonumber(L,-1);lua_pop(L,1); - lightCell fm; + rgbf fm; lua_getfield(L,3,"fm"); lua_getfield(L,-1,"r"); fm.r=lua_tonumber(L,-1);lua_pop(L,1); @@ -212,7 +212,7 @@ static int setCell(lua_State* L) lua_getfield(L,-1,"b"); fm.b=lua_tonumber(L,-1);lua_pop(L,1); - lightCell bo; + rgbf bo; lua_getfield(L,3,"bo"); lua_getfield(L,-1,"r"); bo.r=lua_tonumber(L,-1);lua_pop(L,1); @@ -221,7 +221,7 @@ static int setCell(lua_State* L) lua_getfield(L,-1,"b"); bo.b=lua_tonumber(L,-1);lua_pop(L,1); - lightCell bm; + rgbf bm; lua_getfield(L,3,"bm"); lua_getfield(L,-1,"r"); bm.r=lua_tonumber(L,-1);lua_pop(L,1); @@ -307,9 +307,9 @@ static command_result rendermax(color_ostream &out, vector & parameters } if(current_mode==MODE_TRUECOLOR && parameters.size()==2) { - lightCell red(1,0,0),green(0,1,0),blue(0,0,1),white(1,1,1); - lightCell cur=white; - lightCell dim(0.2f,0.2f,0.2f); + rgbf red(1,0,0),green(0,1,0),blue(0,0,1),white(1,1,1); + rgbf cur=white; + rgbf dim(0.2f,0.2f,0.2f); string col=parameters[1]; if(col=="red") cur=red;