diff options
author | kcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300> | 2006-02-08 22:48:24 +0000 |
---|---|---|
committer | kcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300> | 2006-02-08 22:48:24 +0000 |
commit | 80fd150d309bd13424be73392a4bde2c742a185f (patch) | |
tree | 21a60a7075bd93cf9fc7f12276becb7d2dd46c07 /src/AlternateAppearance | |
parent | 1f9cc0db52f9a8e5ccb839930bff07145b2cf745 (diff) |
Merged changes between 1.4.0-beta3 and 1.4.0-beta4 into dev-1_5
Diffstat (limited to 'src/AlternateAppearance')
8 files changed, 0 insertions, 962 deletions
diff --git a/src/AlternateAppearance/AlternateAppearanceBoundsTest.html b/src/AlternateAppearance/AlternateAppearanceBoundsTest.html deleted file mode 100644 index 1de548b..0000000 --- a/src/AlternateAppearance/AlternateAppearanceBoundsTest.html +++ /dev/null @@ -1,15 +0,0 @@ -<HTML> -<HEAD> -<TITLE>AlternateAppearanceBoundsTest</TITLE> -</HEAD> -<BODY BGCOLOR="#000000"> -<applet align=middle code="AlternateAppearanceBoundsTest.class" width=800 height=800> -<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/AlternateAppearance/AlternateAppearanceBoundsTest.java b/src/AlternateAppearance/AlternateAppearanceBoundsTest.java deleted file mode 100644 index b080f97..0000000 --- a/src/AlternateAppearance/AlternateAppearanceBoundsTest.java +++ /dev/null @@ -1,308 +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 java.applet.Applet; -import java.awt.*; -import java.awt.event.*; -import com.sun.j3d.utils.applet.MainFrame; -import com.sun.j3d.utils.geometry.*; -import com.sun.j3d.utils.universe.*; -import javax.media.j3d.*; -import javax.vecmath.*; -import javax.swing.*; -import javax.swing.event.*; -import javax.swing.border.*; -import com.sun.j3d.utils.behaviors.mouse.*; - -public class AlternateAppearanceBoundsTest extends JApplet -implements ActionListener { - - - Material mat1, altMat; - Appearance app, otherApp; - JComboBox altAppMaterialColor; - JComboBox appMaterialColor; - JCheckBox useBoundingLeaf; - JCheckBox override; - JComboBox boundsType; - private Group content1 = null; - AlternateAppearance altApp; - Shape3D[] shapes1; - boolean boundingLeafOn = false; - // Globally used colors - Color3f white = new Color3f(1.0f, 1.0f, 1.0f); - Color3f red = new Color3f(1.0f, 0.0f, 0.0f); - Color3f green = new Color3f(0.0f, 1.0f, 0.0f); - Color3f blue = new Color3f(0.0f, 0.0f, 1.0f); - Color3f[] colors = {white, red, green, blue}; - - private Bounds worldBounds = new BoundingSphere( - new Point3d( 0.0, 0.0, 0.0 ), // Center - 1000.0 ); // Extent - private Bounds smallBounds = new BoundingSphere( - new Point3d( 0.0, 0.0, 0.0 ), // Center - 0.25 ); // Extent - private Bounds tinyBounds = new BoundingSphere( - new Point3d( 0.0, 0.0, 0.0 ), // Center - 0.05 ); // Extent - private BoundingLeaf leafBounds = null; - private int currentBounds = 2; - - private Bounds[] allBounds = {tinyBounds, smallBounds, worldBounds}; - - DirectionalLight light1 = null; - - // Get the current bounding leaf position - private int currentPosition = 0; - // Point3f pos = (Point3f)positions[currentPosition].value; - - private SimpleUniverse u = null; - - public AlternateAppearanceBoundsTest() { - } - - public void init() { - Container contentPane = getContentPane(); - - Canvas3D c = new Canvas3D(SimpleUniverse.getPreferredConfiguration()); - contentPane.add("Center", c); - - BranchGroup scene = createSceneGraph(); - // SimpleUniverse is a Convenience Utility class - 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); - - - // Create GUI - JPanel p = new JPanel(); - BoxLayout boxlayout = new BoxLayout(p, - BoxLayout.Y_AXIS); - p.add(createBoundsPanel()); - p.add(createMaterialPanel()); - p.setLayout(boxlayout); - - contentPane.add("South", p); - } - - public void destroy() { - u.cleanup(); - } - - BranchGroup createSceneGraph() { - BranchGroup objRoot = new BranchGroup(); - - // Create an alternate appearance - otherApp = new Appearance(); - altMat = new Material(); - altMat.setCapability(Material.ALLOW_COMPONENT_WRITE); - altMat.setDiffuseColor( new Color3f( 0.0f, 1.0f, 0.0f ) ); - otherApp.setMaterial(altMat); - - altApp = new AlternateAppearance(); - altApp.setAppearance(otherApp); - altApp.setCapability(AlternateAppearance.ALLOW_BOUNDS_WRITE); - altApp.setCapability(AlternateAppearance.ALLOW_INFLUENCING_BOUNDS_WRITE); - altApp.setInfluencingBounds( worldBounds ); - objRoot.addChild(altApp); - - // Build foreground geometry - Appearance app1 = new Appearance(); - mat1 = new Material(); - mat1.setCapability(Material.ALLOW_COMPONENT_WRITE); - mat1.setDiffuseColor( new Color3f( 1.0f, 0.0f, 0.0f ) ); - app1.setMaterial(mat1); - content1 = new SphereGroup( - 0.05f, // radius of spheres - 0.15f, // x spacing - 0.15f, // y spacing - 5, // number of spheres in X - 5, // number of spheres in Y - app1, // appearance - true); // alt app override = true - objRoot.addChild( content1 ); - shapes1 = ((SphereGroup)content1).getShapes(); - - - - // Add lights - light1 = new DirectionalLight( ); - light1.setEnable( true ); - light1.setColor( new Color3f(0.2f, 0.2f, 0.2f) ); - light1.setDirection( new Vector3f( 1.0f, 0.0f, -1.0f ) ); - light1.setInfluencingBounds( worldBounds ); - light1.setCapability( - DirectionalLight.ALLOW_INFLUENCING_BOUNDS_WRITE ); - light1.setCapability( - DirectionalLight.ALLOW_BOUNDS_WRITE ); - objRoot.addChild( light1 ); - - // Add an ambient light to dimly illuminate the rest of - // the shapes in the scene to help illustrate that the - // directional lights are being scoped... otherwise it looks - // like we're just removing shapes from the scene - AmbientLight ambient = new AmbientLight( ); - ambient.setEnable( true ); - ambient.setColor( new Color3f(1.0f, 1.0f, 1.0f) ); - ambient.setInfluencingBounds( worldBounds ); - objRoot.addChild( ambient ); - - - // Define a bounding leaf - leafBounds = new BoundingLeaf( allBounds[currentBounds] ); - leafBounds.setCapability( BoundingLeaf.ALLOW_REGION_WRITE ); - objRoot.addChild( leafBounds ); - if (boundingLeafOn) { - altApp.setInfluencingBoundingLeaf(leafBounds); - } - else { - altApp.setInfluencingBounds(allBounds[currentBounds]); - } - - - - return objRoot; - } - JPanel createBoundsPanel() { - JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("Scopes")); - - - String boundsValues[] = { "Tiny Bounds", "Small Bounds", "Big Bounds"}; - - boundsType = new JComboBox(boundsValues); - boundsType.addActionListener(this); - boundsType.setSelectedIndex(2); - panel.add(new JLabel("Bounds")); - panel.add(boundsType); - - useBoundingLeaf = new JCheckBox("Enable BoundingLeaf", - boundingLeafOn); - useBoundingLeaf.addActionListener(this); - panel.add(useBoundingLeaf); - - override = new JCheckBox("Enable App Override", - false); - override.addActionListener(this); - panel.add(override); - - return panel; - - } - - JPanel createMaterialPanel() { - JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("Appearance Attributes")); - - String colorVals[] = { "WHITE", "RED", "GREEN", "BLUE"}; - - altAppMaterialColor = new JComboBox(colorVals); - altAppMaterialColor.addActionListener(this); - altAppMaterialColor.setSelectedIndex(2); - panel.add(new JLabel("Alternate Appearance MaterialColor")); - panel.add(altAppMaterialColor); - - - - appMaterialColor = new JComboBox(colorVals); - appMaterialColor.addActionListener(this); - appMaterialColor.setSelectedIndex(1); - panel.add(new JLabel("Normal Appearance MaterialColor")); - panel.add(appMaterialColor); - - return panel; - - - } - - public void actionPerformed(ActionEvent e) { - int i; - - Object target = e.getSource(); - if (target == altAppMaterialColor) { - altMat.setDiffuseColor(colors[altAppMaterialColor.getSelectedIndex()]); - } - else if (target == useBoundingLeaf) { - boundingLeafOn = useBoundingLeaf.isSelected(); - if (boundingLeafOn) { - leafBounds.setRegion(allBounds[currentBounds]); - altApp.setInfluencingBoundingLeaf( leafBounds ); - } - else { - altApp.setInfluencingBoundingLeaf( null ); - altApp.setInfluencingBounds(allBounds[currentBounds]); - } - - } - else if (target == boundsType) { - currentBounds = boundsType.getSelectedIndex(); - if (boundingLeafOn) { - leafBounds.setRegion(allBounds[currentBounds]); - altApp.setInfluencingBoundingLeaf( leafBounds ); - } - else { - altApp.setInfluencingBoundingLeaf( null ); - altApp.setInfluencingBounds(allBounds[currentBounds]); - } - - } - else if (target == override) { - for (i = 0; i < shapes1.length; i++) - shapes1[i].setAppearanceOverrideEnable(override.isSelected()); - } - else if (target == appMaterialColor) { - mat1.setDiffuseColor(colors[appMaterialColor.getSelectedIndex()]); - } - - } - - - public static void main(String[] args) { - Frame frame = new MainFrame(new AlternateAppearanceBoundsTest(), 800, 800); - } - -} diff --git a/src/AlternateAppearance/AlternateAppearanceBoundsTest_plugin.html b/src/AlternateAppearance/AlternateAppearanceBoundsTest_plugin.html deleted file mode 100644 index 08f45fa..0000000 --- a/src/AlternateAppearance/AlternateAppearanceBoundsTest_plugin.html +++ /dev/null @@ -1,39 +0,0 @@ -<HTML> -<HEAD> -<TITLE>AlternateAppearanceBoundsTest</TITLE> -</HEAD> -<BODY BGCOLOR="#000000"> -<!--"CONVERTED_APPLET"--> -<!-- CONVERTER VERSION 1.3 --> -<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" -WIDTH = 800 HEIGHT = 800 ALIGN = middle codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"> -<PARAM NAME = CODE VALUE = "AlternateAppearanceBoundsTest.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 = "AlternateAppearanceBoundsTest.class" WIDTH = 800 HEIGHT = 800 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 = "AlternateAppearanceBoundsTest.class" WIDTH = 800 HEIGHT = 800 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/AlternateAppearance/AlternateAppearanceScopeTest.html b/src/AlternateAppearance/AlternateAppearanceScopeTest.html deleted file mode 100644 index c455c5e..0000000 --- a/src/AlternateAppearance/AlternateAppearanceScopeTest.html +++ /dev/null @@ -1,15 +0,0 @@ -<HTML> -<HEAD> -<TITLE>AlternateAppearanceScopeTest</TITLE> -</HEAD> -<BODY BGCOLOR="#000000"> -<applet align=middle code="AlternateAppearanceScopeTest.class" width=800 height=800> -<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/AlternateAppearance/AlternateAppearanceScopeTest.java b/src/AlternateAppearance/AlternateAppearanceScopeTest.java deleted file mode 100644 index 6a2d276..0000000 --- a/src/AlternateAppearance/AlternateAppearanceScopeTest.java +++ /dev/null @@ -1,354 +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 java.applet.Applet; -import java.awt.*; -import java.awt.event.*; -import com.sun.j3d.utils.applet.MainFrame; -import com.sun.j3d.utils.geometry.*; -import com.sun.j3d.utils.universe.*; -import javax.media.j3d.*; -import javax.vecmath.*; -import javax.swing.*; -import javax.swing.event.*; -import javax.swing.border.*; -import com.sun.j3d.utils.behaviors.vp.*; - -public class AlternateAppearanceScopeTest extends JApplet -implements ActionListener { - - - Material mat1, altMat; - Appearance app, otherApp; - JComboBox altAppMaterialColor; - JComboBox appMaterialColor; - JComboBox altAppScoping; - JComboBox override; - private Group content1 = null; - private Group content2 = null; - BoundingSphere worldBounds; - AlternateAppearance altApp; - Shape3D[] shapes1, shapes2; - boolean shape1Enabled = false, shape2Enabled = false; - // Globally used colors - Color3f white = new Color3f(1.0f, 1.0f, 1.0f); - Color3f red = new Color3f(1.0f, 0.0f, 0.0f); - Color3f green = new Color3f(0.0f, 1.0f, 0.0f); - Color3f blue = new Color3f(0.0f, 0.0f, 1.0f); - Color3f[] colors = {white, red, green, blue}; - - private SimpleUniverse u; - - public AlternateAppearanceScopeTest() { - } - - public void init() { - Container contentPane = getContentPane(); - - Canvas3D c = new Canvas3D(SimpleUniverse.getPreferredConfiguration()); - contentPane.add("Center", c); - - BranchGroup scene = createSceneGraph(); - // SimpleUniverse is a Convenience Utility class - u = new SimpleUniverse(c); - - // add mouse behaviors to the viewingPlatform - ViewingPlatform viewingPlatform = u.getViewingPlatform(); - - // This will move the ViewPlatform back a bit so the - // objects in the scene can be viewed. - viewingPlatform.setNominalViewingTransform(); - - OrbitBehavior orbit = new OrbitBehavior(c, - OrbitBehavior.REVERSE_ALL); - BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), - 100.0); - orbit.setSchedulingBounds(bounds); - viewingPlatform.setViewPlatformBehavior(orbit); - - u.addBranchGraph(scene); - - - // Create GUI - JPanel p = new JPanel(); - BoxLayout boxlayout = new BoxLayout(p, - BoxLayout.Y_AXIS); - p.add(createScopingPanel()); - p.add(createMaterialPanel()); - p.setLayout(boxlayout); - - contentPane.add("South", p); - } - - public void destroy() { - u.cleanup(); - } - - BranchGroup createSceneGraph() { - BranchGroup objRoot = new BranchGroup(); - - // Create influencing bounds - worldBounds = new BoundingSphere( - new Point3d( 0.0, 0.0, 0.0 ), // Center - 1000.0 ); // Extent - - Transform3D t = new Transform3D(); - // move the object upwards - t.set(new Vector3f(0.0f, 0.1f, 0.0f)); - // Shrink the object - t.setScale(0.8); - - TransformGroup trans = new TransformGroup(t); - trans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); - trans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); - - - otherApp = new Appearance(); - altMat = new Material(); - altMat.setCapability(Material.ALLOW_COMPONENT_WRITE); - altMat.setDiffuseColor( new Color3f( 0.0f, 1.0f, 0.0f ) ); - otherApp.setMaterial(altMat); - - altApp = new AlternateAppearance(); - altApp.setAppearance(otherApp); - altApp.setCapability(AlternateAppearance.ALLOW_SCOPE_WRITE); - altApp.setCapability(AlternateAppearance.ALLOW_SCOPE_READ); - altApp.setInfluencingBounds( worldBounds ); - objRoot.addChild(altApp); - - // Build foreground geometry into two groups. We'll - // create three directional lights below, one each with - // scope to cover the first geometry group only, the - // second geometry group only, or both geometry groups. - Appearance app1 = new Appearance(); - mat1 = new Material(); - mat1.setCapability(Material.ALLOW_COMPONENT_WRITE); - mat1.setDiffuseColor( new Color3f( 1.0f, 0.0f, 0.0f ) ); - app1.setMaterial(mat1); - content1 = new SphereGroup( - 0.05f, // radius of spheres - 0.4f, // x spacing - 0.2f, // y spacing - 3, // number of spheres in X - 5, // number of spheres in Y - app1, // appearance - true); // alt app override = true - trans.addChild( content1 ); - shapes1 = ((SphereGroup)content1).getShapes(); - - content2 = new SphereGroup( - 0.05f, // radius of spheres - .4f, // x spacing - 0.2f, // y spacing - 2, // number of spheres in X - 5, // number of spheres in Y - app1, // appearance - true); // alt app override = true - trans.addChild( content2 ); - shapes2 = ((SphereGroup)content2).getShapes(); - - - // Add lights - DirectionalLight light1 = null; - light1 = new DirectionalLight( ); - light1.setEnable( true ); - light1.setColor( new Color3f(0.2f, 0.2f, 0.2f) ); - light1.setDirection( new Vector3f( 1.0f, 0.0f, -1.0f ) ); - light1.setInfluencingBounds( worldBounds ); - objRoot.addChild( light1 ); - - DirectionalLight light2 = new DirectionalLight(); - light2.setEnable(true); - light2.setColor(new Color3f(0.2f, 0.2f, 0.2f)); - light2.setDirection(new Vector3f(-1.0f, 0.0f, 1.0f)); - light2.setInfluencingBounds(worldBounds); - objRoot.addChild(light2); - - // Add an ambient light to dimly illuminate the rest of - // the shapes in the scene to help illustrate that the - // directional lights are being scoped... otherwise it looks - // like we're just removing shapes from the scene - AmbientLight ambient = new AmbientLight( ); - ambient.setEnable( true ); - ambient.setColor( new Color3f(1.0f, 1.0f, 1.0f) ); - ambient.setInfluencingBounds( worldBounds ); - objRoot.addChild( ambient ); - - - objRoot.addChild(trans); - - return objRoot; - } - JPanel createScopingPanel() { - JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("Scopes")); - - String values[] = {"Scoped Set1", "Scoped Set2", "Universal Scope"}; - altAppScoping = new JComboBox(values); - altAppScoping.addActionListener(this); - altAppScoping.setSelectedIndex(2); - panel.add(new JLabel("Scoping")); - panel.add(altAppScoping); - - - String enables[] = { "Enabled Set1", "Enabled Set2", "Enabled set1&2", "Disabled set1&2"}; - - override = new JComboBox(enables); - override.addActionListener(this); - override.setSelectedIndex(3); - panel.add(new JLabel("Alternate Appearance Override")); - panel.add(override); - - return panel; - - } - - JPanel createMaterialPanel() { - JPanel panel = new JPanel(); - panel.setBorder(new TitledBorder("Appearance Attributes")); - - String colorVals[] = { "WHITE", "RED", "GREEN", "BLUE"}; - - altAppMaterialColor = new JComboBox(colorVals); - altAppMaterialColor.addActionListener(this); - altAppMaterialColor.setSelectedIndex(2); - panel.add(new JLabel("Alternate Appearance MaterialColor")); - panel.add(altAppMaterialColor); - - - - appMaterialColor = new JComboBox(colorVals); - appMaterialColor.addActionListener(this); - appMaterialColor.setSelectedIndex(1); - panel.add(new JLabel("Normal Appearance MaterialColor")); - panel.add(appMaterialColor); - - return panel; - - - } - - public void actionPerformed(ActionEvent e) { - Object target = e.getSource(); - if (target == altAppMaterialColor) { - altMat.setDiffuseColor(colors[altAppMaterialColor.getSelectedIndex()]); - } - else if (target == altAppScoping) { - for (int i = 0; i < altApp.numScopes(); i++) { - altApp.removeScope(0); - } - if (altAppScoping.getSelectedIndex() == 0) { - altApp.addScope(content1); - } - else if (altAppScoping.getSelectedIndex() == 1) { - altApp.addScope(content2); - } - } - else if (target == override) { - int i; - if (override.getSelectedIndex()== 0) { - if (!shape1Enabled) { - for (i = 0; i < shapes1.length; i++) - shapes1[i].setAppearanceOverrideEnable(true); - shape1Enabled = true; - } - - if (shape2Enabled) { - for (i = 0; i < shapes2.length; i++) - shapes2[i].setAppearanceOverrideEnable(false); - shape2Enabled = false; - } - } - else if (override.getSelectedIndex() == 1) { - if (!shape2Enabled) { - for (i = 0; i < shapes2.length; i++) - shapes2[i].setAppearanceOverrideEnable(true); - shape2Enabled = true; - } - - if (shape1Enabled) { - for (i = 0; i < shapes1.length; i++) - shapes1[i].setAppearanceOverrideEnable(false); - shape1Enabled = false; - } - } - else if (override.getSelectedIndex() == 2) { - if (!shape1Enabled) { - for (i = 0; i < shapes1.length; i++) - shapes1[i].setAppearanceOverrideEnable(true); - shape1Enabled = true; - } - if (!shape2Enabled) { - for (i = 0; i < shapes2.length; i++) - shapes2[i].setAppearanceOverrideEnable(true); - shape2Enabled = true; - } - } - else { - if (shape1Enabled) { - for (i = 0; i < shapes1.length; i++) - shapes1[i].setAppearanceOverrideEnable(false); - shape1Enabled = false; - } - - if (shape2Enabled) { - for (i = 0; i < shapes2.length; i++) - shapes2[i].setAppearanceOverrideEnable(false); - shape2Enabled = false; - } - } - - } - else if (target == appMaterialColor) { - mat1.setDiffuseColor(colors[appMaterialColor.getSelectedIndex()]); - } - - } - - - public static void main(String[] args) { - Frame frame = new MainFrame(new AlternateAppearanceScopeTest(), 800, 800); - } - -} diff --git a/src/AlternateAppearance/AlternateAppearanceScopeTest_plugin.html b/src/AlternateAppearance/AlternateAppearanceScopeTest_plugin.html deleted file mode 100644 index 3a1c690..0000000 --- a/src/AlternateAppearance/AlternateAppearanceScopeTest_plugin.html +++ /dev/null @@ -1,39 +0,0 @@ -<HTML> -<HEAD> -<TITLE>AlternateAppearanceScopeTest</TITLE> -</HEAD> -<BODY BGCOLOR="#000000"> -<!--"CONVERTED_APPLET"--> -<!-- CONVERTER VERSION 1.3 --> -<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" -WIDTH = 800 HEIGHT = 800 ALIGN = middle codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"> -<PARAM NAME = CODE VALUE = "AlternateAppearanceScopeTest.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 = "AlternateAppearanceScopeTest.class" WIDTH = 800 HEIGHT = 800 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 = "AlternateAppearanceScopeTest.class" WIDTH = 800 HEIGHT = 800 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/AlternateAppearance/SphereGroup.java b/src/AlternateAppearance/SphereGroup.java deleted file mode 100644 index 7b5d4db..0000000 --- a/src/AlternateAppearance/SphereGroup.java +++ /dev/null @@ -1,123 +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 javax.media.j3d.*; -import javax.vecmath.*; -import com.sun.j3d.utils.geometry.*; - -public class SphereGroup - extends Group -{ - Shape3D[] shapes; - int numShapes = 0; - // Constructors - public SphereGroup( ) - { - // radius x,y spacing x,y count appearance - this( 0.25f, 0.75f, 0.75f, 5, 5, null, false ); - } - - public SphereGroup( Appearance app ) - { - // radius x,y spacing x,y count appearance - this( 0.25f, 0.75f, 0.75f, 5, 5, app, false ); - } - - public SphereGroup( float radius, float xSpacing, float ySpacing, - int xCount, int yCount, boolean overrideflag ) - { - this( radius, xSpacing, ySpacing, xCount, yCount, null, overrideflag ); - } - - public SphereGroup( float radius, float xSpacing, float ySpacing, - int xCount, int yCount, Appearance app, boolean overrideflag ) - { - if ( app == null ) - { - app = new Appearance( ); - Material material = new Material( ); - material.setDiffuseColor( new Color3f( 0.8f, 0.8f, 0.8f ) ); - material.setSpecularColor( new Color3f( 0.0f, 0.0f, 0.0f ) ); - material.setShininess( 0.0f ); - app.setMaterial( material ); - } - - double xStart = -xSpacing * (double)(xCount-1) / 2.0; - double yStart = -ySpacing * (double)(yCount-1) / 2.0; - - Sphere sphere = null; - TransformGroup trans = null; - Transform3D t3d = new Transform3D( ); - Vector3d vec = new Vector3d( ); - double x, y = yStart, z = 0.0; - shapes = new Shape3D[xCount * yCount]; - for ( int i = 0; i < yCount; i++ ) - { - x = xStart; - for ( int j = 0; j < xCount; j++ ) { - vec.set( x, y, z ); - t3d.setTranslation( vec ); - trans = new TransformGroup( t3d ); - addChild( trans ); - - sphere = new Sphere( - radius, // sphere radius - Primitive.GENERATE_NORMALS, // generate normals - 16, // 16 divisions radially - app ); // it's appearance - trans.addChild( sphere ); - x += xSpacing; - shapes[numShapes] = sphere.getShape(); - if (overrideflag) - shapes[numShapes].setCapability(Shape3D.ALLOW_APPEARANCE_OVERRIDE_WRITE); - numShapes++; - } - y += ySpacing; - } - } - Shape3D[] getShapes() { - return shapes; - } - -} diff --git a/src/AlternateAppearance/build.xml b/src/AlternateAppearance/build.xml deleted file mode 100644 index 4e57328..0000000 --- a/src/AlternateAppearance/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> |