本文整理汇总了C++中Sprite3D::loadFromCache方法的典型用法代码示例。如果您正苦于以下问题:C++ Sprite3D::loadFromCache方法的具体用法?C++ Sprite3D::loadFromCache怎么用?C++ Sprite3D::loadFromCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite3D
的用法示例。
在下文中一共展示了Sprite3D::loadFromCache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new
void Sprite3D::createAsync(const std::string &modelPath, const std::string &texturePath, const std::function<void(Sprite3D*, void*)>& callback, void* callbackparam)
{
Sprite3D *sprite = new (std::nothrow) Sprite3D();
if (sprite->loadFromCache(modelPath))
{
sprite->autorelease();
if (!texturePath.empty())
sprite->setTexture(texturePath);
callback(sprite, callbackparam);
return;
}
sprite->_asyncLoadParam.afterLoadCallback = callback;
sprite->_asyncLoadParam.texPath = texturePath;
sprite->_asyncLoadParam.modlePath = modelPath;
sprite->_asyncLoadParam.callbackParam = callbackparam;
sprite->_asyncLoadParam.materialdatas = new (std::nothrow) MaterialDatas();
sprite->_asyncLoadParam.meshdatas = new (std::nothrow) MeshDatas();
sprite->_asyncLoadParam.nodeDatas = new (std::nothrow) NodeDatas();
AsyncTaskPool::getInstance()->enqueue(AsyncTaskPool::TaskType::TASK_IO, CC_CALLBACK_1(Sprite3D::afterAsyncLoad, sprite), (void*)(&sprite->_asyncLoadParam), [sprite]()
{
sprite->_asyncLoadParam.result = sprite->loadFromFile(sprite->_asyncLoadParam.modlePath, sprite->_asyncLoadParam.nodeDatas, sprite->_asyncLoadParam.meshdatas, sprite->_asyncLoadParam.materialdatas);
});
}