Example usage for javax.media.j3d Texture MULTI_LEVEL_LINEAR

List of usage examples for javax.media.j3d Texture MULTI_LEVEL_LINEAR

Introduction

In this page you can find the example usage for javax.media.j3d Texture MULTI_LEVEL_LINEAR.

Prototype

int MULTI_LEVEL_LINEAR

To view the source code for javax.media.j3d Texture MULTI_LEVEL_LINEAR.

Click Source Link

Document

Performs tri-linear interpolation of texels between four texels each from two nearest mipmap levels.

Usage

From source file:TexBug.java

public void actionPerformed(ActionEvent e) {
    String action = e.getActionCommand();
    Object source = e.getSource();
    if (action == texEnableString) {
        texEnable = texEnableCheckBox.isSelected();
        System.out.println("texture.setEnable(" + texEnable + ")");
        texture.setEnable(texEnable);/*from   w  w  w . ja  v  a 2s .co m*/
    } else if (action == texBoundarySWrapString) {
        texBoundaryModeS = Texture.WRAP;
        setTexture();
    } else if (action == texBoundarySClampString) {
        texBoundaryModeS = Texture.CLAMP;
        setTexture();
    } else if (action == texBoundaryTWrapString) {
        texBoundaryModeT = Texture.WRAP;
        setTexture();
    } else if (action == texBoundaryTClampString) {
        texBoundaryModeT = Texture.CLAMP;
        setTexture();
    } else if (action == texMinFilterBasePointString) {
        texMinFilter = Texture.BASE_LEVEL_POINT;
        setTexture();
    } else if (action == texMinFilterBaseLinearString) {
        texMinFilter = Texture.BASE_LEVEL_LINEAR;
        setTexture();
    } else if (action == texMinFilterMultiPointString) {
        texMinFilter = Texture.MULTI_LEVEL_POINT;
        setTexture();
    } else if (action == texMinFilterMultiLinearString) {
        texMinFilter = Texture.MULTI_LEVEL_LINEAR;
        setTexture();
    } else if (action == texMinFilterFastestString) {
        texMinFilter = Texture.FASTEST;
        setTexture();
    } else if (action == texMinFilterNicestString) {
        texMinFilter = Texture.NICEST;
        setTexture();
    } else if (action == texMagFilterBasePointString) {
        texMagFilter = Texture.BASE_LEVEL_POINT;
        setTexture();
    } else if (action == texMagFilterBaseLinearString) {
        texMagFilter = Texture.BASE_LEVEL_LINEAR;
        setTexture();
    } else if (action == texMagFilterNicestString) {
        texMagFilter = Texture.NICEST;
        setTexture();
    } else if (action == texMagFilterFastestString) {
        texMagFilter = Texture.FASTEST;
        setTexture();
    } else if (action == texMipMapBaseString) {
        texMipMapMode = Texture.BASE_LEVEL;
        setTexture();
    } else if (action == texMipMapMultiString) {
        texMipMapMode = Texture.MULTI_LEVEL_MIPMAP;
        setTexture();
    }
}

From source file:AppearanceTest.java

public void onMin_MULTI_LEVEL_LINEAR() {
    getTexture().setMinFilter(Texture.MULTI_LEVEL_LINEAR);
    assignToAppearance();
}

From source file:AppearanceExplorer.java

