Package javax.media.j3d

Examples of javax.media.j3d.Material


  * @param app      The Appearance for the surface.
  * @param col      The colour.
  */
  public static void setToMyDefaultAppearance(Appearance app, Color3f col)
  {
    app.setMaterial(new Material(col,col,col,col,120.0f));
  }
View Full Code Here


    Color3f specularColourFBox = new Color3f(0.8f,0.0f,0.0f);
    float shininessFBox = 10.0f;

    Appearance fBoxApp = new Appearance();

    fBoxApp.setMaterial(new Material(ambientColourFBox,emissiveColourFBox,
                          diffuseColourFBox,specularColourFBox,shininessFBox));


    Box fBox = new Box(0.2f,0.2f,0.2f,fBoxApp);

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


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

    tgFBox.addChild(fBox);



//*** Generate a red cube including its transformation group. ***
    Color3f ambientColourBSphere = new Color3f(0.0f,0.6f,0.0f);
    Color3f emissiveColourBSphere = new Color3f(0.0f,0.0f,0.0f);
    Color3f diffuseColourBSphere = new Color3f(0.0f,0.6f,0.0f);
    Color3f specularColourBSphere = new Color3f(0.0f,0.6f,0.0f);
    float shininessBSphere = 2.0f;

    Appearance bSphereApp = new Appearance();

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

    Sphere bSphere = new Sphere(0.4f,bSphereApp);

    //The UserData are needed in order to identify the sphere when it is picked.
View Full Code Here

    Color3f specularColourShaded = new Color3f(0.0f,0.5f,0.5f);

    float shininessShaded = 20.0f;

    Appearance shadedApp = new Appearance();
    shadedApp.setMaterial(new Material(ambientColourShaded,emissiveColourShaded,
                           diffuseColourShaded,specularColourShaded,shininessShaded));



View Full Code Here



    //The bird's Appearance.
    Appearance birdApp = new Appearance();
    birdApp.setMaterial(new Material(ambientColourBird,emissiveColourBird,
                          diffuseColourBird,specularColourBird,shininessBird));

    //The wings.
    Box wings = new Box(0.03f,0.005f,0.3f,birdApp);
View Full Code Here

    float shininessFBox = 10.0f;


    //The Appearance for the cube.
    Appearance fBoxApp = new Appearance();
    fBoxApp.setMaterial(new Material(ambientColourFBox,emissiveColourFBox,
                          diffuseColourFBox,specularColourFBox,shininessFBox));

    //The cube.
    Box fBox = new Box(0.2f,0.2f,0.2f,fBoxApp);

    //The transformation group of the cube.
    Transform3D tfFBox = new Transform3D();
    tfFBox.rotY(Math.PI/6);
    Transform3D rotationX = new Transform3D();
    rotationX.rotX(-Math.PI/5);
    tfFBox.mul(rotationX);
    TransformGroup tgFBox = new TransformGroup(tfFBox);
    tgFBox.addChild(fBox);


//*** And a sphere with its transformation group.

    //The colours for the Appearance.
    Color3f ambientColourBSphere = new Color3f(0.0f,0.4f,0.0f);
    Color3f emissiveColourBSphere = new Color3f(0.0f,0.0f,0.0f);
    Color3f diffuseColourBSphere = new Color3f(0.0f,0.0f,0.0f);
    Color3f specularColourBSphere = new Color3f(0.0f,0.8f,0.0f);
    float shininessBSphere = 128.0f;

    //The Appearance for the sphere.
    Appearance bSphereApp = new Appearance();
    bSphereApp.setMaterial(new Material(ambientColourBSphere,emissiveColourBSphere,
                          diffuseColourBSphere,specularColourBSphere,shininessBSphere));

    //The sphere.
    Sphere bSphere = new Sphere(0.4f,bSphereApp);

View Full Code Here

  * @param app      The Appearance for the surface.
  * @param col      The colour.
  */
  public static void setToMyDefaultAppearance(Appearance app, Color3f col)
  {
    app.setMaterial(new Material(col,col,col,col,120.0f));
  }
View Full Code Here

        Text3D text = new Text3D(f3d, new String("Wladimir Cönig"), new Point3f(-3.5f, -.5f, -4.5f));
       
        Color3f white = new Color3f(1.0f, 1.0f, 1.0f);
        Color3f blue = new Color3f(.2f, 0.2f, 0.6f);
        Appearance a = new Appearance();
        Material m = new Material(blue, blue, white, white, 80.0f);
        m.setLightingEnable(true);
        a.setMaterial(m);

        Shape3D sh = new Shape3D();
        sh.setGeometry(text);
        sh.setAppearance(a);
View Full Code Here

    float shininessSphere = 20.0f;

    Appearance sphereApp = new Appearance();

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


    //n spheres with radius r will be shown.
    int n = 5;
View Full Code Here

    Color3f specularColourShaded = new Color3f(0.0f,0.5f,0.5f);

    float shininessShaded = 20.0f;

    Appearance shadedApp = new Appearance();
    shadedApp.setMaterial(new Material(ambientColourShaded,emissiveColourShaded,
                           diffuseColourShaded,specularColourShaded,shininessShaded));



View Full Code Here

  * @param app      The Appearance for the surface.
  * @param col      The colour.
  */
  public static void setToMyDefaultAppearance(Appearance app, Color3f col)
  {
    app.setMaterial(new Material(col,col,col,col,120.0f));
  }
View Full Code Here

TOP

Related Classes of javax.media.j3d.Material

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.