Normand Briere
2019-08-06 b3ae4e889872ca0b9ca76f1d17b2f0b961226729
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;
....@@ -41,7 +43,11 @@
4143 static void Assert(boolean b)
4244 {
4345 if (!b)
46
+ {
47
+ b = !!b;
4448 new Exception().printStackTrace(); // assert(b);
49
+
50
+ }
4551 }
4652
4753 public void init()
....@@ -52,7 +58,7 @@
5258 universe.material = new cMaterial();
5359 //god.addChild(universe);
5460 universe.name = "Applet";
55
- grafreeD = this;
61
+ grafreed = this;
5662 }
5763
5864 /**/
....@@ -843,19 +849,59 @@
843849
844850 //Monitor mon=MonitorFactory.start("myFirstMonitor");
845851 standAlone = true;
846
- grafreeD = new Grafreed();
847
- grafreeD.universe = new Composite();
848
- grafreeD.universe.name = "Grafreed";
849
- 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();
850858 // theApplet3D.universe.textures = CameraPane.DEFAULT_TEXTURE;
851859
852
- grafreeD.universe.root = true;
853
- grafreeD.universe.openEditWindow(null, true); //, true);
860
+ grafreed.universe.root = true;
861
+ grafreed.universe.openEditWindow(null, true); //, true);
854862 //mon.stop();
855863 //System.out.println(mon);
856864 //timeflow.app.TimeflowAppLauncher.GetTimeFlow();
857865 }
858866
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
+
859905 // Timer callback
860906 public void actionPerformed(ActionEvent e)
861907 {
....@@ -870,7 +916,7 @@
870916 static int depth = 0;
871917 static java.util.Stack stack = new java.util.Stack();
872918 static boolean traceoff = false; // true;
873
- static float[] colorV = new float[5];
919
+ static float[] colorV = new float[4]; // 5];
874920
875921 static void traceon()
876922 {
....@@ -1079,7 +1125,7 @@
10791125 } while (avail > 0 && numRead >= 0);
10801126 return new String(data, 0, pos, "US-ASCII");
10811127 }
1082
- public static Grafreed grafreeD;
1128
+ public static Grafreed grafreed;
10831129 public static boolean standAlone = true;
10841130 public Composite universe;
10851131 public static Object3D clipboard = new Object3D();