set bindShapeMatrix to identity

pull/1024/head
Angelo Scandaliato 2016-10-05 18:16:32 -07:00
parent 79852de5ae
commit 0313328a92
2 changed files with 20 additions and 0 deletions

View File

@ -425,6 +425,12 @@ namespace glTF {
vJointNames.PushBack(StringRef(b.jointNames[i]), w.mAl); vJointNames.PushBack(StringRef(b.jointNames[i]), w.mAl);
} }
obj.AddMember("jointNames", vJointNames, w.mAl); obj.AddMember("jointNames", vJointNames, w.mAl);
if (b.bindShapeMatrix.isPresent) {
Value val;
obj.AddMember("bindShapeMatrix", MakeValue(val, b.bindShapeMatrix.value, w.mAl).Move(), w.mAl);
}
} }
inline void Write(Value& obj, Technique& b, AssetWriter& w) inline void Write(Value& obj, Technique& b, AssetWriter& w)

View File

@ -166,6 +166,14 @@ static void CopyValue(const aiMatrix4x4& v, glTF::mat4& o)
o[12] = v.a4; o[13] = v.b4; o[14] = v.c4; o[15] = v.d4; o[12] = v.a4; o[13] = v.b4; o[14] = v.c4; o[15] = v.d4;
} }
static void IdentityMatrix4(glTF::mat4& o)
{
o[ 0] = 1; o[ 1] = 0; o[ 2] = 0; o[ 3] = 0;
o[ 4] = 0; o[ 5] = 1; o[ 6] = 0; o[ 7] = 0;
o[ 8] = 0; o[ 9] = 0; o[10] = 1; o[11] = 0;
o[12] = 0; o[13] = 0; o[14] = 0; o[15] = 1;
}
inline Ref<Accessor> ExportData(Asset& a, std::string& meshName, Ref<Buffer>& buffer, inline Ref<Accessor> ExportData(Asset& a, std::string& meshName, Ref<Buffer>& buffer,
unsigned int count, void* data, AttribType::Value typeIn, AttribType::Value typeOut, ComponentType compType, bool isIndices = false) unsigned int count, void* data, AttribType::Value typeIn, AttribType::Value typeOut, ComponentType compType, bool isIndices = false)
{ {
@ -858,6 +866,12 @@ void glTFExporter::ExportSkins()
std::cout << "Node->id " << nodeRef->id << "\n"; std::cout << "Node->id " << nodeRef->id << "\n";
skinRef->bindShapeMatrix.isPresent = true;
// CopyValue(n->mTransformation, skinRef->bindShapeMatrix.value);
// aiIdentityMatrix4(skinRef->bindShapeMatrix.value);
IdentityMatrix4(skinRef->bindShapeMatrix.value);
// skinRef->bindShapeMatrix; // skinRef->bindShapeMatrix;
// skinRef->inverseBindMatrices; // skinRef->inverseBindMatrices;