comparison engine/core/view/renderers/instancerenderer.cpp @ 591:378b588216d6

* Improved addTransparentArea(). Now you can set a list with namespaces.
author helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 13 Aug 2010 20:28:52 +0000
parents d1df6cf5ff23
children e3140f01749d
comparison
equal deleted inserted replaced
590:59c92d10d7bc 591:378b588216d6
160 continue; 160 continue;
161 } 161 }
162 } 162 }
163 163
164 std::string str_name = instance->getObject()->getNamespace(); 164 std::string str_name = instance->getObject()->getNamespace();
165 if(str_name.find(infoa.groups) != -1) { 165 std::list<std::string>::iterator group_it = infoa.groups.begin();
166 ScreenPoint p; 166 for(;group_it != infoa.groups.end(); ++group_it) {
167 Rect rec; 167 if(str_name.find((*group_it)) != -1) {
168 p = cam->toScreenCoordinates(infoa.instance->getLocation().getMapCoordinates()); 168 ScreenPoint p;
169 rec.x = p.x - infoa.w / 2; 169 Rect rec;
170 rec.y = p.y - infoa.h / 2; 170 p = cam->toScreenCoordinates(infoa.instance->getLocation().getMapCoordinates());
171 rec.w = infoa.w; 171 rec.x = p.x - infoa.w / 2;
172 rec.h = infoa.h; 172 rec.y = p.y - infoa.h / 2;
173 if(infoa.instance != instance && vc.dimensions.intersects(rec)) { 173 rec.w = infoa.w;
174 vc.transparency = 255 - infoa.trans; 174 rec.h = infoa.h;
175 if(infoa.instance != instance && vc.dimensions.intersects(rec)) {
176 vc.transparency = 255 - infoa.trans;
177 }
175 } 178 }
176 } 179 }
177 } 180 }
178 } 181 }
179 182
369 info.dirty = true; 372 info.dirty = true;
370 } 373 }
371 } 374 }
372 } 375 }
373 376
374 void InstanceRenderer::addTransparentArea(Instance* instance, const std::string &groups, unsigned int w, unsigned int h, unsigned char trans, bool front) { 377 void InstanceRenderer::addTransparentArea(Instance* instance, const std::list<std::string> &groups, unsigned int w, unsigned int h, unsigned char trans, bool front) {
375 AreaInfo newinfo; 378 AreaInfo newinfo;
376 newinfo.instance = instance; 379 newinfo.instance = instance;
377 newinfo.groups = groups; 380 newinfo.groups = groups;
381
378 newinfo.w = w; 382 newinfo.w = w;
379 newinfo.h = h; 383 newinfo.h = h;
380 newinfo.trans = trans; 384 newinfo.trans = trans;
381 newinfo.front = front; 385 newinfo.front = front;
382 386