You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using picking for mouse collision would bring a lot of good things in sigma:
Nodes / edges clicking would work for every nodes and edges programs, including curved edges, rectangle nodes...
Checking what's below the mouse would be O(1), whatever the size of the graph
The cost would be:
It will take some time to implement
It will make writing program shaders a bit worse
It will have a RAM cost:
We need to store an image the size of the container, where pixel colors represent top item index
We need to add to every programs the index of the item in addition to the color (but this will cost way less than PR Instanced rendering #1377 will make us win)
Here is one plan to implement this feature:
Shaders have macros to be built either for RENDERING_MODE or PICKING_MODE. Rendering mode is as it is today, picking mode will feed every pixel with either transparent or the index of the item (node or edge) to display as the color.
Each program takes a new argument, pickingMode. When true, the program will compile the shaders with PICKING_MODE.
The rendering loop has a new canvas and WebGL context, not visible on screen, where it draws every edge then every node, using the "picking" programs.
Both normal programs and picking programs use the same ByteArrays.
The methods getNodeAtPosition and getEdgeAtPosition look at the color of the pixel at the position, translates it to the related item index if any, and returns the related ID.
Using picking for mouse collision would bring a lot of good things in sigma:
O(1)
, whatever the size of the graphThe cost would be:
Here is one plan to implement this feature:
RENDERING_MODE
orPICKING_MODE
. Rendering mode is as it is today, picking mode will feed every pixel with either transparent or the index of the item (node or edge) to display as the color.pickingMode
. Whentrue
, the program will compile the shaders withPICKING_MODE
.getNodeAtPosition
andgetEdgeAtPosition
look at the color of the pixel at the position, translates it to the related item index if any, and returns the related ID.Any opinion on that @Yomguithereal?
The text was updated successfully, but these errors were encountered: