.. | .. |
---|
5 | 5 | |
---|
6 | 6 | import java.io.*; |
---|
7 | 7 | |
---|
| 8 | +import java.util.ArrayList; |
---|
8 | 9 | import javax.swing.UIManager; |
---|
9 | 10 | import javax.swing.plaf.metal.MetalLookAndFeel; |
---|
10 | 11 | import javax.swing.plaf.ColorUIResource; |
---|
.. | .. |
---|
12 | 13 | |
---|
13 | 14 | import javax.sound.sampled.*; |
---|
14 | 15 | |
---|
| 16 | +import javax.net.ssl.HostnameVerifier; |
---|
| 17 | +import javax.net.ssl.HttpsURLConnection; |
---|
| 18 | +import javax.net.ssl.SSLContext; |
---|
| 19 | +import javax.net.ssl.SSLSession; |
---|
| 20 | +import javax.net.ssl.TrustManager; |
---|
| 21 | +import javax.net.ssl.X509TrustManager; |
---|
| 22 | + |
---|
| 23 | +import java.security.cert.X509Certificate; |
---|
| 24 | +import java.net.Authenticator; |
---|
| 25 | +import java.net.PasswordAuthentication; |
---|
| 26 | + |
---|
| 27 | +import java.util.Iterator; |
---|
| 28 | +import java.util.Locale; |
---|
| 29 | + |
---|
| 30 | +import javax.imageio.IIOImage; |
---|
| 31 | +import javax.imageio.ImageIO; |
---|
| 32 | +import javax.imageio.ImageWriteParam; |
---|
| 33 | +import javax.imageio.ImageWriter; |
---|
| 34 | +import javax.imageio.plugins.jpeg.JPEGImageWriteParam; |
---|
| 35 | +import javax.imageio.stream.ImageOutputStream; |
---|
| 36 | +import javax.imageio.ImageWriteParam; |
---|
| 37 | + |
---|
| 38 | +import java.awt.image.*; |
---|
| 39 | + |
---|
15 | 40 | //import com.jamonapi.*; |
---|
16 | 41 | public class Grafreed extends Applet implements ActionListener |
---|
17 | | -{ |
---|
18 | | - static boolean NIMBUSLAF = true; |
---|
19 | | - |
---|
| 42 | +{ |
---|
20 | 43 | static int RENDERME = 0; |
---|
21 | 44 | |
---|
22 | 45 | static boolean epsequal = false; |
---|
23 | 46 | static float epsvertex2 = 0.001f; |
---|
24 | 47 | static boolean linkUV = false; // not uniform at load time |
---|
25 | 48 | |
---|
| 49 | + static boolean smoothmode = false; |
---|
| 50 | + |
---|
26 | 51 | static Wav wav = new Wav("/Users/nbriere/0ut/wavs/monoformat"); // output"); |
---|
27 | 52 | static boolean hassound = false; |
---|
28 | 53 | static boolean savesound = false; |
---|
.. | .. |
---|
41 | 66 | static void Assert(boolean b) |
---|
42 | 67 | { |
---|
43 | 68 | if (!b) |
---|
| 69 | + { |
---|
| 70 | + b = !!b; |
---|
44 | 71 | new Exception().printStackTrace(); // assert(b); |
---|
| 72 | + |
---|
| 73 | + } |
---|
| 74 | + } |
---|
| 75 | + |
---|
| 76 | + static void Beep() |
---|
| 77 | + { |
---|
| 78 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 79 | + } |
---|
| 80 | + |
---|
| 81 | + static String SaveImage(String filename, BufferedImage bufImage, float compressionQuality) |
---|
| 82 | + { |
---|
| 83 | + String ext = "jpg"; // filename.substring(filename.length()-3, filename.length()) |
---|
| 84 | + |
---|
| 85 | + if (compressionQuality == 1) |
---|
| 86 | + { |
---|
| 87 | + ext = "png"; |
---|
| 88 | + } |
---|
| 89 | + |
---|
| 90 | + BufferedImage rendImage; // = new BufferedImage(bufImage.getWidth(), bufImage.getHeight(), BufferedImage.TYPE_INT_RGB); |
---|
| 91 | + |
---|
| 92 | + try |
---|
| 93 | + { |
---|
| 94 | + int[] storage = ((sun.awt.image.IntegerInterleavedRaster)bufImage.getRaster()).getDataStorage(); |
---|
| 95 | + |
---|
| 96 | + rendImage = new BufferedImage(bufImage.getWidth(), bufImage.getHeight(), BufferedImage.TYPE_INT_RGB); |
---|
| 97 | + int[] storage2 = ((sun.awt.image.IntegerInterleavedRaster)rendImage.getRaster()).getDataStorage(); |
---|
| 98 | + |
---|
| 99 | + for (int i=storage.length; --i>=0;) |
---|
| 100 | + { |
---|
| 101 | + storage2[i] = storage[i]; |
---|
| 102 | + } |
---|
| 103 | + } |
---|
| 104 | + catch (Exception e) |
---|
| 105 | + { |
---|
| 106 | + byte[] storage = ((sun.awt.image.ByteInterleavedRaster)bufImage.getRaster()).getDataStorage(); |
---|
| 107 | + |
---|
| 108 | + rendImage = new BufferedImage(bufImage.getWidth(), bufImage.getHeight(), BufferedImage.TYPE_BYTE_GRAY); |
---|
| 109 | + byte[] storage2 = ((sun.awt.image.ByteInterleavedRaster)rendImage.getRaster()).getDataStorage(); |
---|
| 110 | + |
---|
| 111 | + for (int i=storage.length/2; --i>=0;) |
---|
| 112 | + { |
---|
| 113 | + storage2[i] = storage[2*i]; |
---|
| 114 | + } |
---|
| 115 | + } |
---|
| 116 | + |
---|
| 117 | +// rendImage.setRGB(0,0,bufImage.getWidth(),bufImage.getHeight(), |
---|
| 118 | +// bufImage.getRGB(0, 0, bufImage.getWidth(), bufImage.getHeight(), null, 0, bufImage.getWidth()), |
---|
| 119 | +// 0,bufImage.getWidth()); |
---|
| 120 | +// //bufImage.getWidth()*(bufImage.getHeight()-1),-bufImage.getWidth()); |
---|
| 121 | + |
---|
| 122 | + ImageWriter writer = null; |
---|
| 123 | + Iterator iter = ImageIO.getImageWritersByFormatName(ext); |
---|
| 124 | + |
---|
| 125 | + if (iter.hasNext()) { |
---|
| 126 | + writer = (ImageWriter)iter.next(); |
---|
| 127 | + } |
---|
| 128 | + |
---|
| 129 | +// int i = frames.size(); |
---|
| 130 | +// |
---|
| 131 | +// filename = filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + ".jpg"; |
---|
| 132 | + |
---|
| 133 | + { |
---|
| 134 | + String fn = filename; |
---|
| 135 | + if (!fn.endsWith(".jpg")) |
---|
| 136 | + { |
---|
| 137 | + fn += ".jpg"; |
---|
| 138 | + } |
---|
| 139 | + |
---|
| 140 | + java.io.File outfile = new java.io.File(fn); |
---|
| 141 | + |
---|
| 142 | + if (outfile.getParentFile() != null) // nov 2013 |
---|
| 143 | + outfile.getParentFile().mkdirs(); |
---|
| 144 | + |
---|
| 145 | + filename = outfile.getAbsolutePath(); |
---|
| 146 | + |
---|
| 147 | + //float compressionQuality = 0.85f; |
---|
| 148 | + |
---|
| 149 | + try |
---|
| 150 | + { |
---|
| 151 | + ImageOutputStream ios = ImageIO.createImageOutputStream(outfile); |
---|
| 152 | + writer.setOutput(ios); |
---|
| 153 | + JPEGImageWriteParam iwparam=new JPEGImageWriteParam(Locale.getDefault()); |
---|
| 154 | + iwparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT) ; |
---|
| 155 | + iwparam.setCompressionQuality(compressionQuality); |
---|
| 156 | + writer.write(null, new IIOImage(rendImage, null, null), iwparam); |
---|
| 157 | + ios.flush(); |
---|
| 158 | + writer.dispose(); |
---|
| 159 | + ios.close(); |
---|
| 160 | + } |
---|
| 161 | + catch(Exception e){}; |
---|
| 162 | + } |
---|
| 163 | + |
---|
| 164 | + return ".jpg"; |
---|
| 165 | +// return;// filename; |
---|
| 166 | + } |
---|
| 167 | + |
---|
| 168 | + public static String RemovePrefix(String s, String prefix) |
---|
| 169 | + { |
---|
| 170 | + if (s != null && prefix != null && s.startsWith(prefix)) |
---|
| 171 | + { |
---|
| 172 | + return s.substring(prefix.length()); |
---|
| 173 | + } |
---|
| 174 | + |
---|
| 175 | + return s; |
---|
| 176 | + } |
---|
| 177 | + |
---|
| 178 | + static void ParseFileSystem(java.io.File dir, iResourceCallBack callback, String prefix) |
---|
| 179 | + { |
---|
| 180 | + callback.ResourceCallBack(RemovePrefix(dir.toString(),prefix).split("/")); |
---|
| 181 | + File[] listFiles = dir.listFiles(); |
---|
| 182 | + if (listFiles != null) |
---|
| 183 | + { |
---|
| 184 | + for (java.io.File file : listFiles) |
---|
| 185 | + { |
---|
| 186 | + ParseFileSystem(file, callback, prefix); |
---|
| 187 | + } |
---|
| 188 | + } |
---|
| 189 | + } |
---|
| 190 | + |
---|
| 191 | + static interface iResourceCallBack |
---|
| 192 | + { |
---|
| 193 | + void ResourceCallBack(String[] path); |
---|
| 194 | + } |
---|
| 195 | + |
---|
| 196 | + static void ParseResources(String path, iResourceCallBack callback) |
---|
| 197 | + { |
---|
| 198 | + java.io.File jarFile = new java.io.File(Grafreed.class.getProtectionDomain().getCodeSource().getLocation().getPath()); |
---|
| 199 | + |
---|
| 200 | + if (jarFile.isFile()) |
---|
| 201 | + { |
---|
| 202 | + // Run with JAR file |
---|
| 203 | + try |
---|
| 204 | + { |
---|
| 205 | + java.util.jar.JarFile jar = new java.util.jar.JarFile(jarFile); |
---|
| 206 | + java.util.Enumeration<java.util.jar.JarEntry> entries = jar.entries(); //gives ALL entries in jar |
---|
| 207 | + while (entries.hasMoreElements()) |
---|
| 208 | + { |
---|
| 209 | + String name = entries.nextElement().getName(); |
---|
| 210 | + |
---|
| 211 | + if (name.startsWith(path + "/")) |
---|
| 212 | + callback.ResourceCallBack(RemovePrefix(name, path + "/").split("/")); |
---|
| 213 | + } |
---|
| 214 | + jar.close(); |
---|
| 215 | + } catch (Exception ex) |
---|
| 216 | + { |
---|
| 217 | + ex.printStackTrace(); |
---|
| 218 | + } |
---|
| 219 | + } else |
---|
| 220 | + { |
---|
| 221 | + // Run with IDE |
---|
| 222 | + final java.net.URL url = Object3D.class.getResource("/" + path); |
---|
| 223 | + if (url != null) |
---|
| 224 | + { |
---|
| 225 | + try |
---|
| 226 | + { |
---|
| 227 | + java.io.File apps = new java.io.File(url.toURI()); |
---|
| 228 | + ParseFileSystem(apps, callback, RemovePrefix(url.toString() + "/", "file:")); |
---|
| 229 | +// for (java.io.File app : apps.listFiles()) |
---|
| 230 | +// { |
---|
| 231 | +// //System.out.println(RemovePrefix(app.toString(), RemovePrefix(url.toString(), "file:") + "/")); |
---|
| 232 | +// } |
---|
| 233 | + } catch (Exception ex) |
---|
| 234 | + { |
---|
| 235 | + ex.printStackTrace(); |
---|
| 236 | + } |
---|
| 237 | + } |
---|
| 238 | + } |
---|
45 | 239 | } |
---|
46 | 240 | |
---|
47 | 241 | public void init() |
---|
.. | .. |
---|
52 | 246 | universe.material = new cMaterial(); |
---|
53 | 247 | //god.addChild(universe); |
---|
54 | 248 | universe.name = "Applet"; |
---|
55 | | - grafreeD = this; |
---|
| 249 | + grafreed = this; |
---|
56 | 250 | } |
---|
57 | 251 | |
---|
58 | 252 | /**/ |
---|
.. | .. |
---|
595 | 789 | PlayWord(word, 1); |
---|
596 | 790 | } |
---|
597 | 791 | |
---|
| 792 | + static boolean isWindows; |
---|
| 793 | + |
---|
598 | 794 | public static void main(String argv[]) |
---|
599 | 795 | { |
---|
600 | | - String osArch = System.getProperty("os.arch"); |
---|
| 796 | + String osArch = System.getProperty("os.arch"); |
---|
| 797 | + if (Globals.DEBUG) |
---|
601 | 798 | System.out.println("os.arch = " + osArch); |
---|
602 | 799 | |
---|
| 800 | + String osName = System.getProperty("os.name"); |
---|
| 801 | + |
---|
| 802 | + isWindows = !osName.equals("Mac OS X"); |
---|
| 803 | + |
---|
603 | 804 | if (argv.length == 0) |
---|
604 | 805 | { |
---|
605 | 806 | String javaPath = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; |
---|
.. | .. |
---|
802 | 1003 | // try{Thread.sleep(5000);}catch(Exception e){} |
---|
803 | 1004 | // PlayAudio("/Users/nbriere/Downloads/Footsteps-6.wav", 4, 1); |
---|
804 | 1005 | |
---|
805 | | - |
---|
806 | 1006 | /**/ |
---|
807 | | - if (NIMBUSLAF) |
---|
| 1007 | + if (Globals.NIMBUSLAF) |
---|
808 | 1008 | { |
---|
809 | 1009 | try |
---|
810 | 1010 | { |
---|
811 | | - Object o = UIManager.getInstalledLookAndFeels(); |
---|
| 1011 | + //Object o = UIManager.getInstalledLookAndFeels(); |
---|
812 | 1012 | |
---|
813 | 1013 | javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme(new javax.swing.plaf.metal.DefaultMetalTheme()); |
---|
814 | 1014 | //MetalLookAndFeel.setCurrentTheme(new Theme(Constants.beigeTheme)); |
---|
815 | | - UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel()); |
---|
| 1015 | + //UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel()); |
---|
816 | 1016 | |
---|
817 | 1017 | UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); |
---|
818 | 1018 | //UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel"); |
---|
819 | 1019 | //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); |
---|
820 | 1020 | //UIManager.put("nimbusBase", new Color(0,0,0)); |
---|
| 1021 | + |
---|
| 1022 | + javax.swing.UIDefaults ui = UIManager.getDefaults(); |
---|
| 1023 | + |
---|
| 1024 | + ui.put("TabbedPane.tabInsets", new javax.swing.plaf.InsetsUIResource(0,8,0,0)); |
---|
| 1025 | + |
---|
| 1026 | + for (java.util.Enumeration e = ui.keys(); e.hasMoreElements();) |
---|
| 1027 | + { |
---|
| 1028 | + Object key = e.nextElement(); |
---|
| 1029 | + System.out.println(key + " --> " + ui.get(key)); |
---|
| 1030 | + } |
---|
821 | 1031 | } |
---|
822 | 1032 | catch (Exception e) |
---|
823 | 1033 | { |
---|
.. | .. |
---|
827 | 1037 | { |
---|
828 | 1038 | try |
---|
829 | 1039 | { |
---|
830 | | - MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); |
---|
831 | | - MetalLookAndFeel.setCurrentTheme(new Theme(Constants.yellowTheme)); |
---|
| 1040 | + //Object o = UIManager.getInstalledLookAndFeels(); |
---|
| 1041 | + |
---|
| 1042 | + MetalLookAndFeel.setCurrentTheme(new javax.swing.plaf.metal.DefaultMetalTheme()); |
---|
| 1043 | + //MetalLookAndFeel.setCurrentTheme(new Theme(Constants.yellowTheme)); |
---|
| 1044 | + //UIManager.put("ScrollBar.background", new javax.swing.plaf.ColorUIResource(100,0,0)); |
---|
| 1045 | + UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); |
---|
| 1046 | + |
---|
| 1047 | + javax.swing.UIDefaults ui = UIManager.getDefaults(); |
---|
| 1048 | + |
---|
| 1049 | + Object x = ui.get("TabbedPane.background"); |
---|
| 1050 | + |
---|
832 | 1051 | UIManager.setLookAndFeel(new MetalLookAndFeel()); |
---|
833 | | - //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); |
---|
834 | 1052 | //UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel"); |
---|
| 1053 | + //UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); |
---|
835 | 1054 | //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); |
---|
| 1055 | + |
---|
| 1056 | + ui = UIManager.getDefaults(); |
---|
| 1057 | + |
---|
| 1058 | + x = ui.get("RadioButton.icon"); |
---|
| 1059 | + |
---|
| 1060 | + ArrayList gradient = new java.util.ArrayList(5); |
---|
| 1061 | + gradient.add(1.0); |
---|
| 1062 | + gradient.add(0.0); |
---|
| 1063 | + gradient.add(new javax.swing.plaf.ColorUIResource(255,255,255)); |
---|
| 1064 | + gradient.add(new javax.swing.plaf.ColorUIResource(192,192,192)); |
---|
| 1065 | + gradient.add(new javax.swing.plaf.ColorUIResource(0,0,0)); |
---|
| 1066 | + |
---|
| 1067 | + ui.put("Button.gradient", gradient); |
---|
| 1068 | + |
---|
| 1069 | + //ui.put("RadioButton.icon", new CheckBox()); //ObjEditor.GetIcon("icons/white-sphere-icon.png"))); |
---|
| 1070 | + ui.put("CheckBox.icon", new CheckBox()); //ObjEditor.GetIcon("icons/white-sphere-icon.png"))); |
---|
| 1071 | + //ui.put("CheckBoxMenuItem.checkIcon", ObjEditor.GetIcon("icons/white-sphere-icon.png")); |
---|
| 1072 | + |
---|
| 1073 | + ui.put("Slider.foreground", new javax.swing.plaf.ColorUIResource(0,0,0)); |
---|
| 1074 | + ui.put("Slider.horizontalThumbIcon", ObjEditor.GetIcon("icons/white-sphere-icon.png")); |
---|
| 1075 | + |
---|
| 1076 | + /* |
---|
| 1077 | +TabbedPane.unselectedBackground Color |
---|
| 1078 | +TabbedPane.unselectedTabBackground Color |
---|
| 1079 | +TabbedPane.unselectedTabForeground Color |
---|
| 1080 | +TabbedPane.unselectedTabHighlight Color |
---|
| 1081 | +TabbedPane.unselectedTabShadow |
---|
| 1082 | + */ |
---|
| 1083 | +// ui.put("TabbedPane.contentAreaColor", new javax.swing.plaf.ColorUIResource(0,100,0)); |
---|
| 1084 | + //ui.put("TabbedPane.selected", new javax.swing.plaf.ColorUIResource(200,0,200)); |
---|
| 1085 | + |
---|
| 1086 | + ui.put("TabbedPane.background", new javax.swing.plaf.ColorUIResource(150,150,150)); |
---|
| 1087 | + ui.put("TabbedPane.foreground", new javax.swing.plaf.ColorUIResource(50,50,50)); |
---|
| 1088 | + ui.put("TabbedPane.light", new javax.swing.plaf.ColorUIResource(255,255,255)); |
---|
| 1089 | + ui.put("TabbedPane.selectedForeground", new javax.swing.plaf.ColorUIResource(0,0,0)); |
---|
| 1090 | + ui.put("TabbedPane.selectHighlight", new javax.swing.plaf.ColorUIResource(255,255,255)); |
---|
| 1091 | + ui.put("TabbedPane.darkShadow", new javax.swing.plaf.ColorUIResource(0,0,0)); |
---|
| 1092 | + |
---|
| 1093 | +// ui.put("TabbedPane.shadow", new javax.swing.plaf.ColorUIResource(200,0,0)); |
---|
| 1094 | +// ui.put("TabbedPane.tabAreaBackground", new javax.swing.plaf.ColorUIResource(0,200,0)); |
---|
| 1095 | +// ui.put("TabbedPane.unselectedBackground", new javax.swing.plaf.ColorUIResource(200,200,0)); |
---|
| 1096 | +// ui.put("TabbedPane.unselectedTabBackground", new javax.swing.plaf.ColorUIResource(0,0,200)); |
---|
| 1097 | +// ui.put("TabbedPane.unselectedTabForeground", new javax.swing.plaf.ColorUIResource(200,0,200)); |
---|
| 1098 | +// ui.put("TabbedPane.unselectedTabHighlight", new javax.swing.plaf.ColorUIResource(0,200,200)); |
---|
| 1099 | +// ui.put("TabbedPane.unselectedTabShadow", new javax.swing.plaf.ColorUIResource(200,200,200)); |
---|
| 1100 | + |
---|
| 1101 | + ui.put("TabbedPane.textIconGap", 0); |
---|
| 1102 | + ui.put("TabbedPane.contentBorderInsets", new javax.swing.plaf.InsetsUIResource(0,0,0,0)); |
---|
| 1103 | + ui.put("TabbedPane.tabAreaInsets", new javax.swing.plaf.InsetsUIResource(1,1,0,0)); |
---|
| 1104 | + ui.put("TabbedPane.tabInsets", new javax.swing.plaf.InsetsUIResource(0,8,0,0)); |
---|
| 1105 | + |
---|
| 1106 | + Object openIcon2 = ui.get("Tree.openIcon"); |
---|
| 1107 | + |
---|
| 1108 | + ui.put("Tree.openIcon", ObjEditor.GetIcon("icons/folderopen.png")); |
---|
| 1109 | + ui.put("Tree.closedIcon", ObjEditor.GetIcon("icons/folderclose.png")); |
---|
| 1110 | + ui.put("Tree.leafIcon", ObjEditor.GetIcon("icons/file.png")); |
---|
| 1111 | + |
---|
| 1112 | + //javax.swing.plaf.metal.MetalIconFactory.getHorizontalSliderThumbIcon(). |
---|
| 1113 | + Object o = ui.get("Slider.horizontalThumbIcon"); |
---|
| 1114 | + |
---|
| 1115 | + gradient = new java.util.ArrayList(5); |
---|
| 1116 | + gradient.add(1.0); |
---|
| 1117 | + gradient.add(0.0); |
---|
| 1118 | + gradient.add(new javax.swing.plaf.ColorUIResource(192,192,192)); |
---|
| 1119 | + gradient.add(new javax.swing.plaf.ColorUIResource(255,255,255)); |
---|
| 1120 | + gradient.add(new javax.swing.plaf.ColorUIResource(0,0,0)); |
---|
| 1121 | + |
---|
| 1122 | + ui.put("ToggleButton.gradient", gradient); |
---|
| 1123 | + //ui.put("Button[MouseOver].backgroundPainter", new com.sun.java.swing.plaf.nimbus.ButtonPainter()); |
---|
| 1124 | + //ui.put("Button.highlight", new javax.swing.plaf.ColorUIResource(155,155,155)); |
---|
| 1125 | + |
---|
| 1126 | + for (java.util.Enumeration e = ui.keys(); e.hasMoreElements();) |
---|
| 1127 | + { |
---|
| 1128 | + Object key = e.nextElement(); |
---|
| 1129 | + //System.out.println(key + " --> " + ui.get(key)); |
---|
| 1130 | + } |
---|
836 | 1131 | } catch (Exception e) |
---|
837 | 1132 | { |
---|
838 | 1133 | } |
---|
839 | 1134 | } |
---|
840 | 1135 | /**/ |
---|
| 1136 | + |
---|
| 1137 | + // Create a trust manager that does not validate certificate chains |
---|
| 1138 | + final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { |
---|
| 1139 | + @Override |
---|
| 1140 | + public void checkClientTrusted(final X509Certificate[] chain, final String authType) { |
---|
| 1141 | + } |
---|
| 1142 | + |
---|
| 1143 | + @Override |
---|
| 1144 | + public void checkServerTrusted(final X509Certificate[] chain, final String authType) { |
---|
| 1145 | + } |
---|
| 1146 | + |
---|
| 1147 | + @Override |
---|
| 1148 | + public X509Certificate[] getAcceptedIssuers() { |
---|
| 1149 | + return null; |
---|
| 1150 | + } |
---|
| 1151 | + } }; |
---|
| 1152 | + |
---|
| 1153 | + try |
---|
| 1154 | + { |
---|
| 1155 | + // Install the all-trusting trust manager |
---|
| 1156 | + final SSLContext sslContext = SSLContext.getInstance("SSL"); |
---|
| 1157 | + sslContext.init(null, trustAllCerts, null); |
---|
| 1158 | + // Create an ssl socket factory with our all-trusting manager |
---|
| 1159 | + HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); |
---|
| 1160 | + HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { |
---|
| 1161 | + public boolean verify(String urlHostName, SSLSession session) { |
---|
| 1162 | + return true; |
---|
| 1163 | + } |
---|
| 1164 | + }); |
---|
| 1165 | + // be authentic |
---|
| 1166 | + Authenticator.setDefault(new Authenticator() { |
---|
| 1167 | + @Override |
---|
| 1168 | + protected PasswordAuthentication getPasswordAuthentication() { |
---|
| 1169 | + return new PasswordAuthentication("args[0]", "args[1]".toCharArray()); |
---|
| 1170 | + } |
---|
| 1171 | + }); |
---|
| 1172 | + } |
---|
| 1173 | + catch (Exception e) |
---|
| 1174 | + { |
---|
| 1175 | + e.printStackTrace(); |
---|
| 1176 | + } |
---|
| 1177 | + |
---|
| 1178 | + |
---|
| 1179 | + ///////////// |
---|
841 | 1180 | |
---|
842 | 1181 | // javax.swing.ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
843 | 1182 | |
---|
844 | 1183 | //Monitor mon=MonitorFactory.start("myFirstMonitor"); |
---|
845 | 1184 | standAlone = true; |
---|
846 | | - grafreeD = new Grafreed(); |
---|
847 | | - grafreeD.universe = new Composite(); |
---|
848 | | - grafreeD.universe.name = "Grafreed"; |
---|
849 | | - grafreeD.universe.material = new cMaterial(); |
---|
| 1185 | + |
---|
| 1186 | + grafreed = new Grafreed(); |
---|
| 1187 | + |
---|
| 1188 | + grafreed.materials = ReadGFD(grafreed.getClass().getClassLoader().getResourceAsStream("gfd/materials.gfd")); |
---|
| 1189 | + |
---|
| 1190 | + grafreed.universe = new cGroup(); |
---|
| 1191 | + grafreed.universe.name = "Grafreed"; |
---|
| 1192 | + grafreed.universe.material = new cMaterial(); |
---|
| 1193 | + |
---|
850 | 1194 | // theApplet3D.universe.textures = CameraPane.DEFAULT_TEXTURE; |
---|
851 | 1195 | |
---|
852 | | - grafreeD.universe.root = true; |
---|
853 | | - grafreeD.universe.openEditWindow(null, true); //, true); |
---|
| 1196 | + grafreed.universe.root = true; |
---|
| 1197 | + grafreed.universe.openEditWindow(null, true); //, true); |
---|
| 1198 | + grafreed.universe.editWindow.New(); |
---|
| 1199 | + |
---|
854 | 1200 | //mon.stop(); |
---|
855 | 1201 | //System.out.println(mon); |
---|
856 | 1202 | //timeflow.app.TimeflowAppLauncher.GetTimeFlow(); |
---|
| 1203 | + |
---|
| 1204 | + javax.swing.ToolTipManager.sharedInstance().setEnabled(Globals.TOOLTIPS); |
---|
857 | 1205 | } |
---|
858 | 1206 | |
---|
| 1207 | + static class CheckBox extends javax.swing.plaf.metal.MetalCheckBoxIcon |
---|
| 1208 | + { |
---|
| 1209 | + java.awt.image.BufferedImage image; |
---|
| 1210 | + |
---|
| 1211 | + CheckBox() |
---|
| 1212 | + { |
---|
| 1213 | + try |
---|
| 1214 | + { |
---|
| 1215 | + image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream("icons/checkbox.png")); |
---|
| 1216 | + } |
---|
| 1217 | + catch (Exception e) |
---|
| 1218 | + { |
---|
| 1219 | + } |
---|
| 1220 | + } |
---|
| 1221 | + |
---|
| 1222 | + protected void drawCheck(Component c, Graphics g, int x, int y) |
---|
| 1223 | + { |
---|
| 1224 | + super.drawCheck(c, g, x, y); |
---|
| 1225 | + } |
---|
| 1226 | + |
---|
| 1227 | + public void paintIcon(Component c, Graphics g, int x, int y) |
---|
| 1228 | + { |
---|
| 1229 | + g.drawImage(image, x-1, y-1, 19, 19, null); |
---|
| 1230 | + super.paintIcon(c, g, x+2, y+2); |
---|
| 1231 | + } |
---|
| 1232 | + } |
---|
| 1233 | + |
---|
| 1234 | + static Object3D materials; |
---|
| 1235 | + |
---|
| 1236 | + static Object3D ReadGFD(java.io.InputStream istream) |
---|
| 1237 | + { |
---|
| 1238 | + Object3D readobj = null; |
---|
| 1239 | + |
---|
| 1240 | + try |
---|
| 1241 | + { |
---|
| 1242 | + // Try compressed version first. |
---|
| 1243 | + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
| 1244 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
| 1245 | + |
---|
| 1246 | + readobj = (Object3D) p.readObject(); |
---|
| 1247 | + p.close(); |
---|
| 1248 | + zstream.close(); |
---|
| 1249 | + istream.close(); |
---|
| 1250 | + |
---|
| 1251 | + readobj.ResetDisplayList(); |
---|
| 1252 | + } catch (Exception e) |
---|
| 1253 | + { |
---|
| 1254 | + if (!e.toString().contains("GZIP")) |
---|
| 1255 | + e.printStackTrace(); |
---|
| 1256 | + |
---|
| 1257 | + try |
---|
| 1258 | + { |
---|
| 1259 | + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); |
---|
| 1260 | + |
---|
| 1261 | + readobj = (Object3D) p.readObject(); |
---|
| 1262 | + p.close(); |
---|
| 1263 | + istream.close(); |
---|
| 1264 | + |
---|
| 1265 | + readobj.ResetDisplayList(); |
---|
| 1266 | + } catch (Exception e2) |
---|
| 1267 | + { |
---|
| 1268 | + e2.printStackTrace(); |
---|
| 1269 | + } |
---|
| 1270 | + } |
---|
| 1271 | + |
---|
| 1272 | + return readobj; |
---|
| 1273 | + } |
---|
| 1274 | + |
---|
859 | 1275 | // Timer callback |
---|
860 | 1276 | public void actionPerformed(ActionEvent e) |
---|
861 | 1277 | { |
---|
.. | .. |
---|
870 | 1286 | static int depth = 0; |
---|
871 | 1287 | static java.util.Stack stack = new java.util.Stack(); |
---|
872 | 1288 | static boolean traceoff = false; // true; |
---|
873 | | - static float[] colorV = new float[5]; |
---|
| 1289 | + static float[] colorV = new float[4]; // 5]; |
---|
874 | 1290 | |
---|
875 | 1291 | static void traceon() |
---|
876 | 1292 | { |
---|
.. | .. |
---|
977 | 1393 | |
---|
978 | 1394 | static public Object clone(Object o) |
---|
979 | 1395 | { |
---|
| 1396 | + if (o instanceof Object3D) |
---|
| 1397 | + { |
---|
| 1398 | + assert(((Object3D)o).parent == null); |
---|
| 1399 | + } |
---|
| 1400 | + |
---|
980 | 1401 | if (o == null) |
---|
981 | 1402 | return null; |
---|
982 | 1403 | |
---|
.. | .. |
---|
1079 | 1500 | } while (avail > 0 && numRead >= 0); |
---|
1080 | 1501 | return new String(data, 0, pos, "US-ASCII"); |
---|
1081 | 1502 | } |
---|
1082 | | - public static Grafreed grafreeD; |
---|
| 1503 | + public static Grafreed grafreed; |
---|
1083 | 1504 | public static boolean standAlone = true; |
---|
1084 | 1505 | public Composite universe; |
---|
1085 | 1506 | public static Object3D clipboard = new Object3D(); |
---|