new attribute "render-size" in unit-type
This commit is contained in:
parent
7d562e0bd4
commit
11eeed59a1
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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];}
|
||||
|
|
Loading…
Reference in New Issue