From 5ac8b22022c4c7401d1df4366da51a882dd4cbcc Mon Sep 17 00:00:00 2001 From: jada Date: Fri, 3 Mar 2006 22:02:03 +0000 Subject: 1) Updated README-build.html 2) Updated TickTockPicking to use JFrame instead of MainFrame. 3) Removed apimage.jpg and updated programs to stone.jpg instead of apimage.jpg. 4) Modified Dot3Demo to use a compressed image. --- README-build.html | 39 +++--- .../j3d/examples/appearance/AppearanceMixed.java | 8 +- .../j3d/examples/appearance/AppearanceTest.java | 4 +- .../org/jdesktop/j3d/examples/dot3/Dot3Demo.java | 2 +- .../j3d/examples/picking/TickTockPicking.form | 36 ++++++ .../j3d/examples/picking/TickTockPicking.java | 136 ++++++++++++--------- src/resources/images/Java3Ddot3.png | Bin 88910 -> 0 bytes src/resources/images/apimage.jpg | Bin 79522 -> 0 bytes src/resources/images/mask.jpg | Bin 2655 -> 0 bytes 9 files changed, 138 insertions(+), 87 deletions(-) create mode 100644 src/classes/org/jdesktop/j3d/examples/picking/TickTockPicking.form delete mode 100644 src/resources/images/Java3Ddot3.png delete mode 100644 src/resources/images/apimage.jpg delete mode 100644 src/resources/images/mask.jpg diff --git a/README-build.html b/README-build.html index d813751..0110066 100644 --- a/README-build.html +++ b/README-build.html @@ -82,8 +82,8 @@ work.We have built j3d-examples on the following operating environments:

Building j3d-examples
  • <ant-root-dir>/bin
  • <jdk-root_dir>/bin
  • -

    NOTE that Java 3D must be installed into the JDK that you have in +

    NOTE that Java 3D must be installed into the JDK that you have +in your path OR you must put the Java 3D and vecmath jar files (j3dcore.jar, j3dutils.jar and vecmath.jar) in your CLASSPATH and the directory containing the @@ -110,33 +111,29 @@ PATH (Windows).

    -

    This will build all example programs, each one being placed in the -corresponding src/<ExampleProgram> directory. -You may run -ant from a subdirectory in order to just build that program. For -example, to build the HelloUniverse program:
    -

    -
      - cd <cvs-root-dir>/j3d-examples/src/HelloUniverse
      - ant -
    -

    +

    This will build all example programs and bundle them into a single +jar +file,j3d-examples.jar, placed in the dist +directory.

    Running j3d-examples

    -

    To run an example program, cd to the desired directory and execute -java from there. You must ensure that CLASSPATH is either not set, or -contains "." in its list of directories. For example, to run the +

    To run an example program, you must ensure that your CLASSPATH +contains dist/j3d-examples.jar in its list. For example, +to run the HelloUniverse program:

      - cd <cvs-root-dir>/j3d-examples/src/HelloUniverse
      - java HelloUniverse
      + cd <cvs-root-dir>/j3d-examples
      +
      java +org.jdesktop.j3d.examples.hello_universe.HelloUniverse

    -

    You may also point your Java-enabled web browser at the -src/index.html page and run Java 3D example programs +

    You may also point your Java-enabled web browser at some Java 3D +applet +examples, such as the src/classes/org/jdesktop/j3d/examples/FourByFour.html +page, and run the Java 3D applet example programs from within your browser. Java 3D must be installed into the JDK in order to run Java 3D programs from within a browser.

    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 @@ + + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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. + */ + // //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(); + }// //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 deleted file mode 100644 index 996b3bc..0000000 Binary files a/src/resources/images/Java3Ddot3.png and /dev/null differ diff --git a/src/resources/images/apimage.jpg b/src/resources/images/apimage.jpg deleted file mode 100644 index ab80a4a..0000000 Binary files a/src/resources/images/apimage.jpg and /dev/null differ diff --git a/src/resources/images/mask.jpg b/src/resources/images/mask.jpg deleted file mode 100644 index 35a6c8d..0000000 Binary files a/src/resources/images/mask.jpg and /dev/null differ -- cgit v1.2.3