I want to implement a custom tool that lets the user click on individual faces of a polygon and when that happens the clicked face changes its color.
I have done some research on the available tools in jReality and one that could help me achieve what I want is the FaceDragEvent. There you can attach a FaceDragListener that handles the event of actual face dragging, which gives you access to the face's vertices and coordinates via the FaceDragEvent object (as seen in the http://www3.math.tu-berlin.de/jreality/ ... gEventTool tutorial).
For example, in the class de.jreality.tutorial.tool.DragEventTool02 you have this code:
Code: Select all
public void faceDragStart(FaceDragEvent e) {
faceSet = e.getIndexedFaceSet();
points=new double[faceSet.getNumPoints()][];
points = faceSet.getVertexAttributes(Attribute.COORDINATES).toDoubleArrayArray(null);
}
Code: Select all
public void faceClickedStart(FaceClickedEvent e) {
faceSet = e.getIndexedFaceSet();
Color[] colors = faceSet.getFaceAttributes(Attribute.COLORS); // But at runtime this returns null!
}
Thanks so much!