PRWM
PRWM copied to clipboard
three-buffergeometry-to-prwm: support int array buffers
The core PRWM supports int buffers so this implementation should too. Includes adding browserify and uglify-js as dev dependencies and including package-lock to support CI/CD pipelines.
Thank you for the PR, I'll hopefully look into it later today (CET time) but it seems ok at first glance.
It's more complicated than expected. 😞
My understanding is that until at least March 2020, three.js specified all attributes (even those using with Int/UintXArray) as floats, using gl.vertexAttribPointer
. The library only started using the WebGL2-only gl.vertexAttribIPointer
method to specify integer attributes later that year, and when using the WebGL1 renderer it still fallback to specifying them as floats. https://github.com/mrdoob/three.js/blob/r135/src/renderers/webgl/WebGLBindingStates.js#L291-L303
It's late so this will have to wait, but I'll probably add an arguments to threeBufferGeometryToPrwm
to let the user choose how those attributes should be handled as there is no definitive correct answer in this context. Currently, Three.js will always use its own heuristic to decide how to handle those integer array attributes depending on which renderer is used. So this will only matter in scenario where a BufferGeometry is exported from Three.js and used in a non-Three.js environment.
There is apparently some discussion about this with a PR on the way https://github.com/mrdoob/three.js/issues/21595
That makes sense! Thank you for taking a closer look at it.