Normand Briere
2019-07-21 40f408aaee14abd85d391008b4d22977dc586b50
CameraPane.java
....@@ -60,7 +60,7 @@
6060 //boolean REDUCETEXTURE = true;
6161 boolean CACHETEXTURE = true;
6262 boolean CLEANCACHE = false; // true;
63
- boolean MIPMAP = false; // true;
63
+ boolean MIPMAP = true; // false; // true;
6464 boolean COMPRESSTEXTURE = false;
6565 boolean KOMPACTTEXTURE = false; // true;
6666 boolean RESIZETEXTURE = false;
....@@ -2065,7 +2065,7 @@
20652065 //System.err.println("Oeil on");
20662066 OEIL = true;
20672067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2068
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20692069 //pingthread.StepToTarget(true);
20702070 }
20712071
....@@ -2298,10 +2298,17 @@
22982298 HANDLES ^= true;
22992299 }
23002300
2301
+ Object3D paintFolder;
2302
+
23012303 void TogglePaint()
23022304 {
23032305 PAINTMODE ^= true;
23042306 paintcount = 0;
2307
+
2308
+ if (PAINTMODE)
2309
+ {
2310
+ paintFolder = GetFolder();
2311
+ }
23052312 }
23062313
23072314 void SwapCamera(int a, int b)
....@@ -2398,128 +2405,6 @@
23982405 return currentGL;
23992406 }
24002407
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
-
2521
- }
2522
-
25232408 /**/
25242409 class CacheTexture
25252410 {
....@@ -2537,9 +2422,10 @@
25372422 /**/
25382423
25392424 // TEXTURE static Texture texture;
2540
- static public java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/> textures
2541
- = new java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/>();
2542
- static public java.util.Hashtable<String, String> usedtextures = new java.util.Hashtable<String, String>();
2425
+ static public java.util.Hashtable<String, CacheTexture> textures = new java.util.Hashtable<String, CacheTexture>();
2426
+ static public java.util.Hashtable<BufferedImage, CacheTexture> bimtextures = new java.util.Hashtable<BufferedImage, CacheTexture>();
2427
+ static public java.util.HashSet<String> usedtextures = new java.util.HashSet<String>();
2428
+
25432429 int pigmentdepth = 0;
25442430 public com.sun.opengl.util.texture.Texture[] pigmentstack = new com.sun.opengl.util.texture.Texture[65536];
25452431 int bumpdepth = 0;
....@@ -2561,6 +2447,33 @@
25612447 true,
25622448 com.sun.opengl.util.texture.TextureIO.PNG);
25632449 } catch (java.io.IOException e)
2450
+ {
2451
+ throw new javax.media.opengl.GLException(e);
2452
+ }
2453
+
2454
+ if (bump)
2455
+ texturedata = ConvertBump(texturedata, false);
2456
+
2457
+ com.sun.opengl.util.texture.Texture texture =
2458
+ com.sun.opengl.util.texture.TextureIO.newTexture(texturedata);
2459
+
2460
+ texture.setTexParameteri(javax.media.opengl.GL.GL_TEXTURE_WRAP_S, javax.media.opengl.GL.GL_REPEAT);
2461
+ texture.setTexParameteri(javax.media.opengl.GL.GL_TEXTURE_WRAP_T, javax.media.opengl.GL.GL_REPEAT);
2462
+
2463
+ return texture;
2464
+ }
2465
+
2466
+ com.sun.opengl.util.texture.Texture GetBimTexture(BufferedImage name, boolean bump)
2467
+ {
2468
+ TextureData texturedata = null;
2469
+
2470
+ try
2471
+ {
2472
+ texturedata =
2473
+ com.sun.opengl.util.texture.TextureIO.newTextureData(
2474
+ name,
2475
+ true);
2476
+ } catch (Exception e)
25642477 {
25652478 throw new javax.media.opengl.GLException(e);
25662479 }
....@@ -3647,6 +3560,8 @@
36473560
36483561 System.out.println("LOADING TEXTURE : " + name);
36493562
3563
+ Object x = texturedata.getMipmapData(); // .getBuffer();
3564
+
36503565 //
36513566 if (false) // compressbit > 0)
36523567 {
....@@ -8045,7 +7960,7 @@
80457960 String pigment = Object3D.GetPigment(tex);
80467961 String bump = Object3D.GetBump(tex);
80477962
8048
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7963
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
80497964 {
80507965 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
80517966 // System.out.println("; bump = " + bump);
....@@ -8079,7 +7994,7 @@
80797994
80807995 String pigment = Object3D.GetPigment(tex);
80817996
8082
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7997
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
80837998 {
80847999 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
80858000 // System.out.println("; bump = " + bump);
....@@ -8108,7 +8023,7 @@
81088023
81098024 String bump = Object3D.GetBump(tex);
81108025
8111
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8026
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81128027 {
81138028 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
81148029 // System.out.println("; bump = " + bump);
....@@ -8227,47 +8142,50 @@
82278142
82288143 /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
82298144 {
8230
- if (// DrawMode() != 0 || /*tex == null ||*/
8231
- ambientOcclusion ) // || !textureon)
8232
- {
8233
- return; // false;
8234
- }
8235
-
8236
- if (tex == null)
8237
- {
8238
- BindTexture(null,false,resolution);
8239
- BindTexture(null,true,resolution);
8240
- return;
8241
- }
8145
+// if (// DrawMode() != 0 || /*tex == null ||*/
8146
+// ambientOcclusion ) // || !textureon)
8147
+// {
8148
+// return; // false;
8149
+// }
8150
+//
8151
+// if (tex == null)
8152
+// {
8153
+// BindTexture(null,false,resolution);
8154
+// BindTexture(null,true,resolution);
8155
+// return;
8156
+// }
8157
+//
8158
+// String pigment = Object3D.GetPigment(tex);
8159
+// String bump = Object3D.GetBump(tex);
8160
+//
8161
+// usedtextures.add(pigment);
8162
+// usedtextures.add(bump);
8163
+//
8164
+// //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8165
+// {
8166
+// // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8167
+// // System.out.println("; bump = " + bump);
8168
+// }
8169
+//
8170
+// if (bump.equals(""))
8171
+// {
8172
+// bump = null;
8173
+// }
8174
+// if (pigment.equals(""))
8175
+// {
8176
+// pigment = null;
8177
+// }
8178
+//
8179
+// GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8180
+// BindTexture(pigment, false, resolution);
8181
+// GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8182
+// BindTexture(bump, true, resolution);
8183
+// GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8184
+//
8185
+// return; // true;
82428186
8243
- String pigment = Object3D.GetPigment(tex);
8244
- String bump = Object3D.GetBump(tex);
8245
-
8246
- usedtextures.put(pigment, pigment);
8247
- usedtextures.put(bump, bump);
8248
-
8249
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8250
- {
8251
- // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8252
- // System.out.println("; bump = " + bump);
8253
- }
8254
-
8255
- if (bump.equals(""))
8256
- {
8257
- bump = null;
8258
- }
8259
- if (pigment.equals(""))
8260
- {
8261
- pigment = null;
8262
- }
8263
-
8264
- GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8265
- BindTexture(pigment, false, resolution);
8266
- GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8267
- BindTexture(bump, true, resolution);
8268
- GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8269
-
8270
- return; // true;
8187
+ BindPigmentTexture(tex, resolution);
8188
+ BindBumpTexture(tex, resolution);
82718189 }
82728190
82738191 /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE
....@@ -8280,15 +8198,15 @@
82808198
82818199 if (tex == null)
82828200 {
8283
- BindTexture(null,false,resolution);
8201
+ BindTexture(null, null,false,resolution);
82848202 return;
82858203 }
82868204
82878205 String pigment = Object3D.GetPigment(tex);
82888206
8289
- usedtextures.put(pigment, pigment);
8207
+ usedtextures.add(pigment);
82908208
8291
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8209
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
82928210 {
82938211 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
82948212 // System.out.println("; bump = " + bump);
....@@ -8300,7 +8218,7 @@
83008218 }
83018219
83028220 GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8303
- BindTexture(pigment, false, resolution);
8221
+ BindTexture(tex.pigmenttexture, pigment, false, resolution);
83048222 }
83058223
83068224 /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE
....@@ -8313,15 +8231,15 @@
83138231
83148232 if (tex == null)
83158233 {
8316
- BindTexture(null,true,resolution);
8234
+ BindTexture(null, null,true,resolution);
83178235 return;
83188236 }
83198237
83208238 String bump = Object3D.GetBump(tex);
83218239
8322
- usedtextures.put(bump, bump);
8240
+ usedtextures.add(bump);
83238241
8324
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8242
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
83258243 {
83268244 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
83278245 // System.out.println("; bump = " + bump);
....@@ -8333,7 +8251,7 @@
83338251 }
83348252
83358253 GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8336
- BindTexture(bump, true, resolution);
8254
+ BindTexture(tex.bumptexture, bump, true, resolution);
83378255 GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
83388256 }
83398257
....@@ -8357,9 +8275,9 @@
83578275 return fileExists;
83588276 }
83598277
8360
- CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception
8278
+ CacheTexture GetCacheTexture(java.awt.image.BufferedImage bim, String tex, boolean bump, int resolution) throws Exception
83618279 {
8362
- CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
8280
+ CacheTexture texturecache = null;
83638281
83648282 if (tex != null)
83658283 {
....@@ -8379,12 +8297,22 @@
83798297 }
83808298
83818299 if (CACHETEXTURE)
8382
- texture = textures.get(texname); // TEXTURE CACHE
8383
-
8384
- TextureData texturedata = null;
8385
-
8386
- if (texture == null || texture.resolution < resolution)
83878300 {
8301
+ if (bim == null)
8302
+ texturecache = textures.get(texname); // TEXTURE CACHE
8303
+ else
8304
+ texturecache = bimtextures.get(bim); // TEXTURE CACHE
8305
+ }
8306
+
8307
+ if (texturecache == null || texturecache.resolution < resolution)
8308
+ {
8309
+ TextureData texturedata = null;
8310
+
8311
+ if (bim == null)
8312
+ {
8313
+
8314
+ }
8315
+ else
83888316 if (tex.equals("DEFAULT_TEXTURE")) // ||*/ tex.equals(""))
83898317 {
83908318 assert(!bump);
....@@ -8396,19 +8324,19 @@
83968324 // }
83978325 // else
83988326 // {
8399
- texture = textures.get(tex);
8400
- if (texture == null)
8327
+ texturecache = textures.get(tex);
8328
+ if (texturecache == null)
84018329 {
8402
- texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
8330
+ texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
84038331 }
84048332 // }
84058333 } else
84068334 if (tex.equals("DEFAULT_TEXTURE_BUMP")) // ||*/ tex.equals(""))
84078335 {
84088336 assert(bump);
8409
- texture = textures.get(tex);
8410
- if (texture == null)
8411
- texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
8337
+ texturecache = textures.get(tex);
8338
+ if (texturecache == null)
8339
+ texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
84128340 } else
84138341 {
84148342 //if (tex.equals("IMMORTAL"))
....@@ -8418,9 +8346,9 @@
84188346 //{
84198347 if (tex.equals("WHITE_NOISE"))
84208348 {
8421
- texture = textures.get(tex);
8422
- if (texture == null)
8423
- texture = new CacheTexture(GetResourceTexture("whitenoise.png", bump),resolution);
8349
+ texturecache = textures.get(tex);
8350
+ if (texturecache == null)
8351
+ texturecache = new CacheTexture(GetResourceTexture("whitenoise.png", bump),resolution);
84248352 } else
84258353 {
84268354 if (textureon)
....@@ -8479,19 +8407,19 @@
84798407 if (texturedata == null)
84808408 throw new Exception();
84818409
8482
- texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
8410
+ texturecache = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
84838411 //texture = GetTexture(tex, bump);
84848412 }
84858413 }
84868414 //}
84878415 }
84888416
8489
- if (/*CACHETEXTURE &&*/ texture != null && textureon)
8417
+ if (/*CACHETEXTURE &&*/ texturecache != null && textureon)
84908418 {
84918419 //return false;
84928420
84938421 // System.out.println("CACHE +++++++++++++++ TEXTURE : " + texname + " (" + texture.getEstimatedMemorySize() + ")");
8494
- if (texturedata != null && (texname.endsWith(".jpg") || texname.endsWith(".JPG")))
8422
+ if (texturedata != null && texname.toLowerCase().endsWith(".jpg"))
84958423 {
84968424 // String ext = "_highres";
84978425 // if (REDUCETEXTURE)
....@@ -8580,8 +8508,8 @@
85808508 textures.remove(texname);
85818509 }
85828510
8583
- texture.texturedata = texturedata;
8584
- textures.put(texname, texture);
8511
+ //texture.texturedata = texturedata;
8512
+ textures.put(texname, texturecache);
85858513
85868514 // newtex = true;
85878515 }
....@@ -8597,12 +8525,12 @@
85978525 }
85988526 }
85998527
8600
- return texture;
8528
+ return texturecache;
86018529 }
86028530
8603
- com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception
8531
+ com.sun.opengl.util.texture.Texture GetTexture(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception
86048532 {
8605
- CacheTexture texture = GetCacheTexture(tex, bump, resolution);
8533
+ CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution);
86068534
86078535 if (bump)
86088536 {
....@@ -8618,23 +8546,23 @@
86188546 return texture!=null?texture.texture:null;
86198547 }
86208548
8621
- public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception
8549
+ public com.sun.opengl.util.texture.TextureData GetTextureData(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception
86228550 {
8623
- CacheTexture texture = GetCacheTexture(tex, bump, resolution);
8551
+ CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution);
86248552
86258553 return texture!=null?texture.texturedata:null;
86268554 }
86278555
8628
- boolean BindTexture(String tex, boolean bump, int resolution) throws Exception
8556
+ boolean BindTexture(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception
86298557 {
86308558 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
86318559 {
86328560 return false;
86338561 }
86348562
8635
- boolean newtex = false;
8563
+ //boolean newtex = false;
86368564
8637
- com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
8565
+ com.sun.opengl.util.texture.Texture texture = GetTexture(stream, tex, bump, resolution);
86388566
86398567 if (texture == null)
86408568 return false;
....@@ -8664,7 +8592,7 @@
86648592 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT);
86658593 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT);
86668594
8667
- return newtex;
8595
+ return true; // Warning: not used.
86688596 }
86698597
86708598 ShadowBuffer shadowPBuf;
....@@ -11121,7 +11049,7 @@
1112111049
1112211050 try
1112311051 {
11124
- BindTexture(NOISE_TEXTURE, false, 2);
11052
+ BindTexture(null, NOISE_TEXTURE, false, 2);
1112511053 }
1112611054 catch (Exception e)
1112711055 {
....@@ -11150,9 +11078,9 @@
1115011078
1115111079 gl.glMatrixMode(GL.GL_MODELVIEW);
1115211080
11153
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11154
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
11155
-//gl.glEnable(gl.GL_MULTISAMPLE);
11081
+gl.glEnable(gl.GL_POLYGON_SMOOTH);
11082
+gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11083
+gl.glEnable(gl.GL_MULTISAMPLE);
1115611084 } else
1115711085 {
1115811086 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -11163,7 +11091,7 @@
1116311091 //System.out.println("BLENDING ON");
1116411092 gl.glEnable(GL.GL_BLEND);
1116511093 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
11166
-
11094
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1116711095 gl.glMatrixMode(gl.GL_PROJECTION);
1116811096 gl.glLoadIdentity();
1116911097
....@@ -11649,7 +11577,7 @@
1164911577 if ((TRACK || SHADOWTRACK) || zoomonce)
1165011578 {
1165111579 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11652
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11580
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1165311581 pingthread.StepToTarget(true); // true);
1165411582 // zoomonce = false;
1165511583 }
....@@ -11786,7 +11714,7 @@
1178611714 if (tex.equals("WHITE_NOISE"))
1178711715 continue;
1178811716
11789
- if (!usedtextures.containsKey(tex))
11717
+ if (!usedtextures.contains(tex))
1179011718 {
1179111719 // System.out.println("DISPOSE +++++++++++++++ " + tex);
1179211720 textures.get(tex).texture.dispose();
....@@ -14065,7 +13993,7 @@
1406513993
1406613994 // fev 2014???
1406713995 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
14068
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13996
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1406913997 pingthread.StepToTarget(true); // true);
1407013998 }
1407113999 // if (!LIVE)
....@@ -14419,12 +14347,12 @@
1441914347 void GoDown(int mod)
1442014348 {
1442114349 MODIFIERS |= COMMAND;
14422
- /*
14350
+ /**/
1442314351 if((mod&SHIFT) == SHIFT)
1442414352 manipCamera.RotatePosition(0, -speed);
1442514353 else
14426
- manipCamera.BackForth(0, -speed*delta, getWidth());
14427
- */
14354
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14355
+ /**/
1442814356 if ((mod & SHIFT) == SHIFT)
1442914357 {
1443014358 mouseMode = mouseMode; // VR??
....@@ -14440,12 +14368,12 @@
1444014368 void GoUp(int mod)
1444114369 {
1444214370 MODIFIERS |= COMMAND;
14443
- /*
14371
+ /**/
1444414372 if((mod&SHIFT) == SHIFT)
1444514373 manipCamera.RotatePosition(0, speed);
1444614374 else
14447
- manipCamera.BackForth(0, speed*delta, getWidth());
14448
- */
14375
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14376
+ /**/
1444914377 if ((mod & SHIFT) == SHIFT)
1445014378 {
1445114379 mouseMode = mouseMode;
....@@ -14461,12 +14389,12 @@
1446114389 void GoLeft(int mod)
1446214390 {
1446314391 MODIFIERS |= COMMAND;
14464
- /*
14392
+ /**/
1446514393 if((mod&SHIFT) == SHIFT)
14466
- manipCamera.RotatePosition(speed, 0);
14467
- else
1446814394 manipCamera.Translate(speed*delta, 0, getWidth());
14469
- */
14395
+ else
14396
+ manipCamera.RotatePosition(speed, 0);
14397
+ /**/
1447014398 if ((mod & SHIFT) == SHIFT)
1447114399 {
1447214400 mouseMode = mouseMode;
....@@ -14482,12 +14410,12 @@
1448214410 void GoRight(int mod)
1448314411 {
1448414412 MODIFIERS |= COMMAND;
14485
- /*
14413
+ /**/
1448614414 if((mod&SHIFT) == SHIFT)
14487
- manipCamera.RotatePosition(-speed, 0);
14488
- else
1448914415 manipCamera.Translate(-speed*delta, 0, getWidth());
14490
- */
14416
+ else
14417
+ manipCamera.RotatePosition(-speed, 0);
14418
+ /**/
1449114419 if ((mod & SHIFT) == SHIFT)
1449214420 {
1449314421 mouseMode = mouseMode;
....@@ -14726,7 +14654,8 @@
1472614654 Globals.MOUSEDRAGGED = false;
1472714655
1472814656 movingcamera = false;
14729
- X = Y = 0;
14657
+ X = 0; // getBounds().width/2;
14658
+ Y = 0; // getBounds().height/2;
1473014659 //System.out.println("mouseReleased: " + e);
1473114660 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1473214661 }
....@@ -15067,7 +14996,9 @@
1506714996 case 'E' : COMPACT ^= true;
1506814997 repaint();
1506914998 break;
15070
- case 'W' : DEBUGHSB ^= true;
14999
+ case 'W' : // Wide Window (fullscreen)
15000
+ //DEBUGHSB ^= true;
15001
+ ObjEditor.theFrame.ToggleFullScreen();
1507115002 repaint();
1507215003 break;
1507315004 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -15093,13 +15024,7 @@
1509315024 repaint();
1509415025 break;
1509515026 case 'l':
15096
- lightMode ^= true;
15097
- Globals.lighttouched = true;
15098
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15099
- targetLookAt.set(manipCamera.lookAt);
15100
- repaint();
15101
- break;
15102
- case 'L':
15027
+ //case 'L':
1510315028 if (lightMode)
1510415029 {
1510515030 lightMode = false;
....@@ -15246,7 +15171,10 @@
1524615171 // kompactbit = 6;
1524715172 // break;
1524815173 case ' ':
15249
- ObjEditor.theFrame.ToggleFullScreen();
15174
+ lightMode ^= true;
15175
+ Globals.lighttouched = true;
15176
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15177
+ targetLookAt.set(manipCamera.lookAt);
1525015178 repaint();
1525115179 break;
1525215180 //case '`' :
....@@ -15295,12 +15223,6 @@
1529515223 break;
1529615224 case '+':
1529715225
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
-
1530415226 /*
1530515227 //fontsize += 1;
1530615228 bbzoom *= 2;
....@@ -15318,17 +15240,17 @@
1531815240 case '=':
1531915241 IncDepth();
1532015242 //fontsize += 1;
15321
- object.editWindow.refreshContents(true);
15243
+ object.GetWindow().refreshContents(true);
1532215244 maskbit = 6;
1532315245 break;
1532415246 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1532515247 DecDepth();
1532615248 maskbit = 5;
1532715249 //if(fontsize > 1) fontsize -= 1;
15328
- if (object.editWindow == null)
15329
- new Exception().printStackTrace();
15330
- else
15331
- object.editWindow.refreshContents(true);
15250
+// if (object.editWindow == null)
15251
+// new Exception().printStackTrace();
15252
+// else
15253
+ object.GetWindow().refreshContents(true);
1533215254 break;
1533315255 case '{':
1533415256 manipCamera.shaper_fovy /= 1.1;
....@@ -15552,7 +15474,7 @@
1555215474 }
1555315475 */
1555415476
15555
- object.editWindow.EditSelection(false);
15477
+ object.GetWindow().EditSelection(false);
1555615478 }
1555715479
1555815480 void SelectParent()
....@@ -15569,10 +15491,10 @@
1556915491 {
1557015492 //selectees.remove(i);
1557115493 System.out.println("select parent of " + elem);
15572
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15494
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1557315495 } else
1557415496 {
15575
- group.editWindow.Select(elem.GetTreePath(), first, true);
15497
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1557615498 }
1557715499
1557815500 first = false;
....@@ -15614,12 +15536,12 @@
1561415536 for (int j = 0; j < group.children.size(); j++)
1561515537 {
1561615538 elem = (Object3D) group.children.elementAt(j);
15617
- object.editWindow.Select(elem.GetTreePath(), first, true);
15539
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1561815540 first = false;
1561915541 }
1562015542 } else
1562115543 {
15622
- object.editWindow.Select(elem.GetTreePath(), first, true);
15544
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1562315545 }
1562415546
1562515547 first = false;
....@@ -15630,21 +15552,21 @@
1563015552 {
1563115553 //Composite group = (Composite) object;
1563215554 Object3D group = object;
15633
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15555
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1563415556 }
1563515557
1563615558 void ResetTransform(int mask)
1563715559 {
1563815560 //Composite group = (Composite) object;
1563915561 Object3D group = object;
15640
- group.editWindow.ResetTransform(mask);
15562
+ group.GetWindow().ResetTransform(mask);
1564115563 }
1564215564
1564315565 void FlipTransform()
1564415566 {
1564515567 //Composite group = (Composite) object;
1564615568 Object3D group = object;
15647
- group.editWindow.FlipTransform();
15569
+ group.GetWindow().FlipTransform();
1564815570 // group.editWindow.ReduceMesh(true);
1564915571 }
1565015572
....@@ -15652,7 +15574,7 @@
1565215574 {
1565315575 //Composite group = (Composite) object;
1565415576 Object3D group = object;
15655
- group.editWindow.PrintMemory();
15577
+ group.GetWindow().PrintMemory();
1565615578 // group.editWindow.ReduceMesh(true);
1565715579 }
1565815580
....@@ -15660,7 +15582,7 @@
1566015582 {
1566115583 //Composite group = (Composite) object;
1566215584 Object3D group = object;
15663
- group.editWindow.ResetCentroid();
15585
+ group.GetWindow().ResetCentroid();
1566415586 }
1566515587
1566615588 void IncDepth()
....@@ -15836,6 +15758,7 @@
1583615758 info.bounds.y += (height - desired) / 2;
1583715759 }
1583815760 }
15761
+
1583915762 info.g = gr;
1584015763 info.camera = renderCamera;
1584115764 /*
....@@ -15845,23 +15768,44 @@
1584515768 */
1584615769 if (!isRenderer)
1584715770 {
15848
- object.drawEditHandles(info, 0);
15849
-
15850
- if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15771
+ Grafreed.Assert(object != null);
15772
+ Grafreed.Assert(object.selection != null);
15773
+ if (object.selection.Size() > 0)
1585115774 {
15852
- switch (object.selection.get(0).hitSomething)
15775
+ int hitSomething = object.selection.get(0).hitSomething;
15776
+
15777
+ info.DX = 0;
15778
+ info.DY = 0;
15779
+ info.W = 1;
15780
+ if (hitSomething == Object3D.hitCenter)
1585315781 {
15854
- case Object3D.hitCenter: gr.setColor(Color.pink);
15855
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15856
- break;
15857
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15858
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15859
- break;
15860
- case Object3D.hitScale: gr.setColor(Color.cyan);
15861
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15862
- break;
15782
+ info.DX = X;
15783
+ if (X != 0)
15784
+ info.DX -= info.bounds.width/2;
15785
+
15786
+ info.DY = Y;
15787
+ if (Y != 0)
15788
+ info.DY -= info.bounds.height/2;
1586315789 }
15864
-
15790
+
15791
+ object.drawEditHandles(info, 0);
15792
+
15793
+ if (drag && (X != 0 || Y != 0))
15794
+ {
15795
+ switch (hitSomething)
15796
+ {
15797
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15798
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15799
+ break;
15800
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15801
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15802
+ break;
15803
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15804
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15805
+ break;
15806
+ }
15807
+
15808
+ }
1586515809 }
1586615810 }
1586715811 }
....@@ -16659,6 +16603,14 @@
1665916603 }
1666016604 }
1666116605
16606
+ private Object3D GetFolder()
16607
+ {
16608
+ Object3D folder = object.GetWindow().copy;
16609
+ if (object.GetWindow().copy.selection.Size() > 0)
16610
+ folder = object.GetWindow().copy.selection.elementAt(0);
16611
+ return folder;
16612
+ }
16613
+
1666216614 class SelectBuffer implements GLEventListener
1666316615 {
1666416616
....@@ -16738,6 +16690,17 @@
1673816690
1673916691 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1674016692
16693
+ if (PAINTMODE)
16694
+ {
16695
+ if (object.GetWindow().copy.selection.Size() > 0)
16696
+ {
16697
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
16698
+
16699
+ // Make what you paint not selectable.
16700
+ paintobj.ResetSelectable();
16701
+ }
16702
+ }
16703
+
1674116704 //int tmp = selection_view;
1674216705 //selection_view = -1;
1674316706 int temp = DrawMode();
....@@ -16749,6 +16712,17 @@
1674916712 // temp = DEFAULT; // patch for selection debug
1675016713 Globals.drawMode = temp; // WARNING
1675116714
16715
+ if (PAINTMODE)
16716
+ {
16717
+ if (object.GetWindow().copy.selection.Size() > 0)
16718
+ {
16719
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
16720
+
16721
+ // Revert.
16722
+ paintobj.RestoreSelectable();
16723
+ }
16724
+ }
16725
+
1675216726 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1675316727
1675416728 // trying different ways of getting the depth info over
....@@ -16852,29 +16826,31 @@
1685216826 }
1685316827
1685416828 if (!movingcamera && !PAINTMODE)
16855
- object.editWindow.ScreenFitPoint(); // fev 2014
16829
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1685616830
16857
- if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16831
+ if (PAINTMODE) // && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1685816832 {
16859
- Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16833
+ //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1686016834
16861
- Object3D group = new Object3D("inst" + paintcount++);
16835
+ if (object.GetWindow().copy.selection.Size() > 0)
16836
+ {
16837
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1686216838
16863
- group.CreateMaterial(); // use a void leaf to select instances
16864
-
16865
- group.add(paintobj); // link
16866
-
16867
- object.editWindow.SnapObject(group);
16868
-
16869
- Object3D folder = object.editWindow.copy;
16870
-
16871
- if (object.editWindow.copy.selection.Size() > 0)
16872
- folder = object.editWindow.copy.selection.elementAt(0);
16873
-
16874
- folder.add(group);
16875
-
16876
- object.editWindow.ResetModel();
16877
- object.editWindow.refreshContents();
16839
+ Object3D inst = new Object3D("inst" + paintcount++);
16840
+
16841
+ inst.CreateMaterial(); // use a void leaf to select instances
16842
+
16843
+ inst.add(paintobj); // link
16844
+
16845
+ object.GetWindow().SnapObject(inst);
16846
+
16847
+ Object3D folder = paintFolder; // GetFolder();
16848
+
16849
+ folder.add(inst);
16850
+
16851
+ object.GetWindow().ResetModel();
16852
+ object.GetWindow().refreshContents();
16853
+ }
1687816854 }
1687916855 else
1688016856 paintcount = 0;