multi joint has bug with ReplaceData

multi joint has  a bug  in ReplaceData_joint with "bin" change
pull/1925/head
wuxq 2018-04-28 15:05:21 +08:00 committed by GitHub
parent dd7d0943f6
commit 814b56e5e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

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