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)
....@@ -2415,9 +2422,10 @@
24152422 /**/
24162423
24172424 // TEXTURE static Texture texture;
2418
- static public java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/> textures
2419
- = new java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/>();
2420
- 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
+
24212429 int pigmentdepth = 0;
24222430 public com.sun.opengl.util.texture.Texture[] pigmentstack = new com.sun.opengl.util.texture.Texture[65536];
24232431 int bumpdepth = 0;
....@@ -2439,6 +2447,33 @@
24392447 true,
24402448 com.sun.opengl.util.texture.TextureIO.PNG);
24412449 } 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)
24422477 {
24432478 throw new javax.media.opengl.GLException(e);
24442479 }
....@@ -3525,6 +3560,8 @@
35253560
35263561 System.out.println("LOADING TEXTURE : " + name);
35273562
3563
+ Object x = texturedata.getMipmapData(); // .getBuffer();
3564
+
35283565 //
35293566 if (false) // compressbit > 0)
35303567 {
....@@ -7923,7 +7960,7 @@
79237960 String pigment = Object3D.GetPigment(tex);
79247961 String bump = Object3D.GetBump(tex);
79257962
7926
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7963
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79277964 {
79287965 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79297966 // System.out.println("; bump = " + bump);
....@@ -7957,7 +7994,7 @@
79577994
79587995 String pigment = Object3D.GetPigment(tex);
79597996
7960
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7997
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79617998 {
79627999 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79638000 // System.out.println("; bump = " + bump);
....@@ -7986,7 +8023,7 @@
79868023
79878024 String bump = Object3D.GetBump(tex);
79888025
7989
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8026
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79908027 {
79918028 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79928029 // System.out.println("; bump = " + bump);
....@@ -8105,47 +8142,50 @@
81058142
81068143 /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
81078144 {
8108
- if (// DrawMode() != 0 || /*tex == null ||*/
8109
- ambientOcclusion ) // || !textureon)
8110
- {
8111
- return; // false;
8112
- }
8113
-
8114
- if (tex == null)
8115
- {
8116
- BindTexture(null,false,resolution);
8117
- BindTexture(null,true,resolution);
8118
- return;
8119
- }
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;
81208186
8121
- String pigment = Object3D.GetPigment(tex);
8122
- String bump = Object3D.GetBump(tex);
8123
-
8124
- usedtextures.put(pigment, pigment);
8125
- usedtextures.put(bump, bump);
8126
-
8127
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8128
- {
8129
- // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8130
- // System.out.println("; bump = " + bump);
8131
- }
8132
-
8133
- if (bump.equals(""))
8134
- {
8135
- bump = null;
8136
- }
8137
- if (pigment.equals(""))
8138
- {
8139
- pigment = null;
8140
- }
8141
-
8142
- GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8143
- BindTexture(pigment, false, resolution);
8144
- GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8145
- BindTexture(bump, true, resolution);
8146
- GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8147
-
8148
- return; // true;
8187
+ BindPigmentTexture(tex, resolution);
8188
+ BindBumpTexture(tex, resolution);
81498189 }
81508190
81518191 /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE
....@@ -8158,15 +8198,15 @@
81588198
81598199 if (tex == null)
81608200 {
8161
- BindTexture(null,false,resolution);
8201
+ BindTexture(null, null,false,resolution);
81628202 return;
81638203 }
81648204
81658205 String pigment = Object3D.GetPigment(tex);
81668206
8167
- usedtextures.put(pigment, pigment);
8207
+ usedtextures.add(pigment);
81688208
8169
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8209
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81708210 {
81718211 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81728212 // System.out.println("; bump = " + bump);
....@@ -8178,7 +8218,7 @@
81788218 }
81798219
81808220 GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8181
- BindTexture(pigment, false, resolution);
8221
+ BindTexture(tex.pigmenttexture, pigment, false, resolution);
81828222 }
81838223
81848224 /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE
....@@ -8191,15 +8231,15 @@
81918231
81928232 if (tex == null)
81938233 {
8194
- BindTexture(null,true,resolution);
8234
+ BindTexture(null, null,true,resolution);
81958235 return;
81968236 }
81978237
81988238 String bump = Object3D.GetBump(tex);
81998239
8200
- usedtextures.put(bump, bump);
8240
+ usedtextures.add(bump);
82018241
8202
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8242
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
82038243 {
82048244 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
82058245 // System.out.println("; bump = " + bump);
....@@ -8211,7 +8251,7 @@
82118251 }
82128252
82138253 GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8214
- BindTexture(bump, true, resolution);
8254
+ BindTexture(tex.bumptexture, bump, true, resolution);
82158255 GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
82168256 }
82178257
....@@ -8235,9 +8275,9 @@
82358275 return fileExists;
82368276 }
82378277
8238
- 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
82398279 {
8240
- CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
8280
+ CacheTexture texturecache = null;
82418281
82428282 if (tex != null)
82438283 {
....@@ -8257,12 +8297,22 @@
82578297 }
82588298
82598299 if (CACHETEXTURE)
8260
- texture = textures.get(texname); // TEXTURE CACHE
8261
-
8262
- TextureData texturedata = null;
8263
-
8264
- if (texture == null || texture.resolution < resolution)
82658300 {
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
82668316 if (tex.equals("DEFAULT_TEXTURE")) // ||*/ tex.equals(""))
82678317 {
82688318 assert(!bump);
....@@ -8274,19 +8324,19 @@
82748324 // }
82758325 // else
82768326 // {
8277
- texture = textures.get(tex);
8278
- if (texture == null)
8327
+ texturecache = textures.get(tex);
8328
+ if (texturecache == null)
82798329 {
8280
- texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
8330
+ texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
82818331 }
82828332 // }
82838333 } else
82848334 if (tex.equals("DEFAULT_TEXTURE_BUMP")) // ||*/ tex.equals(""))
82858335 {
82868336 assert(bump);
8287
- texture = textures.get(tex);
8288
- if (texture == null)
8289
- 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);
82908340 } else
82918341 {
82928342 //if (tex.equals("IMMORTAL"))
....@@ -8296,9 +8346,9 @@
82968346 //{
82978347 if (tex.equals("WHITE_NOISE"))
82988348 {
8299
- texture = textures.get(tex);
8300
- if (texture == null)
8301
- 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);
83028352 } else
83038353 {
83048354 if (textureon)
....@@ -8357,19 +8407,19 @@
83578407 if (texturedata == null)
83588408 throw new Exception();
83598409
8360
- 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);
83618411 //texture = GetTexture(tex, bump);
83628412 }
83638413 }
83648414 //}
83658415 }
83668416
8367
- if (/*CACHETEXTURE &&*/ texture != null && textureon)
8417
+ if (/*CACHETEXTURE &&*/ texturecache != null && textureon)
83688418 {
83698419 //return false;
83708420
83718421 // System.out.println("CACHE +++++++++++++++ TEXTURE : " + texname + " (" + texture.getEstimatedMemorySize() + ")");
8372
- if (texturedata != null && (texname.endsWith(".jpg") || texname.endsWith(".JPG")))
8422
+ if (texturedata != null && texname.toLowerCase().endsWith(".jpg"))
83738423 {
83748424 // String ext = "_highres";
83758425 // if (REDUCETEXTURE)
....@@ -8458,8 +8508,8 @@
84588508 textures.remove(texname);
84598509 }
84608510
8461
- texture.texturedata = texturedata;
8462
- textures.put(texname, texture);
8511
+ //texture.texturedata = texturedata;
8512
+ textures.put(texname, texturecache);
84638513
84648514 // newtex = true;
84658515 }
....@@ -8475,12 +8525,12 @@
84758525 }
84768526 }
84778527
8478
- return texture;
8528
+ return texturecache;
84798529 }
84808530
8481
- 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
84828532 {
8483
- CacheTexture texture = GetCacheTexture(tex, bump, resolution);
8533
+ CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution);
84848534
84858535 if (bump)
84868536 {
....@@ -8496,23 +8546,23 @@
84968546 return texture!=null?texture.texture:null;
84978547 }
84988548
8499
- 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
85008550 {
8501
- CacheTexture texture = GetCacheTexture(tex, bump, resolution);
8551
+ CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution);
85028552
85038553 return texture!=null?texture.texturedata:null;
85048554 }
85058555
8506
- 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
85078557 {
85088558 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
85098559 {
85108560 return false;
85118561 }
85128562
8513
- boolean newtex = false;
8563
+ //boolean newtex = false;
85148564
8515
- com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
8565
+ com.sun.opengl.util.texture.Texture texture = GetTexture(stream, tex, bump, resolution);
85168566
85178567 if (texture == null)
85188568 return false;
....@@ -8542,7 +8592,7 @@
85428592 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT);
85438593 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT);
85448594
8545
- return newtex;
8595
+ return true; // Warning: not used.
85468596 }
85478597
85488598 ShadowBuffer shadowPBuf;
....@@ -10999,7 +11049,7 @@
1099911049
1100011050 try
1100111051 {
11002
- BindTexture(NOISE_TEXTURE, false, 2);
11052
+ BindTexture(null, NOISE_TEXTURE, false, 2);
1100311053 }
1100411054 catch (Exception e)
1100511055 {
....@@ -11028,9 +11078,9 @@
1102811078
1102911079 gl.glMatrixMode(GL.GL_MODELVIEW);
1103011080
11031
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11032
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
11033
-//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);
1103411084 } else
1103511085 {
1103611086 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -11041,7 +11091,7 @@
1104111091 //System.out.println("BLENDING ON");
1104211092 gl.glEnable(GL.GL_BLEND);
1104311093 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
11044
-
11094
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1104511095 gl.glMatrixMode(gl.GL_PROJECTION);
1104611096 gl.glLoadIdentity();
1104711097
....@@ -11527,7 +11577,7 @@
1152711577 if ((TRACK || SHADOWTRACK) || zoomonce)
1152811578 {
1152911579 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11530
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11580
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1153111581 pingthread.StepToTarget(true); // true);
1153211582 // zoomonce = false;
1153311583 }
....@@ -11664,7 +11714,7 @@
1166411714 if (tex.equals("WHITE_NOISE"))
1166511715 continue;
1166611716
11667
- if (!usedtextures.containsKey(tex))
11717
+ if (!usedtextures.contains(tex))
1166811718 {
1166911719 // System.out.println("DISPOSE +++++++++++++++ " + tex);
1167011720 textures.get(tex).texture.dispose();
....@@ -13375,9 +13425,10 @@
1337513425 "DP3 " + dest + ".z," + "normals," + "eye;" +
1337613426 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1337713427 //"MOV " + dest + ".w," + "normal.z;" +
13378
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13379
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13380
- //"MOV " + dest + ".z," + "params2.w;" +
13428
+// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET
13429
+// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13430
+
13431
+ "MOV " + dest + ".z," + "params2.w;" + // EXACT
1338113432 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1338213433 "RCP " + dest + ".w," + dest + ".w;" +
1338313434 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13942,7 +13993,7 @@
1394213993
1394313994 // fev 2014???
1394413995 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13945
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13996
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1394613997 pingthread.StepToTarget(true); // true);
1394713998 }
1394813999 // if (!LIVE)
....@@ -14296,12 +14347,12 @@
1429614347 void GoDown(int mod)
1429714348 {
1429814349 MODIFIERS |= COMMAND;
14299
- /*
14350
+ /**/
1430014351 if((mod&SHIFT) == SHIFT)
1430114352 manipCamera.RotatePosition(0, -speed);
1430214353 else
14303
- manipCamera.BackForth(0, -speed*delta, getWidth());
14304
- */
14354
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14355
+ /**/
1430514356 if ((mod & SHIFT) == SHIFT)
1430614357 {
1430714358 mouseMode = mouseMode; // VR??
....@@ -14317,12 +14368,12 @@
1431714368 void GoUp(int mod)
1431814369 {
1431914370 MODIFIERS |= COMMAND;
14320
- /*
14371
+ /**/
1432114372 if((mod&SHIFT) == SHIFT)
1432214373 manipCamera.RotatePosition(0, speed);
1432314374 else
14324
- manipCamera.BackForth(0, speed*delta, getWidth());
14325
- */
14375
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14376
+ /**/
1432614377 if ((mod & SHIFT) == SHIFT)
1432714378 {
1432814379 mouseMode = mouseMode;
....@@ -14338,12 +14389,12 @@
1433814389 void GoLeft(int mod)
1433914390 {
1434014391 MODIFIERS |= COMMAND;
14341
- /*
14392
+ /**/
1434214393 if((mod&SHIFT) == SHIFT)
14343
- manipCamera.RotatePosition(speed, 0);
14344
- else
1434514394 manipCamera.Translate(speed*delta, 0, getWidth());
14346
- */
14395
+ else
14396
+ manipCamera.RotatePosition(speed, 0);
14397
+ /**/
1434714398 if ((mod & SHIFT) == SHIFT)
1434814399 {
1434914400 mouseMode = mouseMode;
....@@ -14359,12 +14410,12 @@
1435914410 void GoRight(int mod)
1436014411 {
1436114412 MODIFIERS |= COMMAND;
14362
- /*
14413
+ /**/
1436314414 if((mod&SHIFT) == SHIFT)
14364
- manipCamera.RotatePosition(-speed, 0);
14365
- else
1436614415 manipCamera.Translate(-speed*delta, 0, getWidth());
14367
- */
14416
+ else
14417
+ manipCamera.RotatePosition(-speed, 0);
14418
+ /**/
1436814419 if ((mod & SHIFT) == SHIFT)
1436914420 {
1437014421 mouseMode = mouseMode;
....@@ -14603,7 +14654,8 @@
1460314654 Globals.MOUSEDRAGGED = false;
1460414655
1460514656 movingcamera = false;
14606
- X = Y = 0;
14657
+ X = 0; // getBounds().width/2;
14658
+ Y = 0; // getBounds().height/2;
1460714659 //System.out.println("mouseReleased: " + e);
1460814660 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1460914661 }
....@@ -14944,7 +14996,9 @@
1494414996 case 'E' : COMPACT ^= true;
1494514997 repaint();
1494614998 break;
14947
- case 'W' : DEBUGHSB ^= true;
14999
+ case 'W' : // Wide Window (fullscreen)
15000
+ //DEBUGHSB ^= true;
15001
+ ObjEditor.theFrame.ToggleFullScreen();
1494815002 repaint();
1494915003 break;
1495015004 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14970,13 +15024,7 @@
1497015024 repaint();
1497115025 break;
1497215026 case 'l':
14973
- lightMode ^= true;
14974
- Globals.lighttouched = true;
14975
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14976
- targetLookAt.set(manipCamera.lookAt);
14977
- repaint();
14978
- break;
14979
- case 'L':
15027
+ //case 'L':
1498015028 if (lightMode)
1498115029 {
1498215030 lightMode = false;
....@@ -15119,11 +15167,14 @@
1511915167 case '_':
1512015168 kompactbit = 5;
1512115169 break;
15122
- case '+':
15123
- kompactbit = 6;
15124
- break;
15170
+// case '+':
15171
+// kompactbit = 6;
15172
+// break;
1512515173 case ' ':
15126
- ObjEditor.theFrame.ToggleFullScreen();
15174
+ lightMode ^= true;
15175
+ Globals.lighttouched = true;
15176
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15177
+ targetLookAt.set(manipCamera.lookAt);
1512715178 repaint();
1512815179 break;
1512915180 //case '`' :
....@@ -15170,8 +15221,9 @@
1517015221 case DELETE:
1517115222 ClearSelection();
1517215223 break;
15173
- /*
1517415224 case '+':
15225
+
15226
+ /*
1517515227 //fontsize += 1;
1517615228 bbzoom *= 2;
1517715229 repaint();
....@@ -15188,17 +15240,17 @@
1518815240 case '=':
1518915241 IncDepth();
1519015242 //fontsize += 1;
15191
- object.editWindow.refreshContents(true);
15243
+ object.GetWindow().refreshContents(true);
1519215244 maskbit = 6;
1519315245 break;
1519415246 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1519515247 DecDepth();
1519615248 maskbit = 5;
1519715249 //if(fontsize > 1) fontsize -= 1;
15198
- if (object.editWindow == null)
15199
- new Exception().printStackTrace();
15200
- else
15201
- object.editWindow.refreshContents(true);
15250
+// if (object.editWindow == null)
15251
+// new Exception().printStackTrace();
15252
+// else
15253
+ object.GetWindow().refreshContents(true);
1520215254 break;
1520315255 case '{':
1520415256 manipCamera.shaper_fovy /= 1.1;
....@@ -15422,7 +15474,7 @@
1542215474 }
1542315475 */
1542415476
15425
- object.editWindow.EditSelection(false);
15477
+ object.GetWindow().EditSelection(false);
1542615478 }
1542715479
1542815480 void SelectParent()
....@@ -15439,10 +15491,10 @@
1543915491 {
1544015492 //selectees.remove(i);
1544115493 System.out.println("select parent of " + elem);
15442
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15494
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1544315495 } else
1544415496 {
15445
- group.editWindow.Select(elem.GetTreePath(), first, true);
15497
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1544615498 }
1544715499
1544815500 first = false;
....@@ -15484,12 +15536,12 @@
1548415536 for (int j = 0; j < group.children.size(); j++)
1548515537 {
1548615538 elem = (Object3D) group.children.elementAt(j);
15487
- object.editWindow.Select(elem.GetTreePath(), first, true);
15539
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1548815540 first = false;
1548915541 }
1549015542 } else
1549115543 {
15492
- object.editWindow.Select(elem.GetTreePath(), first, true);
15544
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1549315545 }
1549415546
1549515547 first = false;
....@@ -15500,21 +15552,21 @@
1550015552 {
1550115553 //Composite group = (Composite) object;
1550215554 Object3D group = object;
15503
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15555
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1550415556 }
1550515557
1550615558 void ResetTransform(int mask)
1550715559 {
1550815560 //Composite group = (Composite) object;
1550915561 Object3D group = object;
15510
- group.editWindow.ResetTransform(mask);
15562
+ group.GetWindow().ResetTransform(mask);
1551115563 }
1551215564
1551315565 void FlipTransform()
1551415566 {
1551515567 //Composite group = (Composite) object;
1551615568 Object3D group = object;
15517
- group.editWindow.FlipTransform();
15569
+ group.GetWindow().FlipTransform();
1551815570 // group.editWindow.ReduceMesh(true);
1551915571 }
1552015572
....@@ -15522,7 +15574,7 @@
1552215574 {
1552315575 //Composite group = (Composite) object;
1552415576 Object3D group = object;
15525
- group.editWindow.PrintMemory();
15577
+ group.GetWindow().PrintMemory();
1552615578 // group.editWindow.ReduceMesh(true);
1552715579 }
1552815580
....@@ -15530,7 +15582,7 @@
1553015582 {
1553115583 //Composite group = (Composite) object;
1553215584 Object3D group = object;
15533
- group.editWindow.ResetCentroid();
15585
+ group.GetWindow().ResetCentroid();
1553415586 }
1553515587
1553615588 void IncDepth()
....@@ -15706,6 +15758,7 @@
1570615758 info.bounds.y += (height - desired) / 2;
1570715759 }
1570815760 }
15761
+
1570915762 info.g = gr;
1571015763 info.camera = renderCamera;
1571115764 /*
....@@ -15715,23 +15768,44 @@
1571515768 */
1571615769 if (!isRenderer)
1571715770 {
15718
- object.drawEditHandles(info, 0);
15719
-
15720
- 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)
1572115774 {
15722
- 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)
1572315781 {
15724
- case Object3D.hitCenter: gr.setColor(Color.pink);
15725
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15726
- break;
15727
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15728
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15729
- break;
15730
- case Object3D.hitScale: gr.setColor(Color.cyan);
15731
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15732
- 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;
1573315789 }
15734
-
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
+ }
1573515809 }
1573615810 }
1573715811 }
....@@ -16529,6 +16603,14 @@
1652916603 }
1653016604 }
1653116605
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
+
1653216614 class SelectBuffer implements GLEventListener
1653316615 {
1653416616
....@@ -16608,6 +16690,17 @@
1660816690
1660916691 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1661016692
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
+
1661116704 //int tmp = selection_view;
1661216705 //selection_view = -1;
1661316706 int temp = DrawMode();
....@@ -16619,6 +16712,17 @@
1661916712 // temp = DEFAULT; // patch for selection debug
1662016713 Globals.drawMode = temp; // WARNING
1662116714
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
+
1662216726 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1662316727
1662416728 // trying different ways of getting the depth info over
....@@ -16722,29 +16826,31 @@
1672216826 }
1672316827
1672416828 if (!movingcamera && !PAINTMODE)
16725
- object.editWindow.ScreenFitPoint(); // fev 2014
16829
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1672616830
16727
- 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)
1672816832 {
16729
- 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);
1673016834
16731
- Object3D group = new Object3D("inst" + paintcount++);
16835
+ if (object.GetWindow().copy.selection.Size() > 0)
16836
+ {
16837
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1673216838
16733
- group.CreateMaterial(); // use a void leaf to select instances
16734
-
16735
- group.add(paintobj); // link
16736
-
16737
- object.editWindow.SnapObject(group);
16738
-
16739
- Object3D folder = object.editWindow.copy;
16740
-
16741
- if (object.editWindow.copy.selection.Size() > 0)
16742
- folder = object.editWindow.copy.selection.elementAt(0);
16743
-
16744
- folder.add(group);
16745
-
16746
- object.editWindow.ResetModel();
16747
- 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
+ }
1674816854 }
1674916855 else
1675016856 paintcount = 0;
....@@ -16783,6 +16889,11 @@
1678316889 //System.out.println("objects[color] = " + objects[color]);
1678416890 //objects[color].Select();
1678516891 indexcount = 0;
16892
+ ObjEditor window = object.GetWindow();
16893
+ if (window != null && deselect)
16894
+ {
16895
+ window.Select(null, deselect, true);
16896
+ }
1678616897 object.Select(color, deselect);
1678716898 }
1678816899