Normand Briere
2019-06-30 cfd7a643cb5a445016ddb15595158ecc59b184fd
CameraPane.java
....@@ -326,7 +326,7 @@
326326 cStatic.objectstack[materialdepth++] = obj;
327327 //System.out.println("material " + material);
328328 //Applet3D.tracein(this, selected);
329
- display.vector2buffer = obj.projectedVertices;
329
+ //display.vector2buffer = obj.projectedVertices;
330330 if (obj instanceof Camera)
331331 {
332332 display.options1[0] = material.shift;
....@@ -335,14 +335,28 @@
335335 display.options1[2] = material.shadowbias;
336336 display.options1[3] = material.aniso;
337337 display.options1[4] = material.anisoV;
338
+// System.out.println("display.options1[0] " + display.options1[0]);
339
+// System.out.println("display.options1[1] " + display.options1[1]);
340
+// System.out.println("display.options1[2] " + display.options1[2]);
341
+// System.out.println("display.options1[3] " + display.options1[3]);
342
+// System.out.println("display.options1[4] " + display.options1[4]);
338343 display.options2[0] = material.opacity;
339344 display.options2[1] = material.diffuse;
340345 display.options2[2] = material.factor;
346
+// System.out.println("display.options2[0] " + display.options2[0]);
347
+// System.out.println("display.options2[1] " + display.options2[1]);
348
+// System.out.println("display.options2[2] " + display.options2[2]);
341349
342350 cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
351
+// System.out.println("display.options3[0] " + display.options3[0]);
352
+// System.out.println("display.options3[1] " + display.options3[1]);
353
+// System.out.println("display.options3[2] " + display.options3[2]);
343354 display.options4[0] = material.cameralight/0.2f;
344355 display.options4[1] = material.subsurface;
345356 display.options4[2] = material.sheen;
357
+// System.out.println("display.options4[0] " + display.options4[0]);
358
+// System.out.println("display.options4[1] " + display.options4[1]);
359
+// System.out.println("display.options4[2] " + display.options4[2]);
346360
347361 // if (display.CURRENTANTIALIAS > 0)
348362 // display.options3[3] /= 4;
....@@ -358,7 +372,7 @@
358372 /**/
359373 } else
360374 {
361
- DrawMaterial(material, selected);
375
+ DrawMaterial(material, selected, obj.projectedVertices);
362376 }
363377 } else
364378 {
....@@ -382,8 +396,8 @@
382396 cStatic.objectstack[materialdepth++] = obj;
383397 //System.out.println("material " + material);
384398 //Applet3D.tracein("selected ", selected);
385
- display.vector2buffer = obj.projectedVertices;
386
- display.DrawMaterial(material, selected);
399
+ //display.vector2buffer = obj.projectedVertices;
400
+ display.DrawMaterial(material, selected, obj.projectedVertices);
387401 }
388402 }
389403
....@@ -400,8 +414,8 @@
400414 materialdepth -= 1;
401415 if (materialdepth > 0)
402416 {
403
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
404
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
417
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
418
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
405419 }
406420 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
407421 } else if (selected && CameraPane.flash && obj.GetMaterial() != null)
....@@ -421,8 +435,8 @@
421435 materialdepth -= 1;
422436 if (materialdepth > 0)
423437 {
424
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
425
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
438
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
439
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
426440 }
427441 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
428442 //else
....@@ -1610,7 +1624,7 @@
16101624 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16111625 }
16121626
1613
- void DrawMaterial(cMaterial material, boolean selected)
1627
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16141628 {
16151629 CameraPane display = this;
16161630 //new Exception().printStackTrace();
....@@ -1645,7 +1659,7 @@
16451659 colorV[0] = display.modelParams0[0] * material.diffuse;
16461660 colorV[1] = display.modelParams0[1] * material.diffuse;
16471661 colorV[2] = display.modelParams0[2] * material.diffuse;
1648
- colorV[3] = material.opacity;
1662
+ colorV[3] = 1; // material.opacity;
16491663
16501664 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16511665 //System.out.println("Opacity = " + opacity);
....@@ -1753,9 +1767,9 @@
17531767 display.modelParams7[2] = 0;
17541768 display.modelParams7[3] = 0;
17551769
1756
- display.modelParams6[0] = 100; // criss de bug de bump
1770
+ //display.modelParams6[0] = 100; // criss de bug de bump
17571771
1758
- Object3D.cVector2[] extparams = display.vector2buffer;
1772
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17591773 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17601774 {
17611775 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -2382,6 +2396,128 @@
23822396 public GL GetGL() // INTERFACE
23832397 {
23842398 return currentGL;
2399
+ }
2400
+
2401
+ private void GetRemoteZip(String url, String name, boolean unzip, boolean save)
2402
+ {
2403
+ java.net.URL u;
2404
+ InputStream is = null;
2405
+ DataInputStream dis;
2406
+ java.util.zip.ZipInputStream zis;
2407
+ //String s;
2408
+
2409
+ System.out.println("GetRemoteZip " + name);
2410
+
2411
+ int total = 0; // dis.available();
2412
+
2413
+ byte[] bytes = new byte[16384];
2414
+
2415
+ try
2416
+ {
2417
+ u = new java.net.URL(url + name);
2418
+ is = u.openStream();
2419
+
2420
+ System.out.println(url + name);
2421
+
2422
+ if (unzip)
2423
+ {
2424
+ //dis = new DataInputStream(new BufferedInputStream(is));
2425
+ zis = new java.util.zip.ZipInputStream(new BufferedInputStream(is));
2426
+ //while ((s = dis.readLine()) != null)
2427
+
2428
+ if (save)
2429
+ new java.io.File(name).mkdirs();
2430
+
2431
+ // FileOutputStream stream = new FileOutputStream("test.zip");
2432
+ //
2433
+ // int count;
2434
+ //
2435
+ // while ((count = dis.read(bytes)) != -1)
2436
+ // {
2437
+ // //System.out.println(s);
2438
+ // System.out.println(count);
2439
+ // total += count;
2440
+ // stream.write(bytes);
2441
+ // }
2442
+ //
2443
+ // stream.close();
2444
+
2445
+ // now iterate through each item in the stream. The get next
2446
+ // entry call will return a ZipEntry for each file in the
2447
+ // stream
2448
+ java.util.zip.ZipEntry entry;
2449
+ while((entry = zis.getNextEntry())!=null)
2450
+ {
2451
+ if (entry.getName().endsWith(".gsm"))
2452
+ {
2453
+ continue;
2454
+ }
2455
+
2456
+ String s = String.format("Entry: %s len %d added %TD",
2457
+ entry.getName(), entry.getSize(),
2458
+ new java.util.Date(entry.getTime()));
2459
+ System.out.println(s);
2460
+
2461
+ if (save)
2462
+ {
2463
+ // Once we get the entry from the stream, the stream is
2464
+ // positioned read to read the raw data, and we keep
2465
+ // reading until read returns 0 or less.
2466
+ String outpath = name + "/" + entry.getName();
2467
+ FileOutputStream output = null;
2468
+ try
2469
+ {
2470
+ output = new FileOutputStream(outpath);
2471
+ int len = 0;
2472
+ while ((len = zis.read(bytes)) > 0)
2473
+ {
2474
+ output.write(bytes, 0, len);
2475
+ }
2476
+ }
2477
+ finally
2478
+ {
2479
+ // we must always close the output file
2480
+ if(output!=null) output.close();
2481
+ }
2482
+ }
2483
+ }
2484
+ }
2485
+ }
2486
+ catch (java.net.MalformedURLException mue)
2487
+ {
2488
+ System.err.println("Ouch - a MalformedURLException happened.");
2489
+ mue.printStackTrace();
2490
+ //System.exit(2);
2491
+ }
2492
+ catch (IOException ioe)
2493
+ {
2494
+ //System.err.println("Oops - an IOException happened.");
2495
+ //ioe.printStackTrace();
2496
+ //System.exit(3);
2497
+ }
2498
+ finally
2499
+ {
2500
+ try
2501
+ {
2502
+ if (is != null)
2503
+ is.close();
2504
+ }
2505
+ catch (IOException ioe)
2506
+ {
2507
+ }
2508
+ }
2509
+
2510
+ // System.out.println("length = " + total);
2511
+
2512
+// try
2513
+// {
2514
+// Runtime.getRuntime().exec("/usr/local/bin/wget https://archive3d.net/?a=download&do=get&id=7caca905");
2515
+// }
2516
+// catch (Exception e)
2517
+// {
2518
+// e.printStackTrace();
2519
+// }
2520
+
23852521 }
23862522
23872523 /**/
....@@ -9366,11 +9502,35 @@
93669502 jy8[3] = 0.5f;
93679503 }
93689504
9369
- float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
9505
+ float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
93709506 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
93719507 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
93729508 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
93739509
9510
+ void ResetOptions()
9511
+ {
9512
+ options1[0] = 100;
9513
+ options1[1] = 0.025f;
9514
+ options1[2] = 0.01f;
9515
+ options1[3] = 0;
9516
+ options1[4] = 0;
9517
+
9518
+ options2[0] = 0;
9519
+ options2[1] = 0.75f;
9520
+ options2[2] = 0;
9521
+ options2[3] = 0;
9522
+
9523
+ options3[0] = 1;
9524
+ options3[1] = 1;
9525
+ options3[2] = 1;
9526
+ options3[3] = 0;
9527
+
9528
+ options4[0] = 1;
9529
+ options4[1] = 0;
9530
+ options4[2] = 1;
9531
+ options4[3] = 0;
9532
+ }
9533
+
93749534 static int imagecount = 0; // movie generation
93759535
93769536 static int jitter = 0;
....@@ -10481,6 +10641,7 @@
1048110641 ANTIALIAS = 0;
1048210642 //System.out.println("RESTART");
1048310643 AAtimer.restart();
10644
+ Globals.TIMERRUNNING = true;
1048410645 }
1048510646 }
1048610647 }
....@@ -10548,7 +10709,8 @@
1054810709 ambientOcclusion = false;
1054910710 }
1055010711
10551
- if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
10712
+ if (//Globals.lighttouched &&
10713
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1055210714 {
1055310715 //if (RENDERSHADOW) // ?
1055410716 if (!IsFrozen())
....@@ -11458,7 +11620,7 @@
1145811620
1145911621 static boolean zoomonce = false;
1146011622
11461
- void CreateSelectedPoint()
11623
+ static void CreateSelectedPoint()
1146211624 {
1146311625 if (selectedpoint == null)
1146411626 {
....@@ -11478,6 +11640,9 @@
1147811640
1147911641 void DrawObject(GL gl, boolean draw)
1148011642 {
11643
+ // To clear camera values
11644
+ ResetOptions();
11645
+
1148111646 //System.out.println("DRAW OBJECT " + mouseDown);
1148211647 // DrawMode() = SELECTION;
1148311648 //GL gl = getGL();
....@@ -12045,7 +12210,7 @@
1204512210 for (int i = tp.size(); --i >= 0;)
1204612211 {
1204712212 //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12048
- LA.xformPos(light, tp.get(i).GlobalTransform(), light);
12213
+ LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
1204912214 }
1205012215
1205112216
....@@ -13315,7 +13480,8 @@
1331513480 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1331613481 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1331713482 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13318
- Object3D.cVector2[] vector2buffer;
13483
+
13484
+ //Object3D.cVector2[] vector2buffer;
1331913485
1332013486 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1332113487 // OUT : diff, spec
....@@ -13331,9 +13497,10 @@
1333113497 "DP3 " + dest + ".z," + "normals," + "eye;" +
1333213498 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1333313499 //"MOV " + dest + ".w," + "normal.z;" +
13334
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13335
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13336
- //"MOV " + dest + ".z," + "params2.w;" +
13500
+// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET
13501
+// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13502
+
13503
+ "MOV " + dest + ".z," + "params2.w;" + // EXACT
1333713504 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1333813505 "RCP " + dest + ".w," + dest + ".w;" +
1333913506 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13838,6 +14005,7 @@
1383814005 else
1383914006 if (evt.getSource() == AAtimer)
1384014007 {
14008
+ Globals.TIMERRUNNING = false;
1384114009 if (mouseDown)
1384214010 {
1384314011 //new Exception().printStackTrace();
....@@ -13912,6 +14080,7 @@
1391214080 return;
1391314081
1391414082 AAtimer.restart(); //
14083
+ Globals.TIMERRUNNING = true;
1391514084
1391614085 // waslive = LIVE;
1391714086 // LIVE = false;
....@@ -14375,7 +14544,8 @@
1437514544 info.camera = renderCamera;
1437614545 info.x = x;
1437714546 info.y = y;
14378
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14547
+ object.GetWindow().copy
14548
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1437914549 } else
1438014550 {
1438114551 if (x < startX)
....@@ -14539,7 +14709,9 @@
1453914709 ci.camera = renderCamera;
1454014710 if (!isRenderer)
1454114711 {
14542
- if (object.editWindow.copy.doEditClick(ci, 0))
14712
+ //ObjEditor editWindow = object.editWindow;
14713
+ //Object3D copy = editWindow.copy;
14714
+ if (object.doEditClick(ci, 0))
1454314715 {
1454414716 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1454514717 } else
....@@ -15070,9 +15242,9 @@
1507015242 case '_':
1507115243 kompactbit = 5;
1507215244 break;
15073
- case '+':
15074
- kompactbit = 6;
15075
- break;
15245
+// case '+':
15246
+// kompactbit = 6;
15247
+// break;
1507615248 case ' ':
1507715249 ObjEditor.theFrame.ToggleFullScreen();
1507815250 repaint();
....@@ -15121,8 +15293,15 @@
1512115293 case DELETE:
1512215294 ClearSelection();
1512315295 break;
15124
- /*
1512515296 case '+':
15297
+
15298
+ //for (int i=0; i<0x7FFFFFFF; i++)
15299
+ {
15300
+ //String.format("%08X", i); // "7caca905"
15301
+ GetRemoteZip("https://archive3d.net/?a=download&do=get&id=", "7caca905", true, true);
15302
+ }
15303
+
15304
+ /*
1512615305 //fontsize += 1;
1512715306 bbzoom *= 2;
1512815307 repaint();
....@@ -15373,7 +15552,7 @@
1537315552 }
1537415553 */
1537515554
15376
- object.editWindow.EditSelection();
15555
+ object.editWindow.EditSelection(false);
1537715556 }
1537815557
1537915558 void SelectParent()
....@@ -16385,16 +16564,16 @@
1638516564 cStatic.objectstack[materialdepth++] = checker;
1638616565 //System.out.println("material " + material);
1638716566 //Applet3D.tracein(this, selected);
16388
- vector2buffer = checker.projectedVertices;
16567
+ //vector2buffer = checker.projectedVertices;
1638916568
1639016569 //checker.GetMaterial().Draw(this, false); // true);
16391
- DrawMaterial(checker.GetMaterial(), false); // true);
16570
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1639216571
1639316572 materialdepth -= 1;
1639416573 if (materialdepth > 0)
1639516574 {
16396
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16397
- DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
16575
+ //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16576
+ DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
1639816577 }
1639916578 //checker.GetMaterial().opacity = 1f;
1640016579 ////checker.GetMaterial().ambient = 1f;
....@@ -16618,6 +16797,8 @@
1661816797 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1661916798 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
1662016799
16800
+ CreateSelectedPoint();
16801
+
1662116802 // Will fit the mesh !!!
1662216803 selectedpoint.toParent[0][0] = 0.0001;
1662316804 selectedpoint.toParent[1][1] = 0.0001;
....@@ -16732,6 +16913,11 @@
1673216913 //System.out.println("objects[color] = " + objects[color]);
1673316914 //objects[color].Select();
1673416915 indexcount = 0;
16916
+ ObjEditor window = object.GetWindow();
16917
+ if (window != null && deselect)
16918
+ {
16919
+ window.Select(null, deselect, true);
16920
+ }
1673516921 object.Select(color, deselect);
1673616922 }
1673716923