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;
....@@ -326,7 +326,7 @@
326326 cStatic.objectstack[materialdepth++] = obj;
327327 //System.out.println("material " + material);
328328 //Applet3D.tracein(this, selected);
329
- display.vector2buffer = obj.projectedVertices;
329
+ //display.vector2buffer = obj.projectedVertices;
330330 if (obj instanceof Camera)
331331 {
332332 display.options1[0] = material.shift;
....@@ -335,14 +335,28 @@
335335 display.options1[2] = material.shadowbias;
336336 display.options1[3] = material.aniso;
337337 display.options1[4] = material.anisoV;
338
+// System.out.println("display.options1[0] " + display.options1[0]);
339
+// System.out.println("display.options1[1] " + display.options1[1]);
340
+// System.out.println("display.options1[2] " + display.options1[2]);
341
+// System.out.println("display.options1[3] " + display.options1[3]);
342
+// System.out.println("display.options1[4] " + display.options1[4]);
338343 display.options2[0] = material.opacity;
339344 display.options2[1] = material.diffuse;
340345 display.options2[2] = material.factor;
346
+// System.out.println("display.options2[0] " + display.options2[0]);
347
+// System.out.println("display.options2[1] " + display.options2[1]);
348
+// System.out.println("display.options2[2] " + display.options2[2]);
341349
342350 cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
351
+// System.out.println("display.options3[0] " + display.options3[0]);
352
+// System.out.println("display.options3[1] " + display.options3[1]);
353
+// System.out.println("display.options3[2] " + display.options3[2]);
343354 display.options4[0] = material.cameralight/0.2f;
344355 display.options4[1] = material.subsurface;
345356 display.options4[2] = material.sheen;
357
+// System.out.println("display.options4[0] " + display.options4[0]);
358
+// System.out.println("display.options4[1] " + display.options4[1]);
359
+// System.out.println("display.options4[2] " + display.options4[2]);
346360
347361 // if (display.CURRENTANTIALIAS > 0)
348362 // display.options3[3] /= 4;
....@@ -358,7 +372,7 @@
358372 /**/
359373 } else
360374 {
361
- DrawMaterial(material, selected);
375
+ DrawMaterial(material, selected, obj.projectedVertices);
362376 }
363377 } else
364378 {
....@@ -382,8 +396,8 @@
382396 cStatic.objectstack[materialdepth++] = obj;
383397 //System.out.println("material " + material);
384398 //Applet3D.tracein("selected ", selected);
385
- display.vector2buffer = obj.projectedVertices;
386
- display.DrawMaterial(material, selected);
399
+ //display.vector2buffer = obj.projectedVertices;
400
+ display.DrawMaterial(material, selected, obj.projectedVertices);
387401 }
388402 }
389403
....@@ -400,8 +414,8 @@
400414 materialdepth -= 1;
401415 if (materialdepth > 0)
402416 {
403
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
404
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
417
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
418
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
405419 }
406420 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
407421 } else if (selected && CameraPane.flash && obj.GetMaterial() != null)
....@@ -421,8 +435,8 @@
421435 materialdepth -= 1;
422436 if (materialdepth > 0)
423437 {
424
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
425
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
438
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
439
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
426440 }
427441 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
428442 //else
....@@ -1610,7 +1624,7 @@
16101624 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16111625 }
16121626
1613
- void DrawMaterial(cMaterial material, boolean selected)
1627
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16141628 {
16151629 CameraPane display = this;
16161630 //new Exception().printStackTrace();
....@@ -1645,7 +1659,7 @@
16451659 colorV[0] = display.modelParams0[0] * material.diffuse;
16461660 colorV[1] = display.modelParams0[1] * material.diffuse;
16471661 colorV[2] = display.modelParams0[2] * material.diffuse;
1648
- colorV[3] = material.opacity;
1662
+ colorV[3] = 1; // material.opacity;
16491663
16501664 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16511665 //System.out.println("Opacity = " + opacity);
....@@ -1753,9 +1767,9 @@
17531767 display.modelParams7[2] = 0;
17541768 display.modelParams7[3] = 0;
17551769
1756
- display.modelParams6[0] = 100; // criss de bug de bump
1770
+ //display.modelParams6[0] = 100; // criss de bug de bump
17571771
1758
- Object3D.cVector2[] extparams = display.vector2buffer;
1772
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17591773 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17601774 {
17611775 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -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;
....@@ -9366,11 +9430,35 @@
93669430 jy8[3] = 0.5f;
93679431 }
93689432
9369
- float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
9433
+ float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
93709434 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
93719435 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
93729436 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
93739437
9438
+ void ResetOptions()
9439
+ {
9440
+ options1[0] = 100;
9441
+ options1[1] = 0.025f;
9442
+ options1[2] = 0.01f;
9443
+ options1[3] = 0;
9444
+ options1[4] = 0;
9445
+
9446
+ options2[0] = 0;
9447
+ options2[1] = 0.75f;
9448
+ options2[2] = 0;
9449
+ options2[3] = 0;
9450
+
9451
+ options3[0] = 1;
9452
+ options3[1] = 1;
9453
+ options3[2] = 1;
9454
+ options3[3] = 0;
9455
+
9456
+ options4[0] = 1;
9457
+ options4[1] = 0;
9458
+ options4[2] = 1;
9459
+ options4[3] = 0;
9460
+ }
9461
+
93749462 static int imagecount = 0; // movie generation
93759463
93769464 static int jitter = 0;
....@@ -10481,6 +10569,7 @@
1048110569 ANTIALIAS = 0;
1048210570 //System.out.println("RESTART");
1048310571 AAtimer.restart();
10572
+ Globals.TIMERRUNNING = true;
1048410573 }
1048510574 }
1048610575 }
....@@ -10548,7 +10637,8 @@
1054810637 ambientOcclusion = false;
1054910638 }
1055010639
10551
- if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
10640
+ if (//Globals.lighttouched &&
10641
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1055210642 {
1055310643 //if (RENDERSHADOW) // ?
1055410644 if (!IsFrozen())
....@@ -10959,7 +11049,7 @@
1095911049
1096011050 try
1096111051 {
10962
- BindTexture(NOISE_TEXTURE, false, 2);
11052
+ BindTexture(null, NOISE_TEXTURE, false, 2);
1096311053 }
1096411054 catch (Exception e)
1096511055 {
....@@ -10988,9 +11078,9 @@
1098811078
1098911079 gl.glMatrixMode(GL.GL_MODELVIEW);
1099011080
10991
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
10992
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
10993
-//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);
1099411084 } else
1099511085 {
1099611086 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -11001,7 +11091,7 @@
1100111091 //System.out.println("BLENDING ON");
1100211092 gl.glEnable(GL.GL_BLEND);
1100311093 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
11004
-
11094
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1100511095 gl.glMatrixMode(gl.GL_PROJECTION);
1100611096 gl.glLoadIdentity();
1100711097
....@@ -11458,7 +11548,7 @@
1145811548
1145911549 static boolean zoomonce = false;
1146011550
11461
- void CreateSelectedPoint()
11551
+ static void CreateSelectedPoint()
1146211552 {
1146311553 if (selectedpoint == null)
1146411554 {
....@@ -11478,13 +11568,16 @@
1147811568
1147911569 void DrawObject(GL gl, boolean draw)
1148011570 {
11571
+ // To clear camera values
11572
+ ResetOptions();
11573
+
1148111574 //System.out.println("DRAW OBJECT " + mouseDown);
1148211575 // DrawMode() = SELECTION;
1148311576 //GL gl = getGL();
1148411577 if ((TRACK || SHADOWTRACK) || zoomonce)
1148511578 {
1148611579 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11487
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11580
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1148811581 pingthread.StepToTarget(true); // true);
1148911582 // zoomonce = false;
1149011583 }
....@@ -11621,7 +11714,7 @@
1162111714 if (tex.equals("WHITE_NOISE"))
1162211715 continue;
1162311716
11624
- if (!usedtextures.containsKey(tex))
11717
+ if (!usedtextures.contains(tex))
1162511718 {
1162611719 // System.out.println("DISPOSE +++++++++++++++ " + tex);
1162711720 textures.get(tex).texture.dispose();
....@@ -12045,7 +12138,7 @@
1204512138 for (int i = tp.size(); --i >= 0;)
1204612139 {
1204712140 //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12048
- LA.xformPos(light, tp.get(i).GlobalTransform(), light);
12141
+ LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
1204912142 }
1205012143
1205112144
....@@ -13315,7 +13408,8 @@
1331513408 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1331613409 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1331713410 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13318
- Object3D.cVector2[] vector2buffer;
13411
+
13412
+ //Object3D.cVector2[] vector2buffer;
1331913413
1332013414 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1332113415 // OUT : diff, spec
....@@ -13331,9 +13425,10 @@
1333113425 "DP3 " + dest + ".z," + "normals," + "eye;" +
1333213426 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1333313427 //"MOV " + dest + ".w," + "normal.z;" +
13334
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13335
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13336
- //"MOV " + dest + ".z," + "params2.w;" +
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
1333713432 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1333813433 "RCP " + dest + ".w," + dest + ".w;" +
1333913434 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13838,6 +13933,7 @@
1383813933 else
1383913934 if (evt.getSource() == AAtimer)
1384013935 {
13936
+ Globals.TIMERRUNNING = false;
1384113937 if (mouseDown)
1384213938 {
1384313939 //new Exception().printStackTrace();
....@@ -13897,7 +13993,7 @@
1389713993
1389813994 // fev 2014???
1389913995 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13900
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13996
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1390113997 pingthread.StepToTarget(true); // true);
1390213998 }
1390313999 // if (!LIVE)
....@@ -13912,6 +14008,7 @@
1391214008 return;
1391314009
1391414010 AAtimer.restart(); //
14011
+ Globals.TIMERRUNNING = true;
1391514012
1391614013 // waslive = LIVE;
1391714014 // LIVE = false;
....@@ -14250,12 +14347,12 @@
1425014347 void GoDown(int mod)
1425114348 {
1425214349 MODIFIERS |= COMMAND;
14253
- /*
14350
+ /**/
1425414351 if((mod&SHIFT) == SHIFT)
1425514352 manipCamera.RotatePosition(0, -speed);
1425614353 else
14257
- manipCamera.BackForth(0, -speed*delta, getWidth());
14258
- */
14354
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14355
+ /**/
1425914356 if ((mod & SHIFT) == SHIFT)
1426014357 {
1426114358 mouseMode = mouseMode; // VR??
....@@ -14271,12 +14368,12 @@
1427114368 void GoUp(int mod)
1427214369 {
1427314370 MODIFIERS |= COMMAND;
14274
- /*
14371
+ /**/
1427514372 if((mod&SHIFT) == SHIFT)
1427614373 manipCamera.RotatePosition(0, speed);
1427714374 else
14278
- manipCamera.BackForth(0, speed*delta, getWidth());
14279
- */
14375
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14376
+ /**/
1428014377 if ((mod & SHIFT) == SHIFT)
1428114378 {
1428214379 mouseMode = mouseMode;
....@@ -14292,12 +14389,12 @@
1429214389 void GoLeft(int mod)
1429314390 {
1429414391 MODIFIERS |= COMMAND;
14295
- /*
14392
+ /**/
1429614393 if((mod&SHIFT) == SHIFT)
14297
- manipCamera.RotatePosition(speed, 0);
14298
- else
1429914394 manipCamera.Translate(speed*delta, 0, getWidth());
14300
- */
14395
+ else
14396
+ manipCamera.RotatePosition(speed, 0);
14397
+ /**/
1430114398 if ((mod & SHIFT) == SHIFT)
1430214399 {
1430314400 mouseMode = mouseMode;
....@@ -14313,12 +14410,12 @@
1431314410 void GoRight(int mod)
1431414411 {
1431514412 MODIFIERS |= COMMAND;
14316
- /*
14413
+ /**/
1431714414 if((mod&SHIFT) == SHIFT)
14318
- manipCamera.RotatePosition(-speed, 0);
14319
- else
1432014415 manipCamera.Translate(-speed*delta, 0, getWidth());
14321
- */
14416
+ else
14417
+ manipCamera.RotatePosition(-speed, 0);
14418
+ /**/
1432214419 if ((mod & SHIFT) == SHIFT)
1432314420 {
1432414421 mouseMode = mouseMode;
....@@ -14375,7 +14472,8 @@
1437514472 info.camera = renderCamera;
1437614473 info.x = x;
1437714474 info.y = y;
14378
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14475
+ object.GetWindow().copy
14476
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1437914477 } else
1438014478 {
1438114479 if (x < startX)
....@@ -14539,7 +14637,9 @@
1453914637 ci.camera = renderCamera;
1454014638 if (!isRenderer)
1454114639 {
14542
- if (object.editWindow.copy.doEditClick(ci, 0))
14640
+ //ObjEditor editWindow = object.editWindow;
14641
+ //Object3D copy = editWindow.copy;
14642
+ if (object.doEditClick(ci, 0))
1454314643 {
1454414644 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1454514645 } else
....@@ -14554,7 +14654,8 @@
1455414654 Globals.MOUSEDRAGGED = false;
1455514655
1455614656 movingcamera = false;
14557
- X = Y = 0;
14657
+ X = 0; // getBounds().width/2;
14658
+ Y = 0; // getBounds().height/2;
1455814659 //System.out.println("mouseReleased: " + e);
1455914660 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1456014661 }
....@@ -14895,7 +14996,9 @@
1489514996 case 'E' : COMPACT ^= true;
1489614997 repaint();
1489714998 break;
14898
- case 'W' : DEBUGHSB ^= true;
14999
+ case 'W' : // Wide Window (fullscreen)
15000
+ //DEBUGHSB ^= true;
15001
+ ObjEditor.theFrame.ToggleFullScreen();
1489915002 repaint();
1490015003 break;
1490115004 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14921,13 +15024,7 @@
1492115024 repaint();
1492215025 break;
1492315026 case 'l':
14924
- lightMode ^= true;
14925
- Globals.lighttouched = true;
14926
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14927
- targetLookAt.set(manipCamera.lookAt);
14928
- repaint();
14929
- break;
14930
- case 'L':
15027
+ //case 'L':
1493115028 if (lightMode)
1493215029 {
1493315030 lightMode = false;
....@@ -15070,11 +15167,14 @@
1507015167 case '_':
1507115168 kompactbit = 5;
1507215169 break;
15073
- case '+':
15074
- kompactbit = 6;
15075
- break;
15170
+// case '+':
15171
+// kompactbit = 6;
15172
+// break;
1507615173 case ' ':
15077
- ObjEditor.theFrame.ToggleFullScreen();
15174
+ lightMode ^= true;
15175
+ Globals.lighttouched = true;
15176
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15177
+ targetLookAt.set(manipCamera.lookAt);
1507815178 repaint();
1507915179 break;
1508015180 //case '`' :
....@@ -15121,8 +15221,9 @@
1512115221 case DELETE:
1512215222 ClearSelection();
1512315223 break;
15124
- /*
1512515224 case '+':
15225
+
15226
+ /*
1512615227 //fontsize += 1;
1512715228 bbzoom *= 2;
1512815229 repaint();
....@@ -15139,17 +15240,17 @@
1513915240 case '=':
1514015241 IncDepth();
1514115242 //fontsize += 1;
15142
- object.editWindow.refreshContents(true);
15243
+ object.GetWindow().refreshContents(true);
1514315244 maskbit = 6;
1514415245 break;
1514515246 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1514615247 DecDepth();
1514715248 maskbit = 5;
1514815249 //if(fontsize > 1) fontsize -= 1;
15149
- if (object.editWindow == null)
15150
- new Exception().printStackTrace();
15151
- else
15152
- object.editWindow.refreshContents(true);
15250
+// if (object.editWindow == null)
15251
+// new Exception().printStackTrace();
15252
+// else
15253
+ object.GetWindow().refreshContents(true);
1515315254 break;
1515415255 case '{':
1515515256 manipCamera.shaper_fovy /= 1.1;
....@@ -15373,7 +15474,7 @@
1537315474 }
1537415475 */
1537515476
15376
- object.editWindow.EditSelection();
15477
+ object.GetWindow().EditSelection(false);
1537715478 }
1537815479
1537915480 void SelectParent()
....@@ -15390,10 +15491,10 @@
1539015491 {
1539115492 //selectees.remove(i);
1539215493 System.out.println("select parent of " + elem);
15393
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15494
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1539415495 } else
1539515496 {
15396
- group.editWindow.Select(elem.GetTreePath(), first, true);
15497
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1539715498 }
1539815499
1539915500 first = false;
....@@ -15435,12 +15536,12 @@
1543515536 for (int j = 0; j < group.children.size(); j++)
1543615537 {
1543715538 elem = (Object3D) group.children.elementAt(j);
15438
- object.editWindow.Select(elem.GetTreePath(), first, true);
15539
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1543915540 first = false;
1544015541 }
1544115542 } else
1544215543 {
15443
- object.editWindow.Select(elem.GetTreePath(), first, true);
15544
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1544415545 }
1544515546
1544615547 first = false;
....@@ -15451,21 +15552,21 @@
1545115552 {
1545215553 //Composite group = (Composite) object;
1545315554 Object3D group = object;
15454
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15555
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1545515556 }
1545615557
1545715558 void ResetTransform(int mask)
1545815559 {
1545915560 //Composite group = (Composite) object;
1546015561 Object3D group = object;
15461
- group.editWindow.ResetTransform(mask);
15562
+ group.GetWindow().ResetTransform(mask);
1546215563 }
1546315564
1546415565 void FlipTransform()
1546515566 {
1546615567 //Composite group = (Composite) object;
1546715568 Object3D group = object;
15468
- group.editWindow.FlipTransform();
15569
+ group.GetWindow().FlipTransform();
1546915570 // group.editWindow.ReduceMesh(true);
1547015571 }
1547115572
....@@ -15473,7 +15574,7 @@
1547315574 {
1547415575 //Composite group = (Composite) object;
1547515576 Object3D group = object;
15476
- group.editWindow.PrintMemory();
15577
+ group.GetWindow().PrintMemory();
1547715578 // group.editWindow.ReduceMesh(true);
1547815579 }
1547915580
....@@ -15481,7 +15582,7 @@
1548115582 {
1548215583 //Composite group = (Composite) object;
1548315584 Object3D group = object;
15484
- group.editWindow.ResetCentroid();
15585
+ group.GetWindow().ResetCentroid();
1548515586 }
1548615587
1548715588 void IncDepth()
....@@ -15657,6 +15758,7 @@
1565715758 info.bounds.y += (height - desired) / 2;
1565815759 }
1565915760 }
15761
+
1566015762 info.g = gr;
1566115763 info.camera = renderCamera;
1566215764 /*
....@@ -15666,23 +15768,44 @@
1566615768 */
1566715769 if (!isRenderer)
1566815770 {
15669
- object.drawEditHandles(info, 0);
15670
-
15671
- 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)
1567215774 {
15673
- 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)
1567415781 {
15675
- case Object3D.hitCenter: gr.setColor(Color.pink);
15676
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15677
- break;
15678
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15679
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15680
- break;
15681
- case Object3D.hitScale: gr.setColor(Color.cyan);
15682
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15683
- 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;
1568415789 }
15685
-
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
+ }
1568615809 }
1568715810 }
1568815811 }
....@@ -16385,16 +16508,16 @@
1638516508 cStatic.objectstack[materialdepth++] = checker;
1638616509 //System.out.println("material " + material);
1638716510 //Applet3D.tracein(this, selected);
16388
- vector2buffer = checker.projectedVertices;
16511
+ //vector2buffer = checker.projectedVertices;
1638916512
1639016513 //checker.GetMaterial().Draw(this, false); // true);
16391
- DrawMaterial(checker.GetMaterial(), false); // true);
16514
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1639216515
1639316516 materialdepth -= 1;
1639416517 if (materialdepth > 0)
1639516518 {
16396
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16397
- DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
16519
+ //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16520
+ DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
1639816521 }
1639916522 //checker.GetMaterial().opacity = 1f;
1640016523 ////checker.GetMaterial().ambient = 1f;
....@@ -16480,6 +16603,14 @@
1648016603 }
1648116604 }
1648216605
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
+
1648316614 class SelectBuffer implements GLEventListener
1648416615 {
1648516616
....@@ -16559,6 +16690,17 @@
1655916690
1656016691 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1656116692
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
+
1656216704 //int tmp = selection_view;
1656316705 //selection_view = -1;
1656416706 int temp = DrawMode();
....@@ -16570,6 +16712,17 @@
1657016712 // temp = DEFAULT; // patch for selection debug
1657116713 Globals.drawMode = temp; // WARNING
1657216714
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
+
1657316726 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1657416727
1657516728 // trying different ways of getting the depth info over
....@@ -16617,6 +16770,8 @@
1661716770 // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]);
1661816771 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1661916772 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
16773
+
16774
+ CreateSelectedPoint();
1662016775
1662116776 // Will fit the mesh !!!
1662216777 selectedpoint.toParent[0][0] = 0.0001;
....@@ -16671,29 +16826,31 @@
1667116826 }
1667216827
1667316828 if (!movingcamera && !PAINTMODE)
16674
- object.editWindow.ScreenFitPoint(); // fev 2014
16829
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1667516830
16676
- 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)
1667716832 {
16678
- 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);
1667916834
16680
- Object3D group = new Object3D("inst" + paintcount++);
16835
+ if (object.GetWindow().copy.selection.Size() > 0)
16836
+ {
16837
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1668116838
16682
- group.CreateMaterial(); // use a void leaf to select instances
16683
-
16684
- group.add(paintobj); // link
16685
-
16686
- object.editWindow.SnapObject(group);
16687
-
16688
- Object3D folder = object.editWindow.copy;
16689
-
16690
- if (object.editWindow.copy.selection.Size() > 0)
16691
- folder = object.editWindow.copy.selection.elementAt(0);
16692
-
16693
- folder.add(group);
16694
-
16695
- object.editWindow.ResetModel();
16696
- 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
+ }
1669716854 }
1669816855 else
1669916856 paintcount = 0;
....@@ -16732,6 +16889,11 @@
1673216889 //System.out.println("objects[color] = " + objects[color]);
1673316890 //objects[color].Select();
1673416891 indexcount = 0;
16892
+ ObjEditor window = object.GetWindow();
16893
+ if (window != null && deselect)
16894
+ {
16895
+ window.Select(null, deselect, true);
16896
+ }
1673516897 object.Select(color, deselect);
1673616898 }
1673716899