NS_CC_BEGIN CCSprite3D* CCSprite3D::create(const char* fileName, const char* textureName) { if (!fileName || fileName[0] == 0) { return NULL; } std::string file = fileName; CCModel* pModel = NULL; if (file.find(".md2") != std::string::npos) { pModel = CCModelMd2::create(fileName); if (pModel && textureName && textureName[0] != 0) { pModel->setSkin(textureName); } } if (pModel == NULL) { return NULL; } CCSprite3D* pRet = new CCSprite3D(); if (pRet && pRet->init()) { pRet->setModel(pModel); pRet->autorelease(); } else { CC_SAFE_DELETE(pRet); } return pRet; }
NS_CC_BEGIN CCSprite3D* CCSprite3D::create(CCModel* pModel) { CCSprite3D* pRet = new CCSprite3D(); if (pRet && pRet->init()) { pRet->setModel(pModel); pRet->autorelease(); } else { CC_SAFE_DELETE(pRet); } return pRet; }