diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 0904fdbe..61db2fc8 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -6713,7 +6713,7 @@ void Renderer::selectUsingFrustumSelection(Selection::UnitContainer &units, if(unit != NULL && unit->isAlive()) { Vec3f unitPos = unit->getCurrVector(); bool insideQuad = CubeInFrustum(quadSelectionCacheItem.frustumData, - unitPos.x, unitPos.y, unitPos.z, unit->getType()->getSize()); + unitPos.x, unitPos.y, unitPos.z, unit->getType()->getRenderSize()); if(insideQuad == true) { units.push_back(unit); } @@ -8588,7 +8588,7 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame, bool unitCheckedForRender = false; if(VisibleQuadContainerCache::enableFrustumCalcs == true) { //bool insideQuad = PointInFrustum(quadCache.frustumData, unit->getCurrVector().x, unit->getCurrVector().y, unit->getCurrVector().z ); - bool insideQuad = CubeInFrustum(quadCache.frustumData, unit->getCurrVector().x, unit->getCurrVector().y, unit->getCurrVector().z, unit->getType()->getSize()); + bool insideQuad = CubeInFrustum(quadCache.frustumData, unit->getCurrVector().x, unit->getCurrVector().y, unit->getCurrVector().z, unit->getType()->getRenderSize()); bool renderInMap = world->toRenderUnit(unit); if(insideQuad == false || renderInMap == false) { unit->setVisible(false); @@ -8630,7 +8630,7 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame, if(VisibleQuadContainerCache::enableFrustumCalcs == true) { Vec3f pos3f= Vec3f(pos.x, map->getCell(pos)->getHeight(), pos.y); //bool insideQuad = PointInFrustum(quadCache.frustumData, unit->getCurrVector().x, unit->getCurrVector().y, unit->getCurrVector().z ); - bool insideQuad = CubeInFrustum(quadCache.frustumData, pos3f.x, pos3f.y, pos3f.z, pendingUnit.buildUnit->getSize()); + bool insideQuad = CubeInFrustum(quadCache.frustumData, pos3f.x, pos3f.y, pos3f.z, pendingUnit.buildUnit->getRenderSize()); bool renderInMap = world->toRenderUnit(pendingUnit); if(insideQuad == false || renderInMap == false) { if(renderInMap == true) { diff --git a/source/glest_game/types/unit_type.cpp b/source/glest_game/types/unit_type.cpp index 48691866..f9aa117e 100644 --- a/source/glest_game/types/unit_type.cpp +++ b/source/glest_game/types/unit_type.cpp @@ -214,6 +214,10 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, //checkItemInVault(&(this->size),this->size); size= parametersNode->getChild("size")->getAttribute("value")->getIntValue(); addItemToVault(&(this->size),this->size); + renderSize=size; + if(parametersNode->hasChild("render-size")){ + renderSize=parametersNode->getChild("render-size")->getAttribute("value")->getIntValue(); + } //height //checkItemInVault(&(this->height),this->height); diff --git a/source/glest_game/types/unit_type.h b/source/glest_game/types/unit_type.h index 7d3b8035..2f437527 100644 --- a/source/glest_game/types/unit_type.h +++ b/source/glest_game/types/unit_type.h @@ -122,6 +122,7 @@ private: bool multiSelect; int sight; int size; //size in cells + int renderSize; //size to render in cells int height; float rotatedBuildPos; bool rotationAllowed; @@ -198,6 +199,7 @@ public: inline bool getMultiSelect() const {return multiSelect;} inline int getSight() const {return sight;} inline int getSize() const {return size;} + inline int getRenderSize() const {return renderSize;} int getHeight() const {return height;} int getStoredResourceCount() const {return (int)storedResources.size();} inline const Resource *getStoredResource(int i) const {return &storedResources[i];}