Add a ready-made tool
From JReality Wiki
Source file: AddToolExample
JavaDoc: ScaleTool
The following example adds an existing tool to the content node of the scene. To be exact, it adds an instance of ScaleTool. What you need to know to use the tool is that it's activated by the right mouse. See what happens when you drag with the right mouse over the icosahedron.
The tool functions as follows: all movement of the mouse is considered relative to the center of the object (as determined by the bounding box). After the mouse is pressed, all motion away from this point scales up, and motion towards this point scales down.
... public static void main(String[] args) { SceneGraphComponent cmp = new SceneGraphComponent(); Appearance ap = new Appearance(); cmp.setAppearance(ap); setupAppearance(ap); ScaleTool tool= new ScaleTool(); cmp.addTool(tool); cmp.setGeometry(Primitives.icosahedron()); JRViewer.display(cmp); }
|