create Java 3D Appearance - Java javax.media.j3d

Java examples for javax.media.j3d:Appearance

Description

create Java 3D Appearance

Demo Code

/**/*ww w.  ja va2  s. co  m*/
 * Copyright (c) 2014 Sa?l Pi?a <sauljabin@gmail.com>.
 * 
 * This file is part of WaspsNestBuilding.
 * 
 * WaspsNestBuilding is licensed under The MIT License.
 * For full copyright and license information please see the LICENSE file.
 */
import java.awt.Color;
import javax.media.j3d.Appearance;
import javax.media.j3d.Background;
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.Material;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.media.j3d.TransparencyAttributes;
import javax.vecmath.Color3f;
import javax.vecmath.Vector3d;

public class Main{
    public static Appearance createAppearance(Color color) {
        Appearance appearance = new Appearance();
        Material material = new Material();
        Color3f color3f = new Color3f(color);
        material.setAmbientColor(color3f);
        material.setDiffuseColor(color3f);
        material.setSpecularColor(1, 1, 1);
        appearance.setMaterial(material);
        return appearance;
    }
}

Related Tutorials