Geometry.fromBufferGeometry has an issue when reading InterleavedBuffer
See original GitHub issueGeometry.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
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
Related https://github.com/mrdoob/three.js/pull/17369#issuecomment-525567364.
Also see the discussion in https://github.com/mrdoob/three.js/issues/9869.
Sure, why not? I think
WireframeGeometry
supports interleaved buffers…