cleaned up computeSelected (and renderUnitsFast)
This commit is contained in:
parent
df9e8a7900
commit
87e0324dd4
|
@ -2565,31 +2565,15 @@ void Renderer::computeSelected( Selection::UnitContainer &units,
|
||||||
//select units by checking the selected buffer
|
//select units by checking the selected buffer
|
||||||
int selCount= glRenderMode(GL_RENDER);
|
int selCount= glRenderMode(GL_RENDER);
|
||||||
if(selCount > 0) {
|
if(selCount > 0) {
|
||||||
const World *world= game->getWorld();
|
VisibleQuadContainerCache &qCache = getQuadCache();
|
||||||
for(int i=1; i <= selCount; ++i) {
|
for(int i=1; i <= selCount; ++i) {
|
||||||
int factionIndex= selectBuffer[i*5-2];
|
int visibleUnitIndex= selectBuffer[i*4-1];
|
||||||
//int unitIndex= selectBuffer[i*5-1];
|
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||||
int unitId= selectBuffer[i*5-1];
|
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] factionIndex = %d, unitId = %d, selCount = %d\n",__FILE__,__FUNCTION__,__LINE__,factionIndex,unitId,selCount);
|
|
||||||
|
|
||||||
//if( factionIndex >= 0 && factionIndex < world->getFactionCount() &&
|
|
||||||
// unitIndex >= 0 && unitIndex < world->getFaction(factionIndex)->getUnitCount()) {
|
|
||||||
// Unit *unit= world->getFaction(factionIndex)->getUnit(unitIndex);
|
|
||||||
if( factionIndex >= 0 && factionIndex < world->getFactionCount() &&
|
|
||||||
unitId >= 0) {
|
|
||||||
|
|
||||||
const Faction *faction= world->getFaction(factionIndex);
|
|
||||||
if(faction != NULL) {
|
|
||||||
Unit *unit = faction->findUnit(unitId);
|
|
||||||
if(unit != NULL && unit->isAlive()) {
|
if(unit != NULL && unit->isAlive()) {
|
||||||
units.push_back(unit);
|
units.push_back(unit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] units.size() = %d, selCount = %d\n",__FILE__,__FUNCTION__,__LINE__,units.size(),selCount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== shadows ====================
|
// ==================== shadows ====================
|
||||||
|
@ -2953,7 +2937,6 @@ void Renderer::renderUnitsFast() {
|
||||||
bool modelRenderFactionStarted = false;
|
bool modelRenderFactionStarted = false;
|
||||||
|
|
||||||
if(useQuadCache == true) {
|
if(useQuadCache == true) {
|
||||||
int lastFactionIndex = -1;
|
|
||||||
VisibleQuadContainerCache &qCache = getQuadCache();
|
VisibleQuadContainerCache &qCache = getQuadCache();
|
||||||
if(qCache.visibleQuadUnitList.size() > 0) {
|
if(qCache.visibleQuadUnitList.size() > 0) {
|
||||||
for(int visibleUnitIndex = 0;
|
for(int visibleUnitIndex = 0;
|
||||||
|
@ -2970,20 +2953,7 @@ void Renderer::renderUnitsFast() {
|
||||||
glInitNames();
|
glInitNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lastFactionIndex != unit->getFactionIndex()) {
|
glPushName(visibleUnitIndex);
|
||||||
if(lastFactionIndex != -1) {
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] calling glPopName() for lastFactionIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,lastFactionIndex);
|
|
||||||
glPopName();
|
|
||||||
}
|
|
||||||
|
|
||||||
modelRenderFactionStarted = true;
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] calling glPushName() for lastFactionIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,unit->getFactionIndex());
|
|
||||||
// Used for selection lookup in computeSelected
|
|
||||||
glPushName(unit->getFactionIndex());
|
|
||||||
}
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] calling glPushName() for unit->getId() = %d\n",__FILE__,__FUNCTION__,__LINE__,unit->getId());
|
|
||||||
// Used for selection lookup in computeSelected
|
|
||||||
glPushName(unit->getId());
|
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
|
@ -3005,8 +2975,6 @@ void Renderer::renderUnitsFast() {
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] calling glPopName() for unit->getId() = %d\n",__FILE__,__FUNCTION__,__LINE__,unit->getId());
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] calling glPopName() for unit->getId() = %d\n",__FILE__,__FUNCTION__,__LINE__,unit->getId());
|
||||||
glPopName();
|
glPopName();
|
||||||
|
|
||||||
lastFactionIndex = unit->getFactionIndex();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(modelRenderFactionStarted == true) {
|
if(modelRenderFactionStarted == true) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user