Description of the problem
BufferGeometry with only custom attributes does not render in r84. Said geometry used to render in r79 (I think the issue was introduced in r81).
Example:
let geometry = new THREE.BufferGeometry();
geometry.addAttribute('gc_position_x', new THREE.BufferAttribute(positionsX.value, 1));
geometry.addAttribute('gc_position_y', new THREE.InterleavedBufferAttribute(positionsY, 1, c , false));
geometry.setDrawRange(0, N);
This used to render just fine in r79. In r84, I have to add the following line to get it to work:
geometry.addAttribute('position', new THREE.BufferAttribute(positionsX.value, 1));
I don’t even declare position
in the shader but three.js r84 still forces me to add the attribute. I think the behaviour from r79 was better. Can this be re-introduced?
Thanks in advance!
Three.js version
- Dev
- r84
- …
Browser
- All of them
- Chrome
- Firefox
- Internet Explorer
OS
- All of them
- Windows
- Linux
- Android
- IOS
The problem is this line:
Even if you specify a custom drawRange the Math.min call will reset it to zero because it thinks that there are no vertices.
The only solution I can think of without breaking backward compatibility is blindly obeying the drawRange but only if neither index nor position attributes are defined. What I would actually prefer is always obeying drawRange even if it seems to exceed the dataCount and let the developer deal with it but that might break some existing code.