Package javax.media.j3d

Examples of javax.media.j3d.TransformGroup.addChild()


      Transform3D translation2;
      translation2 = new Transform3D();
      translation2.setTranslation(new Vector3f (0, 0, -20));
      tg2.setTransform(translation2);
      Box box = new Box();
      tg2.addChild(box);
      parent.addChild(tg2);
     
      AmbientLight light = new AmbientLight(new Color3f(0.5f, 0.5f, 0.5f));
      //light.setColor(new Color3f(0.5f, 0.5f, 0.5f));
      light.setInfluencingBounds(new BoundingSphere(new Point3d(0, 0, 0), 80));
View Full Code Here


    //The transformation group of the tetrahedron.
    //The tetrahedron will be rotated a little bit.
    Transform3D tfTetrahedron = new Transform3D();
    tfTetrahedron.rotX(0.4*Math.PI);
    TransformGroup tgTetrahedron = new TransformGroup(tfTetrahedron);
    tgTetrahedron.addChild(tetrahedron);


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

View Full Code Here

    //The UserData are needed in order to identify the cube when it is picked.
    fBox.setUserData("box");

    TransformGroup tgmBox = new TransformGroup();
    tgmBox.addChild(fBox);

    Transform3D rotationAxis = new Transform3D();


    //The following lines define what the cube should do when picked.
View Full Code Here

    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE);
    boxRotation.setSchedulingBounds(bounds);

    //The movement is added to the transformation group.
    tgmBox.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    tgmBox.addChild(boxRotation);


    //A transformation group for positioning the cube.
    Transform3D tfFBox = new Transform3D();
    tfFBox.rotY(Math.PI/6);
View Full Code Here

    tfFBox.rotY(Math.PI/6);
    Transform3D rotationX = new Transform3D();
    rotationX.rotX(-Math.PI/5);
    tfFBox.mul(rotationX);
    TransformGroup tgFBox = new TransformGroup(tfFBox);
    tgFBox.addChild(tgmBox);


//*** The same for the sphere.
    Color3f ambientColourBSphere = new Color3f(0.0f,0.6f,0.0f);
    Color3f emissiveColourBSphere = new Color3f(0.0f,0.0f,0.0f);
View Full Code Here

                                                       1.0f,0.5f);

    shrinker.setSchedulingBounds(bounds);

    tgmBSphere.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    tgmBSphere.addChild(shrinker);


    //The same for the growing sphere.
    Alpha sphereStretchAlpha = new Alpha(1,2000);
    sphereStretchAlpha.setStartTime(Long.MAX_VALUE);
View Full Code Here

                                                       new Transform3D(),
                                                       0.5f,1.0f);

    stretcher.setSchedulingBounds(bounds);

    tgmBSphere.addChild(stretcher);


    //A transformation group for positioning the sphere.
    Transform3D tfBSphere = new Transform3D();
    tfBSphere.setTranslation(new Vector3f(2.0f,0.0f,-10.5f));
View Full Code Here

    //A transformation group for positioning the sphere.
    Transform3D tfBSphere = new Transform3D();
    tfBSphere.setTranslation(new Vector3f(2.0f,0.0f,-10.5f));
    TransformGroup tgBSphere = new TransformGroup(tfBSphere);
    tgBSphere.addChild(tgmBSphere);

    //Generate the scenegraph.
    BranchGroup theScene = new BranchGroup();
    theScene.addChild(tgFBox);
    theScene.addChild(tgBSphere);
View Full Code Here

    tfBox.rotX(Math.PI/9);
    Transform3D shift = new Transform3D();
    shift.setTranslation(new Vector3f(-0.6f,-0.2f,0.1f));
    tfBox.mul(shift);
    TransformGroup tgBox = new TransformGroup(tfBox);
    tgBox.addChild(myBox);




//*** Generate a sphere. ***
 
View Full Code Here

    Sphere mySphere = new Sphere(0.3f,Sphere.GENERATE_NORMALS,100,sphereApp);
    Transform3D tfSphere = new Transform3D();
    tfSphere.setTranslation(new Vector3f(0.0f,0.0f,-1.0f));

    TransformGroup tgSphere = new TransformGroup(tfSphere);
    tgSphere.addChild(mySphere);




    //*** Generate (the root of) the scenegraph. ***
 
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.