public Texture2DEditor(Appearance app, String codeBaseString, String[] texImageNames,
        String[] texImageFileNames, int texImageIndex, boolean texEnable, int texBoundaryModeS,
        int texBoundaryModeT, int texMinFilter, int texMagFilter, int texMipMapMode, Color4f texBoundaryColor) {

    super(BoxLayout.Y_AXIS);

    this.appearance = app;
    // TODO: make deep copies?
    this.imageNames = texImageNames;
    this.imageFileNames = texImageFileNames;
    this.imageIndex = texImageIndex;
    this.imageFile = texImageFileNames[texImageIndex];
    this.codeBaseString = codeBaseString;
    this.enable = texEnable;
    this.mipMapMode = texMipMapMode;
    this.boundaryModeS = texBoundaryModeS;
    this.boundaryModeT = texBoundaryModeT;
    this.minFilter = texMinFilter;
    this.magFilter = texMagFilter;
    this.boundaryColor.set(texBoundaryColor);

    // set up the initial texture
    setTexture();// www .  java 2s  .c o  m

    JCheckBox texEnableCheckBox = new JCheckBox("Enable Texture");
    texEnableCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            enable = ((JCheckBox) e.getSource()).isSelected();
            // workaround for bug
            // should just be able to
            // texture.setEnable(texEnable);
            // instead we have to:
            setTexture();
        }
    });

    // add the checkbox to the panel
    add(new LeftAlignComponent(texEnableCheckBox));

    IntChooser imgChooser = new IntChooser("Image:", imageNames);
    imgChooser.setValue(imageIndex);
    imgChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            imageIndex = event.getValue();
            imageFile = imageFileNames[imageIndex];
            setTexture();
        }
    });
    add(imgChooser);

    // texture boundaries
    String[] boundaryNames = { "WRAP", "CLAMP", };
    int[] boundaryValues = { Texture.WRAP, Texture.CLAMP, };

    // texture boundary S
    IntChooser bndSChooser = new IntChooser("Boundary S Mode:", boundaryNames, boundaryValues);
    bndSChooser.setValue(texBoundaryModeS);
    bndSChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            int value = event.getValue();
            boundaryModeS = value;
            setTexture();
        }
    });
    add(bndSChooser);

    // texture boundary T
    IntChooser bndTChooser = new IntChooser("Boundary T Mode:", boundaryNames, boundaryValues);
    bndTChooser.setValue(texBoundaryModeT);
    bndTChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            int value = event.getValue();
            boundaryModeT = value;
            setTexture();
        }
    });
    add(bndTChooser);

    // texture min filter
    String[] minFiltNames = { "FASTEST", "NICEST", "BASE_LEVEL_POINT", "BASE_LEVEL_LINEAR", "MULTI_LEVEL_POINT",
            "MULTI_LEVEL_LINEAR", };
    int[] minFiltValues = { Texture.FASTEST, Texture.NICEST, Texture.BASE_LEVEL_POINT,
            Texture.BASE_LEVEL_LINEAR, Texture.MULTI_LEVEL_POINT, Texture.MULTI_LEVEL_LINEAR, };

    // min filter
    IntChooser minFiltChooser = new IntChooser("Min Filter:", minFiltNames, minFiltValues);
    minFiltChooser.setValue(minFilter);
    minFiltChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            int value = event.getValue();
            minFilter = value;
            setTexture();
        }
    });
    add(minFiltChooser);

    // texture mag filter
    String[] magFiltNames = { "FASTEST", "NICEST", "BASE_LEVEL_POINT", "BASE_LEVEL_LINEAR", };
    int[] magFiltValues = { Texture.FASTEST, Texture.NICEST, Texture.BASE_LEVEL_POINT,
            Texture.BASE_LEVEL_LINEAR, };

    // mag filter
    IntChooser magFiltChooser = new IntChooser("Mag Filter:", magFiltNames, magFiltValues);
    magFiltChooser.setValue(magFilter);
    magFiltChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            int value = event.getValue();
            magFilter = value;
            setTexture();
        }
    });
    add(magFiltChooser);

    // texture mipmap mode
    String[] mipMapNames = { "BASE_LEVEL", "MULTI_LEVEL_MIPMAP", };
    int[] mipMapValues = { Texture.BASE_LEVEL, Texture.MULTI_LEVEL_MIPMAP, };

    // mipMap mode
    IntChooser mipMapChooser = new IntChooser("MipMap Mode:", mipMapNames, mipMapValues);
    mipMapChooser.setValue(mipMapMode);
    mipMapChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            int value = event.getValue();
            mipMapMode = value;
            setTexture();
        }
    });
    add(mipMapChooser);

    Color4fEditor boundaryColorEditor = new Color4fEditor("Boundary Color", boundaryColor);
    boundaryColorEditor.addColor4fListener(new Color4fListener() {
        public void colorChanged(Color4fEvent event) {
            event.getValue(boundaryColor);
            setTexture();
        }
    });
    add(boundaryColorEditor);
}