meshwriter
meshwriter copied to clipboard
FYI: Change in babylonjs 6 slows down text mesh creation significantly
The new babylonjs 6 version introduces a addQuadraticCurveTo method which uses as default 36 segments instead of 6 in your code. In my case this slowed downed text creating by 15x. Maybe add another option to pass in the number of segments, i.e.
"numSegmentsForQuadraticCurveTo": "6"
which the library can pass into the method. In the meantime, I just nulled out the original method to force using your version.
MeshWriterMethods.Path2.prototype.addQuadraticCurveTo = null; this.meshWriter = MeshWriter(this.scene, { scale: 1.00, methods: MeshWriterMethods });
BTW, thanks for a great library.
@aboteler
Would you mind telling me how should I do that
- Do I need to modify package from node modules?
Thanks
@aboteler thank you for bringing this to my attention. I am quite happy to do an update but I am having some trouble putting the threads together.
I understand there is a new addQuadraticCurveTo in Babylon. MeshWriter uses a polyfill based on CreateQuadraticBezier, specifying 6 points. We could make the number of points a configurable setting, if that helps. I am unsure how the existence of a method that MeshWriter does not use would cause a performance change.
Are you suggesting we adopt a new Babylon method? If so, I assume it is somewhere other than Path2, because the code already looks for a native method there. In this case, it would be good to have a specific pointer to the method documentation — I have not done Babylon development for a fair while and am not up on current events.
Thanks in advance.