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;
....@@ -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
....@@ -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();
....@@ -14297,12 +14347,12 @@
1429714347 void GoDown(int mod)
1429814348 {
1429914349 MODIFIERS |= COMMAND;
14300
- /*
14350
+ /**/
1430114351 if((mod&SHIFT) == SHIFT)
1430214352 manipCamera.RotatePosition(0, -speed);
1430314353 else
14304
- manipCamera.BackForth(0, -speed*delta, getWidth());
14305
- */
14354
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14355
+ /**/
1430614356 if ((mod & SHIFT) == SHIFT)
1430714357 {
1430814358 mouseMode = mouseMode; // VR??
....@@ -14318,12 +14368,12 @@
1431814368 void GoUp(int mod)
1431914369 {
1432014370 MODIFIERS |= COMMAND;
14321
- /*
14371
+ /**/
1432214372 if((mod&SHIFT) == SHIFT)
1432314373 manipCamera.RotatePosition(0, speed);
1432414374 else
14325
- manipCamera.BackForth(0, speed*delta, getWidth());
14326
- */
14375
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14376
+ /**/
1432714377 if ((mod & SHIFT) == SHIFT)
1432814378 {
1432914379 mouseMode = mouseMode;
....@@ -14339,12 +14389,12 @@
1433914389 void GoLeft(int mod)
1434014390 {
1434114391 MODIFIERS |= COMMAND;
14342
- /*
14392
+ /**/
1434314393 if((mod&SHIFT) == SHIFT)
14344
- manipCamera.RotatePosition(speed, 0);
14345
- else
1434614394 manipCamera.Translate(speed*delta, 0, getWidth());
14347
- */
14395
+ else
14396
+ manipCamera.RotatePosition(speed, 0);
14397
+ /**/
1434814398 if ((mod & SHIFT) == SHIFT)
1434914399 {
1435014400 mouseMode = mouseMode;
....@@ -14360,12 +14410,12 @@
1436014410 void GoRight(int mod)
1436114411 {
1436214412 MODIFIERS |= COMMAND;
14363
- /*
14413
+ /**/
1436414414 if((mod&SHIFT) == SHIFT)
14365
- manipCamera.RotatePosition(-speed, 0);
14366
- else
1436714415 manipCamera.Translate(-speed*delta, 0, getWidth());
14368
- */
14416
+ else
14417
+ manipCamera.RotatePosition(-speed, 0);
14418
+ /**/
1436914419 if ((mod & SHIFT) == SHIFT)
1437014420 {
1437114421 mouseMode = mouseMode;
....@@ -14946,7 +14996,9 @@
1494614996 case 'E' : COMPACT ^= true;
1494714997 repaint();
1494814998 break;
14949
- case 'W' : DEBUGHSB ^= true;
14999
+ case 'W' : // Wide Window (fullscreen)
15000
+ //DEBUGHSB ^= true;
15001
+ ObjEditor.theFrame.ToggleFullScreen();
1495015002 repaint();
1495115003 break;
1495215004 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14972,13 +15024,7 @@
1497215024 repaint();
1497315025 break;
1497415026 case 'l':
14975
- lightMode ^= true;
14976
- Globals.lighttouched = true;
14977
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14978
- targetLookAt.set(manipCamera.lookAt);
14979
- repaint();
14980
- break;
14981
- case 'L':
15027
+ //case 'L':
1498215028 if (lightMode)
1498315029 {
1498415030 lightMode = false;
....@@ -15125,7 +15171,10 @@
1512515171 // kompactbit = 6;
1512615172 // break;
1512715173 case ' ':
15128
- ObjEditor.theFrame.ToggleFullScreen();
15174
+ lightMode ^= true;
15175
+ Globals.lighttouched = true;
15176
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15177
+ targetLookAt.set(manipCamera.lookAt);
1512915178 repaint();
1513015179 break;
1513115180 //case '`' :
....@@ -15709,6 +15758,7 @@
1570915758 info.bounds.y += (height - desired) / 2;
1571015759 }
1571115760 }
15761
+
1571215762 info.g = gr;
1571315763 info.camera = renderCamera;
1571415764 /*
....@@ -15718,6 +15768,8 @@
1571815768 */
1571915769 if (!isRenderer)
1572015770 {
15771
+ Grafreed.Assert(object != null);
15772
+ Grafreed.Assert(object.selection != null);
1572115773 if (object.selection.Size() > 0)
1572215774 {
1572315775 int hitSomething = object.selection.get(0).hitSomething;
....@@ -16551,6 +16603,14 @@
1655116603 }
1655216604 }
1655316605
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
+
1655416614 class SelectBuffer implements GLEventListener
1655516615 {
1655616616
....@@ -16630,6 +16690,17 @@
1663016690
1663116691 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1663216692
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
+
1663316704 //int tmp = selection_view;
1663416705 //selection_view = -1;
1663516706 int temp = DrawMode();
....@@ -16641,6 +16712,17 @@
1664116712 // temp = DEFAULT; // patch for selection debug
1664216713 Globals.drawMode = temp; // WARNING
1664316714
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
+
1664416726 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1664516727
1664616728 // trying different ways of getting the depth info over
....@@ -16746,27 +16828,29 @@
1674616828 if (!movingcamera && !PAINTMODE)
1674716829 object.GetWindow().ScreenFitPoint(); // fev 2014
1674816830
16749
- 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)
1675016832 {
16751
- Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16752
-
16753
- Object3D group = new Object3D("inst" + paintcount++);
16754
-
16755
- group.CreateMaterial(); // use a void leaf to select instances
16756
-
16757
- group.add(paintobj); // link
16758
-
16759
- object.GetWindow().SnapObject(group);
16760
-
16761
- Object3D folder = object.GetWindow().copy;
16833
+ //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1676216834
1676316835 if (object.GetWindow().copy.selection.Size() > 0)
16764
- folder = object.GetWindow().copy.selection.elementAt(0);
16836
+ {
16837
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1676516838
16766
- folder.add(group);
16767
-
16768
- object.GetWindow().ResetModel();
16769
- object.GetWindow().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
+ }
1677016854 }
1677116855 else
1677216856 paintcount = 0;