From: Angelo Scandaliato Date: Thu, 6 Oct 2016 01:16:32 +0000 (-0700) Subject: set bindShapeMatrix to identity X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0313328a92f431934768447fd52080e80714e3b6;p=platform%2Fupstream%2Fassimp.git set bindShapeMatrix to identity --- diff --git a/code/glTFAssetWriter.inl b/code/glTFAssetWriter.inl index 7aff77a..a5603a3 100644 --- a/code/glTFAssetWriter.inl +++ b/code/glTFAssetWriter.inl @@ -425,6 +425,12 @@ namespace glTF { vJointNames.PushBack(StringRef(b.jointNames[i]), 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) diff --git a/code/glTFExporter.cpp b/code/glTFExporter.cpp index 3d1aa99..86592d2 100644 --- a/code/glTFExporter.cpp +++ b/code/glTFExporter.cpp @@ -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; } +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 ExportData(Asset& a, std::string& meshName, Ref& buffer, 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"; + + skinRef->bindShapeMatrix.isPresent = true; + // CopyValue(n->mTransformation, skinRef->bindShapeMatrix.value); + // aiIdentityMatrix4(skinRef->bindShapeMatrix.value); + IdentityMatrix4(skinRef->bindShapeMatrix.value); + // skinRef->bindShapeMatrix; // skinRef->inverseBindMatrices;