-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Description
Geometry.fromBufferGeometry produces wrong data when working with InterleavedBuffer
Assume we have a bufferGeometry with interleavedBufferAttribute as its attribute type.
There is an issue in geometry.js if we call Geometry.fromBufferGeometry(bufferGeometry).
The current code assumes that the type of attribute is BufferAttribute, but it also can be InterleavedBufferAttribute, and they cannot be read in the same way.
For BufferAttribute, we read attribute like position, normal individually. But for InterleavedBufferAttribute, it returns a typed array that bundles all attributes together. So we need to read the data based on its offset and itemsize.
It might be better to support reading attribute individually in InterleavedBufferAttribute class, but at least we need a quick fix in the geometry method.
If you all think this is a bug and nobody is fixing it right now, I can open a PR. I can also create a jsfiddle if you think it's necessary to demonstrate the wrong data output.
Three.js version
- Dev
- r109
- ...
Browser
- All of them
- Chrome
- Firefox
- Internet Explorer
OS
- All of them
- Windows
- macOS
- Linux
- Android
- iOS