Example usage for javax.media.j3d RenderingAttributes NEVER

List of usage examples for javax.media.j3d RenderingAttributes NEVER

Introduction

In this page you can find the example usage for javax.media.j3d RenderingAttributes NEVER.

Prototype

int NEVER

To view the source code for javax.media.j3d RenderingAttributes NEVER.

Click Source Link

Document

Specifies that pixels are never drawn irrespective of the values being tested.

Usage

From source file:AppearanceTest.java

public void onNEVER() {
    getRenderingAttributes().setAlphaTestFunction(RenderingAttributes.NEVER);
}

From source file:AppearanceExplorer.java

RenderingAttributesEditor(RenderingAttributes init) {
    renderingAttr = init;/*  w ww  .j a  v a 2 s .c  o m*/
    visible = renderingAttr.getVisible();
    depthBufferEnable = renderingAttr.getDepthBufferEnable();
    depthBufferWriteEnable = renderingAttr.getDepthBufferWriteEnable();
    ignoreVertexColors = renderingAttr.getIgnoreVertexColors();
    rasterOpEnable = renderingAttr.getRasterOpEnable();
    rasterOp = renderingAttr.getRasterOp();
    alphaTestFunction = renderingAttr.getAlphaTestFunction();
    alphaTestValue = renderingAttr.getAlphaTestValue();

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    JCheckBox visibleCheckBox = new JCheckBox("Visible", visible);
    visibleCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JCheckBox checkbox = (JCheckBox) e.getSource();
            visible = checkbox.isSelected();
            renderingAttr.setVisible(visible);
        }
    });
    // add the checkbox to the panel
    add(new LeftAlignComponent(visibleCheckBox));

    JCheckBox ignoreVertexColorsCheckBox = new JCheckBox("Ignore Vertex Colors", ignoreVertexColors);
    ignoreVertexColorsCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JCheckBox checkbox = (JCheckBox) e.getSource();
            ignoreVertexColors = checkbox.isSelected();
            renderingAttr.setIgnoreVertexColors(ignoreVertexColors);
        }
    });
    // add the checkbox to the panel
    add(new LeftAlignComponent(ignoreVertexColorsCheckBox));

    JCheckBox depthBufferEnableCheckBox = new JCheckBox("Depth Buffer Enable", depthBufferEnable);
    depthBufferEnableCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JCheckBox checkbox = (JCheckBox) e.getSource();
            depthBufferEnable = checkbox.isSelected();
            renderingAttr.setDepthBufferEnable(depthBufferEnable);
        }
    });
    // add the checkbox to the panel
    add(new LeftAlignComponent(depthBufferEnableCheckBox));
    // no cap bit for depth buffer enable
    depthBufferEnableCheckBox.setEnabled(false);

    JCheckBox depthBufferWriteEnableCheckBox = new JCheckBox("Depth Buffer Write Enable",
            depthBufferWriteEnable);
    depthBufferWriteEnableCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JCheckBox checkbox = (JCheckBox) e.getSource();
            depthBufferWriteEnable = checkbox.isSelected();
            renderingAttr.setDepthBufferWriteEnable(depthBufferWriteEnable);
        }
    });
    // add the checkbox to the panel
    add(new LeftAlignComponent(depthBufferWriteEnableCheckBox));
    // no cap bit for depth buffer enable
    depthBufferWriteEnableCheckBox.setEnabled(false);

    JCheckBox rasterOpEnableCheckBox = new JCheckBox("Raster Operation Enable", rasterOpEnable);
    rasterOpEnableCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JCheckBox checkbox = (JCheckBox) e.getSource();
            rasterOpEnable = checkbox.isSelected();
            renderingAttr.setRasterOpEnable(rasterOpEnable);
        }
    });
    // add the checkbox to the panel
    add(new LeftAlignComponent(rasterOpEnableCheckBox));

    String[] rasterOpNames = { "ROP_COPY", "ROP_XOR", };
    int[] rasterOpValues = { RenderingAttributes.ROP_COPY, RenderingAttributes.ROP_XOR, };
    IntChooser rasterOpChooser = new IntChooser("Raster Operation:", rasterOpNames, rasterOpValues, rasterOp);
    rasterOpChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            rasterOp = event.getValue();
            renderingAttr.setRasterOp(rasterOp);
        }
    });
    add(rasterOpChooser);

    String[] alphaTestFunctionNames = { "ALWAYS", "NEVER", "EQUAL", "NOT_EQUAL", "LESS", "LESS_OR_EQUAL",
            "GREATER", "GREATER_OR_EQUAL", };
    int[] alphaTestFunctionValues = { RenderingAttributes.ALWAYS, RenderingAttributes.NEVER,
            RenderingAttributes.EQUAL, RenderingAttributes.NOT_EQUAL, RenderingAttributes.LESS,
            RenderingAttributes.LESS_OR_EQUAL, RenderingAttributes.GREATER,
            RenderingAttributes.GREATER_OR_EQUAL, };
    IntChooser alphaTestFunctionChooser = new IntChooser("Alpha Test Function:", alphaTestFunctionNames,
            alphaTestFunctionValues, alphaTestFunction);
    alphaTestFunctionChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            alphaTestFunction = event.getValue();
            renderingAttr.setAlphaTestFunction(alphaTestFunction);
        }
    });
    add(alphaTestFunctionChooser);

    FloatLabelJSlider alphaTestValueSlider = new FloatLabelJSlider("Alpha Test Value: ", 0.1f, 0.0f, 1.0f,
            alphaTestValue);
    alphaTestValueSlider.setMajorTickSpacing(1.0f);
    alphaTestValueSlider.setPaintTicks(true);
    alphaTestValueSlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            alphaTestValue = e.getValue();
            renderingAttr.setAlphaTestValue(alphaTestValue);
        }
    });
    add(alphaTestValueSlider);

}