User:Kevin Reid/java3d.e-awt

# Translated a Java 3D example into E. Written 2008-12-05. # # I was pondering writing a 3D-spatial interface to Den and looking into 3D # API choices; that would be a Very Large Project I don't currently have # enough interest in. (I've also heard that Java 3D is abandoned...) I'm # posting this just so the work isn't entirely wasted. #  -- Kevin Reid 2009-12-30 # # https://j3d-examples.dev.java.net/source/browse/j3d-examples/src/classes/org/jdesktop/j3d/examples/hello_universe/HelloUniverse.java?rev=1.2&view=markup def :=  def :=  def :=  def pi := (-1.0).acos def createSceneGraph { # :BranchGroup # Create the root of the branch graph def objRoot := ; # Create the TransformGroup node and initialize it to the # identity. Enable the TRANSFORM_WRITE capability so that # our behavior code can modify it at run time. Add it to # the root of the subgraph. def objTrans := ; objTrans.setCapability(.getALLOW_TRANSFORM_WRITE); objRoot.addChild(objTrans); # Create a simple Shape3D node; add it to the scene graph. objTrans.addChild((0.4)); # Create a new Behavior object that will perform the # desired operation on the specified transform and add # it into the scene graph. def yAxis := ; def rotationAlpha := (-1, 4000); def rotator := (rotationAlpha, objTrans, yAxis, 				     0.0, pi*2); def bounds := ((0.0,0.0,0.0), 100.0); rotator.setSchedulingBounds(bounds); objRoot.addChild(rotator); # Have Java 3D perform optimizations on this scene graph. objRoot.compile; return objRoot; }    def canvas := (.getPreferredConfiguration) def univ := (canvas) univ.getViewingPlatform.setNominalViewingTransform univ.getViewer.getView.setMinimumFrameCycleTime(5) # Canvas3D is an AWT component so it doesn't have a preferredSize def swingContainer := JPanel`$canvas` swingContainer.setPreferredSize((250, 250)) def frame := <swing:makeJFrame>("3d") frame.getContentPane."add(Component)"(swingContainer) def scene := createSceneGraph; univ.addBranchGraph(scene); frame.pack frame.show interp.blockAtTop
 * 1) !/usr/bin/env rune