diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/classes/org/jdesktop/j3d/examples/appearance/AppearanceMixed.java | 8 | ||||
-rw-r--r-- | src/classes/org/jdesktop/j3d/examples/appearance/AppearanceTest.java | 4 | ||||
-rw-r--r-- | src/classes/org/jdesktop/j3d/examples/dot3/Dot3Demo.java | 2 | ||||
-rw-r--r-- | src/classes/org/jdesktop/j3d/examples/picking/TickTockPicking.form | 36 | ||||
-rw-r--r-- | src/classes/org/jdesktop/j3d/examples/picking/TickTockPicking.java | 136 | ||||
-rw-r--r-- | src/resources/images/Java3Ddot3.png | bin | 88910 -> 0 bytes | |||
-rw-r--r-- | src/resources/images/apimage.jpg | bin | 79522 -> 0 bytes | |||
-rw-r--r-- | src/resources/images/mask.jpg | bin | 2655 -> 0 bytes |
8 files changed, 120 insertions, 66 deletions
diff --git a/src/classes/org/jdesktop/j3d/examples/appearance/AppearanceMixed.java b/src/classes/org/jdesktop/j3d/examples/appearance/AppearanceMixed.java index b6f76c1..598f5cb 100644 --- a/src/classes/org/jdesktop/j3d/examples/appearance/AppearanceMixed.java +++ b/src/classes/org/jdesktop/j3d/examples/appearance/AppearanceMixed.java @@ -451,7 +451,7 @@ public class AppearanceMixed extends javax.swing.JFrame { } /** - * Creates new form AppearanceTest + * Creates new form AppearanceMixed */ public AppearanceMixed() { @@ -466,9 +466,9 @@ public class AppearanceMixed extends javax.swing.JFrame { if (texImage == null) { // the path to the image for an applet - texImage = Resources.getResource("resources/images/apimage.jpg"); + texImage = Resources.getResource("resources/images/stone.jpg"); if (texImage == null) { - System.err.println("resources/images/apimage.jpg not found"); + System.err.println("resources/images/stone.jpg not found"); System.exit(1); } } @@ -497,7 +497,7 @@ public class AppearanceMixed extends javax.swing.JFrame { drawingPanel = new javax.swing.JPanel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - setTitle("AppearanceTest"); + setTitle("AppearanceMixed"); drawingPanel.setLayout(new java.awt.BorderLayout()); drawingPanel.setPreferredSize(new java.awt.Dimension(700, 700)); diff --git a/src/classes/org/jdesktop/j3d/examples/appearance/AppearanceTest.java b/src/classes/org/jdesktop/j3d/examples/appearance/AppearanceTest.java index f53c24d..fa25921 100644 --- a/src/classes/org/jdesktop/j3d/examples/appearance/AppearanceTest.java +++ b/src/classes/org/jdesktop/j3d/examples/appearance/AppearanceTest.java @@ -339,9 +339,9 @@ public class AppearanceTest extends javax.swing.JFrame { if (texImage == null) { // the path to the image for an applet - texImage = Resources.getResource("resources/images/apimage.jpg"); + texImage = Resources.getResource("resources/images/stone.jpg"); if (texImage == null) { - System.err.println("resources/images/apimage.jpg not found"); + System.err.println("resources/images/stone.jpg not found"); System.exit(1); } } diff --git a/src/classes/org/jdesktop/j3d/examples/dot3/Dot3Demo.java b/src/classes/org/jdesktop/j3d/examples/dot3/Dot3Demo.java index f47eb4e..8dbaada 100644 --- a/src/classes/org/jdesktop/j3d/examples/dot3/Dot3Demo.java +++ b/src/classes/org/jdesktop/j3d/examples/dot3/Dot3Demo.java @@ -136,7 +136,7 @@ public class Dot3Demo extends JFrame { // default texture names used String textureColorName= "resources/images/wood.jpg"; - String textureDOT3NormalMapName = "resources/images/Java3Ddot3.png"; + String textureDOT3NormalMapName = "resources/images/Java3Ddot3.jpg"; /** * Constructor. diff --git a/src/classes/org/jdesktop/j3d/examples/picking/TickTockPicking.form b/src/classes/org/jdesktop/j3d/examples/picking/TickTockPicking.form new file mode 100644 index 0000000..8d60ac0 --- /dev/null +++ b/src/classes/org/jdesktop/j3d/examples/picking/TickTockPicking.form @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.0" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="title" type="java.lang.String" value="TickTockPicking"/> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> + </AuxValues> + + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> + <SubComponents> + <Container class="javax.swing.JPanel" name="drawingPanel"> + <Properties> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[700, 700]"/> + </Property> + </Properties> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> + <BorderConstraints direction="Center"/> + </Constraint> + </Constraints> + + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> + </Container> + </SubComponents> +</Form> diff --git a/src/classes/org/jdesktop/j3d/examples/picking/TickTockPicking.java b/src/classes/org/jdesktop/j3d/examples/picking/TickTockPicking.java index 29eaec0..6828d6a 100644 --- a/src/classes/org/jdesktop/j3d/examples/picking/TickTockPicking.java +++ b/src/classes/org/jdesktop/j3d/examples/picking/TickTockPicking.java @@ -44,22 +44,20 @@ package org.jdesktop.j3d.examples.picking; -import java.applet.Applet; -import java.awt.*; -import java.awt.event.*; -import com.sun.j3d.utils.applet.MainFrame; import com.sun.j3d.utils.universe.*; -import com.sun.j3d.utils.image.TextureLoader; import javax.media.j3d.*; import javax.vecmath.*; +import com.sun.j3d.utils.image.TextureLoader; +import java.awt.GraphicsConfiguration; +import org.jdesktop.j3d.examples.Resources; -public class TickTockPicking extends Applet { +public class TickTockPicking extends javax.swing.JFrame { + private SimpleUniverse univ = null; + private BranchGroup scene = null; // path the the texture map image private java.net.URL texImage = null; - private SimpleUniverse u = null; - public BranchGroup createSceneGraph(Canvas3D c) { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); @@ -384,65 +382,85 @@ public class TickTockPicking extends Applet { return objTrans; } + + private Canvas3D createUniverse() { + // Get the preferred graphics configuration for the default screen + GraphicsConfiguration config = + SimpleUniverse.getPreferredConfiguration(); + // Create a Canvas3D using the preferred configuration + Canvas3D c = new Canvas3D(config); - public TickTockPicking() { - } - - public TickTockPicking(java.net.URL url) { - texImage = url; - } - - public void init() { - if (texImage == null) { - // the path to the image for an applet - try { - texImage = new java.net.URL(getCodeBase().toString() + - "../images/apimage.jpg"); - } - catch (java.net.MalformedURLException ex) { - System.out.println(ex.getMessage()); - System.exit(1); - } - } - - setLayout(new BorderLayout()); - GraphicsConfiguration config = - SimpleUniverse.getPreferredConfiguration(); - - Canvas3D c = new Canvas3D(config); - add("Center", c); - - // Create a simple scene and attach it to the virtual universe - BranchGroup scene = createSceneGraph(c); - u = new SimpleUniverse(c); + // Create simple universe with view branch + univ = new SimpleUniverse(c); - // This will move the ViewPlatform back a bit so the - // objects in the scene can be viewed. - u.getViewingPlatform().setNominalViewingTransform(); + // This will move the ViewPlatform back a bit so the + // objects in the scene can be viewed. + univ.getViewingPlatform().setNominalViewingTransform(); - u.addBranchGraph(scene); + // Ensure at least 5 msec per frame (i.e., < 200Hz) + univ.getViewer().getView().setMinimumFrameCycleTime(5); + return c; } - public void destroy() { - u.cleanup(); + /** + * Creates new form HelloUniverse + */ + public TickTockPicking() { + + // the path to the image for an applet + texImage = Resources.getResource("resources/images/stone.jpg"); + if (texImage == null) { + System.err.println("resources/images/stone.jpg not found"); + System.exit(1); + } + // Initialize the GUI components + initComponents(); + + // Create Canvas3D and SimpleUniverse; add canvas to drawing panel + Canvas3D c = createUniverse(); + drawingPanel.add(c, java.awt.BorderLayout.CENTER); + + // Create the content branch and add it to the universe + scene = createSceneGraph(c); + univ.addBranchGraph(scene); } + + // ---------------------------------------------------------------- - // - // The following allows TickTockPicking to be run as an application - // as well as an applet - // - public static void main(String[] args) { - // the path the the texture map for an application - java.net.URL url = null; - try { - url = new java.net.URL("file:../images/apimage.jpg"); - } - catch (java.net.MalformedURLException ex) { - System.out.println(ex.getMessage()); - System.exit(1); - } - new MainFrame(new TickTockPicking(url), 700, 700); + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents + private void initComponents() { + drawingPanel = new javax.swing.JPanel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("TickTockPicking"); + drawingPanel.setLayout(new java.awt.BorderLayout()); + + drawingPanel.setPreferredSize(new java.awt.Dimension(700, 700)); + getContentPane().add(drawingPanel, java.awt.BorderLayout.CENTER); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new TickTockPicking().setVisible(true); + } + }); } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JPanel drawingPanel; + // End of variables declaration//GEN-END:variables + } diff --git a/src/resources/images/Java3Ddot3.png b/src/resources/images/Java3Ddot3.png Binary files differdeleted file mode 100644 index 996b3bc..0000000 --- a/src/resources/images/Java3Ddot3.png +++ /dev/null diff --git a/src/resources/images/apimage.jpg b/src/resources/images/apimage.jpg Binary files differdeleted file mode 100644 index ab80a4a..0000000 --- a/src/resources/images/apimage.jpg +++ /dev/null diff --git a/src/resources/images/mask.jpg b/src/resources/images/mask.jpg Binary files differdeleted file mode 100644 index 35a6c8d..0000000 --- a/src/resources/images/mask.jpg +++ /dev/null |