MCPcopy Create free account
hub / github.com/axmolengine/axmol / loadFromFile

Method loadFromFile

core/3d/MeshRenderer.cpp:236–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234}
235
236bool MeshRenderer::loadFromFile(std::string_view path,
237 NodeDatas* nodedatas,
238 MeshDatas* meshdatas,
239 MaterialDatas* materialdatas)
240{
241 std::string fullPath = FileUtils::getInstance()->fullPathForFilename(path);
242
243 std::string ext = FileUtils::getPathExtension(path);
244 if (ext == ".obj")
245 {
246 return Bundle3D::loadObj(*meshdatas, *materialdatas, *nodedatas, fullPath);
247 }
248 else if (ext == ".c3b" || ext == ".c3t")
249 {
250 // load from .c3b or .c3t
251 auto bundle = Bundle3D::createBundle();
252 if (!bundle->load(fullPath))
253 {
254 Bundle3D::destroyBundle(bundle);
255 return false;
256 }
257
258 auto ret =
259 bundle->loadMeshDatas(*meshdatas) && bundle->loadMaterials(*materialdatas) && bundle->loadNodes(*nodedatas);
260 Bundle3D::destroyBundle(bundle);
261
262 return ret;
263 }
264 return false;
265}
266
267MeshRenderer::MeshRenderer()
268 : _skeleton(nullptr)

Callers 1

createAsyncMethod · 0.80

Calls 6

getInstanceFunction · 0.85
fullPathForFilenameMethod · 0.80
loadMeshDatasMethod · 0.80
loadNodesMethod · 0.80
loadMethod · 0.45
loadMaterialsMethod · 0.45

Tested by

no test coverage detected