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()) {
|
if(unit != NULL && unit->isAlive()) {
|
||||||
Vec3f unitPos = unit->getCurrVector();
|
Vec3f unitPos = unit->getCurrVector();
|
||||||
bool insideQuad = CubeInFrustum(quadSelectionCacheItem.frustumData,
|
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) {
|
if(insideQuad == true) {
|
||||||
units.push_back(unit);
|
units.push_back(unit);
|
||||||
}
|
}
|
||||||
|
@ -8588,7 +8588,7 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame,
|
||||||
bool unitCheckedForRender = false;
|
bool unitCheckedForRender = false;
|
||||||
if(VisibleQuadContainerCache::enableFrustumCalcs == true) {
|
if(VisibleQuadContainerCache::enableFrustumCalcs == true) {
|
||||||
//bool insideQuad = PointInFrustum(quadCache.frustumData, unit->getCurrVector().x, unit->getCurrVector().y, unit->getCurrVector().z );
|
//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);
|
bool renderInMap = world->toRenderUnit(unit);
|
||||||
if(insideQuad == false || renderInMap == false) {
|
if(insideQuad == false || renderInMap == false) {
|
||||||
unit->setVisible(false);
|
unit->setVisible(false);
|
||||||
|
@ -8630,7 +8630,7 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame,
|
||||||
if(VisibleQuadContainerCache::enableFrustumCalcs == true) {
|
if(VisibleQuadContainerCache::enableFrustumCalcs == true) {
|
||||||
Vec3f pos3f= Vec3f(pos.x, map->getCell(pos)->getHeight(), pos.y);
|
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 = 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);
|
bool renderInMap = world->toRenderUnit(pendingUnit);
|
||||||
if(insideQuad == false || renderInMap == false) {
|
if(insideQuad == false || renderInMap == false) {
|
||||||
if(renderInMap == true) {
|
if(renderInMap == true) {
|
||||||
|
|
|
@ -214,6 +214,10 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
||||||
//checkItemInVault(&(this->size),this->size);
|
//checkItemInVault(&(this->size),this->size);
|
||||||
size= parametersNode->getChild("size")->getAttribute("value")->getIntValue();
|
size= parametersNode->getChild("size")->getAttribute("value")->getIntValue();
|
||||||
addItemToVault(&(this->size),this->size);
|
addItemToVault(&(this->size),this->size);
|
||||||
|
renderSize=size;
|
||||||
|
if(parametersNode->hasChild("render-size")){
|
||||||
|
renderSize=parametersNode->getChild("render-size")->getAttribute("value")->getIntValue();
|
||||||
|
}
|
||||||
|
|
||||||
//height
|
//height
|
||||||
//checkItemInVault(&(this->height),this->height);
|
//checkItemInVault(&(this->height),this->height);
|
||||||
|
|
|
@ -122,6 +122,7 @@ private:
|
||||||
bool multiSelect;
|
bool multiSelect;
|
||||||
int sight;
|
int sight;
|
||||||
int size; //size in cells
|
int size; //size in cells
|
||||||
|
int renderSize; //size to render in cells
|
||||||
int height;
|
int height;
|
||||||
float rotatedBuildPos;
|
float rotatedBuildPos;
|
||||||
bool rotationAllowed;
|
bool rotationAllowed;
|
||||||
|
@ -198,6 +199,7 @@ public:
|
||||||
inline bool getMultiSelect() const {return multiSelect;}
|
inline bool getMultiSelect() const {return multiSelect;}
|
||||||
inline int getSight() const {return sight;}
|
inline int getSight() const {return sight;}
|
||||||
inline int getSize() const {return size;}
|
inline int getSize() const {return size;}
|
||||||
|
inline int getRenderSize() const {return renderSize;}
|
||||||
int getHeight() const {return height;}
|
int getHeight() const {return height;}
|
||||||
int getStoredResourceCount() const {return (int)storedResources.size();}
|
int getStoredResourceCount() const {return (int)storedResources.size();}
|
||||||
inline const Resource *getStoredResource(int i) const {return &storedResources[i];}
|
inline const Resource *getStoredResource(int i) const {return &storedResources[i];}
|
||||||
|
|
Loading…
Reference in New Issue