change the length of bufferView byteLength

chang the joint  attribute bufferView byteLength
pull/1925/head
wuxq 2018-05-08 18:31:27 +08:00 committed by GitHub
parent 327a43c26f
commit cc1bde0514
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -642,6 +642,7 @@ 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[bytesLen];
unsigned int i = 0;
@ -656,6 +657,7 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buf
}
buf->ReplaceData_joint(offset, bytesLen, arrys, bytesLen);
vertexJointAccessor->componentType = ComponentType_UNSIGNED_SHORT;
vertexJointAccessor->bufferView->byteLength = s_bytesLen;
p.attributes.joint.push_back( vertexJointAccessor );
}