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;
....@@ -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;
....@@ -2051,7 +2065,7 @@
20512065 //System.err.println("Oeil on");
20522066 OEIL = true;
20532067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2054
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20552069 //pingthread.StepToTarget(true);
20562070 }
20572071
....@@ -2284,10 +2298,17 @@
22842298 HANDLES ^= true;
22852299 }
22862300
2301
+ Object3D paintFolder;
2302
+
22872303 void TogglePaint()
22882304 {
22892305 PAINTMODE ^= true;
22902306 paintcount = 0;
2307
+
2308
+ if (PAINTMODE)
2309
+ {
2310
+ paintFolder = GetFolder();
2311
+ }
22912312 }
22922313
22932314 void SwapCamera(int a, int b)
....@@ -2401,9 +2422,10 @@
24012422 /**/
24022423
24032424 // TEXTURE static Texture texture;
2404
- static public java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/> textures
2405
- = new java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/>();
2406
- 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
+
24072429 int pigmentdepth = 0;
24082430 public com.sun.opengl.util.texture.Texture[] pigmentstack = new com.sun.opengl.util.texture.Texture[65536];
24092431 int bumpdepth = 0;
....@@ -2425,6 +2447,33 @@
24252447 true,
24262448 com.sun.opengl.util.texture.TextureIO.PNG);
24272449 } 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)
24282477 {
24292478 throw new javax.media.opengl.GLException(e);
24302479 }
....@@ -3511,6 +3560,8 @@
35113560
35123561 System.out.println("LOADING TEXTURE : " + name);
35133562
3563
+ Object x = texturedata.getMipmapData(); // .getBuffer();
3564
+
35143565 //
35153566 if (false) // compressbit > 0)
35163567 {
....@@ -7909,7 +7960,7 @@
79097960 String pigment = Object3D.GetPigment(tex);
79107961 String bump = Object3D.GetBump(tex);
79117962
7912
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7963
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79137964 {
79147965 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79157966 // System.out.println("; bump = " + bump);
....@@ -7943,7 +7994,7 @@
79437994
79447995 String pigment = Object3D.GetPigment(tex);
79457996
7946
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7997
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79477998 {
79487999 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79498000 // System.out.println("; bump = " + bump);
....@@ -7972,7 +8023,7 @@
79728023
79738024 String bump = Object3D.GetBump(tex);
79748025
7975
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8026
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79768027 {
79778028 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79788029 // System.out.println("; bump = " + bump);
....@@ -8091,47 +8142,50 @@
80918142
80928143 /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
80938144 {
8094
- if (// DrawMode() != 0 || /*tex == null ||*/
8095
- ambientOcclusion ) // || !textureon)
8096
- {
8097
- return; // false;
8098
- }
8099
-
8100
- if (tex == null)
8101
- {
8102
- BindTexture(null,false,resolution);
8103
- BindTexture(null,true,resolution);
8104
- return;
8105
- }
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;
81068186
8107
- String pigment = Object3D.GetPigment(tex);
8108
- String bump = Object3D.GetBump(tex);
8109
-
8110
- usedtextures.put(pigment, pigment);
8111
- usedtextures.put(bump, bump);
8112
-
8113
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8114
- {
8115
- // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8116
- // System.out.println("; bump = " + bump);
8117
- }
8118
-
8119
- if (bump.equals(""))
8120
- {
8121
- bump = null;
8122
- }
8123
- if (pigment.equals(""))
8124
- {
8125
- pigment = null;
8126
- }
8127
-
8128
- GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8129
- BindTexture(pigment, false, resolution);
8130
- GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8131
- BindTexture(bump, true, resolution);
8132
- GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8133
-
8134
- return; // true;
8187
+ BindPigmentTexture(tex, resolution);
8188
+ BindBumpTexture(tex, resolution);
81358189 }
81368190
81378191 /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE
....@@ -8144,15 +8198,15 @@
81448198
81458199 if (tex == null)
81468200 {
8147
- BindTexture(null,false,resolution);
8201
+ BindTexture(null, null,false,resolution);
81488202 return;
81498203 }
81508204
81518205 String pigment = Object3D.GetPigment(tex);
81528206
8153
- usedtextures.put(pigment, pigment);
8207
+ usedtextures.add(pigment);
81548208
8155
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8209
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81568210 {
81578211 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81588212 // System.out.println("; bump = " + bump);
....@@ -8164,7 +8218,7 @@
81648218 }
81658219
81668220 GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8167
- BindTexture(pigment, false, resolution);
8221
+ BindTexture(tex.pigmenttexture, pigment, false, resolution);
81688222 }
81698223
81708224 /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE
....@@ -8177,15 +8231,15 @@
81778231
81788232 if (tex == null)
81798233 {
8180
- BindTexture(null,true,resolution);
8234
+ BindTexture(null, null,true,resolution);
81818235 return;
81828236 }
81838237
81848238 String bump = Object3D.GetBump(tex);
81858239
8186
- usedtextures.put(bump, bump);
8240
+ usedtextures.add(bump);
81878241
8188
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8242
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81898243 {
81908244 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81918245 // System.out.println("; bump = " + bump);
....@@ -8197,7 +8251,7 @@
81978251 }
81988252
81998253 GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8200
- BindTexture(bump, true, resolution);
8254
+ BindTexture(tex.bumptexture, bump, true, resolution);
82018255 GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
82028256 }
82038257
....@@ -8221,9 +8275,9 @@
82218275 return fileExists;
82228276 }
82238277
8224
- 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
82258279 {
8226
- CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
8280
+ CacheTexture texturecache = null;
82278281
82288282 if (tex != null)
82298283 {
....@@ -8243,12 +8297,22 @@
82438297 }
82448298
82458299 if (CACHETEXTURE)
8246
- texture = textures.get(texname); // TEXTURE CACHE
8247
-
8248
- TextureData texturedata = null;
8249
-
8250
- if (texture == null || texture.resolution < resolution)
82518300 {
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
82528316 if (tex.equals("DEFAULT_TEXTURE")) // ||*/ tex.equals(""))
82538317 {
82548318 assert(!bump);
....@@ -8260,19 +8324,19 @@
82608324 // }
82618325 // else
82628326 // {
8263
- texture = textures.get(tex);
8264
- if (texture == null)
8327
+ texturecache = textures.get(tex);
8328
+ if (texturecache == null)
82658329 {
8266
- texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
8330
+ texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
82678331 }
82688332 // }
82698333 } else
82708334 if (tex.equals("DEFAULT_TEXTURE_BUMP")) // ||*/ tex.equals(""))
82718335 {
82728336 assert(bump);
8273
- texture = textures.get(tex);
8274
- if (texture == null)
8275
- 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);
82768340 } else
82778341 {
82788342 //if (tex.equals("IMMORTAL"))
....@@ -8282,9 +8346,9 @@
82828346 //{
82838347 if (tex.equals("WHITE_NOISE"))
82848348 {
8285
- texture = textures.get(tex);
8286
- if (texture == null)
8287
- 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);
82888352 } else
82898353 {
82908354 if (textureon)
....@@ -8343,19 +8407,19 @@
83438407 if (texturedata == null)
83448408 throw new Exception();
83458409
8346
- 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);
83478411 //texture = GetTexture(tex, bump);
83488412 }
83498413 }
83508414 //}
83518415 }
83528416
8353
- if (/*CACHETEXTURE &&*/ texture != null && textureon)
8417
+ if (/*CACHETEXTURE &&*/ texturecache != null && textureon)
83548418 {
83558419 //return false;
83568420
83578421 // System.out.println("CACHE +++++++++++++++ TEXTURE : " + texname + " (" + texture.getEstimatedMemorySize() + ")");
8358
- if (texturedata != null && (texname.endsWith(".jpg") || texname.endsWith(".JPG")))
8422
+ if (texturedata != null && texname.toLowerCase().endsWith(".jpg"))
83598423 {
83608424 // String ext = "_highres";
83618425 // if (REDUCETEXTURE)
....@@ -8444,8 +8508,8 @@
84448508 textures.remove(texname);
84458509 }
84468510
8447
- texture.texturedata = texturedata;
8448
- textures.put(texname, texture);
8511
+ //texture.texturedata = texturedata;
8512
+ textures.put(texname, texturecache);
84498513
84508514 // newtex = true;
84518515 }
....@@ -8461,12 +8525,12 @@
84618525 }
84628526 }
84638527
8464
- return texture;
8528
+ return texturecache;
84658529 }
84668530
8467
- 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
84688532 {
8469
- CacheTexture texture = GetCacheTexture(tex, bump, resolution);
8533
+ CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution);
84708534
84718535 if (bump)
84728536 {
....@@ -8482,23 +8546,23 @@
84828546 return texture!=null?texture.texture:null;
84838547 }
84848548
8485
- 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
84868550 {
8487
- CacheTexture texture = GetCacheTexture(tex, bump, resolution);
8551
+ CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution);
84888552
84898553 return texture!=null?texture.texturedata:null;
84908554 }
84918555
8492
- 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
84938557 {
84948558 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
84958559 {
84968560 return false;
84978561 }
84988562
8499
- boolean newtex = false;
8563
+ //boolean newtex = false;
85008564
8501
- com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
8565
+ com.sun.opengl.util.texture.Texture texture = GetTexture(stream, tex, bump, resolution);
85028566
85038567 if (texture == null)
85048568 return false;
....@@ -8528,7 +8592,7 @@
85288592 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT);
85298593 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT);
85308594
8531
- return newtex;
8595
+ return true; // Warning: not used.
85328596 }
85338597
85348598 ShadowBuffer shadowPBuf;
....@@ -9374,13 +9438,13 @@
93749438 void ResetOptions()
93759439 {
93769440 options1[0] = 100;
9377
- options1[1] = 0.00001f;
9378
- options1[2] = 20;
9441
+ options1[1] = 0.025f;
9442
+ options1[2] = 0.01f;
93799443 options1[3] = 0;
93809444 options1[4] = 0;
93819445
93829446 options2[0] = 0;
9383
- options2[1] = 1;
9447
+ options2[1] = 0.75f;
93849448 options2[2] = 0;
93859449 options2[3] = 0;
93869450
....@@ -10985,7 +11049,7 @@
1098511049
1098611050 try
1098711051 {
10988
- BindTexture(NOISE_TEXTURE, false, 2);
11052
+ BindTexture(null, NOISE_TEXTURE, false, 2);
1098911053 }
1099011054 catch (Exception e)
1099111055 {
....@@ -11014,9 +11078,9 @@
1101411078
1101511079 gl.glMatrixMode(GL.GL_MODELVIEW);
1101611080
11017
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11018
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
11019
-//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);
1102011084 } else
1102111085 {
1102211086 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -11027,7 +11091,7 @@
1102711091 //System.out.println("BLENDING ON");
1102811092 gl.glEnable(GL.GL_BLEND);
1102911093 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
11030
-
11094
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1103111095 gl.glMatrixMode(gl.GL_PROJECTION);
1103211096 gl.glLoadIdentity();
1103311097
....@@ -11513,7 +11577,7 @@
1151311577 if ((TRACK || SHADOWTRACK) || zoomonce)
1151411578 {
1151511579 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11516
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11580
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1151711581 pingthread.StepToTarget(true); // true);
1151811582 // zoomonce = false;
1151911583 }
....@@ -11650,7 +11714,7 @@
1165011714 if (tex.equals("WHITE_NOISE"))
1165111715 continue;
1165211716
11653
- if (!usedtextures.containsKey(tex))
11717
+ if (!usedtextures.contains(tex))
1165411718 {
1165511719 // System.out.println("DISPOSE +++++++++++++++ " + tex);
1165611720 textures.get(tex).texture.dispose();
....@@ -13361,9 +13425,10 @@
1336113425 "DP3 " + dest + ".z," + "normals," + "eye;" +
1336213426 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1336313427 //"MOV " + dest + ".w," + "normal.z;" +
13364
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13365
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13366
- //"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
1336713432 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1336813433 "RCP " + dest + ".w," + dest + ".w;" +
1336913434 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13928,7 +13993,7 @@
1392813993
1392913994 // fev 2014???
1393013995 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13931
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13996
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1393213997 pingthread.StepToTarget(true); // true);
1393313998 }
1393413999 // if (!LIVE)
....@@ -14282,12 +14347,12 @@
1428214347 void GoDown(int mod)
1428314348 {
1428414349 MODIFIERS |= COMMAND;
14285
- /*
14350
+ /**/
1428614351 if((mod&SHIFT) == SHIFT)
1428714352 manipCamera.RotatePosition(0, -speed);
1428814353 else
14289
- manipCamera.BackForth(0, -speed*delta, getWidth());
14290
- */
14354
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14355
+ /**/
1429114356 if ((mod & SHIFT) == SHIFT)
1429214357 {
1429314358 mouseMode = mouseMode; // VR??
....@@ -14303,12 +14368,12 @@
1430314368 void GoUp(int mod)
1430414369 {
1430514370 MODIFIERS |= COMMAND;
14306
- /*
14371
+ /**/
1430714372 if((mod&SHIFT) == SHIFT)
1430814373 manipCamera.RotatePosition(0, speed);
1430914374 else
14310
- manipCamera.BackForth(0, speed*delta, getWidth());
14311
- */
14375
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14376
+ /**/
1431214377 if ((mod & SHIFT) == SHIFT)
1431314378 {
1431414379 mouseMode = mouseMode;
....@@ -14324,12 +14389,12 @@
1432414389 void GoLeft(int mod)
1432514390 {
1432614391 MODIFIERS |= COMMAND;
14327
- /*
14392
+ /**/
1432814393 if((mod&SHIFT) == SHIFT)
14329
- manipCamera.RotatePosition(speed, 0);
14330
- else
1433114394 manipCamera.Translate(speed*delta, 0, getWidth());
14332
- */
14395
+ else
14396
+ manipCamera.RotatePosition(speed, 0);
14397
+ /**/
1433314398 if ((mod & SHIFT) == SHIFT)
1433414399 {
1433514400 mouseMode = mouseMode;
....@@ -14345,12 +14410,12 @@
1434514410 void GoRight(int mod)
1434614411 {
1434714412 MODIFIERS |= COMMAND;
14348
- /*
14413
+ /**/
1434914414 if((mod&SHIFT) == SHIFT)
14350
- manipCamera.RotatePosition(-speed, 0);
14351
- else
1435214415 manipCamera.Translate(-speed*delta, 0, getWidth());
14353
- */
14416
+ else
14417
+ manipCamera.RotatePosition(-speed, 0);
14418
+ /**/
1435414419 if ((mod & SHIFT) == SHIFT)
1435514420 {
1435614421 mouseMode = mouseMode;
....@@ -14589,7 +14654,8 @@
1458914654 Globals.MOUSEDRAGGED = false;
1459014655
1459114656 movingcamera = false;
14592
- X = Y = 0;
14657
+ X = 0; // getBounds().width/2;
14658
+ Y = 0; // getBounds().height/2;
1459314659 //System.out.println("mouseReleased: " + e);
1459414660 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1459514661 }
....@@ -14930,7 +14996,9 @@
1493014996 case 'E' : COMPACT ^= true;
1493114997 repaint();
1493214998 break;
14933
- case 'W' : DEBUGHSB ^= true;
14999
+ case 'W' : // Wide Window (fullscreen)
15000
+ //DEBUGHSB ^= true;
15001
+ ObjEditor.theFrame.ToggleFullScreen();
1493415002 repaint();
1493515003 break;
1493615004 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14956,13 +15024,7 @@
1495615024 repaint();
1495715025 break;
1495815026 case 'l':
14959
- lightMode ^= true;
14960
- Globals.lighttouched = true;
14961
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14962
- targetLookAt.set(manipCamera.lookAt);
14963
- repaint();
14964
- break;
14965
- case 'L':
15027
+ //case 'L':
1496615028 if (lightMode)
1496715029 {
1496815030 lightMode = false;
....@@ -15105,11 +15167,14 @@
1510515167 case '_':
1510615168 kompactbit = 5;
1510715169 break;
15108
- case '+':
15109
- kompactbit = 6;
15110
- break;
15170
+// case '+':
15171
+// kompactbit = 6;
15172
+// break;
1511115173 case ' ':
15112
- ObjEditor.theFrame.ToggleFullScreen();
15174
+ lightMode ^= true;
15175
+ Globals.lighttouched = true;
15176
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15177
+ targetLookAt.set(manipCamera.lookAt);
1511315178 repaint();
1511415179 break;
1511515180 //case '`' :
....@@ -15156,8 +15221,9 @@
1515615221 case DELETE:
1515715222 ClearSelection();
1515815223 break;
15159
- /*
1516015224 case '+':
15225
+
15226
+ /*
1516115227 //fontsize += 1;
1516215228 bbzoom *= 2;
1516315229 repaint();
....@@ -15174,17 +15240,17 @@
1517415240 case '=':
1517515241 IncDepth();
1517615242 //fontsize += 1;
15177
- object.editWindow.refreshContents(true);
15243
+ object.GetWindow().refreshContents(true);
1517815244 maskbit = 6;
1517915245 break;
1518015246 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1518115247 DecDepth();
1518215248 maskbit = 5;
1518315249 //if(fontsize > 1) fontsize -= 1;
15184
- if (object.editWindow == null)
15185
- new Exception().printStackTrace();
15186
- else
15187
- object.editWindow.refreshContents(true);
15250
+// if (object.editWindow == null)
15251
+// new Exception().printStackTrace();
15252
+// else
15253
+ object.GetWindow().refreshContents(true);
1518815254 break;
1518915255 case '{':
1519015256 manipCamera.shaper_fovy /= 1.1;
....@@ -15408,7 +15474,7 @@
1540815474 }
1540915475 */
1541015476
15411
- object.editWindow.EditSelection(false);
15477
+ object.GetWindow().EditSelection(false);
1541215478 }
1541315479
1541415480 void SelectParent()
....@@ -15425,10 +15491,10 @@
1542515491 {
1542615492 //selectees.remove(i);
1542715493 System.out.println("select parent of " + elem);
15428
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15494
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1542915495 } else
1543015496 {
15431
- group.editWindow.Select(elem.GetTreePath(), first, true);
15497
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1543215498 }
1543315499
1543415500 first = false;
....@@ -15470,12 +15536,12 @@
1547015536 for (int j = 0; j < group.children.size(); j++)
1547115537 {
1547215538 elem = (Object3D) group.children.elementAt(j);
15473
- object.editWindow.Select(elem.GetTreePath(), first, true);
15539
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1547415540 first = false;
1547515541 }
1547615542 } else
1547715543 {
15478
- object.editWindow.Select(elem.GetTreePath(), first, true);
15544
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1547915545 }
1548015546
1548115547 first = false;
....@@ -15486,21 +15552,21 @@
1548615552 {
1548715553 //Composite group = (Composite) object;
1548815554 Object3D group = object;
15489
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15555
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1549015556 }
1549115557
1549215558 void ResetTransform(int mask)
1549315559 {
1549415560 //Composite group = (Composite) object;
1549515561 Object3D group = object;
15496
- group.editWindow.ResetTransform(mask);
15562
+ group.GetWindow().ResetTransform(mask);
1549715563 }
1549815564
1549915565 void FlipTransform()
1550015566 {
1550115567 //Composite group = (Composite) object;
1550215568 Object3D group = object;
15503
- group.editWindow.FlipTransform();
15569
+ group.GetWindow().FlipTransform();
1550415570 // group.editWindow.ReduceMesh(true);
1550515571 }
1550615572
....@@ -15508,7 +15574,7 @@
1550815574 {
1550915575 //Composite group = (Composite) object;
1551015576 Object3D group = object;
15511
- group.editWindow.PrintMemory();
15577
+ group.GetWindow().PrintMemory();
1551215578 // group.editWindow.ReduceMesh(true);
1551315579 }
1551415580
....@@ -15516,7 +15582,7 @@
1551615582 {
1551715583 //Composite group = (Composite) object;
1551815584 Object3D group = object;
15519
- group.editWindow.ResetCentroid();
15585
+ group.GetWindow().ResetCentroid();
1552015586 }
1552115587
1552215588 void IncDepth()
....@@ -15692,6 +15758,7 @@
1569215758 info.bounds.y += (height - desired) / 2;
1569315759 }
1569415760 }
15761
+
1569515762 info.g = gr;
1569615763 info.camera = renderCamera;
1569715764 /*
....@@ -15701,23 +15768,44 @@
1570115768 */
1570215769 if (!isRenderer)
1570315770 {
15704
- object.drawEditHandles(info, 0);
15705
-
15706
- 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)
1570715774 {
15708
- 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)
1570915781 {
15710
- case Object3D.hitCenter: gr.setColor(Color.pink);
15711
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15712
- break;
15713
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15714
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15715
- break;
15716
- case Object3D.hitScale: gr.setColor(Color.cyan);
15717
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15718
- 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;
1571915789 }
15720
-
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
+ }
1572115809 }
1572215810 }
1572315811 }
....@@ -16515,6 +16603,14 @@
1651516603 }
1651616604 }
1651716605
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
+
1651816614 class SelectBuffer implements GLEventListener
1651916615 {
1652016616
....@@ -16594,6 +16690,17 @@
1659416690
1659516691 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1659616692
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
+
1659716704 //int tmp = selection_view;
1659816705 //selection_view = -1;
1659916706 int temp = DrawMode();
....@@ -16605,6 +16712,17 @@
1660516712 // temp = DEFAULT; // patch for selection debug
1660616713 Globals.drawMode = temp; // WARNING
1660716714
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
+
1660816726 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1660916727
1661016728 // trying different ways of getting the depth info over
....@@ -16708,29 +16826,31 @@
1670816826 }
1670916827
1671016828 if (!movingcamera && !PAINTMODE)
16711
- object.editWindow.ScreenFitPoint(); // fev 2014
16829
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1671216830
16713
- 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)
1671416832 {
16715
- 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);
1671616834
16717
- Object3D group = new Object3D("inst" + paintcount++);
16835
+ if (object.GetWindow().copy.selection.Size() > 0)
16836
+ {
16837
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1671816838
16719
- group.CreateMaterial(); // use a void leaf to select instances
16720
-
16721
- group.add(paintobj); // link
16722
-
16723
- object.editWindow.SnapObject(group);
16724
-
16725
- Object3D folder = object.editWindow.copy;
16726
-
16727
- if (object.editWindow.copy.selection.Size() > 0)
16728
- folder = object.editWindow.copy.selection.elementAt(0);
16729
-
16730
- folder.add(group);
16731
-
16732
- object.editWindow.ResetModel();
16733
- 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
+ }
1673416854 }
1673516855 else
1673616856 paintcount = 0;
....@@ -16769,6 +16889,11 @@
1676916889 //System.out.println("objects[color] = " + objects[color]);
1677016890 //objects[color].Select();
1677116891 indexcount = 0;
16892
+ ObjEditor window = object.GetWindow();
16893
+ if (window != null && deselect)
16894
+ {
16895
+ window.Select(null, deselect, true);
16896
+ }
1677216897 object.Select(color, deselect);
1677316898 }
1677416899