1
\$\begingroup\$

I am trying to load a bunch of mesh resources in the format of .obj files. Some of the files are very high in poly count so when loading using the below method It takes more than 10 seconds. I would really like to cut this time down.

My question is how can I bind this to call loadMesh with std::async? Because I think that might help speed up the process.

Mesh *Loader::loadMesh(const std::string &path)
{
    std::shared_ptr<Mesh> mesh = Mesh::load(path);

    m_meshes.push_back(mesh);

    return m_meshes.back().get();
}

.
.
.

//this is the binding 
    luabind::module(m_world->getLua()->get())
    [
        luabind::class_<Loader>("world")
            .def("load_mesh", &Loader::loadMesh)
    ]


\$\endgroup\$
  • \$\begingroup\$ Try a different approach: Load everything up front, and cache them. Then your lua code just needs to assign it. It's a lot simpler, if you aren't worried about memory usage. \$\endgroup\$ – Ian Young Jul 20 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.