aboutsummaryrefslogtreecommitdiffstats
path: root/src/DepthFuncTest/DepthFuncTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/DepthFuncTest/DepthFuncTest.java')
-rw-r--r--src/DepthFuncTest/DepthFuncTest.java159
1 files changed, 137 insertions, 22 deletions
diff --git a/src/DepthFuncTest/DepthFuncTest.java b/src/DepthFuncTest/DepthFuncTest.java
index 66397e9..b053857 100644
--- a/src/DepthFuncTest/DepthFuncTest.java
+++ b/src/DepthFuncTest/DepthFuncTest.java
@@ -1,4 +1,3 @@
-package DepthFuncTest;
/*
* $RCSfile$
*
@@ -49,14 +48,15 @@ import javax.media.j3d.*;
/**
*The goal of that example is to show the use of different ZBuffer comparison modes.
*/
-public class DepthFuncTest extends javax.swing.JFrame {
+public class DepthFuncTest extends javax.swing.JFrame
+{
RenderFrame rf;
/**
- * Creates new form DepthFuncTest
+ * Creates new form DepthFuncTest
*/
- public DepthFuncTest() {
+ public DepthFuncTest(){
initComponents();
}
@@ -66,7 +66,8 @@ public class DepthFuncTest extends javax.swing.JFrame {
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
- private void initComponents() {
+ private void initComponents()
+ {
java.awt.GridBagConstraints gridBagConstraints;
jPanel1 = new javax.swing.JPanel();
@@ -77,6 +78,9 @@ public class DepthFuncTest extends javax.swing.JFrame {
jLabel3 = new javax.swing.JLabel();
shadedComboBox = new javax.swing.JComboBox();
shadedCheckBox = new javax.swing.JCheckBox();
+ jPanel3 = new javax.swing.JPanel();
+ jLabel4 = new javax.swing.JLabel();
+ rotatingComboBox = new javax.swing.JComboBox();
getContentPane().setLayout(new java.awt.GridBagLayout());
@@ -92,8 +96,10 @@ public class DepthFuncTest extends javax.swing.JFrame {
normalComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ALWAYS", "NEVER", "EQUAL", "NOT_EQUAL", "LESS", "LESS_OR_EQUAL", "GREATER", "GREATER_OR_EQUAL" }));
normalComboBox.setSelectedIndex(6);
normalComboBox.setPreferredSize(new java.awt.Dimension(150, 22));
- normalComboBox.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
+ normalComboBox.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(java.awt.event.ActionEvent evt)
+ {
normalComboBoxActionPerformed(evt);
}
});
@@ -103,8 +109,10 @@ public class DepthFuncTest extends javax.swing.JFrame {
wfCheckBox.setFont(new java.awt.Font("Dialog", 0, 12));
wfCheckBox.setText("Write Depth Buffer");
wfCheckBox.setToolTipText("Depth will be written for the object, if selected");
- wfCheckBox.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
+ wfCheckBox.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(java.awt.event.ActionEvent evt)
+ {
wfCheckBoxActionPerformed(evt);
}
});
@@ -126,8 +134,10 @@ public class DepthFuncTest extends javax.swing.JFrame {
shadedComboBox.setFont(new java.awt.Font("Dialog", 0, 12));
shadedComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ALWAYS", "NEVER", "EQUAL", "NOT_EQUAL", "LESS", "LESS_OR_EQUAL", "GREATER", "GREATER_OR_EQUAL" }));
shadedComboBox.setSelectedIndex(4);
- shadedComboBox.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
+ shadedComboBox.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(java.awt.event.ActionEvent evt)
+ {
shadedComboBoxActionPerformed(evt);
}
});
@@ -138,8 +148,10 @@ public class DepthFuncTest extends javax.swing.JFrame {
shadedCheckBox.setSelected(true);
shadedCheckBox.setText("Write Depth Buffer");
shadedCheckBox.setToolTipText("Depth will be written for the object, if selected");
- shadedCheckBox.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
+ shadedCheckBox.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(java.awt.event.ActionEvent evt)
+ {
shadedCheckBoxActionPerformed(evt);
}
});
@@ -152,28 +164,128 @@ public class DepthFuncTest extends javax.swing.JFrame {
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
getContentPane().add(jPanel2, gridBagConstraints);
- setBounds(0, 0, 403, 174);
+ jPanel3.setBorder(new javax.swing.border.TitledBorder("Rotating Cube"));
+ jLabel4.setFont(new java.awt.Font("Dialog", 0, 12));
+ jLabel4.setText("Raster Operator");
+ jLabel4.setToolTipText("Raster mode of rotating object (try NOOP)");
+ jPanel3.add(jLabel4);
+
+ rotatingComboBox.setFont(new java.awt.Font("Dialog", 0, 12));
+ rotatingComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "CLEAR", "AND", "AND_REVERSE", "COPY", "AND_INVERTED", "NOOP", "XOR", "OR", "NOR", "EQUIV", "INVERT", "OR_REVERSE", "COPY_INVERTED", "OR_INVERTED", "NAND", "SET" }));
+ rotatingComboBox.setSelectedIndex(3);
+ rotatingComboBox.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(java.awt.event.ActionEvent evt)
+ {
+ rotatingComboBoxActionPerformed(evt);
+ }
+ });
+
+ jPanel3.add(rotatingComboBox);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ getContentPane().add(jPanel3, gridBagConstraints);
+
+ setBounds(0, 0, 403, 240);
}
// </editor-fold>//GEN-END:initComponents
+ private void rotatingComboBoxActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_rotatingComboBoxActionPerformed
+ {//GEN-HEADEREND:event_rotatingComboBoxActionPerformed
+ String selectedItem = rotatingComboBox.getSelectedItem().toString(); // how to avoid a cast and all that goes with it. (lazyness)
+ int mode = RenderingAttributes.ROP_COPY;
+ if ( "CLEAR".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_CLEAR;
+ }
+ else if ( "AND".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_AND;
+ }
+ else if ( "AND_REVERSE".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_AND_REVERSE;
+ }
+ else if ( "COPY".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_COPY;
+ }
+ else if ( "AND_INVERTED".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_AND_INVERTED;
+ }
+ else if ( "NOOP".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_NOOP;
+ }
+ else if ( "XOR".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_XOR;
+ }
+ else if ( "OR".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_OR;
+ }
+ else if ( "NOR".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_NOR;
+ }
+ else if ( "EQUIV".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_EQUIV;
+ }
+ else if ( "INVERT".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_INVERT;
+ }
+ else if ( "OR_REVERSE".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_OR_REVERSE;
+ }
+ else if ( "COPY_INVERTED".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_COPY_INVERTED;
+ }
+ else if ( "OR_INVERTED".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_OR_INVERTED;
+ }
+ else if ( "NAND".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_NAND;
+ }
+ else if ( "SET".equals(selectedItem) )
+ {
+ mode = RenderingAttributes.ROP_SET;
+ }
+ else
+ {
+ System.out.println("oops. wrong mode in ROP combo: "+selectedItem);
+ }
+ rf.setRotatingObjectROPMode( mode );
+ }//GEN-LAST:event_rotatingComboBoxActionPerformed
+
private void shadedCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shadedCheckBoxActionPerformed
- rf.setStaticObjectDBWriteStatus( shadedCheckBox.isSelected() );
+ rf.setStaticObjectDBWriteStatus( shadedCheckBox.isSelected() );
}//GEN-LAST:event_shadedCheckBoxActionPerformed
private void wfCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_wfCheckBoxActionPerformed
- rf.setStaticWFObjectDBWriteStatus( wfCheckBox.isSelected() );
+ rf.setStaticWFObjectDBWriteStatus( wfCheckBox.isSelected() );
}//GEN-LAST:event_wfCheckBoxActionPerformed
private void shadedComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shadedComboBoxActionPerformed
- int func = RenderingAttributes.LESS_OR_EQUAL;
- String selectedItem = shadedComboBox.getSelectedItem().toString(); // how to avoid a cast and all that goes with it. (lazyness)
- rf.setStaticObjectTestFunc( getID( selectedItem ) );
+ int func = RenderingAttributes.LESS_OR_EQUAL;
+ String selectedItem = shadedComboBox.getSelectedItem().toString(); // how to avoid a cast and all that goes with it. (lazyness)
+ rf.setStaticObjectTestFunc( getID( selectedItem ) );
}//GEN-LAST:event_shadedComboBoxActionPerformed
private void normalComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_normalComboBoxActionPerformed
- int func = RenderingAttributes.LESS_OR_EQUAL;
- String selectedItem = normalComboBox.getSelectedItem().toString(); // how to avoid a cast and all that goes with it. (lazyness)
- rf.setStaticWFObjectTestFunc( getID( selectedItem ) );
+ int func = RenderingAttributes.LESS_OR_EQUAL;
+ String selectedItem = normalComboBox.getSelectedItem().toString(); // how to avoid a cast and all that goes with it. (lazyness)
+ rf.setStaticWFObjectTestFunc( getID( selectedItem ) );
}//GEN-LAST:event_normalComboBoxActionPerformed
int getID( String selectedItem )
@@ -231,9 +343,12 @@ public class DepthFuncTest extends javax.swing.JFrame {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
+ private javax.swing.JPanel jPanel3;
private javax.swing.JComboBox normalComboBox;
+ private javax.swing.JComboBox rotatingComboBox;
private javax.swing.JCheckBox shadedCheckBox;
private javax.swing.JComboBox shadedComboBox;
private javax.swing.JCheckBox wfCheckBox;