Normand Briere
2019-08-05 de0d8d87447fea5faea469ccf8072a7aead35b6d
Grafreed.java
....@@ -58,7 +58,7 @@
5858 universe.material = new cMaterial();
5959 //god.addChild(universe);
6060 universe.name = "Applet";
61
- grafreeD = this;
61
+ grafreed = this;
6262 }
6363
6464 /**/
....@@ -849,19 +849,59 @@
849849
850850 //Monitor mon=MonitorFactory.start("myFirstMonitor");
851851 standAlone = true;
852
- grafreeD = new Grafreed();
853
- grafreeD.universe = new cGroup();
854
- grafreeD.universe.name = "Grafreed";
855
- grafreeD.universe.material = new cMaterial();
852
+ grafreed = new Grafreed();
853
+ grafreed.materials = ReadGFD(grafreed.getClass().getClassLoader().getResourceAsStream("gfd/materials.gfd"));
854
+
855
+ grafreed.universe = new cGroup();
856
+ grafreed.universe.name = "Grafreed";
857
+ grafreed.universe.material = new cMaterial();
856858 // theApplet3D.universe.textures = CameraPane.DEFAULT_TEXTURE;
857859
858
- grafreeD.universe.root = true;
859
- grafreeD.universe.openEditWindow(null, true); //, true);
860
+ grafreed.universe.root = true;
861
+ grafreed.universe.openEditWindow(null, true); //, true);
860862 //mon.stop();
861863 //System.out.println(mon);
862864 //timeflow.app.TimeflowAppLauncher.GetTimeFlow();
863865 }
864866
867
+ static Object3D materials;
868
+
869
+ static Object3D ReadGFD(java.io.InputStream istream)
870
+ {
871
+ Object3D readobj = null;
872
+
873
+ try
874
+ {
875
+ // Try compressed version first.
876
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
877
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
878
+
879
+ readobj = (Object3D) p.readObject();
880
+ istream.close();
881
+
882
+ readobj.ResetDisplayList();
883
+ } catch (Exception e)
884
+ {
885
+ if (!e.toString().contains("GZIP"))
886
+ e.printStackTrace();
887
+
888
+ try
889
+ {
890
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
891
+
892
+ readobj = (Object3D) p.readObject();
893
+ istream.close();
894
+
895
+ readobj.ResetDisplayList();
896
+ } catch (Exception e2)
897
+ {
898
+ e2.printStackTrace();
899
+ }
900
+ }
901
+
902
+ return readobj;
903
+ }
904
+
865905 // Timer callback
866906 public void actionPerformed(ActionEvent e)
867907 {
....@@ -876,7 +916,7 @@
876916 static int depth = 0;
877917 static java.util.Stack stack = new java.util.Stack();
878918 static boolean traceoff = false; // true;
879
- static float[] colorV = new float[5];
919
+ static float[] colorV = new float[4]; // 5];
880920
881921 static void traceon()
882922 {
....@@ -1085,7 +1125,7 @@
10851125 } while (avail > 0 && numRead >= 0);
10861126 return new String(data, 0, pos, "US-ASCII");
10871127 }
1088
- public static Grafreed grafreeD;
1128
+ public static Grafreed grafreed;
10891129 public static boolean standAlone = true;
10901130 public Composite universe;
10911131 public static Object3D clipboard = new Object3D();