I.SOURCE
OGRE offical Wiki
http://www.ogre3d.org/tikiwiki/ETMAdd-ons Forum
http://www.ogre3d.org/addonforums/viewforum.php?f=16ETM Offical
http://www.oddbeat.de/wiki/etm
II.USE
1).创建与释放
ET::TerrainManager* mTerrainMgr;
ET::SplattingManager* mSplatMgr;
mTerrainMgr = new ET::TerrainManager(mSceneMgr);
mSplatMgr = new ET::SplattingManager("ETSplatting", "ET", 128, 128, 3);
delete mTerrainMgr;
delete mSplatMgr;
2).设置相关细节
// create a fresh, mid-high terrain for editing
ET::TerrainInfo terrainInfo (129, 129, std::vector<float>(129*129, 0.5f));
// create a manual lightmap texture
TexturePtr lightmapTex = TextureManager::getSingleton().createManual( "ETLightmap", "ET", TEX_TYPE_2D, 128, 128, 1, PF_BYTE_RGB);
Image lightmap;
ET::createTerrainLightmap(terrainInfo, lightmap, 128, 128, Vector3(1, -1, 1), ColourValue::White,ColourValue(0.3, 0.3, 0.3));
// load the terrain material and assign it
MaterialPtr material (MaterialManager::getSingleton().getByName("ETTerrainMaterial"));
mTerrainMgr->setMaterial(material);
III.扯淡
地形的本质是
class Tile : public Ogre::Renderable, public Ogre::MovableObject
TerrainImpl::createTerrain创建地形的时候,用设置信息创建tile:TerrainImpl::createTiles
node = mTerrainNode->createChildSceneNode(name);
mTiles[i][j] = new Tile(name, mSceneMgr, this, mIndexHandler, mInfo, mOpt, i*(mOpt.tileSize-1), j*(mOpt.tileSize-1));
node->attachObject(mTiles[i][j]);
mTerrainNode(OGRE::SceneNode型)是地形的根,命名规则是“mInstanceName + "/Terrain"” 当然mTerrainNode的父节点是root。 tile合成了地形,玩啥就和tile玩吧。都整到这一部了,那该干嘛干嘛。
IV.浅尝辄止
deform地形的时候,还是有些复杂处理的。贴图的时候,也有处理的。还听人说有裂缝一说。还是有些技巧的。虽然没有OGRE1.7.2新地形那么负责,ETM还是值得一玩的。