Shape3D plShape = new Shape3D(pla, app); TransformGroup objRotate = new TransformGroup(); objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objRotate.addChild(plShape); lineGroup.addChild(objRotate);
objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objRotate.addChild(plShape); lineGroup.addChild(objRotate);
objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objRotate.addChild(plShape); lineGroup.addChild(objRotate);
objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objRotate.addChild(plShape); AmbientLight al=new AmbientLight();
sh.setPickable(true); TransformGroup objRotate = new TransformGroup(); objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objRotate.addChild(sh);
objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objRotate.addChild(sh); DirectionalLight light1=new DirectionalLight();
/** * Sets the transform group containing a 6DOF sensor's echo geometry. * This is used to specify a custom echo. Its transform will be * manipulated to represent the position and orientation of the 6DOF * sensor. Capabilities to allow writing its transform and to read, * write, and extend its children will be set. * <p> * This method must be called before the behavior is made live in order to * have an effect. * * @param echo the <code>TransformGroup</code> containing the * echo geometry */ public void setEchoTransformGroup(TransformGroup echo) { echo.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE) ; echo.setCapability(Group.ALLOW_CHILDREN_READ) ; echo.setCapability(Group.ALLOW_CHILDREN_WRITE) ; echo.setCapability(Group.ALLOW_CHILDREN_EXTEND) ; this.echoTransformGroup = echo ; }
transforms[0].setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); transforms[0].setCapability(TransformGroup.ALLOW_TRANSFORM_READ); transforms[0].setCapability(TransformGroup.ALLOW_CHILDREN_WRITE); transforms[0].setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND); transforms[i].setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); transforms[i].setCapability(TransformGroup.ALLOW_TRANSFORM_READ); transforms[i].setCapability(TransformGroup.ALLOW_CHILDREN_WRITE); transforms[i].setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND); transforms[i-1].addChild(transforms[i]);
/** * Creates a PickMouseBehavior given current canvas, root of the tree to * operate on, and the bounds. */ public PickMouseBehavior(Canvas3D canvas, BranchGroup root, Bounds bounds){ super(); currGrp = new TransformGroup(); currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); root.addChild(currGrp); pickCanvas = new PickCanvas(canvas, root); }
/** * Creates a PickMouseBehavior given current canvas, root of the tree to * operate on, and the bounds. */ public PickMouseBehavior(Canvas3D canvas, BranchGroup root, Bounds bounds){ super(); currGrp = new TransformGroup(); currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); root.addChild(currGrp); pickScene = new PickObject(canvas, root); }
/** * Creates a PickMouseBehavior given current canvas, root of the tree to * operate on, and the bounds. */ public PickMouseBehavior(Canvas3D canvas, BranchGroup root, Bounds bounds){ super(); currGrp = new TransformGroup(); currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); root.addChild(currGrp); pickCanvas = new PickCanvas(canvas, root); }
TransformGroup obj = new TransformGroup(); Scene s = null; ObjectFile f = new ObjectFile (); f.setFlags (ObjectFile.RESIZE | ObjectFile.TRIANGULATE | ObjectFile.STRIPIFY); try{ s = f.load (obj_path+model+"\\"+model+".obj"); }catch(Exception ex) { ex.printStackTrace(); } obj.addChild(s.getSceneGroup()); obj.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
public ContentInstant(final String name) { // create BranchGroup for this image this.name = name; setCapability(BranchGroup.ALLOW_DETACH); setCapability(Node.ENABLE_PICK_REPORTING); // create transformation for pickeing localTranslate = new TransformGroup(); localTranslate.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); localTranslate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); addChild(localTranslate); localRotate = new TransformGroup(); localRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); localRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); localTranslate.addChild(localRotate); ordered = new OrderedGroup(); for (int i = 0; i < 5; i++) { final Switch s = new Switch(); s.setCapability(Switch.ALLOW_SWITCH_WRITE); s.setCapability(Switch.ALLOW_SWITCH_READ); s.setCapability(Group.ALLOW_CHILDREN_WRITE); s.setCapability(Group.ALLOW_CHILDREN_EXTEND); ordered.addChild(s); } localRotate.addChild(ordered); // create the point list points = new PointList(); plShape = new PointListShape(points); plShape.setPickable(true); plPanel = new PointListPanel(name, points); }
TransformGroup tg2 = new TransformGroup (); //set the appearance of the product boxes (transparent) Appearance app = new Appearance(); app.setTransparencyAttributes(new TransparencyAttributes(TransparencyAttributes.BLENDED,0.2f)); //create a box having length = l, breadth = b and height = h Box box = new Box( (float )item[p].getLength(), (float) item[p].getBreadth(), (float) item[p].getHeight(), app); // vector to translate the item box to the position (x, y, z) Vector3f position = new Vector3f((float) x, (float) y, (float) z); //creation of a 3D transform group Transform3D transform = new Transform3D(); transform.setTranslation(position); tg2.setTransform(transform); //add new item box to the transform group tg2.addChild(box); tg2.setCapability(Group.ALLOW_CHILDREN_EXTEND); BranchGroup scene = new BranchGroup(); scene.addChild(tg2); scene1.addChild(scene);
echoTransformGroup.setCapability (TransformGroup.ALLOW_TRANSFORM_WRITE) ; echoTransformGroup.setCapability(Group.ALLOW_CHILDREN_READ) ; echoTransformGroup.setCapability(Group.ALLOW_CHILDREN_WRITE) ; echoTransformGroup.setCapability(Group.ALLOW_CHILDREN_EXTEND) ; echoTransformGroup.addChild(echoGeometry) ;
public Test() { SimpleUniverse universe = new SimpleUniverse(); BranchGroup group = new BranchGroup(); TransformGroup rootTransformGroup = new TransformGroup(); group.addChild(rootTransformGroup); rootTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); rootTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); ColorCube colorCube = new ColorCube(.3); rootTransformGroup.addChild(colorCube); BoundingSphere boundingSphere = new BoundingSphere(new Point3d(0, 0, 0), 1000); MouseRotate mouseRotate = new MouseRotate(); mouseRotate.setTransformGroup(rootTransformGroup); mouseRotate.setSchedulingBounds(boundingSphere); group.addChild(mouseRotate); MouseTranslate mouseTrans = new MouseTranslate(); mouseTrans.setTransformGroup(rootTransformGroup); mouseTrans.setSchedulingBounds(boundingSphere); group.addChild(mouseTrans); universe.getViewingPlatform().setNominalViewingTransform(); universe.addBranchGraph(group); }
public Scalebar(final float length) { final Transform3D position = new Transform3D(); positionTG = new TransformGroup(position); positionTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); positionTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); addChild(positionTG); lineShape = new Shape3D(); lineShape.setGeometry(createLineGeometry()); lineShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE); positionTG.addChild(lineShape); final Transform3D texttranslate = new Transform3D(); texttranslate.setTranslation(new Vector3f(length / 2, -length / 2, 0.0f)); textTG = new TransformGroup(texttranslate); textTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); positionTG.addChild(textTG); textShape = new OrientedShape3D(); textShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE); textShape.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE); textShape.setGeometry(createTextGeometry()); textShape.setAppearance(createTextAppearance()); textShape.setAlignmentAxis(0.0f, 1.0f, 0.0f); textTG.addChild(textShape); }
echoTransformGroup.setCapability (TransformGroup.ALLOW_TRANSFORM_WRITE) ;
objSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
private void addText(final Group bg, final String s, final Point3f pos, final Color3f c) { final Transform3D translation = new Transform3D(); translation.setTranslation(new Vector3f(-radius, -radius, 0)); final TransformGroup tg = new TransformGroup(translation); final Text2D t2d = new Text2D(s, c, "Helvetica", 24, Font.PLAIN); t2d.setRectangleScaleFactor(0.03f); final Geometry g = t2d.getGeometry(); final Appearance a = t2d.getAppearance(); final RenderingAttributes ra = new RenderingAttributes(); ra.setDepthTestFunction(RenderingAttributes.ALWAYS); a.setRenderingAttributes(ra); g.setCapability(Geometry.ALLOW_INTERSECT); final OrientedShape3D textShape = new OrientedShape3D(); textShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE); textShape.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE); textShape.setAlignmentMode(OrientedShape3D.ROTATE_ABOUT_POINT); textShape.setAlignmentAxis(0.0f, 1.0f, 0.0f); textShape.setRotationPoint(new Point3f()); textShape.setConstantScaleEnable(true); textShape.setGeometry(g); textShape.setAppearance(a); tg.setCapability(ENABLE_PICK_REPORTING); tg.setPickable(true); tg.addChild(textShape); bg.addChild(tg); }