Hi,

Terrain tiles register themselves with the terrain during one of the scene 
travesals. I cant remember off the top of my head if it occurs during the 
update or cull traversal, but I think it might be the update traversal. If the 
scene has not been traversed, the none of the tiles will have been regstered 
yet.

Have a look at the traverse method of TerrainTile, I think that is where the 
registration is done.

If you are using a VPB built terrain, all the tiles (except the tiles at level 
0 ) are pagged in via the database pager. If the terrain hasn't been rendered, 
then no tiles would have been loaded.

Cheers,
Brad


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Jonathan Klein
Sent: Thursday, 24 November 2011 5:31 AM
To: [email protected]
Subject: [osg-users] osgTerrain::getTile returns nothing

Hi,
I want to access TerrainTiles, but I get always a 0 Pointer.


Code:

ref_ptr<Node> model=osgDB::readNodeFile(Filename.toStdString());

//try to convert the node to an osg::Terrain and analyse it
ref_ptr<osgTerrain::Terrain> Terrain(model->asTerrain());
if(Terrain)
{
  cout << "We have a terrain :)\n" << "...analyzing" << endl;
  osgTerrain::TerrainTile *Tile=Terrain->getTile(osgTerrain::TileID(0, 0, 0));
  cout << "Tile adress: " << Tile << endl;

  //get more detailed info:
  osgTerrain::TerrainTest* 
T=reinterpret_cast<osgTerrain::TerrainTest*>(&*Terrain);
  cout << "TestTerrain Size: " << T->_terrainTileMap.size() << endl;
}




The first thing that I checked is, whether my Node is an actual Terrain (which 
it is, as Terrain is not 0).
Then I'm trying to access a random tile, I supposed that 0,0,0 should always 
exist. But I get a 0-Pointer.
I can't access the TileMap from Terrain directly, so I copied the class 
declaration, made the members public and cast the pointer. (the debugger 
wouldn't show me any contents of _terrainTileMap.
But the map seams to be empty, size is 0. The documentation of Terrain is very 
short, so I don't see any way to access the tiles, or in other words, there 
seam to be no Tiles at all.

Thank you!

Cheers,
Jonathan

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=44015#44015





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


-------------------------------------------------------------------------
DISCLAIMER: This e-mail transmission and any documents, files and 
previous e-mail messages attached to it are private and confidential.  
They may contain proprietary or copyright material or information that 
is subject to legal professional privilege.  They are for the use of 
the intended recipient only.  Any unauthorised viewing, use, disclosure, 
copying, alteration, storage or distribution of, or reliance on, this 
message is strictly prohibited.  No part may be reproduced, adapted or 
transmitted without the written permission of the owner.  If you have 
received this transmission in error, or are not an authorised recipient, 
please immediately notify the sender by return email, delete this 
message and all copies from your e-mail system, and destroy any printed 
copies.  Receipt by anyone other than the intended recipient should not 
be deemed a waiver of any privilege or protection.  Thales Australia 
does not warrant or represent that this e-mail or any documents, files 
and previous e-mail messages attached are error or virus free.  

-------------------------------------------------------------------------

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to