Normand Briere
2019-08-06 4ec7130da08861dc4aff0232dbce38f3471696a4
Grafreed.java
....@@ -23,6 +23,8 @@
2323 static float epsvertex2 = 0.001f;
2424 static boolean linkUV = false; // not uniform at load time
2525
26
+ static boolean smoothmode = false;
27
+
2628 static Wav wav = new Wav("/Users/nbriere/0ut/wavs/monoformat"); // output");
2729 static boolean hassound = false;
2830 static boolean savesound = false;
....@@ -56,7 +58,7 @@
5658 universe.material = new cMaterial();
5759 //god.addChild(universe);
5860 universe.name = "Applet";
59
- grafreeD = this;
61
+ grafreed = this;
6062 }
6163
6264 /**/
....@@ -847,19 +849,59 @@
847849
848850 //Monitor mon=MonitorFactory.start("myFirstMonitor");
849851 standAlone = true;
850
- grafreeD = new Grafreed();
851
- grafreeD.universe = new cGroup();
852
- grafreeD.universe.name = "Grafreed";
853
- 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();
854858 // theApplet3D.universe.textures = CameraPane.DEFAULT_TEXTURE;
855859
856
- grafreeD.universe.root = true;
857
- grafreeD.universe.openEditWindow(null, true); //, true);
860
+ grafreed.universe.root = true;
861
+ grafreed.universe.openEditWindow(null, true); //, true);
858862 //mon.stop();
859863 //System.out.println(mon);
860864 //timeflow.app.TimeflowAppLauncher.GetTimeFlow();
861865 }
862866
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
+
863905 // Timer callback
864906 public void actionPerformed(ActionEvent e)
865907 {
....@@ -874,7 +916,7 @@
874916 static int depth = 0;
875917 static java.util.Stack stack = new java.util.Stack();
876918 static boolean traceoff = false; // true;
877
- static float[] colorV = new float[5];
919
+ static float[] colorV = new float[4]; // 5];
878920
879921 static void traceon()
880922 {
....@@ -1083,7 +1125,7 @@
10831125 } while (avail > 0 && numRead >= 0);
10841126 return new String(data, 0, pos, "US-ASCII");
10851127 }
1086
- public static Grafreed grafreeD;
1128
+ public static Grafreed grafreed;
10871129 public static boolean standAlone = true;
10881130 public Composite universe;
10891131 public static Object3D clipboard = new Object3D();