Quellcode durchsuchen

change the length of bufferView byteLength

chang the joint  attribute bufferView byteLength
wuxq vor 7 Jahren
Ursprung
Commit
cc1bde0514
1 geänderte Dateien mit 2 neuen und 0 gelöschten Zeilen
  1. 2 0
      code/glTF2Exporter.cpp

+ 2 - 0
code/glTF2Exporter.cpp

@@ -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 );
     }