mirror of https://github.com/axmolengine/axmol.git
for tony test
This commit is contained in:
parent
0fa4e921f0
commit
2840409933
|
@ -131,9 +131,10 @@ bool Bundle3D::loadMeshData(const std::string& id, MeshData* meshdata)
|
||||||
{
|
{
|
||||||
meshdata->resetData();
|
meshdata->resetData();
|
||||||
|
|
||||||
|
assert(document.HasMember("mesh_data"));
|
||||||
const rapidjson::Value& mash_data_val_array = document["mesh_data"];
|
const rapidjson::Value& mash_data_val_array = document["mesh_data"];
|
||||||
assert(mash_data_val_array.IsArray());
|
|
||||||
|
|
||||||
|
assert(mash_data_val_array.IsArray());
|
||||||
const rapidjson::Value& mash_data_val = mash_data_val_array[(rapidjson::SizeType)0];
|
const rapidjson::Value& mash_data_val = mash_data_val_array[(rapidjson::SizeType)0];
|
||||||
assert(mash_data_val.IsObject());
|
assert(mash_data_val.IsObject());
|
||||||
|
|
||||||
|
@ -196,12 +197,12 @@ bool Bundle3D::loadSkinData(const std::string& id, SkinData* skindata)
|
||||||
|
|
||||||
const rapidjson::Value& skin_data_array_val_0 = skin_data_array[(rapidjson::SizeType)0];
|
const rapidjson::Value& skin_data_array_val_0 = skin_data_array[(rapidjson::SizeType)0];
|
||||||
|
|
||||||
const rapidjson::Value& skin_data_bind_shape = skin_data_array_val_0["bind_shape"];
|
/*const rapidjson::Value& skin_data_bind_shape = skin_data_array_val_0["bind_pose"];
|
||||||
assert(skin_data_bind_shape.Size() == 16);
|
assert(skin_data_bind_shape.Size() == 16);
|
||||||
for (rapidjson::SizeType i = 0; i < skin_data_bind_shape.Size(); i++)
|
for (rapidjson::SizeType i = 0; i < skin_data_bind_shape.Size(); i++)
|
||||||
{
|
{
|
||||||
skindata->bindShape.m[i] = skin_data_bind_shape[i].GetDouble();
|
skindata->bindShape.m[i] = skin_data_bind_shape[i].GetDouble();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
float m[] = {-0.682038f, -0.035225f, 0.730468f, 0.000000f, 0.731315f, -0.035225f, 0.681130f, 0.000000f, 0.001738f, 0.998758f, 0.049786f, 0.000000f, -0.882000f, 78.798103f, -0.868362f, 1.000000f};
|
float m[] = {-0.682038f, -0.035225f, 0.730468f, 0.000000f, 0.731315f, -0.035225f, 0.681130f, 0.000000f, 0.001738f, 0.998758f, 0.049786f, 0.000000f, -0.882000f, 78.798103f, -0.868362f, 1.000000f};
|
||||||
memcpy(skindata->bindShape.m, m, sizeof(m));
|
memcpy(skindata->bindShape.m, m, sizeof(m));
|
||||||
|
@ -213,7 +214,7 @@ bool Bundle3D::loadSkinData(const std::string& id, SkinData* skindata)
|
||||||
const rapidjson::Value& skin_data_bone = skin_data_bones[i];
|
const rapidjson::Value& skin_data_bone = skin_data_bones[i];
|
||||||
std::string name = skin_data_bone["node"].GetString();
|
std::string name = skin_data_bone["node"].GetString();
|
||||||
skindata->boneNames.push_back(name);
|
skindata->boneNames.push_back(name);
|
||||||
const rapidjson::Value& bind_pos = skin_data_bone["bind_pos"];
|
const rapidjson::Value& bind_pos = skin_data_bone["bind_shape"];
|
||||||
Mat4 mat_bind_pos;
|
Mat4 mat_bind_pos;
|
||||||
for (rapidjson::SizeType j = 0; j < bind_pos.Size(); j++)
|
for (rapidjson::SizeType j = 0; j < bind_pos.Size(); j++)
|
||||||
{
|
{
|
||||||
|
@ -302,7 +303,7 @@ bool Bundle3D::loadAnimationData(const std::string& id, Animation3DData* animati
|
||||||
if ( bone_keyframe.HasMember("translation"))
|
if ( bone_keyframe.HasMember("translation"))
|
||||||
{
|
{
|
||||||
const rapidjson::Value& bone_keyframe_translation = bone_keyframe["translation"];
|
const rapidjson::Value& bone_keyframe_translation = bone_keyframe["translation"];
|
||||||
float keytime = bone_keyframe["keytime"].GetDouble() / 1200.f;
|
float keytime = bone_keyframe["keytime"].GetDouble();
|
||||||
Vec3 val = Vec3(bone_keyframe_translation[(rapidjson::SizeType)0].GetDouble(), bone_keyframe_translation[1].GetDouble(), bone_keyframe_translation[2].GetDouble());
|
Vec3 val = Vec3(bone_keyframe_translation[(rapidjson::SizeType)0].GetDouble(), bone_keyframe_translation[1].GetDouble(), bone_keyframe_translation[2].GetDouble());
|
||||||
animationdata->_translationKeys[bone_name].push_back(Animation3DData::Vec3Key(keytime,val));
|
animationdata->_translationKeys[bone_name].push_back(Animation3DData::Vec3Key(keytime,val));
|
||||||
}
|
}
|
||||||
|
@ -310,7 +311,7 @@ bool Bundle3D::loadAnimationData(const std::string& id, Animation3DData* animati
|
||||||
if ( bone_keyframe.HasMember("rotation"))
|
if ( bone_keyframe.HasMember("rotation"))
|
||||||
{
|
{
|
||||||
const rapidjson::Value& bone_keyframe_rotation = bone_keyframe["rotation"];
|
const rapidjson::Value& bone_keyframe_rotation = bone_keyframe["rotation"];
|
||||||
float keytime = bone_keyframe["keytime"].GetDouble() / 1200.f;
|
float keytime = bone_keyframe["keytime"].GetDouble();
|
||||||
Quaternion val = Quaternion(bone_keyframe_rotation[(rapidjson::SizeType)0].GetDouble(),bone_keyframe_rotation[1].GetDouble(),bone_keyframe_rotation[2].GetDouble(),bone_keyframe_rotation[3].GetDouble());
|
Quaternion val = Quaternion(bone_keyframe_rotation[(rapidjson::SizeType)0].GetDouble(),bone_keyframe_rotation[1].GetDouble(),bone_keyframe_rotation[2].GetDouble(),bone_keyframe_rotation[3].GetDouble());
|
||||||
animationdata->_rotationKeys[bone_name].push_back(Animation3DData::QuatKey(keytime,val));
|
animationdata->_rotationKeys[bone_name].push_back(Animation3DData::QuatKey(keytime,val));
|
||||||
}
|
}
|
||||||
|
@ -318,7 +319,7 @@ bool Bundle3D::loadAnimationData(const std::string& id, Animation3DData* animati
|
||||||
if ( bone_keyframe.HasMember("scale"))
|
if ( bone_keyframe.HasMember("scale"))
|
||||||
{
|
{
|
||||||
const rapidjson::Value& bone_keyframe_scale = bone_keyframe["scale"];
|
const rapidjson::Value& bone_keyframe_scale = bone_keyframe["scale"];
|
||||||
float keytime = bone_keyframe["keytime"].GetDouble() / 1200.f;
|
float keytime = bone_keyframe["keytime"].GetDouble();
|
||||||
Vec3 val = Vec3(bone_keyframe_scale[(rapidjson::SizeType)0].GetDouble(), bone_keyframe_scale[1].GetDouble(), bone_keyframe_scale[2].GetDouble());
|
Vec3 val = Vec3(bone_keyframe_scale[(rapidjson::SizeType)0].GetDouble(), bone_keyframe_scale[1].GetDouble(), bone_keyframe_scale[2].GetDouble());
|
||||||
animationdata->_scaleKeys[bone_name].push_back(Animation3DData::Vec3Key(keytime,val));
|
animationdata->_scaleKeys[bone_name].push_back(Animation3DData::Vec3Key(keytime,val));
|
||||||
}
|
}
|
||||||
|
@ -328,49 +329,6 @@ bool Bundle3D::loadAnimationData(const std::string& id, Animation3DData* animati
|
||||||
|
|
||||||
animationdata->_totalTime = 3;
|
animationdata->_totalTime = 3;
|
||||||
|
|
||||||
CCLOG("translation:////////////////");
|
|
||||||
//animationdata->_translationKeys.erase(animationdata->_translationKeys.begin(), animationdata->_translationKeys.end());
|
|
||||||
for (auto itr: animationdata->_translationKeys)
|
|
||||||
{
|
|
||||||
CCLOG("%s", itr.first.c_str());
|
|
||||||
auto& keys = itr.second;
|
|
||||||
|
|
||||||
if (keys.size())
|
|
||||||
{
|
|
||||||
float maxtime = keys[keys.size() - 1]._time;
|
|
||||||
for (auto it : keys) {
|
|
||||||
it._time /= maxtime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CCLOG("rotation:////////////////");
|
|
||||||
//animationdata->_rotationKeys.erase(animationdata->_rotationKeys.begin(), animationdata->_rotationKeys.end());
|
|
||||||
for (auto itr: animationdata->_rotationKeys)
|
|
||||||
{
|
|
||||||
CCLOG("%s", itr.first.c_str());
|
|
||||||
auto& keys = itr.second;
|
|
||||||
if (keys.size())
|
|
||||||
{
|
|
||||||
float maxtime = keys[keys.size() - 1]._time;
|
|
||||||
for (auto it : keys) {
|
|
||||||
it._time /= maxtime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CCLOG("scale:////////////////");
|
|
||||||
for (auto itr: animationdata->_scaleKeys)
|
|
||||||
{
|
|
||||||
CCLOG("%s", itr.first.c_str());
|
|
||||||
auto& keys = itr.second;
|
|
||||||
if (keys.size())
|
|
||||||
{
|
|
||||||
float maxtime = keys[keys.size() - 1]._time;
|
|
||||||
for (auto it : keys) {
|
|
||||||
it._time /= maxtime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -541,7 +541,7 @@ std::string Sprite3DWithSkinTest::subtitle() const
|
||||||
|
|
||||||
void Sprite3DWithSkinTest::addNewSpriteWithCoords(Vec2 p)
|
void Sprite3DWithSkinTest::addNewSpriteWithCoords(Vec2 p)
|
||||||
{
|
{
|
||||||
auto sprite = Sprite3D::create("Sprite3DTest/girl2.c3t");
|
auto sprite = Sprite3D::create("Sprite3DTest/girl.c3t");
|
||||||
//auto sprite = Sprite3D::create("Sprite3DTest/cube_anim.c3t");
|
//auto sprite = Sprite3D::create("Sprite3DTest/cube_anim.c3t");
|
||||||
//sprite->setScale(2.f);
|
//sprite->setScale(2.f);
|
||||||
sprite->setTexture("Sprite3DTest/girl.png");
|
sprite->setTexture("Sprite3DTest/girl.png");
|
||||||
|
@ -552,7 +552,7 @@ void Sprite3DWithSkinTest::addNewSpriteWithCoords(Vec2 p)
|
||||||
//sprite->setRotationSkewY(90);
|
//sprite->setRotationSkewY(90);
|
||||||
sprite->setPosition( Vec2( p.x, p.y) );
|
sprite->setPosition( Vec2( p.x, p.y) );
|
||||||
|
|
||||||
auto animation = Animation3D::getOrCreate("Sprite3DTest/girl2.c3t");
|
auto animation = Animation3D::getOrCreate("Sprite3DTest/girl.c3t");
|
||||||
auto animate = Animate3D::create(animation);
|
auto animate = Animate3D::create(animation);
|
||||||
if(std::rand() %3 == 0)
|
if(std::rand() %3 == 0)
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7516,11 +7516,6 @@
|
||||||
"id": "Bip001 Head",
|
"id": "Bip001 Head",
|
||||||
"bind_shape": [ 0.985542, 0.167319, -0.026683, 0.000000, -0.157796, 0.963757, 0.215111, 0.000000, 0.061709, -0.207790, 0.976225, 0.000000, 5.469170, 0.000002, -0.000001, 1.000000],
|
"bind_shape": [ 0.985542, 0.167319, -0.026683, 0.000000, -0.157796, 0.963757, 0.215111, 0.000000, 0.061709, -0.207790, 0.976225, 0.000000, 5.469170, 0.000002, -0.000001, 1.000000],
|
||||||
"children": [
|
"children": [
|
||||||
{
|
|
||||||
"version": 1.200000,
|
|
||||||
"id": "Bip001 HeadNub",
|
|
||||||
"bind_shape": [ 1.000000, -0.000000, -0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, -0.000000, 1.000000, 0.000000, 22.780975, 0.000000, -0.000000, 1.000000]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"version": 1.200000,
|
"version": 1.200000,
|
||||||
"id": "Bip001 Ponytail1",
|
"id": "Bip001 Ponytail1",
|
||||||
|
@ -7573,14 +7568,8 @@
|
||||||
{
|
{
|
||||||
"version": 1.200000,
|
"version": 1.200000,
|
||||||
"id": "Bip001 L Toe0",
|
"id": "Bip001 L Toe0",
|
||||||
"bind_shape": [-0.000000, 1.000000, 0.000000, 0.000000, -1.000000, -0.000000, -0.000000, 0.000000, -0.000000, -0.000000, 1.000000, 0.000000, 17.426956, 10.792505, 0.000005, 1.000000],
|
"bind_shape": [-0.000000, 1.000000, 0.000000, 0.000000, -1.000000, -0.000000, -0.000000, 0.000000, -0.000000, -0.000000, 1.000000, 0.000000, 17.426956, 10.792505, 0.000005, 1.000000]
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"version": 1.200000,
|
|
||||||
"id": "Bip001 L Toe0Nub",
|
|
||||||
"bind_shape": [ 1.000000, -0.000000, -0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, -0.000000, 0.000000, -1.000000, 0.000000, 11.620661, 0.000000, 0.000000, 1.000000]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -7606,14 +7595,8 @@
|
||||||
{
|
{
|
||||||
"version": 1.200000,
|
"version": 1.200000,
|
||||||
"id": "Bip001 R Toe0",
|
"id": "Bip001 R Toe0",
|
||||||
"bind_shape": [-0.000000, 1.000000, -0.000000, 0.000000, -1.000000, -0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 17.426960, 10.792509, -0.000001, 1.000000],
|
"bind_shape": [-0.000000, 1.000000, -0.000000, 0.000000, -1.000000, -0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 17.426960, 10.792509, -0.000001, 1.000000]
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"version": 1.200000,
|
|
||||||
"id": "Bip001 R Toe0Nub",
|
|
||||||
"bind_shape": [ 1.000000, -0.000000, -0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, -0.000000, 1.000000, 0.000000, 11.620655, -0.000001, 0.000001, 1.000000]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue