diff examples/java3d/hello3.java @ 1:5df24c91468d

Oh my what a mess.
author samer
date Fri, 05 Apr 2019 16:26:00 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/java3d/hello3.java	Fri Apr 05 16:26:00 2019 +0100
@@ -0,0 +1,64 @@
+import samer.core.*;
+import javax.media.j3d.*;
+import javax.vecmath.*;
+import com.sun.j3d.utils.universe.*; 
+import com.sun.j3d.utils.behaviors.keyboard.*;
+
+public class hello3 extends util
+{
+	BranchGroup	root=new BranchGroup();
+	Bounds		bounds=new BoundingSphere();
+	Canvas3D	canvas=new Canvas3D(null);
+
+	public static void main(String[] args)
+	{
+		new samer.core.shells.AppShell(args);
+		hello3 app=new hello3();
+
+		Shell.Window win;
+		win=Shell.getWindow("hello");
+		win.addWindowListener(Shell.exitListener());
+		win.container().setLayout(new java.awt.BorderLayout());
+		win.container().add(app.canvas);
+		win.expose();
+	}
+
+	public hello3()
+	{		
+		SimpleUniverse U = new SimpleUniverse(canvas);
+		TransformGroup	tg = new TransformGroup();
+
+		addRotator(tg);
+		addBackground(root,new Background(0.1f,0.2f,0.15f));
+		tg.addChild(createObject());
+		root.addChild(tg);
+
+        KeyNavigatorBehavior keyNavBeh = new KeyNavigatorBehavior(
+                       U.getViewingPlatform().getViewPlatformTransform());
+        keyNavBeh.setSchedulingBounds(bounds);
+        root.addChild(keyNavBeh);
+		root.compile();
+
+        U.getViewingPlatform().setNominalViewingTransform();
+		U.addBranchGraph(root);
+	}
+
+	public static Group createObject()
+	{
+		Shape3D		faces=new Shape3D();
+		Shape3D		edges=new Shape3D();
+		Geometry	geom=yoyoGeometryInfo(20).getGeometryArray();
+
+		faces.setGeometry(geom);
+		edges.setGeometry(geom);
+
+		faces.setAppearance(translucent());
+		edges.setAppearance(pointy());
+		
+		BranchGroup bg = new BranchGroup();
+		bg.addChild(faces);
+		bg.addChild(edges);
+
+		return bg;
+	}
+}
\ No newline at end of file