mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/super626/cocos2d-x into v3
This commit is contained in:
commit
db60512c4b
|
@ -85,9 +85,6 @@ void getChildMap(std::map<int, std::vector<int> >& map, SkinData* skinData, cons
|
|||
if (!skinData)
|
||||
return;
|
||||
|
||||
if (!val.HasMember(SKINDATA_CHILDREN))
|
||||
return;
|
||||
|
||||
// get transform matrix
|
||||
Mat4 transform;
|
||||
const rapidjson::Value& parent_tranform = val[SKINDATA_TRANSFORM];
|
||||
|
@ -102,20 +99,25 @@ void getChildMap(std::map<int, std::vector<int> >& map, SkinData* skinData, cons
|
|||
if (parent_name_index < 0)
|
||||
{
|
||||
skinData->addNodeBoneNames(parent_name);
|
||||
parent_name_index = skinData->getBoneNameIndex(parent_name);
|
||||
skinData->nodeBoneOriginMatrices.push_back(transform);
|
||||
}
|
||||
else
|
||||
else if (parent_name_index < skinData->skinBoneNames.size())
|
||||
{
|
||||
skinData->skinBoneOriginMatrices.push_back(transform);
|
||||
skinData->skinBoneOriginMatrices[parent_name_index] = (transform);
|
||||
}
|
||||
|
||||
// set root bone index
|
||||
if(skinData->rootBoneIndex < 0)
|
||||
{
|
||||
if (parent_name_index < 0)
|
||||
parent_name_index = skinData->getBoneNameIndex(parent_name);
|
||||
|
||||
skinData->rootBoneIndex = parent_name_index;
|
||||
}
|
||||
|
||||
if (!val.HasMember(SKINDATA_CHILDREN))
|
||||
return;
|
||||
|
||||
const rapidjson::Value& children = val[SKINDATA_CHILDREN];
|
||||
for (rapidjson::SizeType i = 0; i < children.Size(); i++)
|
||||
{
|
||||
|
@ -339,6 +341,8 @@ bool Bundle3D::loadSkinDataJson(SkinData* skindata)
|
|||
const rapidjson::Value& skin_data_1 = skin_data_array[1];
|
||||
|
||||
// parent and child relationship map
|
||||
skindata->skinBoneOriginMatrices.resize(skindata->skinBoneNames.size());
|
||||
//skindata->nodeBoneOriginMatrices.resize(skindata->nodeBoneNames.size());
|
||||
getChildMap(skindata->boneChild, skindata, skin_data_1);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -53,10 +53,11 @@ void Bone::setOriPose(const Mat4& m)
|
|||
|
||||
void Bone::resetPose()
|
||||
{
|
||||
if (_parent)
|
||||
_world = _parent->_world * _oriPose;
|
||||
else
|
||||
_world = _oriPose;
|
||||
_local =_oriPose;
|
||||
// if (_parent)
|
||||
// _world = _parent->_world * _oriPose;
|
||||
// else
|
||||
// _world = _oriPose;
|
||||
|
||||
for (auto it : _children) {
|
||||
it->resetPose();
|
||||
|
|
|
@ -541,10 +541,10 @@ std::string Sprite3DWithSkinTest::subtitle() const
|
|||
|
||||
void Sprite3DWithSkinTest::addNewSpriteWithCoords(Vec2 p)
|
||||
{
|
||||
std::string fileName = "Sprite3DTest/girl.c3b";
|
||||
std::string fileName = "Sprite3DTest/girl.c3t";
|
||||
auto sprite = Sprite3D::create(fileName);
|
||||
addChild(sprite);
|
||||
sprite->setRotation3D(Vec3(-90.f, 0.f, 0.f));
|
||||
//sprite->setRotation3D(Vec3(0.f, 90.f, 0.f));
|
||||
sprite->setPosition( Vec2( p.x, p.y) );
|
||||
|
||||
auto animation = Animation3D::getOrCreate(fileName);
|
||||
|
|
Loading…
Reference in New Issue