Merge branch 'v3' into addWebView

This commit is contained in:
andyque 2014-08-26 22:11:35 +08:00
commit 84c5542a0e
19 changed files with 33 additions and 39 deletions

View File

@ -96,17 +96,19 @@ void Animate3D::startWithTarget(Node *target)
_boneCurves.clear();
auto skin = sprite->getSkeleton();
bool hasCurve = false;
for (unsigned int i = 0; i < skin->getBoneCount(); i++) {
auto bone = skin->getBoneByIndex(i);
auto curve = _animation->getBoneCurveByName(bone->getName());
if (curve)
{
_boneCurves[bone] = curve;
hasCurve = true;
}
else
{
CCLOG("warning: bone %s not find in animation", bone->getName().c_str());
}
}
if (!hasCurve)
{
CCLOG("warning: no animation finde for the skeleton");
}
}

View File

@ -1202,6 +1202,10 @@ bool Bundle3D::loadAnimationDataJson(Animation3DData* animationdata)
{
const rapidjson::Value& bone_keyframes = bone[KEYFRAMES];
rapidjson::SizeType keyframe_size = bone_keyframes.Size();
animationdata->_rotationKeys[bone_name].reserve(keyframe_size);
animationdata->_scaleKeys[bone_name].reserve(keyframe_size);
animationdata->_translationKeys[bone_name].reserve(keyframe_size);
for (rapidjson::SizeType j = 0; j < keyframe_size; j++)
{
const rapidjson::Value& bone_keyframe = bone_keyframes[j];
@ -1627,6 +1631,10 @@ bool Bundle3D::loadAnimationDataBinary(Animation3DData* animationdata)
CCLOGINFO("Failed to read AnimationData: keyframeNum '%s'.", _path.c_str());
return false;
}
animationdata->_rotationKeys[boneName].reserve(keyframeNum);
animationdata->_scaleKeys[boneName].reserve(keyframeNum);
animationdata->_translationKeys[boneName].reserve(keyframeNum);
for (unsigned int j = 0; j < keyframeNum; ++j)
{

View File

@ -1166,9 +1166,15 @@ void Director::getFPSImageData(unsigned char** datapointer, ssize_t* length)
void Director::createStatsLabel()
{
Texture2D *texture = nullptr;
std::string fpsString = "00.0";
std::string drawBatchString = "000";
std::string drawVerticesString = "00000";
if (_FPSLabel)
{
fpsString = _FPSLabel->getString();
drawBatchString = _drawnBatchesLabel->getString();
drawVerticesString = _drawnVerticesLabel->getString();
CC_SAFE_RELEASE_NULL(_FPSLabel);
CC_SAFE_RELEASE_NULL(_drawnBatchesLabel);
CC_SAFE_RELEASE_NULL(_drawnVerticesLabel);
@ -1205,19 +1211,19 @@ void Director::createStatsLabel()
_FPSLabel = LabelAtlas::create();
_FPSLabel->retain();
_FPSLabel->setIgnoreContentScaleFactor(true);
_FPSLabel->initWithString("00.0", texture, 12, 32 , '.');
_FPSLabel->initWithString(fpsString, texture, 12, 32 , '.');
_FPSLabel->setScale(scaleFactor);
_drawnBatchesLabel = LabelAtlas::create();
_drawnBatchesLabel->retain();
_drawnBatchesLabel->setIgnoreContentScaleFactor(true);
_drawnBatchesLabel->initWithString("000", texture, 12, 32, '.');
_drawnBatchesLabel->initWithString(drawBatchString, texture, 12, 32, '.');
_drawnBatchesLabel->setScale(scaleFactor);
_drawnVerticesLabel = LabelAtlas::create();
_drawnVerticesLabel->retain();
_drawnVerticesLabel->setIgnoreContentScaleFactor(true);
_drawnVerticesLabel->initWithString("00000", texture, 12, 32, '.');
_drawnVerticesLabel->initWithString(drawVerticesString, texture, 12, 32, '.');
_drawnVerticesLabel->setScale(scaleFactor);

View File

@ -363,34 +363,12 @@ void Camera3DTestDemo::addNewSpriteWithCoords(Vec3 p,std::string fileName,bool p
if (animation)
{
auto animate = Animate3D::create(animation);
bool inverse = (std::rand() % 3 == 0);
int rand2 = std::rand();
float speed = 1.0f;
if(rand2 % 3 == 1)
{
speed = animate->getSpeed() + CCRANDOM_0_1();
}
else if(rand2 % 3 == 2)
{
speed = animate->getSpeed() - 0.5 * CCRANDOM_0_1();
}
animate->setSpeed(inverse ? -speed : speed);
sprite->runAction(RepeatForever::create(animate));
//auto sp = Sprite3D::create("Sprite3DTest/axe.c3b");
// sprite->getAttachNode("Bip001 R Hand")->addChild(sp);
}
}
if(bindCamera)
{
_sprite3D=sprite;
// auto sp = Sprite3D::create("Sprite3DTest/axe.c3b");
// sp->setScale(3);
//sprite->getAttachNode("Bip001 R Hand")->addChild(sp);
//ParticleSystem3D* particleSystem3D = ParticleSystem3D::create("CameraTest/particle3Dtest1.particle");
//particleSystem3D->start();
//sprite->getAttachNode("Bip001 R Hand")->addChild(particleSystem3D);
}
sprite->setScale(scale);

View File

@ -1056,7 +1056,7 @@ void Sprite3DReskinTest::menuCallback_switchHair(Ref* sender)
}
void Sprite3DReskinTest::menuCallback_switchGlasses(Ref* sender)
{
auto subMesh = _sprite->getMeshByName("Girl_Yanjing_01");
auto subMesh = _sprite->getMeshByName("Girl_Glasses01");
if(subMesh)
{
if(subMesh->isVisible())
@ -1159,14 +1159,14 @@ std::string Sprite3DReskinTest::subtitle() const
void Sprite3DReskinTest::addNewSpriteWithCoords(Vec2 p)
{
_girlPants[0]= "Girl_Xiashen_01";
_girlPants[1]= "Girl_Xiashen_02";
_girlUpperBody[0] = "Girl_Shangshen_01";
_girlUpperBody[1] = "Girl_Shangshen_02";
_girlShoes[0] = "Girl_Xie_01";
_girlShoes[1] = "Girl_Xie_02";
_girlHair[0]= "Girl_Toufa_01";
_girlHair[1]= "Girl_Toufa_02";
_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;

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB