Closed TiborUdvari closed 1 month ago
Yeah this makes sense. The reason that this wasn't done initially is that modifying p5 prototypes directly is not recommended in the library authoring guidelines for p5. That said, I believe we had to do this elsewhere so it wouldn't be the most extreme departure.
Yes, I think generally it's a good idea, but in think in these cases it would make sense. I think people would expect and interface like this.
I'm adding this feature with #235
This keeps the createARCanvas
type functionality still working, although there are now a few lines like
p5.instance._incrementPreload();
in the __createButton
that are not needed if the preload
method is used for initialisation.
A future refactor could/should be done to better differentiate the two.
We should consider an interface similar to the p5.js way of doing things. It would reduce friction if we could take an existing WEBGL sketch and change it to a WEBXR AR or VR sketch by doing something like this:
instead of
The current p5.js implementation for reference:
It would have to add a parameter to consider starting the sketch automatically as well: #224