Closed henrikbuchholz closed 1 year ago
You're the best, thank you @henrikbuchholz!
Btw I noticed that you fixed the byteOffset/byteLength in the createMeshGeometry method and in the createLineGeometry but not in the createPointGeometry. Any specific reason for that?
Alright, no reason, just in a hurry :) Let me merge this PR and fix the createPointGeometry
method in the same way.
Problem: When using gltf writer, some meshes appeared "imploded" like this - and were fully rejected by some standard gltf viewers:
Reason: The code to write BufferViews ignored the byteOffset/byteLength values of the index array. Therefore, if a TypedArray had a byteOffset>0 or byteLength!=buffer.byteLength, the typed array was incorrectly replaced by the whole ArrayBuffer containing it. This could mess up geometry, e.g. by introducing random indices.
Solution: Add byteOffset and byteLength to various code sections to avoid this problem.
After the fix, the exported mesh looks correct again: