-
Notifications
You must be signed in to change notification settings - Fork 22
Interactivity: Picking #26
Comments
@felixguendling this looks like a very nice to have feature. How do you imagine the api from the elm side? |
I think it could be accomplished by adding a parameter (
Additionally, there needs to be a uniform boolean variable telling the fragment shader whether to render the picking map (not visible to the user) or the real image (visible to the user). This variable would be provided by the system. The Elm code should not be concerned with the creation of the off-screen render buffer and other native functionality. Thus, the fragment shader would look like this:
When the OnMouseMove message is handled by the update method, it just needs to match the provided By default, this functionality (i.e. the I'm not a WebGL expert and I have only little experience bridging native (JS) code into Elm. So I'm currently not aware of the complexity imposed by the described API but I think this would be a feasible approach from an Elm client code perspective. I currently have the 2D case (map overlay) in mind. Perhaps it would be interesting to have a mode providing depth information (in addition to the x/y coordinates and the color). Edit: The client code would look like this:
|
Perhaps it would be a cleaner solution to just have two separate fragment shaders instead of one that uses the uniform variable to distinguish both modes. This way, the user can't forget to declare the Feel free to comment or propose a totally different approach. :-) |
I'm trying to implement a small proof of concept. But it seems not to be possible to enqueue messages from a custom virtual-dom component like the elm-webgl canvas. I don't have access to the Do you know some examples showing how to inject messages into the Elm loop? elm-d3 seems to use |
I've been experimenting with this concept. First result: Feel free to be creative with the demo. :-) Missing:
If you know how to get messages from native code into the Elm loop (i.e. access the |
I would like to display additional information and change the mouse pointer type when the user hovers over rendered objects and create a new window when an entity is clicked. It would be nice, to be able to efficiently detect the rendered object that's under the user's mouse pointer.
The default way to do this seems to be picking. Examples:
In JS this seems to be hassle-free. But I can't see how this is possible with elm-webgl. This is really sad because the modern web is defined by interactivity which includes not just rendering but also reacting on user input.
Google-ing this topic reveals that there has been a discussion about this topic which ended nowhere:
https://groups.google.com/forum/#!topic/elm-discuss/PvVxDq0K8M8
In this thread there are further references to discussions where users ask for this feature:
So there is definitely some demand.
Are there any plans to support this?
If I would try to implement this (I have no idea how hard this will be or whether it's possible at all with the current architecture), does it have any chance to be merged?
Edit: The most important missing functionality seems to be
WebGLRenderingContext.readPixels()
(Docs)Edit1: Currently, I'm mostly interested in the 2D case (map overlay) where depth information is not relevant.
The text was updated successfully, but these errors were encountered: