Examples of BranchGroup


Examples of com.xith3d.scenegraph.BranchGroup

  public static void main(String[] args) {
    VirtualUniverse universe = new VirtualUniverse();
    Locale locale = new Locale();
    universe.addLocale(locale);

    BranchGroup objRoot = new BranchGroup();

    Appearance a = new Appearance();
    a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
    Shape3D sph = new Shape3D(TestUtils.createSphere(1.0f, 20), a);
    TransformGroup sphereTrans = new TransformGroup();
    sphereTrans.addChild(sph);

    objRoot.addChild(sphereTrans);

    AmbientLight aLgt = new AmbientLight(new Color3f(0.2f, 0.2f, 0.2f));
    objRoot.addChild(aLgt);

    locale.addBranchGraph(objRoot);
   
   
    PluginManager pluginManager = (PluginManager) new Java3DPluginManager();
View Full Code Here

Examples of com.xith3d.scenegraph.BranchGroup

    protected BranchGroup branchgroup;
   
    public BranchGroupNodeXith3D(ActiveNode parent) {
        super(parent);
        branchgroup = new BranchGroup();
        branchgroup.setName(name);
        branchgroup.setUserData(this);
        branchgroup.setPickable(true);
        if (parent.get3DObject() instanceof Group) {
            ((Group)parent.get3DObject()).addChild(branchgroup);
View Full Code Here

Examples of com.xith3d.scenegraph.BranchGroup

   
    VirtualUniverse v=new VirtualUniverse();
    Locale l=new Locale();
    l.setName("loc1");
    v.addLocale(l);
    BranchGroup bg=new BranchGroup();
    bg.setName("bg1");
    l.addBranchGraph(bg);
   
    Appearance a = new Appearance();
    a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
    Shape3D sph = new Shape3D(TestUtils.createSphere(1.0f, 20), a);
    sph.setName("s1");
    TransformGroup sphereTrans = new TransformGroup();
    sphereTrans.addChild(sph);
    sphereTrans.setName("t1");

    bg.addChild(sphereTrans);

    AmbientLight aLgt = new AmbientLight(new Color3f(0.2f, 0.2f, 0.2f));
    aLgt.setName("l1");
    bg.addChild(aLgt);
   
    VirtualUniverse v2=new VirtualUniverse();
    Locale l2=new Locale();
    l2.setName("loc2");
    v2.addLocale(l2);
    BranchGroup bg2=new BranchGroup();
    bg2.setName("bg2");
    l2.addBranchGraph(bg2);

    SceneGraphModel tm=new SceneGraphModelXith3D();
    // TODO: use factories and test them by the same occasion
    //tm.insert(null, v, "v1", 0);
View Full Code Here

Examples of com.xith3d.scenegraph.BranchGroup

        locale.setName(name);
        //locale.setPickable(true);
        //locale.setUserData(this);
        universe.addLocale(locale);
       
        branchgroup = new BranchGroup();
        branchgroup.setName(name);
        branchgroup.setUserData(this);
        branchgroup.setPickable(true);

        rootGroup = new BranchGroup();
        rootGroup.setName(name);
        rootGroup.setUserData(this);
        rootGroup.setPickable(true);
       
        AmbientLight alight = new AmbientLight(true,new Color3f(0.5f,0.5f,0.5f));
View Full Code Here

Examples of javax.media.j3d.BranchGroup

    /**
     * Sets the 3D model viewed by this model 
     */
    public void setModel(Content model, final UserPreferences preferences) {
      if (model == null) {
        setModel(new BranchGroup());           
      } else {
        ModelManager.getInstance().loadModel(model, new ModelManager.ModelObserver() {         
            public void modelUpdated(BranchGroup modelRoot) {
              setModel(modelRoot);           
            }
View Full Code Here

Examples of javax.media.j3d.BranchGroup

   
    /*
     *
     */
  protected float getSceneSize() {
    BranchGroup bg = scene.getBranchgroup();
    boolean autocompute = bg.getBoundsAutoCompute();
    scene.getBranchgroup().setBoundsAutoCompute(true);
    Bounds bounds = scene.getBranchgroup().getBounds();
    scene.getBranchgroup().setBoundsAutoCompute(autocompute);
    if (bounds instanceof BoundingSphere) {
      return (float)((BoundingSphere)bounds).getRadius();
View Full Code Here

Examples of javax.media.j3d.BranchGroup

        canvas3D = new Canvas3D(r);
       
        canvas3D.setDoubleBufferEnable(true);
        universe = new SimpleUniverse(canvas3D);

        rootGroup = new BranchGroup();
        rootGroup.setCapability(BranchGroup.ALLOW_DETACH);
        rootGroup.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
        rootGroup.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
        rootGroup.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
        branchgroup = new BranchGroup();
        branchgroup.setCapability(BranchGroup.ALLOW_AUTO_COMPUTE_BOUNDS_READ);
        branchgroup.setCapability(BranchGroup.ALLOW_BOUNDS_READ);
        branchgroup.setCapability(BranchGroup.ALLOW_AUTO_COMPUTE_BOUNDS_WRITE);
        branchgroup.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
        branchgroup.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
        branchgroup.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
       
        // TODO use light factories

        AmbientLight alight = new AmbientLight(true,new Color3f(0.5f,0.5f,0.5f));
        alight.setEnable(true);
        rootGroup.addChild(alight);
        BoundingSphere bounds = new BoundingSphere (new Point3d (0, 0.0, 0), 1E100);
        alight.setInfluencingBounds(bounds);

        lights = new DirectionalLight[1];

        for (int i=0; i<lights.length; ++i) {
          // TODO : position lights around the object
            lights[i] = new DirectionalLight(true,new Color3f(1.0f,1.0f,1.0f),new Vector3f(-1,-1,-1));
            lights[i].setCapability(DirectionalLight.ALLOW_DIRECTION_READ);
            lights[i].setCapability(DirectionalLight.ALLOW_DIRECTION_WRITE);
            lights[i].setCapabilityIsFrequent(DirectionalLight.ALLOW_DIRECTION_READ);
            lights[i].setCapabilityIsFrequent(DirectionalLight.ALLOW_DIRECTION_WRITE);
            lights[i].setEnable(true);
            lights[i].setInfluencingBounds(bounds);
            rootGroup.addChild(lights[i]);
        }
       
        // X axis in blue
        axisGroup = new BranchGroup();

        float[] axis = AxisMaker.makeAxis(0);
        LineArray la = new LineArray(axis.length/3, LineArray.COORDINATES);
        la.setCoordinates(0,axis);
        Appearance a = new Appearance();
View Full Code Here

Examples of javax.media.j3d.BranchGroup

        canvas3D = new Canvas3D(r);
       
        canvas3D.setDoubleBufferEnable(true);
        universe = new SimpleUniverse(canvas3D);

        rootGroup = new BranchGroup();
        rootGroup.setCapability(BranchGroup.ALLOW_DETACH);
        rootGroup.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
        rootGroup.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
        rootGroup.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
        branchgroup = new BranchGroup();
        branchgroup.setCapability(BranchGroup.ALLOW_AUTO_COMPUTE_BOUNDS_READ);
        branchgroup.setCapability(BranchGroup.ALLOW_BOUNDS_READ);
        branchgroup.setCapability(BranchGroup.ALLOW_AUTO_COMPUTE_BOUNDS_WRITE);
        branchgroup.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
        branchgroup.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
        branchgroup.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
       
        // TODO use light factories

        AmbientLight alight = new AmbientLight(true,new Color3f(0.5f,0.5f,0.5f));
        alight.setEnable(true);
        rootGroup.addChild(alight);
        BoundingSphere bounds = new BoundingSphere (new Point3d (0, 0.0, 0), 1E100);
        alight.setInfluencingBounds(bounds);

        lights = new DirectionalLight[1];

        for (int i=0; i<lights.length; ++i) {
          // TODO : position lights around the object
            lights[i] = new DirectionalLight(true,new Color3f(1.0f,1.0f,1.0f),new Vector3f(-1,-1,-1));
            lights[i].setCapability(DirectionalLight.ALLOW_DIRECTION_READ);
            lights[i].setCapability(DirectionalLight.ALLOW_DIRECTION_WRITE);
            lights[i].setCapabilityIsFrequent(DirectionalLight.ALLOW_DIRECTION_READ);
            lights[i].setCapabilityIsFrequent(DirectionalLight.ALLOW_DIRECTION_WRITE);
            lights[i].setEnable(true);
            lights[i].setInfluencingBounds(bounds);
            rootGroup.addChild(lights[i]);
        }
       
        // X axis in blue
        axisGroup = new BranchGroup();

        float[] axis = AxisMaker.makeAxis(0);
        LineArray la = new LineArray(axis.length/3, LineArray.COORDINATES);
        la.setCoordinates(0,axis);
        Appearance a = new Appearance();
View Full Code Here

Examples of javax.media.j3d.BranchGroup

 
    protected transient BranchGroup branchgroup;
   
    public BranchGroupNodeJava3D(ActiveNode parent) {
        super(parent);
        branchgroup = new BranchGroup();
        branchgroup.setUserData(this);
        branchgroup.setPickable(true);
        SceneNodeJava3D.addChildToParentGroup((Group)getParent().get3DObject(), branchgroup);
    }
View Full Code Here

Examples of javax.media.j3d.BranchGroup

    }
   
   
    private void readObject(java.io.ObjectInputStream in) throws java.lang.ClassNotFoundException, java.io.IOException {
    in.defaultReadObject();
    branchgroup = new BranchGroup();
      branchgroup.setUserData(this);
      branchgroup.setPickable(true);
  }
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.