Package javax.media.j3d

Examples of javax.media.j3d.Material


  BranchGroup aLeg(int rot2, int rot3){
    BranchGroup leg = new BranchGroup();
   
    // appearance box
    Appearance app = new Appearance();
    Material mat = new Material();
    app.setMaterial(mat);
   
    // appearance cylinder
    Appearance appCyl = new Appearance();
    Material matCyl = new Material();
    //matCyl.setDiffuseColor(0,1,0);
    matCyl.setEmissiveColor(0f,1f,0f);
    appCyl.setMaterial(matCyl);
   
    // appearance sphere
    Appearance appSphere = new Appearance();
    Material matSphere = new Material();
    matSphere.setEmissiveColor(1f,1f,0f);
    appSphere.setMaterial(matSphere);
   
   
   
   
View Full Code Here


     * @param expectedDiffuseColor the expected diffuse color
     */
    public static void testColorFromMaterial(Appearance appearance, Color3f expectedAmbientColor,
            Color3f expectedSpecularColor, Color3f expectedDiffuseColor) {
        assertNotNull(appearance);
        Material material = appearance.getMaterial();
        assertNotNull(material);

        Color3f actualAmbientColor = new Color3f();
        material.getAmbientColor(actualAmbientColor);
        assertEquals(expectedAmbientColor, actualAmbientColor);

        Color3f actualSpecularColor = new Color3f();
        material.getSpecularColor(actualSpecularColor);
        assertEquals(expectedSpecularColor, actualSpecularColor);

        Color3f actualDiffuseColor = new Color3f();
        material.getDiffuseColor(actualDiffuseColor);
        assertEquals(expectedDiffuseColor, actualDiffuseColor);
    }
View Full Code Here

  public static Appearance createDefaultAppearance(){
      PolygonAttributes attr = new PolygonAttributes();
      attr.setCullFace(PolygonAttributes.CULL_NONE);
      Appearance ap = new Appearance();
      Material mat = new Material();
      mat.setLightingEnable(true);
      ap.setMaterial(mat);
      ap.setPolygonAttributes(attr);
      return ap;
  }
View Full Code Here

     * @param expectedDiffuseColor the expected diffuse color
     */
    public static void testColorFromMaterial(Appearance appearance, Color3f expectedAmbientColor,
            Color3f expectedSpecularColor, Color3f expectedDiffuseColor) {
        assertNotNull(appearance);
        Material material = appearance.getMaterial();
        assertNotNull(material);

        Color3f actualAmbientColor = new Color3f();
        material.getAmbientColor(actualAmbientColor);
        assertEquals(expectedAmbientColor, actualAmbientColor);

        Color3f actualSpecularColor = new Color3f();
        material.getSpecularColor(actualSpecularColor);
        assertEquals(expectedSpecularColor, actualSpecularColor);

        Color3f actualDiffuseColor = new Color3f();
        material.getDiffuseColor(actualDiffuseColor);
        assertEquals(expectedDiffuseColor, actualDiffuseColor);
    }
View Full Code Here

     * @param diffuseColor the expected diffuse color
     * @param specularColor the expected specular color
     */
    public static void setColorWithMaterial(Appearance appearance, Color3f ambientColor, Color3f diffuseColor,
            Color3f specularColor) {
        Material material = new Material();
        material.setAmbientColor(ambientColor);
        material.setDiffuseColor(diffuseColor);
        material.setSpecularColor(specularColor);
        appearance.setMaterial(material);
    }
View Full Code Here

        final TextureLoader loader = new TextureLoader(textureFileName, null);
        final Texture texture = loader.getTexture();
        final Appearance appearance = new Appearance();
        final TextureAttributes ta = new TextureAttributes();
        ta.setTextureMode(TextureAttributes.COMBINE);
        appearance.setMaterial(new Material());
        appearance.setTexture(texture);
        appearance.setTextureAttributes(ta);
        return appearance;
    }
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.