ITADN

[p5.js 2.0+ Bug Report]: Floats in strands shaders are always rounded to 4 decimals

#8884Opendavepagurek 创建于 2026-06-08
Help WantedArea:WebGLp5.js 2.0+p5.strandsArea:WebGPU
D
davepagurekcommented
### Most appropriate sub-area of p5.js? - [ ] Accessibility - [ ] Color - [ ] Core/Environment/Rendering - [ ] Data - [ ] DOM - [ ] Events - [ ] Image - [ ] IO - [ ] Math - [ ] Typography - [ ] Utilities - [x] WebGL - [x] WebGPU - [x] p5.strands - [ ] Build process - [ ] Unit testing - [ ] Internationalization - [ ] Friendly errors - [ ] Other (specify if possible) ### p5.js version 2.3.0 ### Web browser and version All ### Operating system All ### Steps to reproduce this In strands_glslBackend.js, we do this when converting number literals into shader code: https://github.com/processing/p5.js/blob/a5c9056fa2b3fb829a4e0187a9a9b1d7ad3700ab/src/webgl/strands_glslBackend.js#L273-L274 This means that if you include `0.00001` in your strands code, your shader code would be `0.0000`. That seems like a problem. Is there any way we can do this in a more context-dependent way where we don't just add more decimals across the board for everything?
0 条评论