Example usage for javax.media.j3d Texture WRAP

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

Introduction

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

Prototype

int WRAP

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

Click Source Link

Document

Repeats the texture by wrapping texture coordinates that are outside the range [0,1].

Usage

From source file:AppearanceTest.java

public void onT_WRAP() {
    getTexture().setBoundaryModeT(Texture.WRAP);
    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();//from www .j ava2  s . 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);
}