Example usage for javax.media.j3d TransparencyAttributes BLEND_ZERO

List of usage examples for javax.media.j3d TransparencyAttributes BLEND_ZERO

Introduction

In this page you can find the example usage for javax.media.j3d TransparencyAttributes BLEND_ZERO.

Prototype

int BLEND_ZERO

To view the source code for javax.media.j3d TransparencyAttributes BLEND_ZERO.

Click Source Link

Document

Blend function: f = 0.

Usage

From source file:AppearanceExplorer.java

TransparencyAttributesEditor(TransparencyAttributes init) {
    transpAttr = init;/*from   w  w  w  .j  a va 2  s .  com*/
    transparency = transpAttr.getTransparency();
    mode = transpAttr.getTransparencyMode();
    srcBlendFunction = transpAttr.getSrcBlendFunction();
    dstBlendFunction = transpAttr.getDstBlendFunction();

    setLayout(new GridLayout(4, 1));

    FloatLabelJSlider transparencySlider = new FloatLabelJSlider("Transparency", 0.1f, 0.0f, 1.0f,
            transparency);
    transparencySlider.setMajorTickSpacing(0.1f);
    transparencySlider.setPaintTicks(true);
    transparencySlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            transparency = e.getValue();
            transpAttr.setTransparency(transparency);
        }
    });
    add(transparencySlider);

    String[] modeNames = { "NONE", "SCREEN_DOOR", "BLENDED", "NICEST", "FASTEST" };
    int[] modeValues = { TransparencyAttributes.NONE, TransparencyAttributes.SCREEN_DOOR,
            TransparencyAttributes.BLENDED, TransparencyAttributes.NICEST, TransparencyAttributes.FASTEST };

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

    String[] blendNames = { "BLEND_ZERO", "BLEND_ONE", "BLEND_SRC_ALPHA", "BLEND_ONE_MINUS_SRC_ALPHA" };
    int[] blendValues = { TransparencyAttributes.BLEND_ZERO, TransparencyAttributes.BLEND_ONE,
            TransparencyAttributes.BLEND_SRC_ALPHA, TransparencyAttributes.BLEND_ONE_MINUS_SRC_ALPHA, };
    IntChooser srcBlendFunctionChooser = new IntChooser("Src Blend Func:", blendNames, blendValues,
            srcBlendFunction);
    srcBlendFunctionChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            srcBlendFunction = event.getValue();
            transpAttr.setSrcBlendFunction(srcBlendFunction);
        }
    });
    add(srcBlendFunctionChooser);
    IntChooser dstBlendFunctionChooser = new IntChooser("Dst Blend Func:", blendNames, blendValues,
            dstBlendFunction);
    dstBlendFunctionChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            dstBlendFunction = event.getValue();
            transpAttr.setDstBlendFunction(dstBlendFunction);
        }
    });
    add(dstBlendFunctionChooser);
}