Open mccs001 opened 1 year ago
Personally, I never found no major performance issues with view.draw
methods.
For 3D drawing, storing the instructions (independent from the view camera) and calling the view.draw
methods is good enough.
For 2D drawing (dependent on view camera), I only recompute the instructions when there is an observer event onViewChanged
.
What would however be nice to have, is a method to draw any type of polygons. Currently, GL_POLYGON
only works for convex polygons, not concave ones.
- For example, there could be an officially-supported C-style function exported by the SketchUp.exe process (similar to other SketchUp C API functions) that accepts the same arguments as View#draw but in a native format (I don't think it would make sense to make it a Ruby function unless it's easy and safe for the caller to pass through some kind of object in the native representation)
We have talked about this in the past for the Live C API. A year and 9 months ago ... this request was opened:
What would however be nice to have, is a method to draw any type of polygons. Currently, GL_POLYGON only works for convex polygons, not concave ones.
You can use Geom.tesselate
to deal with convext and complex (with holes) polygons:
https://ruby.sketchup.com/Geom.html#tesselate-class_method
These are feature requests (originally raised in the SketchUp MeetUp meeting on 8th March 2023: ThomThom asked me to raise them here)
The requests are to allow SketchUp Extensions to be able to draw large amounts of mainly-fixed geometry (in model coordinates, anyway) in a way that runs performantly (without introducing lag to the UI when orbiting/panning/zooming) and looks nice.
These can be achieved with some manual calls to C++ OpenGL functions (while in Tool#draw call - probably also with Overlay#draw but not tested yet) but it would be much better for them to be available with officially-documented SketchUp API functions that will continue to work with the new Graphics pipelines being introduced.
Please add the following capabilities:
Hope that all makes sense. I'll be happy to give more details if that would help and take part in any discussions around implementation ideas.