Example usage for javax.media.j3d TextureAttributes FASTEST

List of usage examples for javax.media.j3d TextureAttributes FASTEST

Introduction

In this page you can find the example usage for javax.media.j3d TextureAttributes FASTEST.

Prototype

int FASTEST

To view the source code for javax.media.j3d TextureAttributes FASTEST.

Click Source Link

Document

Use the fastest available method for perspective correction.

Usage

From source file:J3dSwingFrame.java

/**
 * Construct the default appearance.//from  w ww  .j  av  a  2  s  .com
 */
private void constructAppearance() {
    appearance = new Appearance();

    TextureAttributes tex_attr = new TextureAttributes();
    tex_attr.setTextureMode(TextureAttributes.DECAL);
    tex_attr.setPerspectiveCorrectionMode(TextureAttributes.FASTEST);

    appearance.setTextureAttributes(tex_attr);

    ColoringAttributes col_attr = new ColoringAttributes();
    col_attr.setShadeModel(ColoringAttributes.SHADE_GOURAUD);

    appearance.setColoringAttributes(col_attr);

    PolygonAttributes rend_attr = new PolygonAttributes();
    rend_attr.setCullFace(PolygonAttributes.CULL_NONE);
    //  uncomment this if you want it to display in line draw mode
    //    rend_attr.setPolygonMode(PolygonAttributes.POLYGON_LINE);

    appearance.setPolygonAttributes(rend_attr);

    Material mat = new Material();
    //    Color3f col = new Color3f(1, 0, 0);
    //    mat.setEmissiveColor(col);

    appearance.setMaterial(mat);

    setAppearance(appearance);
}

From source file:KeyNavigateTest.java

void createWater(Group mapGroup, int nPixelX, int nPixelY) {
    Point3d point = convertToWorldCoordinatesPixelCenter(nPixelX, nPixelY);

    if (m_WaterAppearance == null) {
        m_WaterAppearance = new Appearance();
        m_WaterAppearance.setPolygonAttributes(
                new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0, false));
        m_WaterAppearance//from www .  j av  a  2  s  . c  o m
                .setTransparencyAttributes(new TransparencyAttributes(TransparencyAttributes.BLENDED, 1.0f));
        m_WaterAppearance.setTextureAttributes(new TextureAttributes(TextureAttributes.REPLACE,
                new Transform3D(), new Color4f(0, 0, 0, 1), TextureAttributes.FASTEST));

    }

    Land water = new Land(this, mapGroup, ComplexObject.GEOMETRY | ComplexObject.TEXTURE);
    water.createObject(m_WaterAppearance, new Vector3d(point.x, m_kFloorLevel + 0.1, point.z),
            new Vector3d(40, 1, 40), "water.gif", null, null);
}

From source file:KeyNavigateTest.java

protected Group createGeometryGroup(Appearance app, Vector3d position, Vector3d scale, String szTextureFile,
        String szSoundFile) {/*from   ww  w  .java 2  s .c  om*/
    Group g = new Group();

    app.setPolygonAttributes(
            new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0, false));
    app.setTransparencyAttributes(new TransparencyAttributes(TransparencyAttributes.BLENDED, 1.0f));

    m_TextureAttributes = new TextureAttributes(TextureAttributes.REPLACE, new Transform3D(),
            new Color4f(0, 0, 0, 1), TextureAttributes.FASTEST);
    app.setTextureAttributes(m_TextureAttributes);

    if ((m_nFlags & ComplexObject.TEXTURE) == ComplexObject.TEXTURE)
        setTexture(app, szTextureFile);

    Cone cone = new Cone(1, 1, Primitive.GENERATE_TEXTURE_COORDS, app);

    g.addChild(cone);

    attachBehavior(new TextureAnimationBehavior(m_TextureAttributes));

    return g;
}

From source file:AppearanceTest.java

public void onFASTEST() {
    getTextureAttributes().setPerspectiveCorrectionMode(TextureAttributes.FASTEST);
}

From source file:AppearanceExplorer.java

TextureAttributesEditor(TextureAttributes init) {
    super(BoxLayout.Y_AXIS);
    textureAttr = init;//from  w  w  w  .j a  va2 s.  c  o m
    mode = textureAttr.getTextureMode();
    pcMode = textureAttr.getPerspectiveCorrectionMode();
    textureAttr.getTextureBlendColor(blendColor);

    String[] modeNames = { "REPLACE", "MODULATE", "DECAL", "BLEND", };
    int[] modeValues = { TextureAttributes.REPLACE, TextureAttributes.MODULATE, TextureAttributes.DECAL,
            TextureAttributes.BLEND, };

    IntChooser modeChooser = new IntChooser("Mode:", modeNames, modeValues, mode);
    modeChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            mode = event.getValue();
            textureAttr.setTextureMode(mode);
        }
    });
    add(modeChooser);

    Color4fEditor blendColorEditor = new Color4fEditor("Blend Color", blendColor);
    blendColorEditor.addColor4fListener(new Color4fListener() {
        public void colorChanged(Color4fEvent event) {
            event.getValue(blendColor);
            textureAttr.setTextureBlendColor(blendColor);
        }
    });
    add(blendColorEditor);

    String[] pcModeNames = { "NICEST", "FASTEST", };
    int[] pcModeValues = { TextureAttributes.NICEST, TextureAttributes.FASTEST, };

    IntChooser pcModeChooser = new IntChooser("Perspective Correction:", pcModeNames, pcModeValues, pcMode);
    pcModeChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            pcMode = event.getValue();
            textureAttr.setPerspectiveCorrectionMode(pcMode);
        }
    });
    add(pcModeChooser);

}