summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjada <jada@28c7f869-5b4e-e670-f602-82bfaf57f300>2006-03-03 22:02:03 +0000
committerjada <jada@28c7f869-5b4e-e670-f602-82bfaf57f300>2006-03-03 22:02:03 +0000
commit5ac8b22022c4c7401d1df4366da51a882dd4cbcc (patch)
tree97bbabd788f8233630615e9013fd5879458cd89d
parentcc83f56aa28faa7a78b1a1113253619662ef1329 (diff)
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.
-rw-r--r--README-build.html39
-rw-r--r--src/classes/org/jdesktop/j3d/examples/appearance/AppearanceMixed.java8
-rw-r--r--src/classes/org/jdesktop/j3d/examples/appearance/AppearanceTest.java4
-rw-r--r--src/classes/org/jdesktop/j3d/examples/dot3/Dot3Demo.java2
-rw-r--r--src/classes/org/jdesktop/j3d/examples/picking/TickTockPicking.form36
-rw-r--r--src/classes/org/jdesktop/j3d/examples/picking/TickTockPicking.java136
-rw-r--r--src/resources/images/Java3Ddot3.pngbin88910 -> 0 bytes
-rw-r--r--src/resources/images/apimage.jpgbin79522 -> 0 bytes
-rw-r--r--src/resources/images/mask.jpgbin2655 -> 0 bytes
9 files changed, 138 insertions, 87 deletions
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:<br>
<ul>
<li><a href="http://java.sun.com/j2se">JDK 1.4.2</a> </li>
<li><a href="http://jakarta.apache.org/ant">Apache Ant 1.6.1</a> </li>
- <li><a href="http://java.sun.com/products/java-media/3D/">Java&nbsp;3D
-1.3.1</a> or later. </li>
+ <li><a href="https://j3d-examples.dev.java.net/">Java&nbsp;3D
+1.4.0</a> or later. </li>
</ul>
<h3><span style="text-decoration: underline;">Building
j3d-examples</span><span
@@ -96,7 +96,8 @@ following directories:</p>
<li>&lt;ant-root-dir&gt;/bin</li>
<li>&lt;jdk-root_dir&gt;/bin</li>
</ul>
-<p>NOTE that Java&nbsp;3D must be installed into the JDK that you have in
+<p>NOTE that Java&nbsp;3D must be installed into the JDK that you have
+in
your path <span style="font-weight: bold;">OR</span> you must put the
Java&nbsp;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).<br>
</ul>
<p>
</p>
-<p>This will build all example programs, each one being placed in the
-corresponding <code>src/&lt;ExampleProgram&gt;</code> directory.
-You may run
-ant from a subdirectory in order to just build that program. For
-example, to build the HelloUniverse program:<br>
-</p>
-<ul>
- <code>cd &lt;cvs-root-dir&gt;/j3d-examples/src/HelloUniverse</code><br>
- <code>ant</code>
-</ul>
-<p>
+<p>This will build all example programs and bundle them into a single
+jar
+file,<code>j3d-examples.jar</code>, placed in the <code>dist</code>
+directory. <br>
</p>
<h3><span style="text-decoration: underline;">Running j3d-examples</span></h3>
-<p>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
+<p>To run an example program, you must ensure that your CLASSPATH
+contains <code>dist/j3d-examples.jar </code>in its list. For example,
+to run the
HelloUniverse program:<br>
</p>
<ul>
- <code>cd &lt;cvs-root-dir&gt;/j3d-examples/src/HelloUniverse</code><br>
- <code>java HelloUniverse<br>
+ <code>cd &lt;cvs-root-dir&gt;/j3d-examples<br>
+ </code> <code>java
+org.jdesktop.j3d.examples.hello_universe.HelloUniverse<br>
</code>
</ul>
<p>
</p>
-<p>You may also point your Java-enabled web browser at the
-<code>src/index.html</code> page and run Java&nbsp;3D example programs
+<p>You may also point your Java-enabled web browser at some Java 3D
+applet
+examples, such as the <code>src/classes/org/jdesktop/j3d/examples/FourByFour.html</code>
+page, and run the Java&nbsp;3D applet example programs
from within your browser. Java&nbsp;3D must be installed into the JDK
in order to run Java&nbsp;3D programs from within a browser.<br>
<br>
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
deleted file mode 100644
index 996b3bc..0000000
--- a/src/resources/images/Java3Ddot3.png
+++ /dev/null
Binary files differ
diff --git a/src/resources/images/apimage.jpg b/src/resources/images/apimage.jpg
deleted file mode 100644
index ab80a4a..0000000
--- a/src/resources/images/apimage.jpg
+++ /dev/null
Binary files differ
diff --git a/src/resources/images/mask.jpg b/src/resources/images/mask.jpg
deleted file mode 100644
index 35a6c8d..0000000
--- a/src/resources/images/mask.jpg
+++ /dev/null
Binary files differ