| 234 | } |
| 235 | |
| 236 | bool 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 | |
| 267 | MeshRenderer::MeshRenderer() |
| 268 | : _skeleton(nullptr) |
no test coverage detected