Open WorldSEnder opened 1 week ago
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you!
Two points here:
For why stuff without strokes ends up spending time on stroke calculations anyway: it looks like when we draw a model, we generate strokes around every triangle if we have no stroke info: https://github.com/processing/p5.js/blob/main/src%2Fwebgl%2Floading.js#L1121-L1123
I suspect this was so that something like sphere()
wouldn't have to manually add edges everywhere. But we could add a flag to objects that come from buildGeometry
and skip that check if we see that flag is set.
For why it has to recalculate anything when combining shapes: I think we could be adding calculated edge data like lineVertices
when adding a shape in GeometryBuilder
!
If anyone's interested in taking on any of these tasks before I get to them, let me know, I'm happy to help review!
Most appropriate sub-area of p5.js?
p5.js version
v1.10.0
Web browser and version
Firefox 128.0.3, Chrome 128.0.6613.84
Operating system
Any
Steps to reproduce this
I am assembling my "world" into geometry, updating it whenever the world changes. Since updates are very rare, this should give me a nice boost in performance. I noticed that whenever the world does change, and I have to refresh the prebuilt geometry, a lot of time is spent in
_edgesToVertices
(up to 88% when first drawing the new geometry). While it does make sense to me that high-fidelity strokes cost performance and need this step, I do not see why it needs to go through this step in the first place, given that I assemble my geometry from primitives that already should have, or should have cached, their strokes.EDIT: The above is compounded by the fact that this step is apparently done even when I explicitly render the model with
noStroke()
(during[begin|end]Geometry
and when rendering withmodel(..)
) meaning I can not find a way to work around this post processing step.Steps:
Snippet: