void Sprite3DReskinTest::addNewSpriteWithCoords(Vec2 p) { _girlPants[0]= "Girl_LowerBody01"; _girlPants[1]= "Girl_LowerBody02"; _girlUpperBody[0] = "Girl_UpperBody01"; _girlUpperBody[1] = "Girl_UpperBody02"; _girlShoes[0] = "Girl_Shoes01"; _girlShoes[1] = "Girl_Shoes02"; _girlHair[0]= "Girl_Hair01"; _girlHair[1]= "Girl_Hair02"; _usePantsId = 0; _useUpBodyId = 0; _useShoesId =0; _useHairId = 0; std::string fileName = "Sprite3DTest/ReskinGirl.c3b"; auto sprite = Sprite3D::create(fileName); sprite->setScale(4); sprite->setRotation3D(Vec3(0,0,0)); auto girlPants = sprite->getMeshByName(_girlPants[1]); if(girlPants) { girlPants->setVisible(false); } auto girlShoes = sprite->getMeshByName(_girlShoes[1]); if(girlShoes) { girlShoes->setVisible(false); } auto girlHair = sprite->getMeshByName(_girlHair[1]); if(girlHair) { girlHair->setVisible(false); } auto girlUpBody = sprite->getMeshByName( _girlUpperBody[1]); if(girlUpBody) { girlUpBody->setVisible(false); } addChild(sprite); sprite->setPosition( Vec2( p.x, p.y-60) ); auto animation = Animation3D::create(fileName); if (animation) { auto animate = Animate3D::create(animation); sprite->runAction(RepeatForever::create(animate)); } _sprite = sprite; }
//! returns if a mesh already was loaded bool CMeshCache::isMeshLoaded(const io::path& name) { return getMeshByName(name) != 0; }