Examples of BranchGroup


Examples of javax.media.j3d.BranchGroup

        return _global;
    }

    private static BranchGroup createSimpleSceneGraph() {
        // Create the root of the branch graph
        BranchGroup objRoot = new BranchGroup();
        // 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.
        TransformGroup objTrans = new TransformGroup();
        Transform3D t3dTrans = new Transform3D();
        objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        objTrans.setTransform(t3dTrans);
        objRoot.addChild(objTrans);
        BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0),
                100.0);
        // Set up the ambient light
        Color3f ambientColor = new Color3f(0.3f, 0.3f, 0.3f);
        AmbientLight ambientLightNode = new AmbientLight(ambientColor);
        ambientLightNode.setInfluencingBounds(bounds);
        objRoot.addChild(ambientLightNode);
        // Set up one directional lights
        Color3f light1Color = new Color3f(1.0f, 1.0f, 0.9f);
        Vector3f light1Direction = new Vector3f(1.0f, 1.0f, 1.0f);
        DirectionalLight light1 = new DirectionalLight(light1Color,
                light1Direction);
        light1.setInfluencingBounds(bounds);
        objRoot.addChild(light1);
        return objRoot;
    }
View Full Code Here

Examples of javax.media.j3d.BranchGroup

    BranchGroup getRootGroup() {
        Node n = _n;
        while (n != null) {
            if (n instanceof BranchGroup) {
                BranchGroup bg = (BranchGroup) n;
                if (bg.getParent() == null) {
                    return bg;
                }
            }
            n = n.getParent();
        }
View Full Code Here

Examples of javax.media.j3d.BranchGroup

     */
    protected float getSceneSize() {
        Bounds res=null;
        Enumeration<?> e=_viewingPlatform.getLocale().getAllBranchGraphs();
        while(e.hasMoreElements()){
            BranchGroup bg=(BranchGroup)e.nextElement();
            Bounds b=bg.getBounds();
            if(res==null){
                res=b;
            }
            else{
                res.combine(b);
View Full Code Here

Examples of javax.media.j3d.BranchGroup

        public AddBranchGroupActionUniverse() {
        }

        public void actionPerformed(ActionEvent e) {
            ((Universe) getNode().getGraphObject())
                    .addBranchGraph(new BranchGroup());
            // TODO add undo
            getNode().refresh();
        }
View Full Code Here

Examples of javax.media.j3d.BranchGroup

    public ArrayList<BranchGroup> getSceneGraphs() {
        Enumeration<?> e = _rootLocale.getAllBranchGraphs();
        ArrayList<BranchGroup> res = new ArrayList<BranchGroup>();
        while (e.hasMoreElements()) {
            BranchGroup bg = (BranchGroup) e.nextElement();
            if (!(bg instanceof ViewingPlatform)) {
                res.add(bg);
            }
        }
        return res;
View Full Code Here

Examples of javax.media.j3d.BranchGroup

        try {
            SceneGraphFileWriter w = new SceneGraphFileWriter(f, null, false,
                    "TBDuinverseName", null);
            Enumeration<?> e = _rootLocale.getAllBranchGraphs();
            while (e.hasMoreElements()) {
                BranchGroup bg = (BranchGroup) e.nextElement();
                if (!(bg instanceof ViewingPlatform)) {
                    // TODO serialize a name ???
                    w.writeBranchGraph(bg, null);
                }
            }
View Full Code Here

Examples of javax.media.j3d.BranchGroup

        Enumeration<?> e=getAllLocales();
        while(e.hasMoreElements()){
            Locale l=(Locale)e.nextElement();
            Enumeration<?> el=l.getAllBranchGraphs();
            while(el.hasMoreElements()){
                BranchGroup bg=(BranchGroup)el.nextElement();
                if(nodeClass.isAssignableFrom(bg.getClass())){
                    res.add(bg);
                }
                getNodes(res, nodeClass, bg);
            }
        }
View Full Code Here

Examples of javax.media.j3d.BranchGroup

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

Examples of javax.media.j3d.BranchGroup

                handler=new LoaderHandler();
            }
            if(handler.select()){
                Scene sc=handler.load();
                if(sc!=null){
                    BranchGroup bg=sc.getSceneGroup();
                    if(bg!=null){
                        GroupNode gn=(GroupNode)getNode();
                        gn.addChild(bg);
                        getNode().refresh();
                    }
View Full Code Here

Examples of javax.media.j3d.BranchGroup

    } else {
      setModelChangeTexts(preferences);
      // Read model in modelLoader executor
      this.modelLoader.execute(new Runnable() {
          public void run() {
            BranchGroup model = null;
            try {
              model = readModel(piece.getModel());
            } catch (IOException ex) {
              // Model loading failed
            }
            final BranchGroup readModel = model;
            // Update components in dispatch thread
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                  if (readModel != null) {
                    controller.setModel(piece.getModel());
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.