Fixed tabs to be four spaces.
This commit is contained in:
@@ -540,7 +540,7 @@ bool TXPArchive::getTileInfo(int x, int y, int lod, TileInfo& info)
|
||||
info.center.set(0.f,0.f,0.f);
|
||||
info.bbox.set(0.f,0.f,0.f,0.f,0.f,0.f);
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
|
||||
header.GetLodRange(lod,info.maxRange);
|
||||
header.GetLodRange(lod+1,info.minRange);
|
||||
@@ -602,16 +602,16 @@ osg::Group* TXPArchive::getTileContent(
|
||||
|
||||
bool TXPArchive::getLODSize(int lod, int& x, int& y)
|
||||
{
|
||||
x = y = 0;
|
||||
x = y = 0;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
|
||||
trpg2iPoint size;
|
||||
if (header.GetLodSize(lod,size))
|
||||
{
|
||||
x = size.x;
|
||||
y = size.y;
|
||||
}
|
||||
|
||||
return true;
|
||||
trpg2iPoint size;
|
||||
if (header.GetLodSize(lod,size))
|
||||
{
|
||||
x = size.x;
|
||||
y = size.y;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
// Gets some informations for a given tile
|
||||
struct TileInfo
|
||||
{
|
||||
osg::Vec3 center;
|
||||
osg::Vec3 center;
|
||||
double minRange;
|
||||
double maxRange;
|
||||
float radius;
|
||||
@@ -128,13 +128,13 @@ public:
|
||||
y=_swExtents.y;
|
||||
}
|
||||
|
||||
// Returns global texture
|
||||
// Returns global texture
|
||||
inline osg::Texture2D* getGlobalTexture(int id)
|
||||
{
|
||||
return _textures[id].get();
|
||||
}
|
||||
|
||||
// Returns scenegraph representing the Tile
|
||||
// Returns scenegraph representing the Tile
|
||||
osg::Group* getTileContent(
|
||||
int x,
|
||||
int y,
|
||||
@@ -143,8 +143,8 @@ public:
|
||||
double realMaxRange,
|
||||
double usedMaxRange);
|
||||
|
||||
// Get the number of tiles for given LOD
|
||||
bool getLODSize(int lod, int& x, int& y);
|
||||
// Get the number of tiles for given LOD
|
||||
bool getLODSize(int lod, int& x, int& y);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -176,8 +176,8 @@ protected:
|
||||
// Light attributes vector
|
||||
std::vector<DefferedLightAttribute> _lights;
|
||||
|
||||
//
|
||||
OpenThreads::Mutex _mutex;
|
||||
//
|
||||
OpenThreads::Mutex _mutex;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -191,22 +191,22 @@ osg::Node* TXPNode::addPagedLODTile(int x, int y, int lod)
|
||||
TXPPagedLOD* pagedLOD = new TXPPagedLOD;
|
||||
pagedLOD->setFileName(0,pagedLODfile);
|
||||
//pagedLOD->setPriorityOffset(0,1.0f);
|
||||
pagedLOD->setPriorityOffset(0,_archive->getNumLODs());
|
||||
pagedLOD->setPriorityOffset(0,_archive->getNumLODs());
|
||||
pagedLOD->setPriorityScale(0,1.0f);
|
||||
pagedLOD->setRange(0,0.0,info.maxRange);
|
||||
pagedLOD->setCenter(info.center);
|
||||
pagedLOD->setRadius(info.radius);
|
||||
pagedLOD->setNumChildrenThatCannotBeExpired(1);
|
||||
pagedLOD->setTileId(x,y,lod);
|
||||
pagedLOD->setTileId(x,y,lod);
|
||||
|
||||
int sizeX, sizeY;
|
||||
if (_archive->getLODSize(lod,sizeX,sizeY))
|
||||
{
|
||||
if ((x-1) > -1) pagedLOD->addNeighbour(x-1,y);
|
||||
if ((x+1) < sizeX) pagedLOD->addNeighbour(x+1,y);
|
||||
if ((y-1) > -1) pagedLOD->addNeighbour(x,y-1);
|
||||
if ((y+1) < sizeY) pagedLOD->addNeighbour(x,y+1);
|
||||
}
|
||||
int sizeX, sizeY;
|
||||
if (_archive->getLODSize(lod,sizeX,sizeY))
|
||||
{
|
||||
if ((x-1) > -1) pagedLOD->addNeighbour(x-1,y);
|
||||
if ((x+1) < sizeX) pagedLOD->addNeighbour(x+1,y);
|
||||
if ((y-1) > -1) pagedLOD->addNeighbour(x,y-1);
|
||||
if ((y+1) < sizeY) pagedLOD->addNeighbour(x,y+1);
|
||||
}
|
||||
|
||||
_nodesToAdd.push_back(pagedLOD);
|
||||
|
||||
|
||||
@@ -30,44 +30,44 @@ void TXPPagedLOD::traverse(osg::NodeVisitor& nv)
|
||||
|
||||
switch(nv.getTraversalMode())
|
||||
{
|
||||
case(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN):
|
||||
std::for_each(_children.begin(),_children.end(),osg::NodeAcceptOp(nv));
|
||||
case(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN):
|
||||
std::for_each(_children.begin(),_children.end(),osg::NodeAcceptOp(nv));
|
||||
break;
|
||||
case(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN):
|
||||
case(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN):
|
||||
{
|
||||
float distance = nv.getDistanceToEyePoint(getCenter(),true);
|
||||
|
||||
int lastChildTraversed = -1;
|
||||
bool needToLoadChild = false;
|
||||
bool rollBack = false;
|
||||
bool rollBack = false;
|
||||
for(unsigned int i=0;i<_rangeList.size();++i)
|
||||
{
|
||||
if (_rangeList[i].first<=distance && distance<_rangeList[i].second)
|
||||
{
|
||||
if (i<_children.size())
|
||||
{
|
||||
bool acceptThisChild = true;
|
||||
bool acceptThisChild = true;
|
||||
|
||||
if (i)
|
||||
{
|
||||
for (unsigned int ni = 0; ni < _neighbours.size(); ni++)
|
||||
{
|
||||
Neighbour& n = _neighbours[ni];
|
||||
if (TileMapper::instance()->getPagedLOD(n._x, n._y, _tileLOD)== 0)
|
||||
{
|
||||
rollBack = true;
|
||||
acceptThisChild = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i)
|
||||
{
|
||||
for (unsigned int ni = 0; ni < _neighbours.size(); ni++)
|
||||
{
|
||||
Neighbour& n = _neighbours[ni];
|
||||
if (TileMapper::instance()->getPagedLOD(n._x, n._y, _tileLOD)== 0)
|
||||
{
|
||||
rollBack = true;
|
||||
acceptThisChild = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (acceptThisChild)
|
||||
{
|
||||
if (updateTimeStamp) _perRangeDataList[i]._timeStamp=timeStamp;
|
||||
_children[i]->accept(nv);
|
||||
lastChildTraversed = (int)i;
|
||||
}
|
||||
if (acceptThisChild)
|
||||
{
|
||||
if (updateTimeStamp) _perRangeDataList[i]._timeStamp=timeStamp;
|
||||
_children[i]->accept(nv);
|
||||
lastChildTraversed = (int)i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -76,13 +76,13 @@ void TXPPagedLOD::traverse(osg::NodeVisitor& nv)
|
||||
}
|
||||
}
|
||||
|
||||
if (rollBack)
|
||||
{
|
||||
if (updateTimeStamp) _perRangeDataList[0]._timeStamp=timeStamp;
|
||||
_children[0]->accept(nv);
|
||||
lastChildTraversed = 0;
|
||||
//std::cout << "Rolling back" << std::endl;
|
||||
}
|
||||
if (rollBack)
|
||||
{
|
||||
if (updateTimeStamp) _perRangeDataList[0]._timeStamp=timeStamp;
|
||||
_children[0]->accept(nv);
|
||||
lastChildTraversed = 0;
|
||||
//std::cout << "Rolling back" << std::endl;
|
||||
}
|
||||
|
||||
if (needToLoadChild)
|
||||
{
|
||||
|
||||
@@ -38,44 +38,44 @@
|
||||
|
||||
namespace txp
|
||||
{
|
||||
class TXPPagedLOD : public osg::PagedLOD
|
||||
{
|
||||
public:
|
||||
TXPPagedLOD();
|
||||
class TXPPagedLOD : public osg::PagedLOD
|
||||
{
|
||||
public:
|
||||
TXPPagedLOD();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
TXPPagedLOD(const TXPPagedLOD&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
||||
TXPPagedLOD(const TXPPagedLOD&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_Node(txp, TXPPagedLOD);
|
||||
|
||||
virtual void traverse(osg::NodeVisitor& nv);
|
||||
virtual void traverse(osg::NodeVisitor& nv);
|
||||
|
||||
inline void setTileId(int x, int y, int lod)
|
||||
{
|
||||
_tileX = x; _tileY = y; _tileLOD = lod;
|
||||
}
|
||||
inline void setTileId(int x, int y, int lod)
|
||||
{
|
||||
_tileX = x; _tileY = y; _tileLOD = lod;
|
||||
}
|
||||
|
||||
inline void addNeighbour(int x,int y)
|
||||
{
|
||||
Neighbour n;
|
||||
n._x = x;
|
||||
n._y = y;
|
||||
_neighbours.push_back(n);
|
||||
}
|
||||
inline void addNeighbour(int x,int y)
|
||||
{
|
||||
Neighbour n;
|
||||
n._x = x;
|
||||
n._y = y;
|
||||
_neighbours.push_back(n);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~TXPPagedLOD();
|
||||
protected:
|
||||
virtual ~TXPPagedLOD();
|
||||
|
||||
int _tileX;
|
||||
int _tileY;
|
||||
int _tileLOD;
|
||||
int _tileX;
|
||||
int _tileY;
|
||||
int _tileLOD;
|
||||
|
||||
struct Neighbour
|
||||
{
|
||||
int _x, _y;
|
||||
};
|
||||
std::vector<Neighbour> _neighbours;
|
||||
};
|
||||
struct Neighbour
|
||||
{
|
||||
int _x, _y;
|
||||
};
|
||||
std::vector<Neighbour> _neighbours;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ void TXPSeamLOD::traverse(osg::NodeVisitor& nv)
|
||||
|
||||
#if 1
|
||||
osg::PagedLOD* pagedLOD = TileMapper::instance()->getPagedLOD(_neighbourTileX,_neighbourTileY, _neighbourTileLOD);
|
||||
bool acceptLoRes = true;
|
||||
bool acceptLoRes = true;
|
||||
if (pagedLOD)
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ void TXPSeamLOD::traverse(osg::NodeVisitor& nv)
|
||||
if (distance<=pagedLOD->getMaxRange(i))
|
||||
{
|
||||
getChild(i)->accept(nv);
|
||||
acceptLoRes = false;
|
||||
acceptLoRes = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,54 +48,54 @@ class TXPSeamLOD : public osg::Group
|
||||
{
|
||||
public:
|
||||
|
||||
TXPSeamLOD();
|
||||
TXPSeamLOD();
|
||||
|
||||
TXPSeamLOD(int x, int y, int lod, const osg::Vec3& center, float dmin,
|
||||
float dmid, float dmax);
|
||||
TXPSeamLOD(int x, int y, int lod, const osg::Vec3& center, float dmin,
|
||||
float dmid, float dmax);
|
||||
|
||||
TXPSeamLOD(const TXPSeamLOD&,
|
||||
const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
|
||||
TXPSeamLOD(const TXPSeamLOD&,
|
||||
const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_Node(txp, TXPSeamLOD);
|
||||
META_Node(txp, TXPSeamLOD);
|
||||
|
||||
virtual void traverse(osg::NodeVisitor& nv);
|
||||
virtual void traverse(osg::NodeVisitor& nv);
|
||||
|
||||
void setTileRef(bool* b)
|
||||
{
|
||||
_tileRef = b;
|
||||
}
|
||||
void setTileRef(bool* b)
|
||||
{
|
||||
_tileRef = b;
|
||||
}
|
||||
|
||||
void setTxpNode(TXPTileNode* txpNode)
|
||||
{
|
||||
_txpNode = txpNode;
|
||||
}
|
||||
void setTxpNode(TXPTileNode* txpNode)
|
||||
{
|
||||
_txpNode = txpNode;
|
||||
}
|
||||
|
||||
TXPTileNode* getTxpNode() const
|
||||
{
|
||||
return _txpNode;
|
||||
}
|
||||
TXPTileNode* getTxpNode() const
|
||||
{
|
||||
return _txpNode;
|
||||
}
|
||||
|
||||
void setArchive(TXPArchive* ar)
|
||||
{
|
||||
_archive = ar;
|
||||
}
|
||||
void setArchive(TXPArchive* ar)
|
||||
{
|
||||
_archive = ar;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
int _neighbourTileX;
|
||||
int _neighbourTileY;
|
||||
int _neighbourTileLOD;
|
||||
int _neighbourTileX;
|
||||
int _neighbourTileY;
|
||||
int _neighbourTileLOD;
|
||||
|
||||
osg::Vec3 _center;
|
||||
osg::Vec3 _center;
|
||||
|
||||
float _min;
|
||||
float _mid;
|
||||
float _max;
|
||||
float _min;
|
||||
float _mid;
|
||||
float _max;
|
||||
|
||||
bool* _tileRef;
|
||||
bool* _tileRef;
|
||||
|
||||
TXPTileNode* _txpNode;
|
||||
TXPArchive* _archive;
|
||||
TXPTileNode* _txpNode;
|
||||
TXPArchive* _archive;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -223,19 +223,19 @@ bool TXPTileNode::loadTile(int x, int y, int lod)
|
||||
pagedLOD->setRange(1,0,info.minRange);
|
||||
pagedLOD->setCenter(info.center);
|
||||
pagedLOD->setRadius(info.radius);
|
||||
pagedLOD->setPriorityOffset(0,numLods-lod);
|
||||
pagedLOD->setPriorityScale(0,1.0f);
|
||||
pagedLOD->setPriorityOffset(0,numLods-lod);
|
||||
pagedLOD->setPriorityScale(0,1.0f);
|
||||
pagedLOD->setNumChildrenThatCannotBeExpired(1);
|
||||
pagedLOD->setTileId(x,y,lod);
|
||||
pagedLOD->setTileId(x,y,lod);
|
||||
|
||||
int sizeX, sizeY;
|
||||
if (_archive->getLODSize(lod,sizeX,sizeY))
|
||||
{
|
||||
if ((x-1) > -1) pagedLOD->addNeighbour(x-1,y);
|
||||
if ((x+1) < sizeX) pagedLOD->addNeighbour(x+1,y);
|
||||
if ((y-1) > -1) pagedLOD->addNeighbour(x,y-1);
|
||||
if ((y+1) < sizeY) pagedLOD->addNeighbour(x,y+1);
|
||||
}
|
||||
int sizeX, sizeY;
|
||||
if (_archive->getLODSize(lod,sizeX,sizeY))
|
||||
{
|
||||
if ((x-1) > -1) pagedLOD->addNeighbour(x-1,y);
|
||||
if ((x+1) < sizeX) pagedLOD->addNeighbour(x+1,y);
|
||||
if ((y-1) > -1) pagedLOD->addNeighbour(x,y-1);
|
||||
if ((y+1) < sizeY) pagedLOD->addNeighbour(x,y+1);
|
||||
}
|
||||
|
||||
TileMapper::instance()->insertPagedLOD(x,y,lod,pagedLOD.get());
|
||||
|
||||
|
||||
@@ -43,25 +43,25 @@ class TXPArchive;
|
||||
class TXPTileNode : public osg::Group
|
||||
{
|
||||
public:
|
||||
TXPTileNode();
|
||||
TXPTileNode();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
TXPTileNode(const TXPTileNode&,
|
||||
const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
TXPTileNode(const TXPTileNode&,
|
||||
const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_Node(txp, TXPTileNode);
|
||||
META_Node(txp, TXPTileNode);
|
||||
|
||||
void setArchive(TXPArchive* archive);
|
||||
bool loadTile(int x, int y, int lod);
|
||||
void setArchive(TXPArchive* archive);
|
||||
bool loadTile(int x, int y, int lod);
|
||||
|
||||
osg::Node* seamReplacement(osg::Node* child, int x, int y, int level,
|
||||
TXPArchive::TileInfo& info);
|
||||
osg::Node* seamReplacement(osg::Node* child, int x, int y, int level,
|
||||
TXPArchive::TileInfo& info);
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~TXPTileNode();
|
||||
virtual ~TXPTileNode();
|
||||
|
||||
TXPArchive* _archive;
|
||||
TXPArchive* _archive;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user