浏览代码

multi joint has bug with ReplaceData

multi joint has  a bug  in ReplaceData_joint with "bin" change
wuxq 7 年之前
父节点
当前提交
814b56e5e2
共有 1 个文件被更改,包括 2 次插入3 次删除
  1. 2 3
      code/glTF2Exporter.cpp

+ 2 - 3
code/glTF2Exporter.cpp

@@ -642,9 +642,8 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buf
         unsigned int bytesLen = vertexJointAccessor->bufferView->byteLength;
         unsigned int s_bytesPerComp= ComponentTypeSize(ComponentType_UNSIGNED_SHORT);
         unsigned int bytesPerComp = ComponentTypeSize(vertexJointAccessor->componentType);
-        unsigned int s_bytesLen = bytesLen * s_bytesPerComp / bytesPerComp;
         Ref<Buffer> buf = vertexJointAccessor->bufferView->buffer;
-        uint8_t* arrys = new uint8_t[s_bytesLen];
+        uint8_t* arrys = new uint8_t[bytesLen];
         unsigned int i = 0;
         for ( unsigned int j = 0; j <= bytesLen; j += bytesPerComp ){
             size_t len_p = offset + j;
@@ -655,7 +654,7 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buf
             memcpy(&arrys[i*s_bytesPerComp], data, s_bytesPerComp);
             ++i;
         }
-        buf->ReplaceData_joint(offset, bytesLen, arrys, s_bytesLen);
+        buf->ReplaceData_joint(offset, bytesLen, arrys, bytesLen);
         vertexJointAccessor->componentType = ComponentType_UNSIGNED_SHORT;
 
         p.attributes.joint.push_back( vertexJointAccessor );