From cfd7a643cb5a445016ddb15595158ecc59b184fd Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sun, 30 Jun 2019 18:18:44 -0400 Subject: [PATCH] Proto wget 3d models. --- CameraPane.java | 149 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 142 insertions(+), 7 deletions(-) diff --git a/CameraPane.java b/CameraPane.java index b2db6b7..cdf2ce1 100644 --- a/CameraPane.java +++ b/CameraPane.java @@ -2398,6 +2398,128 @@ return currentGL; } + private void GetRemoteZip(String url, String name, boolean unzip, boolean save) + { + java.net.URL u; + InputStream is = null; + DataInputStream dis; + java.util.zip.ZipInputStream zis; + //String s; + + System.out.println("GetRemoteZip " + name); + + int total = 0; // dis.available(); + + byte[] bytes = new byte[16384]; + + try + { + u = new java.net.URL(url + name); + is = u.openStream(); + + System.out.println(url + name); + + if (unzip) + { + //dis = new DataInputStream(new BufferedInputStream(is)); + zis = new java.util.zip.ZipInputStream(new BufferedInputStream(is)); + //while ((s = dis.readLine()) != null) + + if (save) + new java.io.File(name).mkdirs(); + + // FileOutputStream stream = new FileOutputStream("test.zip"); + // + // int count; + // + // while ((count = dis.read(bytes)) != -1) + // { + // //System.out.println(s); + // System.out.println(count); + // total += count; + // stream.write(bytes); + // } + // + // stream.close(); + + // now iterate through each item in the stream. The get next + // entry call will return a ZipEntry for each file in the + // stream + java.util.zip.ZipEntry entry; + while((entry = zis.getNextEntry())!=null) + { + if (entry.getName().endsWith(".gsm")) + { + continue; + } + + String s = String.format("Entry: %s len %d added %TD", + entry.getName(), entry.getSize(), + new java.util.Date(entry.getTime())); + System.out.println(s); + + if (save) + { + // Once we get the entry from the stream, the stream is + // positioned read to read the raw data, and we keep + // reading until read returns 0 or less. + String outpath = name + "/" + entry.getName(); + FileOutputStream output = null; + try + { + output = new FileOutputStream(outpath); + int len = 0; + while ((len = zis.read(bytes)) > 0) + { + output.write(bytes, 0, len); + } + } + finally + { + // we must always close the output file + if(output!=null) output.close(); + } + } + } + } + } + catch (java.net.MalformedURLException mue) + { + System.err.println("Ouch - a MalformedURLException happened."); + mue.printStackTrace(); + //System.exit(2); + } + catch (IOException ioe) + { + //System.err.println("Oops - an IOException happened."); + //ioe.printStackTrace(); + //System.exit(3); + } + finally + { + try + { + if (is != null) + is.close(); + } + catch (IOException ioe) + { + } + } + + // System.out.println("length = " + total); + +// try +// { +// Runtime.getRuntime().exec("/usr/local/bin/wget https://archive3d.net/?a=download&do=get&id=7caca905"); +// } +// catch (Exception e) +// { +// e.printStackTrace(); +// } + + } + /**/ class CacheTexture { @@ -13375,9 +13497,10 @@ "DP3 " + dest + ".z," + "normals," + "eye;" + "MAX " + dest + ".w," + dest + ".z," + "eps.x;" + //"MOV " + dest + ".w," + "normal.z;" + - "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + - "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + - //"MOV " + dest + ".z," + "params2.w;" + +// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET +// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + + + "MOV " + dest + ".z," + "params2.w;" + // EXACT "POW " + dest + ".w," + dest + ".w," + dest + ".z;" + "RCP " + dest + ".w," + dest + ".w;" + //"RSQ " + dest + ".w," + dest + ".w;" + @@ -15119,9 +15242,9 @@ case '_': kompactbit = 5; break; - case '+': - kompactbit = 6; - break; +// case '+': +// kompactbit = 6; +// break; case ' ': ObjEditor.theFrame.ToggleFullScreen(); repaint(); @@ -15170,8 +15293,15 @@ case DELETE: ClearSelection(); break; - /* case '+': + + //for (int i=0; i<0x7FFFFFFF; i++) + { + //String.format("%08X", i); // "7caca905" + GetRemoteZip("https://archive3d.net/?a=download&do=get&id=", "7caca905", true, true); + } + + /* //fontsize += 1; bbzoom *= 2; repaint(); @@ -16783,6 +16913,11 @@ //System.out.println("objects[color] = " + objects[color]); //objects[color].Select(); indexcount = 0; + ObjEditor window = object.GetWindow(); + if (window != null && deselect) + { + window.Select(null, deselect, true); + } object.Select(color, deselect); } -- Gitblit v1.6.2