Package com.sun.j3d.utils.geometry

Examples of com.sun.j3d.utils.geometry.Sphere


    BranchGroup objRoot = scene.getBranchgroup();

    Appearance a = new Appearance();
    a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
    TransformGroup sphereTrans = new TransformGroup();
    sphereTrans.addChild(new Sphere(1.f, Sphere.GENERATE_NORMALS,40, a));

    scene.detach();
    objRoot.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
    objRoot.addChild(sphereTrans);
View Full Code Here


   }
   
    private void createPrimitive(){
        int genFlag=Primitive.GENERATE_NORMALS|Primitive.GENERATE_TEXTURE_COORDS|Primitive.GEOMETRY_NOT_SHARED|Primitive.ENABLE_GEOMETRY_PICKING;
        if(_primitiveClass==Sphere.class){
            _result=new Sphere(_radius, genFlag , _divisions);
        }
        else if(_primitiveClass==Cylinder.class){
            _result=new Cylinder(_radius, _height, genFlag,
                    _divisions, _heightDivisions, null);
        }
View Full Code Here

    // 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

        Appearance sapp = new Appearance();
        sapp.setColoringAttributes(new ColoringAttributes(SKY, ColoringAttributes.SHADE_FLAT));
        sapp.setPolygonAttributes(C.noCull);
        sapp.setTexture(tileManager.getTexture("data/images/misc/clouds.jpg"));
        TransformGroup tg = new TransformGroup(new Transform3D(C.mkquat(1, 0, 0, Math.PI/2), new Vector3d(), 1.0));
        tg.addChild(new Sphere(1f, Primitive.GENERATE_TEXTURE_COORDS, 100, sapp));
        back.addChild(tg);
        Background bg = new Background(back);
        bg.setApplicationBounds(bounds);
        addChild(bg);
    }
View Full Code Here

                                            specularColourGSphere,
                                            shininessGSphere));

    //Generate the green sphere.
    float radius = 0.1f;
    Sphere greenSphere = new Sphere(radius,greenSphereApp);



    //The same for the red sphere.
    Color3f ambientColourRSphere = new Color3f(0.6f,0.0f,0.0f);
    Color3f emissiveColourRSphere = new Color3f(0.0f,0.0f,0.0f);
    Color3f diffuseColourRSphere = new Color3f(0.6f,0.0f,0.0f);
    Color3f specularColourRSphere = new Color3f(0.8f,0.0f,0.0f);
    float shininessRSphere = 20.0f;

    Appearance redSphereApp = new Appearance();

    redSphereApp.setMaterial(new Material(ambientColourRSphere,emissiveColourRSphere,
                             diffuseColourRSphere,specularColourRSphere,shininessRSphere));

    Sphere redSphere = new Sphere(radius,redSphereApp);



    //Add the two spheres to the Switch.
    colourSwitch.addChild(greenSphere);
View Full Code Here

    sphereApp.setMaterial(new Material(ambientColourSphere,emissiveColourSphere,
                           diffuseColourSphere,specularColourSphere,shininessSphere));



    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);
View Full Code Here

    bSphereApp.setMaterial(new Material(ambientColourBSphere,emissiveColourBSphere,
                          diffuseColourBSphere,specularColourBSphere,shininessBSphere));

    //The left sphere and its transformation group.
    Sphere bSphere1 = new Sphere(radius,bSphereApp);

    Transform3D tfBSphere1 = new Transform3D();
    tfBSphere1.setTranslation(new Vector3f(xShiftSphere,sphereLift,sphereBackShift));
    TransformGroup tgBSphere1 = new TransformGroup(tfBSphere1);
    tgBSphere1.addChild(bSphere1);


    //The left cube and the left sphere are combined in one transformation group
    //in order to position them jointly.
    Transform3D tf1 = new Transform3D();
    tf1.setTranslation(new Vector3f(-xShift,0.0f,0.0f));
    TransformGroup tg1 = new TransformGroup(tf1);
    tg1.addChild(tgFBox1);
    tg1.addChild(tgBSphere1);


    //The right cube with sreen door transparency.
    Appearance fBoxApp2 = new Appearance();
    fBoxApp2.setMaterial(new Material(ambientColourFBox,emissiveColourFBox,
                          diffuseColourFBox,specularColourFBox,shininessFBox));

    //Generate screen door transparency.
    TransparencyAttributes ta2 = new TransparencyAttributes();
    ta2.setTransparencyMode(TransparencyAttributes.SCREEN_DOOR);
    ta2.setTransparency(transparencyCoefficient);

    fBoxApp2.setTransparencyAttributes(ta2);

    Box fBox2 = new Box(cubeEdge,cubeEdge,cubeEdge,fBoxApp2);


    //Position the cube.
    Transform3D tfFBox2 = new Transform3D();
    tfFBox2.mul(rotationX);
    TransformGroup tgFBox2 = new TransformGroup(tfFBox2);

    //The transformation group for the right cube.
    tgFBox2.addChild(fBox2);


    //The right sphere and its transformation group.
    Sphere bSphere2 = new Sphere(radius,bSphereApp);
    Transform3D tfBSphere2 = new Transform3D();
    tfBSphere2.setTranslation(new Vector3f(-xShiftSphere,sphereLift,sphereBackShift));
    TransformGroup tgBSphere2 = new TransformGroup(tfBSphere2);
    tgBSphere2.addChild(bSphere2);
View Full Code Here

    //Radius of the cockpit.
    float cabinRadius = 0.1f;

    //Generate the cockpit in the form of a sphere.
    Sphere cabin = new Sphere(cabinRadius,greenApp);

    //The transformation group for the cockpit.
    //The cockpit first remains in the origin. Later on, the whole
    //helicopter is shifted onto the platform.
    TransformGroup tgCabin = new TransformGroup();
View Full Code Here

    //Radius of the cockpit.
    float cabinRadius = 0.1f;

    //Generate the cockpit in the form of a sphere.
    Sphere cabin = new Sphere(cabinRadius,greenApp);

    //The transformation group for the cockpit.
    //The cockpit first remains in the origin. Later on, the whole
    //helicopter is shifted onto the platform.
    TransformGroup tgCabin = new TransformGroup();
View Full Code Here

    textureApp.setTexCoordGeneration(tcg);


    //A sphere to which Appearance, i.e. the texture is assigned.
    Sphere tSphere = new Sphere(0.5f,Sphere.GENERATE_NORMALS,100,textureApp);

    //The transformation group for the sphere.
    TransformGroup tgSphere = new TransformGroup();
    tgSphere.addChild(tSphere);
View Full Code Here

TOP

Related Classes of com.sun.j3d.utils.geometry.Sphere

Copyright © 2018 www.massapicom. 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.