Accessing LineBuilder / a way to draw polylines in 3d

Godot Version

4.6

Question

Goal

I need to dynamically create flat polylines in 3d space, with widths, textures, JointModes, CapModes, etc. I do not need curves.

What I know of

  • Path3D + CSGPolygon3d
    • Unsuitable because I need to generate them at runtime, and there will be many of them. So I assume this solution would be way too slow, given the documentation explicitly warns about using CSG nodes in this way.
  • Line2D
    • Does not seem to expose anything to be able to recreate the line in a mesh
  • LineBuilder
    • I think this is my best bet, Line2Dinternally uses line_builder.cpp which seems to have everything I need (vertices, indices, uvs)
    • The problem is, I can’t access LineBuilder in an actual script…

Questions

  • Is there a better option than somehow accessing LineBuilder?
  • If not, do I need to “write” my own GDExtension and just recreate what line_builder.cpp already does?

Edit:

I converted the cpp to a C# class and it seems to perform well, so I guess I answered my own question, but I’m still interested if there are better solutions, because this is somewhat of a workaround to what I believe should be available out of the box.