Triangle Num:32768
FPS < 30
Environment: 6G-ddr3, i5-480m
Brute Force not very userful for nowadays game, due to its poor fps. I'm a novice for terrain rendering, maybe the "LOD" could increase the fps.
How to do : Here is the principle and below is the code(yes, I use Ogre O>_<O).
void createScene() { // load terrain map if(myTerrain.LoadHeightMap("height.dat", TERRAIN_SIZE)) { myTerrain.SetHeightScale(0.25f); } else { return; } //config the light /*Ogre::Light* light = mSceneMgr->createLight("Light1"); light->setType(Ogre::Light::LT_DIRECTIONAL); light->setDirection(Ogre::Vector3(1,-1,0));*/ Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create("myMaterialWithNoCulling", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); mat->setCullingMode(Ogre::CULL_NONE ); mat->setSceneBlending(Ogre::SBT_ADD); Ogre::ManualObject* manual = mSceneMgr->createManualObject("MyTerrain"); manual->begin("myMaterialWithNoCulling", RenderOperation::OT_TRIANGLE_LIST); float fColor; for(int iz = 0; iz < TERRAIN_SIZE - 1; ++iz) { for(int ix = 0; ix < TERRAIN_SIZE - 1 ; ++ix) { fColor = myTerrain.GetTrueHeightAtPoint(ix, iz); manual->position(ix, myTerrain.GetScaledHeightAtPoint(ix,iz), iz); manual->colour(fColor, fColor, fColor); fColor = myTerrain.GetTrueHeightAtPoint(ix + 1, iz); manual->position(ix + 1, myTerrain.GetScaledHeightAtPoint(ix + 1,iz), iz); manual->colour(fColor, fColor, fColor); fColor = myTerrain.GetTrueHeightAtPoint(ix, iz + 1); manual->position(ix, myTerrain.GetScaledHeightAtPoint(ix,iz + 1), iz + 1); manual->colour(fColor, fColor, fColor); fColor = myTerrain.GetTrueHeightAtPoint(ix, iz + 1); manual->position(ix, myTerrain.GetScaledHeightAtPoint(ix,iz + 1), iz + 1); manual->colour(fColor, fColor, fColor); fColor = myTerrain.GetTrueHeightAtPoint(ix + 1, iz); manual->position(ix + 1, myTerrain.GetScaledHeightAtPoint(ix + 1,iz), iz); manual->colour(fColor, fColor, fColor); fColor = myTerrain.GetTrueHeightAtPoint(ix + 1, iz + 1); manual->position(ix + 1, myTerrain.GetScaledHeightAtPoint(ix + 1,iz + 1), iz + 1); manual->colour(fColor, fColor, fColor); } } manual->end(); /*manual->convertToMesh("bruteForceTerrain"); Ogre::Entity* terrainMesh = mSceneMgr->createEntity("bruteForceTerrain");*/ mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(manual); }