informatics-isi-edu / mesh-viewer

3D mesh viewer
1 stars 1 forks source link

Display the caption and make each mesh respond to click events for the link #19

Open robes opened 6 years ago

robes commented 6 years ago

The caption and link, discussed in #18 , should also be displayed within the model. Ideally, we could display the caption hovering over each region in the model, perhaps only when the user "mouses over" the mesh object. And also ideally, then the user clicks on a mesh object in the model, the event could send the user to the corresponding link location.

NickolausDS commented 6 years ago

we could display the caption hovering over each region in the model, perhaps only when the user "mouses over" the mesh object.

When you say '"mouses over" the mesh object' did you envision them mousing over items in the "Meshes" dropdown menu or mousing over the actual meshes displayed in 3d space?

I notice there are already links displayed in the meshes dropdown, for example here: https://dev.facebase.org/mesh-viewer/view.html?model=https://dev.facebase.org/data/mesh/19dpf/19model.json

robes commented 6 years ago

When you say '"mouses over" the mesh object' did you envision them mousing over items in the "Meshes" dropdown menu or mousing over the actual meshes displayed in 3d space?

The latter -> "...mousing over the actual meshes displayed in 3d space"

NickolausDS commented 6 years ago

Progress Update:

The general method I know of for finding objects in a 3D projection is through Ray Casting. Ray Casting doesn't appear to be officially supported, but there is a 'prototype' function that defines it here, which takes the bounding box and start/end vectors. This could be attached to a hover event which does have built in support.

Edit: Mixed up Ray Tracing with Casting. Edit 2: Ray Casting is supported, but is called 'pick' for grabbing a 3d object from a 2d point. The original code for mesh-viewer actually had an implementation for clicking an object and displaying info about it, however it seems to no longer work and was disabled a while ago.

NickolausDS commented 6 years ago

The underlying code does work for Safari, but not with Chrome due to a bug in XTK with the pick function:

[.Offscreen-For-WebGL-0x7fe17b111a00]GL ERROR :GL_INVALID_OPERATION : glDrawArrays: Source and destination textures of the draw are the same.

An overview of the underlying problem can be found here.

A bug report was filed with XTK in early 2015 here.