Code: Select all
IMeshSceneNode* node=NULL;
SMeshBuffer *buf = new SMeshBuffer();
SMesh* BoxMesh = new SMesh();
BoxMesh->addMeshBuffer(buf);
buf->drop();
buf->Vertices.set_used(8);
buf->Indices.set_used(36);
buf->Vertices[0].Pos.set(80,20,20);
buf->Vertices[1].Pos.set(80,-20,-20);
buf->Vertices[2].Pos.set(-80,-20,-20);
buf->Vertices[3].Pos.set(-80,-20,20);
buf->Vertices[4].Pos.set(-80,20,20);
buf->Vertices[5].Pos.set(80,-20,20);
buf->Vertices[6].Pos.set(-80,20,-20);
buf->Vertices[7].Pos.set(80,20,-20);
buf->Vertices[0].Color = (255,255,255,0);
buf->Vertices[1].Color = (255,255,255,0);
buf->Vertices[2].Color = (255,255,255,0);
buf->Vertices[3].Color = (255,255,255,0);
buf->Vertices[4].Color = (255,255,255,0);
buf->Vertices[5].Color = (255,255,255,0);
buf->Vertices[6].Color = (255,255,255,0);
buf->Vertices[7].Color = (255,255,255,0);
buf->Indices[0] = 3;
buf->Indices[1] = 5;
buf->Indices[2] = 0;
buf->Indices[3] = 0;
buf->Indices[4] = 4;
buf->Indices[5] = 3;
buf->Indices[6] = 5;
buf->Indices[7] = 1;
buf->Indices[8] = 7;
buf->Indices[9] = 7;
buf->Indices[10] = 0;
buf->Indices[11] = 5;
buf->Indices[12] = 1;
buf->Indices[13] = 2;
buf->Indices[14] = 6;
buf->Indices[15] = 6;
buf->Indices[16] = 7;
buf->Indices[17] = 1;
buf->Indices[18] = 2;
buf->Indices[19] = 3;
buf->Indices[20] = 4;
buf->Indices[21] = 4;
buf->Indices[22] = 6;
buf->Indices[23] = 2;
buf->Indices[24] = 5;
buf->Indices[25] = 3;
buf->Indices[26] = 2;
buf->Indices[27] = 2;
buf->Indices[28] = 1;
buf->Indices[29] = 5;
buf->Indices[30] = 4;
buf->Indices[31] = 0;
buf->Indices[32] = 7;
buf->Indices[33] = 7;
buf->Indices[34] = 6;
buf->Indices[35] = 4;
buf->recalculateBoundingBox();
BoxMesh->setMaterialFlag(EMF_LIGHTING, false);
node = smgr->addMeshSceneNode(BoxMesh);
Many thanks in advance!