colorpicking: first we render buildings then we render units. By this we can select units in or behind buildings with colorpicking.

This commit is contained in:
Titus Tscharntke 2013-04-28 10:26:25 +00:00
parent 6849d432bf
commit d303170b3f
1 changed files with 89 additions and 67 deletions

View File

@ -7520,10 +7520,31 @@ vector<Unit *> Renderer::renderUnitsFast(bool renderingShadows, bool colorPickin
}
bool modelRenderStarted = false;
bool renderOnlyBuildings=true;
for(int k=0; k<2 ;k++) {
if(k==0){
//glDisable(GL_DEPTH_TEST);
renderOnlyBuildings=true;
}
else {
//glClear(GL_DEPTH_BUFFER_BIT);
//glEnable(GL_DEPTH_TEST);
renderOnlyBuildings=false;
}
for(int visibleUnitIndex = 0;
visibleUnitIndex < qCache.visibleQuadUnitList.size(); ++visibleUnitIndex) {
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
if(renderOnlyBuildings==true && unit->getType()->hasCommandClass(ccMove))
{
continue;
}
if(renderOnlyBuildings==false && !unit->getType()->hasCommandClass(ccMove))
{
continue;
}
if(modelRenderStarted == false) {
modelRenderStarted = true;
@ -7599,6 +7620,7 @@ vector<Unit *> Renderer::renderUnitsFast(bool renderingShadows, bool colorPickin
glPopName();
}
}
}
if(modelRenderStarted == true) {
modelRenderer->end();
@ -7607,7 +7629,7 @@ vector<Unit *> Renderer::renderUnitsFast(bool renderingShadows, bool colorPickin
}
}
}
//glDisable(GL_DEPTH_TEST);
return unitsList;
}