At this time, I simply want to "plant" a field of randomly-positioned grass across a flat terrain. A small level was created integrating Irrlicht's Tutorial 12 code (Terrain Rendering) with elvman's Realistic Water node. I needed water, lol! Anyway, the fps with that combination averages around 400+ fps.
Thanks to Acki's loop/nodeID code at http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24874, this works to plant 2000 instances of grass (one GrassPlane2.x model is simply made of two intersecting planes [4 triangles total] and currently not animated):
Code: Select all
// create 2000 nodes with IDs from 1 to 2000:
for(int ID = 1; ID <= 2000; ID++)
{
scene::IAnimatedMeshSceneNode* arrGrass = smgr->addAnimatedMeshSceneNode(smgr->getMesh("../../media/GrassPlane2.x"), 0, ID);
arrGrass->setMaterialFlag(video::EMF_LIGHTING, false);
arrGrass->setMaterialFlag(video::EMF_BACK_FACE_CULLING, false);
arrGrass->getMaterial(0).MaterialTypeParam = 0.01f;
arrGrass->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
arrGrass->setPosition(core::vector3df(random_intX,1800,random_intY));
arrGrass->setRotation(core::vector3df (0,random_rot,0));
}
Is this loop (and the engine's API behaviour) reloading the model and texture 2000 times, or is the original file being stored in IMeshCache automatically? Is there a better way to tackle this?
Thanks very much for any thoughts!