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\$
1
  • \$\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\$ Commented Jul 20, 2020 at 15:16

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.