Heightmap File Name from TerrainSceneNode

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
gbutcher
Posts: 8
Joined: Sun Jan 06, 2008 4:27 pm

Heightmap File Name from TerrainSceneNode

Post by gbutcher »

I'm writing a scene editor that exports the scene to a .zip file. I need to retrieve the heightmap file name from the terrain scene node, but I can't find a suitable method to do so. Any ideas?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

The only way that I know of is a bit of a hack. You can use the serializeAttributes() method to get the attributes of the scene node, then query the attributes object for its Heightmap attribute.

I posted some code a while back to get the name of a mesh used by an oct tree scene node. You can see that code here.

Travis
gbutcher
Posts: 8
Joined: Sun Jan 06, 2008 4:27 pm

Thanks...

Post by gbutcher »

Thanks, I'll try it.
gbutcher
Posts: 8
Joined: Sun Jan 06, 2008 4:27 pm

Post by gbutcher »

Didn't get to try it until my next business trip, but it works:

Code: Select all

ITerrainSceneNode* terrain = (ITerrainSceneNode*) smgr->getSceneNodeFromType(ESNT_TERRAIN);
    io::IAttributes* attribs = device->getFileSystem()->createEmptyAttributes();
    if (attribs)
    {
      terrain->serializeAttributes(attribs);
      core::stringc name = attribs->getAttributeAsString("Heightmap");
        wxLogMessage("  heightmap: %s", name.c_str());
      attribs->drop();
    }

Post Reply