Package edu.worcester.subter.j3d

Source Code of edu.worcester.subter.j3d.Appearances

package edu.worcester.subter.j3d;

import javax.media.j3d.Appearance;
import javax.media.j3d.Material;
import javax.media.j3d.Texture;
import javax.media.j3d.TextureAttributes;

import com.sun.j3d.utils.image.TextureLoader;

public class Appearances {

    public static Appearance fromFile(String textureFileName) {
        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;
    }

}
TOP

Related Classes of edu.worcester.subter.j3d.Appearances

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.