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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to