return anim_mesh;
}
+scene::IAnimatedMesh* createCubeMesh(v3f scale,core::aabbox3d<f32> box)
+{
+ video::SColor c(255,255,255,255);
+ video::S3DVertex vertices[24] =
+ {
+ // Up
+ video::S3DVertex(box.MinEdge.X,box.MaxEdge.Y,box.MinEdge.Z, 0,1,0, c, 0,1),
+ video::S3DVertex(box.MinEdge.X,box.MaxEdge.Y,box.MaxEdge.Z, 0,1,0, c, 0,0),
+ video::S3DVertex(box.MaxEdge.X,box.MaxEdge.Y,box.MaxEdge.Z, 0,1,0, c, 1,0),
+ video::S3DVertex(box.MaxEdge.X,box.MaxEdge.Y,box.MinEdge.Z, 0,1,0, c, 1,1),
+ // Down
+ video::S3DVertex(box.MinEdge.X,box.MinEdge.Y,box.MinEdge.Z, 0,-1,0, c, 0,0),
+ video::S3DVertex(box.MaxEdge.X,box.MinEdge.Y,box.MinEdge.Z, 0,-1,0, c, 1,0),
+ video::S3DVertex(box.MaxEdge.X,box.MinEdge.Y,box.MaxEdge.Z, 0,-1,0, c, 1,1),
+ video::S3DVertex(box.MinEdge.X,box.MinEdge.Y,box.MaxEdge.Z, 0,-1,0, c, 0,1),
+ // Right
+ video::S3DVertex(box.MaxEdge.X,box.MinEdge.Y,box.MinEdge.Z, 1,0,0, c, 0,1),
+ video::S3DVertex(box.MaxEdge.X,box.MaxEdge.Y,box.MinEdge.Z, 1,0,0, c, 0,0),
+ video::S3DVertex(box.MaxEdge.X,box.MaxEdge.Y,box.MaxEdge.Z, 1,0,0, c, 1,0),
+ video::S3DVertex(box.MaxEdge.X,box.MinEdge.Y,box.MaxEdge.Z, 1,0,0, c, 1,1),
+ // Left
+ video::S3DVertex(box.MinEdge.X,box.MinEdge.Y,box.MinEdge.Z, -1,0,0, c, 1,1),
+ video::S3DVertex(box.MinEdge.X,box.MinEdge.Y,box.MaxEdge.Z, -1,0,0, c, 0,1),
+ video::S3DVertex(box.MinEdge.X,box.MaxEdge.Y,box.MaxEdge.Z, -1,0,0, c, 0,0),
+ video::S3DVertex(box.MinEdge.X,box.MaxEdge.Y,box.MinEdge.Z, -1,0,0, c, 1,0),
+ // Back
+ video::S3DVertex(box.MinEdge.X,box.MinEdge.Y,box.MaxEdge.Z, 0,0,1, c, 1,1),
+ video::S3DVertex(box.MaxEdge.X,box.MinEdge.Y,box.MaxEdge.Z, 0,0,1, c, 0,1),
+ video::S3DVertex(box.MaxEdge.X,box.MaxEdge.Y,box.MaxEdge.Z, 0,0,1, c, 0,0),
+ video::S3DVertex(box.MinEdge.X,box.MaxEdge.Y,box.MaxEdge.Z, 0,0,1, c, 1,0),
+ // Front
+ video::S3DVertex(box.MinEdge.X,box.MinEdge.Y,box.MinEdge.Z, 0,0,-1, c, 0,1),
+ video::S3DVertex(box.MinEdge.X,box.MaxEdge.Y,box.MinEdge.Z, 0,0,-1, c, 0,0),
+ video::S3DVertex(box.MaxEdge.X,box.MaxEdge.Y,box.MinEdge.Z, 0,0,-1, c, 1,0),
+ video::S3DVertex(box.MaxEdge.X,box.MinEdge.Y,box.MinEdge.Z, 0,0,-1, c, 1,1),
+ };
+
+ u16 indices[6] = {0,1,2,2,3,0};
+
+ scene::SMesh *mesh = new scene::SMesh();
+ for (u32 i=0; i<6; ++i)
+ {
+ scene::IMeshBuffer *buf = new scene::SMeshBuffer();
+ buf->append(vertices + 4 * i, 4, indices, 6);
+ mesh->addMeshBuffer(buf);
+ buf->drop();
+ }
+ scene::SAnimatedMesh *anim_mesh = new scene::SAnimatedMesh(mesh);
+ mesh->drop();
+ scaleMesh(anim_mesh, scale); // also recalculates bounding box
+ return anim_mesh;
+}
+
scene::IAnimatedMesh* createPlantMesh(v3f scale)
{
video::SColor c(255,255,255,255);