nindim
07-03-2007 21:12:25
I'm having some problems managing to hide a tile. They are just renderables but I really dont know where to start, so much code!
I tried setting the mvisible bool of a paginglandscapetile (by making it public first) but there seems to be more to it than that. Is there an example I should look at in the plugin as to how to effectively hide a tile? Tried loking at the tilehide event but it seem empty....
this is the code I'm trying so far, first time really looking at the plugin code so not too sure whats going on (I used the setoption for PageGetTileVertexData_2 as a starting point):
If anyone could point me in the right direction I would be grateful.
I tried setting the mvisible bool of a paginglandscapetile (by making it public first) but there seems to be more to it than that. Is there an example I should look at in the plugin as to how to effectively hide a tile? Tried loking at the tilehide event but it seem empty....
this is the code I'm trying so far, first time really looking at the plugin code so not too sure whats going on (I used the setoption for PageGetTileVertexData_2 as a starting point):
if (strKey == "myHideTile")
{
/**
* This is the optimized, yet a bit fuzzy implementation of the getVertexDataPatch
* Usage: Pass in a std::vector<void*> Pointer to the getOption call containing at least 5 Elements
* [0](Ogre::unsigned int*) = X Index of the Page to retrieve data from
* [1](Ogre::unsigned int*) = Z Index of the Page to retrieve data from
* [2](Ogre::unsigned int*) = X Index of the Tile within the Page to retrieve data from
* [3](Ogre::unsigned int*) = Z Index of the Tile within the Page to retrieve data from
* [4](Ogre::unsigned int*) = LodLevel to get the data at (note that level 0 means highest detail)
* The getData call will then append 3 entries to the end of the vector. In Detail(in order)
* [End-2](Ogre::unsigned int*) = Number of vertices returned
* [End-1] (Ogre::Vector3*) = The actual vertices, this is a array containing as many elements as returned in [End-2]
* [End] (Ogre::IndexData*) = The index data for the terrain polygons at the queried LodLevel
* @remark note that the caller is in charge of deleting the vector array, vertices array and indice array.
*/
unsigned int requestPageX = *static_cast<unsigned int *>((*static_cast<std::vector<void*>*>(pDestValue))[0]);
unsigned int requestPageZ = *static_cast<unsigned int *>((*static_cast<std::vector<void*>*>(pDestValue))[1]);
unsigned int requestTileX = *static_cast<unsigned int *>((*static_cast<std::vector<void*>*>(pDestValue))[2]);
unsigned int requestTileZ = *static_cast<unsigned int *>((*static_cast<std::vector<void*>*>(pDestValue))[3]);
unsigned int requestLodLevel = *static_cast<unsigned int *>((*static_cast<std::vector<void*>*>(pDestValue))[4]);
PagingLandScapePage* page = mPageManager->getPage(requestPageX,requestPageZ);
if(page)
{
PagingLandScapeTile* tile = page->getTile(requestTileX,requestTileZ);
if(tile)
{
PagingLandScapeRenderable* rend = tile->getRenderable();
if(rend)
{
if(tile->mVisible)
{
//printf("CRAP!!!!!!!!!");
//tile->mVisible = false;
AxisAlignedBox crap = tile->getCullWorldBbox();
mListenerManager->fireTileHide(requestPageX, requestPageZ, requestTileX, requestTileZ,crap);
return true;
}
}
}
}
return false;
}
If anyone could point me in the right direction I would be grateful.