diff options
-rw-r--r-- | build.xml | 2 | ||||
-rw-r--r-- | src/Applet3D/HelloUniverse.html (renamed from src/HelloUniverse/HelloUniverse.html) | 0 | ||||
-rw-r--r-- | src/Applet3D/HelloUniverse.java | 127 | ||||
-rw-r--r-- | src/Applet3D/HelloUniverse_plugin.html (renamed from src/HelloUniverse/HelloUniverse_plugin.html) | 0 | ||||
-rw-r--r-- | src/Applet3D/build.xml | 69 | ||||
-rw-r--r-- | src/HelloUniverse/HelloUniverse.form | 36 | ||||
-rw-r--r-- | src/HelloUniverse/HelloUniverse.java | 101 | ||||
-rw-r--r-- | src/index.html | 183 |
8 files changed, 303 insertions, 215 deletions
@@ -68,6 +68,7 @@ <ant dir="src/AlternateAppearance" target="${build.target}"/> <ant dir="src/Appearance" target="${build.target}"/> <ant dir="src/AppearanceMixed" target="${build.target}"/> + <ant dir="src/Applet3D" target="${build.target}"/> <ant dir="src/Background" target="${build.target}"/> <ant dir="src/CgShaderTest" target="${build.target}"/> <ant dir="src/ConfiguredUniverse" target="${build.target}"/> @@ -95,6 +96,7 @@ <ant dir="src/PrintCanvas3D" target="${build.target}"/> <ant dir="src/PureImmediate" target="${build.target}"/> <ant dir="src/ReadRaster" target="${build.target}"/> + <ant dir="src/SgChangerListener" target="${build.target}"/> <ant dir="src/Sound" target="${build.target}"/> <ant dir="src/SphereMotion" target="${build.target}"/> <ant dir="src/SplineAnim" target="${build.target}"/> diff --git a/src/HelloUniverse/HelloUniverse.html b/src/Applet3D/HelloUniverse.html index 93b044c..93b044c 100644 --- a/src/HelloUniverse/HelloUniverse.html +++ b/src/Applet3D/HelloUniverse.html diff --git a/src/Applet3D/HelloUniverse.java b/src/Applet3D/HelloUniverse.java new file mode 100644 index 0000000..7616a88 --- /dev/null +++ b/src/Applet3D/HelloUniverse.java @@ -0,0 +1,127 @@ +/* + * $RCSfile$ + * + * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + +import java.applet.Applet; +import java.awt.BorderLayout; +import java.awt.event.*; +import java.awt.GraphicsConfiguration; +import com.sun.j3d.utils.applet.MainFrame; +import com.sun.j3d.utils.geometry.ColorCube; +import com.sun.j3d.utils.universe.*; +import javax.media.j3d.*; +import javax.vecmath.*; + +public class HelloUniverse extends Applet { + + private SimpleUniverse u = null; + + public BranchGroup createSceneGraph() { + // Create the root of the branch graph + BranchGroup objRoot = new BranchGroup(); + + // Create the TransformGroup node and initialize it to the + // identity. Enable the TRANSFORM_WRITE capability so that + // our behavior code can modify it at run time. Add it to + // the root of the subgraph. + TransformGroup objTrans = new TransformGroup(); + objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); + objRoot.addChild(objTrans); + + // Create a simple Shape3D node; add it to the scene graph. + objTrans.addChild(new ColorCube(0.4)); + + // Create a new Behavior object that will perform the + // desired operation on the specified transform and add + // it into the scene graph. + Transform3D yAxis = new Transform3D(); + Alpha rotationAlpha = new Alpha(-1, 4000); + + RotationInterpolator rotator = + new RotationInterpolator(rotationAlpha, objTrans, yAxis, + 0.0f, (float) Math.PI*2.0f); + BoundingSphere bounds = + new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0); + rotator.setSchedulingBounds(bounds); + objRoot.addChild(rotator); + + // Have Java 3D perform optimizations on this scene graph. + objRoot.compile(); + + return objRoot; + } + + public HelloUniverse() { + } + + public void init() { + 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(); + u = new SimpleUniverse(c); + + // This will move the ViewPlatform back a bit so the + // objects in the scene can be viewed. + u.getViewingPlatform().setNominalViewingTransform(); + + u.addBranchGraph(scene); + } + + public void destroy() { + u.cleanup(); + } + + // + // The following allows HelloUniverse to be run as an application + // as well as an applet + // + public static void main(String[] args) { + new MainFrame(new HelloUniverse(), 256, 256); + } +} diff --git a/src/HelloUniverse/HelloUniverse_plugin.html b/src/Applet3D/HelloUniverse_plugin.html index 947a59b..947a59b 100644 --- a/src/HelloUniverse/HelloUniverse_plugin.html +++ b/src/Applet3D/HelloUniverse_plugin.html diff --git a/src/Applet3D/build.xml b/src/Applet3D/build.xml new file mode 100644 index 0000000..47e5a36 --- /dev/null +++ b/src/Applet3D/build.xml @@ -0,0 +1,69 @@ +<?xml version="1.0"?> + +<!-- +/* + * $RCSfile$ + * + * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any + * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND + * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY + * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL + * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF + * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS + * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR + * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, + * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND + * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR + * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed, licensed or + * intended for use in the design, construction, operation or + * maintenance of any nuclear facility. + * + * $Revision$ + * $Date$ + * $State$ + */ + --> + +<project basedir="." default="compile"> + <target name="compile"> + <javac + destdir="." srcdir="." + source="1.4" target="1.4" + debug="true" deprecation="true"> + </javac> + </target> + + <target name="all" depends="compile"> + </target> + + <target description="Clean all build products." name="clean"> + <delete> + <fileset dir="."> + <include name="**/*.class"/> + </fileset> + </delete> + </target> + +</project> diff --git a/src/HelloUniverse/HelloUniverse.form b/src/HelloUniverse/HelloUniverse.form new file mode 100644 index 0000000..48fadea --- /dev/null +++ b/src/HelloUniverse/HelloUniverse.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="HelloUniverse"/> + </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="[250, 250]"/> + </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/HelloUniverse/HelloUniverse.java b/src/HelloUniverse/HelloUniverse.java index 7616a88..53faf03 100644 --- a/src/HelloUniverse/HelloUniverse.java +++ b/src/HelloUniverse/HelloUniverse.java @@ -42,20 +42,20 @@ * $State$ */ -import java.applet.Applet; -import java.awt.BorderLayout; -import java.awt.event.*; -import java.awt.GraphicsConfiguration; -import com.sun.j3d.utils.applet.MainFrame; -import com.sun.j3d.utils.geometry.ColorCube; import com.sun.j3d.utils.universe.*; +import com.sun.j3d.utils.geometry.ColorCube; import javax.media.j3d.*; import javax.vecmath.*; +import java.awt.GraphicsConfiguration; -public class HelloUniverse extends Applet { +/** + * Simple Java 3D example program to display a spinning cube. + */ +public class HelloUniverse extends javax.swing.JFrame { + + private SimpleUniverse univ = null; + private BranchGroup scene = null; - private SimpleUniverse u = null; - public BranchGroup createSceneGraph() { // Create the root of the branch graph BranchGroup objRoot = new BranchGroup(); @@ -91,37 +91,74 @@ public class HelloUniverse extends Applet { return objRoot; } - public HelloUniverse() { - } - - public void init() { - setLayout(new BorderLayout()); - GraphicsConfiguration config = - SimpleUniverse.getPreferredConfiguration(); + 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); - add("Center", c); - // Create a simple scene and attach it to the virtual universe - BranchGroup scene = createSceneGraph(); - 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); + return c; } - public void destroy() { - u.cleanup(); + /** + * Creates new form HelloUniverse + */ + public HelloUniverse() { + // 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(); + univ.addBranchGraph(scene); } - // - // The following allows HelloUniverse to be run as an application - // as well as an applet - // - public static void main(String[] args) { - new MainFrame(new HelloUniverse(), 256, 256); + // ---------------------------------------------------------------- + + /** 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("HelloUniverse"); + drawingPanel.setLayout(new java.awt.BorderLayout()); + + drawingPanel.setPreferredSize(new java.awt.Dimension(250, 250)); + 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 HelloUniverse().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/index.html b/src/index.html deleted file mode 100644 index 1d5533b..0000000 --- a/src/index.html +++ /dev/null @@ -1,183 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> -<head> -<title>Java 3D Example Programs</title> -</head> - -<body bgcolor="#ffffff"> -<center><h1>Java 3D Example Programs</h1></center> - -<h3>Run the Example Programs</h3> - -<p> -<font size=-1> -If these example programs don't work in your browser, refer to -"RUNNING JAVA 3D™ IN A BROWSER" in the Java 3D™ README file. -</font> - -<p> -Click on any of the hyperlinks below to run that example program in your -browser using Java Plug-in. - -<ul> - -<h4>HelloUniverse</h4> -<dl> -<dd><a href="HelloUniverse/HelloUniverse_plugin.html">HelloUniverse</a><br> -</dl> -<h4>AWT_Interaction</h4> -<dl> -<dd><a href="AWT_Interaction/AWTInteraction_plugin.html">AWTInteraction</a><br> -</dl> -<h4>AlternateAppearance</h4> -<dl> -<dd><a href="AlternateAppearance/AlternateAppearanceBoundsTest_plugin.html">AlternateAppearanceBoundsTest</a><br> -<dd><a href="AlternateAppearance/AlternateAppearanceScopeTest_plugin.html">AlternateAppearanceScopeTest</a><br> -</dl> -<h4>Appearance</h4> -<dl> -<dd><a href="Appearance/AppearanceTest_plugin.html">AppearanceTest</a><br> -</dl> -<h4>AppearanceMixed</h4> -<dl> -<dd><a href="AppearanceMixed/AppearanceMixed_plugin.html">AppearanceMixed</a><br> -</dl> -<h4>Background</h4> -<dl> -<dd><a href="Background/BackgroundGeometry_plugin.html">BackgroundGeometry</a><br> -</dl> -<h4>ConicWorld</h4> -<dl> -<dd><a href="ConicWorld/ConicWorld_plugin.html">ConicWorld</a><br> -</dl> -<h4>FourByFour</h4> -<dl> -<dd><a href="FourByFour/FourByFour_plugin.html">FourByFour</a><br> -</dl> -<h4>GearTest</h4> -<dl> -<dd><a href="GearTest/GearBox_plugin.html">GearBox</a><br> -<dd><a href="GearTest/GearTest_plugin.html">GearTest</a><br> -</dl> -<h4>GeometryByReference</h4> -<dl> -<dd><a href="GeometryByReference/GeometryByReferenceTest_plugin.html">GeometryByReferenceTest</a><br> -<dd><a href="GeometryByReference/ImageComponentByReferenceTest_plugin.html">ImageComponentByReferenceTest</a><br> -<dd><a href="GeometryByReference/InterleavedTest_plugin.html">InterleavedTest</a><br> -</dl> -<h4>GeometryCompression</h4> -<dl> -<dd>cgview (runs as an application only) -<dd>obj2cg (runs as an application only) -</dl> -<h4>Lightwave</h4> -<dl> -<dd><a href="Lightwave/Viewer_plugin.html">Viewer</a><br> -</dl> -<h4>LOD</h4> -<dl> -<dd><a href="LOD/LOD_plugin.html">LOD</a><br> -</dl> -<h4>ModelClip</h4> -<dl> -<dd><a href="ModelClip/ModelClipTest_plugin.html">ModelClipTest</a><br> -<dd><a href="ModelClip/ModelClipTest2_plugin.html">ModelClipTest2</a><br> -</dl> -<h4>Morphing</h4> -<dl> -<dd><a href="Morphing/Morphing_plugin.html">Morphing</a><br> -<dd><a href="Morphing/Pyramid2Cube_plugin.html">Pyramid2Cube</a><br> -</dl> -<h4>ObjLoad</h4> -<dl> -<dd><a href="ObjLoad/ObjLoad_plugin.html">ObjLoad</a><br> -</dl> -<h4>OffScreenCanvas3D</h4> -<dl> -<dd><a href="OffScreenCanvas3D/OffScreenTest_plugin.html">OffScreenTest</a><br> -<dd><a href="OffScreenCanvas3D/PrintFromButton_plugin.html">PrintFromButton</a><br> -</dl> -<h4>OrientedShape3D</h4> -<dl> -<dd><a href="OrientedShape3D/OrientedTest_plugin.html">OrientedTest</a><br> -<dd><a href="OrientedShape3D/OrientedPtTest_plugin.html">OrientedPtTest</a><br> -</dl> -<h4>PackageInfo</h4> -<dl> -<dd>PackageInfo (runs as an application only) -<dd>QueryProperties (runs as an application only) -</dl> -<h4>PickTest</h4> -<dl> -<dd><a href="PickTest/IntersectTest_plugin.html">IntersectTest</a><br> -<dd><a href="PickTest/PickTest_plugin.html">PickTest</a><br> -</dl> -<h4>PickText3D</h4> -<dl> -<dd><a href="PickText3D/PickText3DBounds_plugin.html">PickText3DBounds</a><br> -<dd><a href="PickText3D/PickText3DGeometry_plugin.html">PickText3DGeometry</a><br> -</dl> -<h4>PlatformGeometry</h4> -<dl> -<dd><a href="PlatformGeometry/SimpleGeometry_plugin.html">SimpleGeometry</a><br> -</dl> -<h4>PrintCanvas3D</h4> -<dl> -<dd>PrintCanvas3D (runs as an application only) -</dl> -<h4>PureImmediate</h4> -<dl> -<dd><a href="PureImmediate/PureImmediate_plugin.html">PureImmediate</a><br> -<dd><a href="PureImmediate/PureImmediateStereo_plugin.html">PureImmediateStereo</a><br> -</dl> -<h4>ReadRaster</h4> -<dl> -<dd><a href="ReadRaster/ReadRaster_plugin.html">ReadRaster</a><br> -</dl> -<h4>Sound</h4> -<dl> -<dd><a href="Sound/MoveAppBoundingLeaf_plugin.html">MoveAppBoundingLeaf</a><br> -<dd><a href="Sound/ReverberateSound_plugin.html">ReverberateSound</a><br> -<dd><a href="Sound/SimpleSounds_plugin.html">SimpleSounds</a><br> -</dl> -<h4>SphereMotion</h4> -<dl> -<dd><a href="SphereMotion/SphereMotion_plugin.html">SphereMotion</a><br> -</dl> -<h4>SplineAnim</h4> -<dl> -<dd><a href="SplineAnim/SplineAnim_plugin.html">SplineAnim</a><br> -</dl> -<h4>Text2D</h4> -<dl> -<dd><a href="Text2D/Text2DTest_plugin.html">Text2DTest</a><br> -</dl> -<h4>Text3D</h4> -<dl> -<dd><a href="Text3D/Text3DLoad_plugin.html">Text3DLoad</a><br> -</dl> -<h4>TextureByReference</h4> -<dl> -<dd><a href="TextureByReference/TextureByReference_plugin.html">TextureByReference</a><br> -</dl> -<h4>TextureTest</h4> -<dl> -<dd><a href="TextureTest/MultiTextureTest_plugin.html">MultiTextureTest</a><br> -<dd><a href="TextureTest/TextureImage_plugin.html">TextureImage</a><br> -</dl> -<h4>TickTockCollision</h4> -<dl> -<dd><a href="TickTockCollision/TickTockCollision_plugin.html">TickTockCollision</a><br> -</dl> -<h4>TickTockPicking</h4> -<dl> -<dd><a href="TickTockPicking/TickTockPicking_plugin.html">TickTockPicking</a><br> -</dl> -<h4>VirtualInputDevice</h4> -<dl> -<dd><a href="VirtualInputDevice/HelloUniverse_plugin.html">HelloUniverse</a><br> -</dl> -</ul> - -</body> -</html> |