StaticGeometry添加的实体要用索引形式的三角形来构建。否则程序出错。
ManualObject* manual = mSceneMgr->createManualObject("grass"); manual->begin("Examples/GrassBlades", RenderOperation::OT_TRIANGLE_LIST); //6 manual->position(5.0, 0.0, 0.0); manual->textureCoord(1, 1); manual->position(-5.0, 10.0, 0.0); manual->textureCoord(0, 0); manual->position(-5.0, 0.0, 0.0); manual->textureCoord(0, 1); manual->index(0); manual->index(1); manual->index(2); //8 manual->end(); manual->convertToMesh("bladesGrass"); StaticGeometry* field = mSceneMgr->createStaticGeometry("fieldGrass"); for (int i= 0; i < 50; ++i) { for (int j = 0; j < 50; ++j) { Entity* ent = mSceneMgr->createEntity("bladesGrass"); field->addEntity(ent, Vector3(i*3, -10, j*3)); } } field->build();