Examples of TransformGroup


Examples of javax.media.j3d.TransformGroup

  }
 
  public void restoreTransform(TransformGroupNode node, TransformData transformRoot){
    super.restoreTransform(node, transformRoot);
   
    this.group = new TransformGroup();
    trans = new Transform3D();
    group.getTransform(trans);
    updateTransform();
    group.setTransform(trans);
    if (node!=null) node.setDirty();
View Full Code Here

Examples of javax.media.j3d.TransformGroup

        @Override
        public void actionPerformed(ActionEvent e) {
           
            GroupNode gn=(GroupNode)getNode();
           
            TransformGroup g=new TransformGroup();
            // TODO i18n
            g.setName("SolidFrame");
           
            Transform3D nz=new Transform3D();
            nz.rotZ(-Math.PI/2.);
            TransformGroup tgx=new TransformGroup(nz);
            tgx.setName("X");           
            makeSolidAxis(tgx, 1.f, 0.04f, 0.02f, 0.04f, Color.RED, Color.RED, 10);           
            g.addChild(tgx);

            TransformGroup tgy=new TransformGroup(new Transform3D());
            tgy.setName("Y");           
            makeSolidAxis(tgy, 1.f, 0.04f, 0.02f, 0.04f, Color.GREEN, Color.GREEN, 10);           
            g.addChild(tgy);
           
            Transform3D px=new Transform3D();
            px.rotX(Math.PI/2.);
            TransformGroup tgz=new TransformGroup(px);
            tgz.setName("Z");           
            makeSolidAxis(tgz, 1.f, 0.04f, 0.02f, 0.04f, Color.BLUE, Color.BLUE, 10);           
            g.addChild(tgz);

            gn.addChild(g);
           
View Full Code Here

Examples of javax.media.j3d.TransformGroup

                    getLocation(),"Axis"); // TODO i18n
            AxisDialog.Result n=d.getResult();
            if(n!=null){
                GroupNode gn=(GroupNode)getNode();
       
                TransformGroup g=new TransformGroup();
                // TODO i18n
                g.setName("Axis");
       
                makeSolidAxis(g, n.height, n.arrowHeight, n.radius, n.arrowRadius, Color.WHITE, Color.WHITE, n.divisions);           

                gn.addChild(g);
       
View Full Code Here

Examples of javax.media.j3d.TransformGroup

    static class AddTransformGroupAction extends AbstractNodeAction {
        // required for dynamic action creation
        public AddTransformGroupAction() {
        }
        public void actionPerformed(ActionEvent e) {
            ((GroupNode)getNode()).addChildUndoable(new TransformGroup());
            getNode().refresh();
        }
View Full Code Here

Examples of javax.media.j3d.TransformGroup

    writer.writeNode(new Box());
   
    // Write a sphere centered at (2, 0, 2)
    Transform3D translation = new Transform3D();
    translation.setTranslation(new Vector3f(2f, 0, 2f));
    TransformGroup translationGroup = new TransformGroup(translation);
   
    translationGroup.addChild(new Sphere());
    writer.writeNode(translationGroup);
   
    // 3. Close file
    writer.close();
    assertTrue("Test@#.mtl not created", new File("Test@#.mtl").exists());
View Full Code Here

Examples of javax.media.j3d.TransformGroup

                                        boolean listenToHomeUpdates,
                                        boolean waitForLoading) {
    // Create a universe bound to no canvas 3D
    ViewingPlatform viewingPlatform = new ViewingPlatform();
    // Add an interpolator to view transform to get smooth transition
    TransformGroup viewPlatformTransform = viewingPlatform.getViewPlatformTransform();
    CameraInterpolator cameraInterpolator = new CameraInterpolator(viewPlatformTransform);
    cameraInterpolator.setSchedulingBounds(new BoundingSphere(new Point3d(), 1E7));
    viewPlatformTransform.addChild(cameraInterpolator);
    viewPlatformTransform.setCapability(TransformGroup.ALLOW_CHILDREN_READ);
   
    Viewer viewer = new Viewer(new Canvas3D [0]);
    SimpleUniverse universe = new SimpleUniverse(viewingPlatform, viewer);
   
    View view = viewer.getView();
View Full Code Here

Examples of javax.media.j3d.TransformGroup

                                boolean waitForLoading) {
    final Ground3D ground3D = new Ground3D(this.home,
        groundOriginX, groundOriginY, groundWidth, groundDepth, waitForLoading);
    Transform3D translation = new Transform3D();
    translation.setTranslation(new Vector3f(0, -0.2f, 0));
    TransformGroup transformGroup = new TransformGroup(translation);
    transformGroup.addChild(ground3D);
   
    if (listenToHomeUpdates) {
      // Add a listener on ground color and texture properties change
      this.groundColorAndTextureListener = new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
View Full Code Here

Examples of javax.media.j3d.TransformGroup

    private Icon createIcon(BranchGroup modelNode, 
                            float pieceWidth, float pieceDepth, float pieceHeight) {
      // Add piece model scene to a normalized transform group
      Transform3D scaleTransform = new Transform3D();
      scaleTransform.setScale(new Vector3d(2 / pieceWidth, 2 / pieceHeight, 2 / pieceDepth));
      TransformGroup modelTransformGroup = new TransformGroup();
      modelTransformGroup.setTransform(scaleTransform);
      modelTransformGroup.addChild(modelNode);
      // Replace model textures by clones because Java 3D doesn't accept all the time
      // to share textures between offscreen and onscreen environments
      cloneTexture(modelNode, new HashMap<Texture, Texture>());

      BranchGroup model = new BranchGroup();
View Full Code Here

Examples of javax.media.j3d.TransformGroup

  /**
   * Returns the root of model tree.
   */
  private Node getModelTree() {
    TransformGroup modelTransformGroup = new TransformGroup();     
    //  Allow transform group to have new children
    modelTransformGroup.setCapability(Group.ALLOW_CHILDREN_READ);
    modelTransformGroup.setCapability(Group.ALLOW_CHILDREN_WRITE);
    modelTransformGroup.setCapability(Group.ALLOW_CHILDREN_EXTEND);
    // Allow the change of the transformation that sets model size and position
    modelTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    return modelTransformGroup;
  }
View Full Code Here

Examples of javax.media.j3d.TransformGroup

  /**
   * Returns the <code>model</code> displayed by this component.
   */
  public BranchGroup getModel() {
    TransformGroup modelTransformGroup = (TransformGroup)this.sceneTree.getChild(0);
    if (modelTransformGroup.numChildren() > 0) {
      return (BranchGroup)modelTransformGroup.getChild(0);
    } else {
      return null;
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.