Examples of BranchGroup


Examples of javax.media.j3d.BranchGroup

    static ViewTransform create(int index, SimpleUniverse universe) {
        try {
            ViewTransform v = (ViewTransform)transforms[index].newInstance();
            v.universe = universe;
            v.controllers = new BranchGroup();
            v.controllers.setCapability(BranchGroup.ALLOW_DETACH);

            MultiTransformGroup mtg = universe.getViewingPlatform().getMultiTransformGroup();

            for (int i = 0; i < mtg.getNumTransforms(); i++) {
View Full Code Here

Examples of javax.media.j3d.BranchGroup

        f.addChild(r);
        r.addChild(p);
        p.addChild(t);
        t.addChild(obj);

        BranchGroup bg = new BranchGroup();
        MouseRotate behavior1 = new MouseRotate(t);
        behavior1.setFactor(0.0, -0.002);
        bg.addChild(behavior1);
        behavior1.setSchedulingBounds(BoardModel.bounds);

        MouseRotate behavior2 = new MouseRotate(r);
        behavior2.setFactor(-0.002, 0.0);
        bg.addChild(behavior2);
        behavior2.setSchedulingBounds(BoardModel.bounds);

        bg.addChild(f);

        return bg;
    }
View Full Code Here

Examples of javax.media.j3d.BranchGroup

        v.setFrontClipPolicy(View.VIRTUAL_EYE);
        v.setTransparencySortingPolicy(View.TRANSPARENCY_SORT_GEOMETRY);

        tileManager = new TileTextureManager(this, game);

        cursors = new BranchGroup();
        cursors.setPickable(false);
        cursors.addChild(cursor = new CursorModel(C.cyan));
        cursors.addChild(highlightCursor = new CursorModel(C.white));
        cursors.addChild(selectCursor = new CursorModel(C.blue));
        cursors.addChild(firstLOSCursor = new CursorModel(LOS_COLOR));
View Full Code Here

Examples of javax.media.j3d.BranchGroup

        addChild(new ArtilleryAttackModel(TilesetManager.ARTILLERY_INCOMING, aaa, game, tileManager));
    }

    public void remove(Entity entity) {
        for (Enumeration<?> e = getAllChildren(); e.hasMoreElements();) {
            BranchGroup bg = (BranchGroup)e.nextElement();
            AttackAction a = (AttackAction)bg.getUserData();
            if (a != null && a.getEntityId() == entity.getId()) bg.detach();
        }
    }
View Full Code Here

Examples of javax.media.j3d.BranchGroup

    TransformGroup tgTetrahedron = new TransformGroup(tfTetrahedron);
    tgTetrahedron.addChild(tetrahedron);


//*** The root of the scenegraph. ***
    BranchGroup theScene = new BranchGroup();

    //Add the tetrahedron to the scene.
    theScene.addChild(tgTetrahedron);

    theScene.compile();

    //Add everything to the universe.
    su.addBranchGraph(theScene);

  }
View Full Code Here

Examples of javax.media.j3d.BranchGroup

  //Some light is added to the scene here.
  public void addLight(SimpleUniverse su)
  {

    BranchGroup bgLight = new BranchGroup();

    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), Double.MAX_VALUE);
    Color3f lightColour1 = new Color3f(1.0f,1.0f,1.0f);
    Vector3f lightDir1  = new Vector3f(-1.0f,0.0f,-0.5f);
    DirectionalLight light1 = new DirectionalLight(lightColour1, lightDir1);
    light1.setInfluencingBounds(bounds);


    Vector3f lightDir2  = new Vector3f(1.0f,0.0f,0.5f);
    DirectionalLight light2 = new DirectionalLight(lightColour1, lightDir2);
    light2.setInfluencingBounds(bounds);


    bgLight.addChild(light1);
    bgLight.addChild(light2);

    su.addBranchGraph(bgLight);
  }
View Full Code Here

Examples of javax.media.j3d.BranchGroup

    tgSphere.addChild(colourSwitch);



    //Generate the scenegraph.
    BranchGroup theScene = new BranchGroup();


    //In order to allow navigation through the scene with the keyboard,
    //everything must be collected in a separate transformation group to which
    //the KeyNavigatorBehavior is applied.
    TransformGroup tgAll = new TransformGroup();
    tgAll.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    tgAll.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    tgAll.addChild(tgBox);
    tgAll.addChild(tgSphere);
    tgAll.addChild(tgmCyl);
    KeyNavigatorBehavior knb = new KeyNavigatorBehavior(tgAll);
    knb.setSchedulingBounds(bounds);
    tgAll.addChild(knb);
    theScene.addChild(tgAll);

    //The PickTranslateBehavior for moving the blue cube.
    PickTranslateBehavior pickTrans = new PickTranslateBehavior(theScene,myCanvas3D,bounds);
    theScene.addChild(pickTrans);



    //This class takes care of changing the colour of the sphere when the cube touches it.
    CollisionBehaviour1 scb1 = new CollisionBehaviour1(colourSwitch,bounds);
    theScene.addChild(scb1);


    //A corresponding class for the movement(s) of the cylinder.
    Alpha[] cylAlphas= new Alpha[2];
    cylAlphas[0] = cylAlphaR;
    cylAlphas[1] = cylAlphaL;

    CollisionBehaviour2 scb2 = new CollisionBehaviour2(cyli,cylAlphas,bounds);
    theScene.addChild(scb2);



    theScene.compile();


    //Add everything to the universe.
    su.addBranchGraph(theScene);
View Full Code Here

Examples of javax.media.j3d.BranchGroup

  //Some light is added to the scene here.
  public void addLight(SimpleUniverse su)
  {

    BranchGroup bgLight = new BranchGroup();

    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
    Color3f lightColour1 = new Color3f(1.0f,1.0f,1.0f);
    Vector3f lightDir1  = new Vector3f(-1.0f,0.0f,-0.5f);
    DirectionalLight light1 = new DirectionalLight(lightColour1, lightDir1);
    light1.setInfluencingBounds(bounds);

    bgLight.addChild(light1);


    Vector3f lightDir2  = new Vector3f(1.0f,-1.0f,0.5f);
    DirectionalLight light2 = new DirectionalLight(lightColour1, lightDir2);
    light2.setInfluencingBounds(bounds);

    bgLight.addChild(light2);
    su.addBranchGraph(bgLight);

  }
View Full Code Here

Examples of javax.media.j3d.BranchGroup

  //Some light is added to the scene here.
  public void addLight(SimpleUniverse su)
  {

    BranchGroup bgLight = new BranchGroup();

    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
    Color3f lightColour1 = new Color3f(1.0f,1.0f,1.0f);
    Vector3f lightDir1  = new Vector3f(-1.0f,0.0f,-0.5f);
    DirectionalLight light1 = new DirectionalLight(lightColour1, lightDir1);
    light1.setInfluencingBounds(bounds);

    bgLight.addChild(light1);
    su.addBranchGraph(bgLight);
  }
View Full Code Here

Examples of javax.media.j3d.BranchGroup




    //*** Generate (the root of) the scenegraph. ***
    BranchGroup theScene = new BranchGroup();


    //Add the cube and the sphere to the scene.
    theScene.addChild(tgBox);
    theScene.addChild(tgSphere);


    //Generate a white background.
    Background bg = new Background(new Color3f(1.0f,1.0f,1.0f));
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE);
    bg.setApplicationBounds(bounds);
    theScene.addChild(bg);




    theScene.compile();

    //Add everything to the universe.
    su.addBranchGraph(theScene);

  }
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.