diff options
author | kcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300> | 2006-02-01 01:33:24 +0000 |
---|---|---|
committer | kcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300> | 2006-02-01 01:33:24 +0000 |
commit | 39283191507259cb4dccba3441cdf16025179829 (patch) | |
tree | 29ad229325ab151a056d06fbe4c6f1fcd7b292d7 /src/PlatformGeometry | |
parent | 3d596b24b72677fbf264a22f3c0ff44aa9bb2baf (diff) |
Issue 206 : Example program cleanup
Item 4) Reorganized directory structure to make the examples a single project rather than a collection of independent apps.
. All example programs moved under src/classes, and all are now in a subpackage of org.jdesktop.j3d.examples.
. All resource files (geometry, images, audio) moved under src/resources
. ant script now exists only at top level
. Created netbeans project file for NetBeans IDE
Diffstat (limited to 'src/PlatformGeometry')
-rw-r--r-- | src/PlatformGeometry/SimpleGeometry.html | 15 | ||||
-rw-r--r-- | src/PlatformGeometry/SimpleGeometry.java | 198 | ||||
-rw-r--r-- | src/PlatformGeometry/SimpleGeometry_plugin.html | 39 | ||||
-rw-r--r-- | src/PlatformGeometry/build.xml | 69 |
4 files changed, 0 insertions, 321 deletions
diff --git a/src/PlatformGeometry/SimpleGeometry.html b/src/PlatformGeometry/SimpleGeometry.html deleted file mode 100644 index 9371405..0000000 --- a/src/PlatformGeometry/SimpleGeometry.html +++ /dev/null @@ -1,15 +0,0 @@ -<HTML> -<HEAD> -<TITLE>Platform Geometry</TITLE> -</HEAD> -<BODY BGCOLOR="#000000"> -<applet align=middle code="SimpleGeometry.class" width=256 height=256> -<blockquote> -<hr> -If you were using a Java-capable browser, -you would see Hello Universe! instead of this paragraph. -<hr> -</blockquote> -</applet> -</BODY> -</HTML> diff --git a/src/PlatformGeometry/SimpleGeometry.java b/src/PlatformGeometry/SimpleGeometry.java deleted file mode 100644 index 0f2f562..0000000 --- a/src/PlatformGeometry/SimpleGeometry.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * $RCSfile$ - * - * Copyright (c) 2006 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 com.sun.j3d.utils.geometry.ColorCube; -import com.sun.j3d.utils.geometry.*; -import com.sun.j3d.utils.behaviors.mouse.MouseTranslate; -import com.sun.j3d.utils.universe.*; -import javax.media.j3d.*; -import javax.vecmath.*; -import java.applet.Applet; -import com.sun.j3d.utils.applet.MainFrame; -import java.awt.*; - -/** - * This class demonstrates the use of the Universe builder for stand-alone - * applications along with the use of the PlatformGeometry node that is - * present in the Java 3D Universe Builder utility. The standard - * HelloWorld application is brought up. A transparent cylinder has been - * added to the PlatfromGeometry node of the ViewingPlatform and the - * MouseTranslate utility has been used to allow this sphere to be dragged - * around the canvas. - */ -public class SimpleGeometry extends Applet { - - SimpleUniverse u = null; - - public BranchGroup createSceneGraph() { - // Create the root of the branch graph - BranchGroup objRoot = new BranchGroup(); - - // Create a Transformgroup to scale all objects so they - // appear in the scene. - TransformGroup objScale = new TransformGroup(); - Transform3D t3d = new Transform3D(); - t3d.setScale(0.4); - objScale.setTransform(t3d); - objRoot.addChild(objScale); - - // Create the transform group node and initialize it to the - // identity. Enable the TRANSFORM_WRITE capability so that - // our behavior code can modify it at runtime. Add it to the - // root of the subgraph. - TransformGroup objTrans = new TransformGroup(); - objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); - objScale.addChild(objTrans); - - // Create a simple shape leaf node, add it to the scene graph. - objTrans.addChild(new ColorCube()); - - // Create a new Behavior object that will perform the desired - // operation on the specified transform object and add it into - // the scene graph. - Transform3D yAxis = new Transform3D(); - Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, - 0, 0, - 4000, 0, 0, - 0, 0, 0); - - 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); - objTrans.addChild(rotator); - - - // Have Java 3D perform optimizations on this scene graph. - objRoot.compile(); - - return objRoot; - } - - /* - * Create the geometry to add to the platform geometry. - */ - PlatformGeometry createAimer() { - - PlatformGeometry pg = new PlatformGeometry(); - - // This TransformGroup will be used by the MouseTranslate - // utiltiy to move the cylinder around the canvas. when the - // the user holds down mouse button 3. - TransformGroup moveTG = new TransformGroup(); - moveTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); - moveTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); - MouseTranslate mouseT = new MouseTranslate(moveTG); - moveTG.addChild(mouseT); - BoundingSphere bounds = - new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0); - mouseT.setSchedulingBounds(bounds); - pg.addChild(moveTG); - - // This TransformGroup is used to place the cylinder in the scene. - // The cylinder will be rotated 90 degrees so it will appear as - // a circle on the screen (could be made into a nice gun site...). - // The cylinder is also displaced a little in Z so it is in front - // of the viewer. - Transform3D xForm = new Transform3D(); - xForm.rotX(Math.PI/2.0); - xForm.setTranslation(new Vector3d(0.0, 0.0, -0.7)); - TransformGroup placementTG = new TransformGroup(xForm); - moveTG.addChild(placementTG); - - // Create the cylinder - make it thin and transparent. - Appearance cylinderAppearance = new Appearance(); - TransparencyAttributes transAttrs = - new TransparencyAttributes(TransparencyAttributes.FASTEST, 0.5f); - // cylinderAppearance.setTransparencyAttributes(transAttrs); - Cylinder aimer = new Cylinder(0.06f, 0.005f, 0, cylinderAppearance); - placementTG.addChild(aimer); - - return pg; - } - - 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); - - PlatformGeometry pg = createAimer(); - - // Now set the just created PlatformGeometry. - ViewingPlatform vp = u.getViewingPlatform(); - vp.setPlatformGeometry(pg); - - // This will move the ViewPlatform back a bit so the - // objects in the scene can be viewed. - u.getViewingPlatform().setNominalViewingTransform(); - - // Add everthing to the scene graph - it will now be displayed. - u.addBranchGraph(scene); - } - - public SimpleGeometry(String[] args) { - } - - public SimpleGeometry() { - } - - public void destroy() { - u.cleanup(); - } - - public static void main(String[] args) { - new MainFrame(new SimpleGeometry(args), 256, 256); - } -} diff --git a/src/PlatformGeometry/SimpleGeometry_plugin.html b/src/PlatformGeometry/SimpleGeometry_plugin.html deleted file mode 100644 index 9255a68..0000000 --- a/src/PlatformGeometry/SimpleGeometry_plugin.html +++ /dev/null @@ -1,39 +0,0 @@ -<HTML> -<HEAD> -<TITLE>Platform Geometry</TITLE> -</HEAD> -<BODY BGCOLOR="#000000"> -<!--"CONVERTED_APPLET"--> -<!-- CONVERTER VERSION 1.3 --> -<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" -WIDTH = 256 HEIGHT = 256 ALIGN = middle codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"> -<PARAM NAME = CODE VALUE = "SimpleGeometry.class" > - -<PARAM NAME="type" VALUE="application/x-java-applet;version=1.2.2"> -<PARAM NAME="scriptable" VALUE="false"> -<COMMENT> -<EMBED type="application/x-java-applet;version=1.2.2" CODE = "SimpleGeometry.class" WIDTH = 256 HEIGHT = 256 ALIGN = middle scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED></COMMENT> -<blockquote> -<hr> -If you were using a Java-capable browser, -you would see Hello Universe! instead of this paragraph. -<hr> -</blockquote> -</NOEMBED></EMBED> -</OBJECT> - -<!-- -<APPLET CODE = "SimpleGeometry.class" WIDTH = 256 HEIGHT = 256 ALIGN = middle> -<blockquote> -<hr> -If you were using a Java-capable browser, -you would see Hello Universe! instead of this paragraph. -<hr> -</blockquote> - -</APPLET> ---> -<!--"END_CONVERTED_APPLET"--> - -</BODY> -</HTML> diff --git a/src/PlatformGeometry/build.xml b/src/PlatformGeometry/build.xml deleted file mode 100644 index 4e57328..0000000 --- a/src/PlatformGeometry/build.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0"?> - -<!-- -/* - * $RCSfile$ - * - * Copyright (c) 2006 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> |