Normand Briere
2019-07-23 cf7cfa1c792eebba606a48aa648893f6e4873263
CameraPane.java
....@@ -18,7 +18,10 @@
1818 import javax.imageio.ImageIO;
1919 import javax.imageio.ImageWriteParam;
2020 import javax.imageio.ImageWriter;
21
+import javax.imageio.ImageReadParam;
22
+import javax.imageio.ImageReader;
2123 import javax.imageio.plugins.jpeg.JPEGImageWriteParam;
24
+import javax.imageio.stream.ImageInputStream;
2225 import javax.imageio.stream.ImageOutputStream;
2326 import javax.imageio.ImageWriteParam;
2427
....@@ -30,6 +33,7 @@
3033 import java.nio.*;
3134
3235 import gleem.linalg.Mat4f;
36
+import javax.imageio.ImageTypeSpecifier;
3337
3438 class CameraPane extends GLCanvas implements iCameraPane, Runnable, GLEventListener, ActionListener, MouseWheelListener, MouseMotionListener, MouseListener, KeyListener
3539 {
....@@ -37,7 +41,6 @@
3741 static boolean[] selectedstack = new boolean[65536];
3842 static int materialdepth = 0;
3943
40
- static boolean DEBUG = false;
4144 static boolean FRUSTUM = false; // still bogus true; // frustum culling
4245
4346 // camera change fix
....@@ -45,6 +48,39 @@
4548 static boolean ABORTED = false;
4649
4750 static int STEP = 1;
51
+
52
+ private static BufferedImage CreateBim(byte[] bytes, int width, int height)
53
+ {
54
+ int[] pixels = new int[bytes.length/3];
55
+ for (int i=pixels.length; --i>=0;)
56
+ {
57
+ int i3 = i*3;
58
+ pixels[i] = 0xFF;
59
+ pixels[i] <<= 8;
60
+ pixels[i] |= bytes[i3+2] & 0xFF;
61
+ pixels[i] <<= 8;
62
+ pixels[i] |= bytes[i3+1] & 0xFF;
63
+ pixels[i] <<= 8;
64
+ pixels[i] |= bytes[i3] & 0xFF;
65
+ }
66
+ /*
67
+ int r=0,g=0,b=0,a=0;
68
+ for (int i=0; i<width; i++)
69
+ for (int j=0; j<height; j++)
70
+ {
71
+ int index = j*width+i;
72
+ int p = pixels[index];
73
+ a = ((p>>24) & 0xFF);
74
+ r = ((p>>16) & 0xFF);
75
+ g = ((p>>8) & 0xFF);
76
+ b = (p & 0xFF);
77
+ pixels[index] = (a<<24) | (b<<16) | (g<<8) | r;
78
+ }
79
+ /**/
80
+ BufferedImage rendImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // ImageIO.read(infile);
81
+ rendImage.setRGB(0,0,width,height,pixels,width*(height-1),-width);
82
+ return rendImage;
83
+ }
4884
4985 /*static*/ private boolean CULLFACE = false; // true;
5086 /*static*/ boolean NEAREST = false; // true;
....@@ -61,7 +97,7 @@
6197 //boolean REDUCETEXTURE = true;
6298 boolean CACHETEXTURE = true;
6399 boolean CLEANCACHE = false; // true;
64
- boolean MIPMAP = false; // true;
100
+ boolean MIPMAP = false; // true; // never works...
65101 boolean COMPRESSTEXTURE = false;
66102 boolean KOMPACTTEXTURE = false; // true;
67103 boolean RESIZETEXTURE = false;
....@@ -327,7 +363,7 @@
327363 cStatic.objectstack[materialdepth++] = obj;
328364 //System.out.println("material " + material);
329365 //Applet3D.tracein(this, selected);
330
- display.vector2buffer = obj.projectedVertices;
366
+ //display.vector2buffer = obj.projectedVertices;
331367 if (obj instanceof Camera)
332368 {
333369 display.options1[0] = material.shift;
....@@ -336,14 +372,28 @@
336372 display.options1[2] = material.shadowbias;
337373 display.options1[3] = material.aniso;
338374 display.options1[4] = material.anisoV;
375
+// System.out.println("display.options1[0] " + display.options1[0]);
376
+// System.out.println("display.options1[1] " + display.options1[1]);
377
+// System.out.println("display.options1[2] " + display.options1[2]);
378
+// System.out.println("display.options1[3] " + display.options1[3]);
379
+// System.out.println("display.options1[4] " + display.options1[4]);
339380 display.options2[0] = material.opacity;
340381 display.options2[1] = material.diffuse;
341382 display.options2[2] = material.factor;
383
+// System.out.println("display.options2[0] " + display.options2[0]);
384
+// System.out.println("display.options2[1] " + display.options2[1]);
385
+// System.out.println("display.options2[2] " + display.options2[2]);
342386
343387 cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
388
+// System.out.println("display.options3[0] " + display.options3[0]);
389
+// System.out.println("display.options3[1] " + display.options3[1]);
390
+// System.out.println("display.options3[2] " + display.options3[2]);
344391 display.options4[0] = material.cameralight/0.2f;
345392 display.options4[1] = material.subsurface;
346393 display.options4[2] = material.sheen;
394
+// System.out.println("display.options4[0] " + display.options4[0]);
395
+// System.out.println("display.options4[1] " + display.options4[1]);
396
+// System.out.println("display.options4[2] " + display.options4[2]);
347397
348398 // if (display.CURRENTANTIALIAS > 0)
349399 // display.options3[3] /= 4;
....@@ -359,7 +409,7 @@
359409 /**/
360410 } else
361411 {
362
- DrawMaterial(material, selected);
412
+ DrawMaterial(material, selected, obj.projectedVertices);
363413 }
364414 } else
365415 {
....@@ -383,8 +433,8 @@
383433 cStatic.objectstack[materialdepth++] = obj;
384434 //System.out.println("material " + material);
385435 //Applet3D.tracein("selected ", selected);
386
- display.vector2buffer = obj.projectedVertices;
387
- display.DrawMaterial(material, selected);
436
+ //display.vector2buffer = obj.projectedVertices;
437
+ display.DrawMaterial(material, selected, obj.projectedVertices);
388438 }
389439 }
390440
....@@ -401,8 +451,8 @@
401451 materialdepth -= 1;
402452 if (materialdepth > 0)
403453 {
404
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
405
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
454
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
455
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
406456 }
407457 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
408458 } else if (selected && CameraPane.flash && obj.GetMaterial() != null)
....@@ -422,8 +472,8 @@
422472 materialdepth -= 1;
423473 if (materialdepth > 0)
424474 {
425
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
426
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
475
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
476
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
427477 }
428478 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
429479 //else
....@@ -464,10 +514,12 @@
464514 if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
465515 {
466516 //gl.glBegin(gl.GL_TRIANGLES);
467
- boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
517
+ boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0)
518
+ // TEST LIVE NORMALS && !obj.dontselect
519
+ ;
468520 if (!hasnorm)
469521 {
470
- // System.out.println("FUCK!!");
522
+ // System.out.println("Mesh normal");
471523 LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0);
472524 LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1);
473525 LA.vecCross(obj.v0, obj.v1, obj.v2);
....@@ -1192,10 +1244,12 @@
11921244 gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
11931245 }
11941246 }
1247
+
11951248 if (flipV)
11961249 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
11971250 else
11981251 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1252
+
11991253 //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
12001254 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
12011255
....@@ -1215,10 +1269,12 @@
12151269 gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
12161270 }
12171271 }
1272
+
12181273 if (flipV)
12191274 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
12201275 else
12211276 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1277
+
12221278 //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
12231279 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
12241280
....@@ -1246,8 +1302,10 @@
12461302 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
12471303 else
12481304 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1305
+
12491306 //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
12501307 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
1308
+
12511309 count2 += 2;
12521310 count3 += 3;
12531311 }
....@@ -1603,7 +1661,7 @@
16031661 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16041662 }
16051663
1606
- void DrawMaterial(cMaterial material, boolean selected)
1664
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16071665 {
16081666 CameraPane display = this;
16091667 //new Exception().printStackTrace();
....@@ -1638,7 +1696,7 @@
16381696 colorV[0] = display.modelParams0[0] * material.diffuse;
16391697 colorV[1] = display.modelParams0[1] * material.diffuse;
16401698 colorV[2] = display.modelParams0[2] * material.diffuse;
1641
- colorV[3] = material.opacity;
1699
+ colorV[3] = 1; // material.opacity;
16421700
16431701 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16441702 //System.out.println("Opacity = " + opacity);
....@@ -1746,9 +1804,9 @@
17461804 display.modelParams7[2] = 0;
17471805 display.modelParams7[3] = 0;
17481806
1749
- display.modelParams6[0] = 100; // criss de bug de bump
1807
+ //display.modelParams6[0] = 100; // criss de bug de bump
17501808
1751
- Object3D.cVector2[] extparams = display.vector2buffer;
1809
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17521810 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17531811 {
17541812 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -2044,7 +2102,7 @@
20442102 //System.err.println("Oeil on");
20452103 OEIL = true;
20462104 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2047
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2105
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20482106 //pingthread.StepToTarget(true);
20492107 }
20502108
....@@ -2259,7 +2317,7 @@
22592317
22602318 void ToggleDebug()
22612319 {
2262
- DEBUG ^= true;
2320
+ Globals.DEBUG ^= true;
22632321 }
22642322
22652323 void ToggleLookAt()
....@@ -2277,10 +2335,17 @@
22772335 HANDLES ^= true;
22782336 }
22792337
2338
+ Object3D paintFolder;
2339
+
22802340 void TogglePaint()
22812341 {
22822342 PAINTMODE ^= true;
22832343 paintcount = 0;
2344
+
2345
+ if (PAINTMODE)
2346
+ {
2347
+ paintFolder = GetFolder();
2348
+ }
22842349 }
22852350
22862351 void SwapCamera(int a, int b)
....@@ -2377,6 +2442,21 @@
23772442 return currentGL;
23782443 }
23792444
2445
+ static private BufferedImage CreateBim(TextureData texturedata)
2446
+ {
2447
+ Grafreed.Assert(texturedata != null);
2448
+
2449
+ int width = texturedata.getWidth();
2450
+ int height = texturedata.getHeight();
2451
+
2452
+ Buffer buffer = texturedata.getBuffer();
2453
+ ByteBuffer bytebuf = (ByteBuffer)buffer;
2454
+
2455
+ byte[] bytes = bytebuf.array();
2456
+
2457
+ return CreateBim(bytes, width, height);
2458
+ }
2459
+
23802460 /**/
23812461 class CacheTexture
23822462 {
....@@ -2385,28 +2465,31 @@
23852465
23862466 int resolution;
23872467
2388
- CacheTexture(com.sun.opengl.util.texture.Texture tex, int res)
2468
+ CacheTexture(com.sun.opengl.util.texture.TextureData texdata, int res)
23892469 {
2390
- texture = tex;
2470
+ texture = com.sun.opengl.util.texture.TextureIO.newTexture(texdata);
2471
+ texturedata = texdata;
23912472 resolution = res;
23922473 }
23932474 }
23942475 /**/
23952476
23962477 // TEXTURE static Texture texture;
2397
- static public java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/> textures
2398
- = new java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/>();
2399
- static public java.util.Hashtable<String, String> usedtextures = new java.util.Hashtable<String, String>();
2478
+ static public Hashtable<cTexture, CacheTexture> texturepigment = new Hashtable<cTexture, CacheTexture>();
2479
+ static public Hashtable<cTexture, CacheTexture> texturebump = new Hashtable<cTexture, CacheTexture>();
2480
+ static public Hashtable<byte[], CacheTexture> bimtextures = new Hashtable<byte[], CacheTexture>();
2481
+ static public java.util.HashSet<cTexture> usedtextures = new java.util.HashSet<cTexture>();
2482
+
24002483 int pigmentdepth = 0;
24012484 public com.sun.opengl.util.texture.Texture[] pigmentstack = new com.sun.opengl.util.texture.Texture[65536];
24022485 int bumpdepth = 0;
24032486 public com.sun.opengl.util.texture.Texture[] bumpstack = new com.sun.opengl.util.texture.Texture[65536];
24042487 //public static String DEFAULT_TEXTURE = "DEFAULT_TEXTURE";
24052488 public static cTexture DEFAULT_TEXTURES = new cTexture("DEFAULT_TEXTURE" + ":" + "DEFAULT_TEXTURE_BUMP");
2406
- public static String NOISE_TEXTURE = "WHITE_NOISE";
2489
+ public static cTexture NOISE_TEXTURE = new cTexture("WHITE_NOISE:");
24072490 // public static cTexture IMMORTAL_TEXTURE = new cTexture("IMMORTAL");
24082491
2409
- com.sun.opengl.util.texture.Texture GetResourceTexture(String name, boolean bump)
2492
+ com.sun.opengl.util.texture.TextureData GetResourceTexture(String name, boolean bump)
24102493 {
24112494 TextureData texturedata = null;
24122495
....@@ -2425,13 +2508,34 @@
24252508 if (bump)
24262509 texturedata = ConvertBump(texturedata, false);
24272510
2428
- com.sun.opengl.util.texture.Texture texture =
2429
- com.sun.opengl.util.texture.TextureIO.newTexture(texturedata);
2511
+// com.sun.opengl.util.texture.Texture texture =
2512
+// com.sun.opengl.util.texture.TextureIO.newTexture(texturedata);
24302513
2431
- texture.setTexParameteri(javax.media.opengl.GL.GL_TEXTURE_WRAP_S, javax.media.opengl.GL.GL_REPEAT);
2432
- texture.setTexParameteri(javax.media.opengl.GL.GL_TEXTURE_WRAP_T, javax.media.opengl.GL.GL_REPEAT);
2514
+ //texture.setTexParameteri(javax.media.opengl.GL.GL_TEXTURE_WRAP_S, javax.media.opengl.GL.GL_REPEAT);
2515
+ //texture.setTexParameteri(javax.media.opengl.GL.GL_TEXTURE_WRAP_T, javax.media.opengl.GL.GL_REPEAT);
24332516
2434
- return texture;
2517
+ return texturedata;
2518
+ }
2519
+
2520
+ com.sun.opengl.util.texture.TextureData GetBimTexture(BufferedImage bim, boolean bump)
2521
+ {
2522
+ TextureData texturedata = null;
2523
+
2524
+ try
2525
+ {
2526
+ texturedata =
2527
+ com.sun.opengl.util.texture.TextureIO.newTextureData(
2528
+ bim,
2529
+ true);
2530
+ } catch (Exception e)
2531
+ {
2532
+ throw new javax.media.opengl.GLException(e);
2533
+ }
2534
+
2535
+ if (bump)
2536
+ texturedata = ConvertBump(texturedata, false);
2537
+
2538
+ return texturedata;
24352539 }
24362540
24372541 boolean HUESMOOTH = true; // wrap around bug... true;
....@@ -3504,6 +3608,8 @@
35043608
35053609 System.out.println("LOADING TEXTURE : " + name);
35063610
3611
+ Object x = texturedata.getMipmapData(); // .getBuffer();
3612
+
35073613 //
35083614 if (false) // compressbit > 0)
35093615 {
....@@ -7902,7 +8008,7 @@
79028008 String pigment = Object3D.GetPigment(tex);
79038009 String bump = Object3D.GetBump(tex);
79048010
7905
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8011
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79068012 {
79078013 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79088014 // System.out.println("; bump = " + bump);
....@@ -7917,8 +8023,8 @@
79178023 pigment = null;
79188024 }
79198025
7920
- ReleaseTexture(bump, true);
7921
- ReleaseTexture(pigment, false);
8026
+ ReleaseTexture(tex, true);
8027
+ ReleaseTexture(tex, false);
79228028 }
79238029
79248030 public void ReleasePigmentTexture(cTexture tex) // INTERFACE
....@@ -7936,7 +8042,7 @@
79368042
79378043 String pigment = Object3D.GetPigment(tex);
79388044
7939
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8045
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79408046 {
79418047 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79428048 // System.out.println("; bump = " + bump);
....@@ -7947,7 +8053,7 @@
79478053 pigment = null;
79488054 }
79498055
7950
- ReleaseTexture(pigment, false);
8056
+ ReleaseTexture(tex, false);
79518057 }
79528058
79538059 public void ReleaseBumpTexture(cTexture tex) // INTERFACE
....@@ -7965,7 +8071,7 @@
79658071
79668072 String bump = Object3D.GetBump(tex);
79678073
7968
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8074
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79698075 {
79708076 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79718077 // System.out.println("; bump = " + bump);
....@@ -7976,10 +8082,10 @@
79768082 bump = null;
79778083 }
79788084
7979
- ReleaseTexture(bump, true);
8085
+ ReleaseTexture(tex, true);
79808086 }
79818087
7982
- void ReleaseTexture(String tex, boolean bump)
8088
+ void ReleaseTexture(cTexture tex, boolean bump)
79838089 {
79848090 if (// DrawMode() != 0 || /*tex == null ||*/
79858091 ambientOcclusion ) // || !textureon)
....@@ -7990,7 +8096,7 @@
79908096 CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
79918097
79928098 if (tex != null)
7993
- texture = textures.get(tex);
8099
+ texture = bump ? texturebump.get(tex) : texturepigment.get(tex);
79948100
79958101 // //assert( texture != null );
79968102 // if (texture == null)
....@@ -8084,47 +8190,50 @@
80848190
80858191 /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
80868192 {
8087
- if (// DrawMode() != 0 || /*tex == null ||*/
8088
- ambientOcclusion ) // || !textureon)
8089
- {
8090
- return; // false;
8091
- }
8092
-
8093
- if (tex == null)
8094
- {
8095
- BindTexture(null,false,resolution);
8096
- BindTexture(null,true,resolution);
8097
- return;
8098
- }
8193
+// if (// DrawMode() != 0 || /*tex == null ||*/
8194
+// ambientOcclusion ) // || !textureon)
8195
+// {
8196
+// return; // false;
8197
+// }
8198
+//
8199
+// if (tex == null)
8200
+// {
8201
+// BindTexture(null,false,resolution);
8202
+// BindTexture(null,true,resolution);
8203
+// return;
8204
+// }
8205
+//
8206
+// String pigment = Object3D.GetPigment(tex);
8207
+// String bump = Object3D.GetBump(tex);
8208
+//
8209
+// usedtextures.add(pigment);
8210
+// usedtextures.add(bump);
8211
+//
8212
+// //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8213
+// {
8214
+// // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8215
+// // System.out.println("; bump = " + bump);
8216
+// }
8217
+//
8218
+// if (bump.equals(""))
8219
+// {
8220
+// bump = null;
8221
+// }
8222
+// if (pigment.equals(""))
8223
+// {
8224
+// pigment = null;
8225
+// }
8226
+//
8227
+// GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8228
+// BindTexture(pigment, false, resolution);
8229
+// GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8230
+// BindTexture(bump, true, resolution);
8231
+// GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8232
+//
8233
+// return; // true;
80998234
8100
- String pigment = Object3D.GetPigment(tex);
8101
- String bump = Object3D.GetBump(tex);
8102
-
8103
- usedtextures.put(pigment, pigment);
8104
- usedtextures.put(bump, bump);
8105
-
8106
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8107
- {
8108
- // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8109
- // System.out.println("; bump = " + bump);
8110
- }
8111
-
8112
- if (bump.equals(""))
8113
- {
8114
- bump = null;
8115
- }
8116
- if (pigment.equals(""))
8117
- {
8118
- pigment = null;
8119
- }
8120
-
8121
- GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8122
- BindTexture(pigment, false, resolution);
8123
- GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8124
- BindTexture(bump, true, resolution);
8125
- GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8126
-
8127
- return; // true;
8235
+ BindPigmentTexture(tex, resolution);
8236
+ BindBumpTexture(tex, resolution);
81288237 }
81298238
81308239 /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE
....@@ -8143,9 +8252,9 @@
81438252
81448253 String pigment = Object3D.GetPigment(tex);
81458254
8146
- usedtextures.put(pigment, pigment);
8255
+ usedtextures.add(tex);
81478256
8148
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8257
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81498258 {
81508259 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81518260 // System.out.println("; bump = " + bump);
....@@ -8157,7 +8266,7 @@
81578266 }
81588267
81598268 GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8160
- BindTexture(pigment, false, resolution);
8269
+ BindTexture(tex, false, resolution);
81618270 }
81628271
81638272 /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE
....@@ -8176,9 +8285,9 @@
81768285
81778286 String bump = Object3D.GetBump(tex);
81788287
8179
- usedtextures.put(bump, bump);
8288
+ usedtextures.add(tex);
81808289
8181
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8290
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81828291 {
81838292 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81848293 // System.out.println("; bump = " + bump);
....@@ -8190,7 +8299,7 @@
81908299 }
81918300
81928301 GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8193
- BindTexture(bump, true, resolution);
8302
+ BindTexture(tex, true, resolution);
81948303 GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
81958304 }
81968305
....@@ -8214,13 +8323,19 @@
82148323 return fileExists;
82158324 }
82168325
8217
- CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception
8326
+ CacheTexture GetCacheTexture(cTexture tex, boolean bump, int resolution) throws Exception
82188327 {
8219
- CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
8328
+ CacheTexture texturecache = null;
82208329
82218330 if (tex != null)
82228331 {
8223
- String texname = tex;
8332
+ String texname = bump ? Object3D.GetBump(tex) : Object3D.GetPigment(tex);
8333
+ byte[] texdata = bump ? tex.bumpdata : tex.pigmentdata;
8334
+
8335
+ if (texname.equals("") && texdata == null)
8336
+ {
8337
+ return null;
8338
+ }
82248339
82258340 String fallbackTextureName = defaultDirectory + "/Textures/" + texname;
82268341
....@@ -8230,19 +8345,46 @@
82308345 // else
82318346 // if (!texname.startsWith("/"))
82328347 // texname = "/Users/nbriere/Textures/" + texname;
8233
- if (!FileExists(tex))
8348
+ if (!FileExists(texname))
82348349 {
82358350 texname = fallbackTextureName;
82368351 }
82378352
82388353 if (CACHETEXTURE)
8239
- texture = textures.get(texname); // TEXTURE CACHE
8240
-
8241
- TextureData texturedata = null;
8242
-
8243
- if (texture == null || texture.resolution < resolution)
82448354 {
8245
- if (tex.equals("DEFAULT_TEXTURE")) // ||*/ tex.equals(""))
8355
+ if (texdata == null)
8356
+ texturecache = bump ? texturebump.get(tex) : texturepigment.get(tex);
8357
+ else
8358
+ texturecache = bimtextures.get(texdata);
8359
+ }
8360
+
8361
+ if (texturecache == null || texturecache.resolution != -1 && texturecache.resolution < resolution)
8362
+ {
8363
+ TextureData texturedata = null;
8364
+
8365
+ if (texdata != null && textureon)
8366
+ {
8367
+ BufferedImage bim; // = new BufferedImage(bump?tex.bw:tex.pw, bump?tex.bh:tex.ph, BufferedImage.TYPE_INT_RGB);
8368
+
8369
+ try
8370
+ {
8371
+ bim = DecompressJPEG(texdata, bump?tex.bw:tex.pw, bump?tex.bh:tex.ph);
8372
+ }
8373
+ catch (Exception e)
8374
+ {
8375
+ bim = CreateBim(texdata, bump?tex.bw:tex.pw, bump?tex.bh:tex.ph);
8376
+ }
8377
+
8378
+ texturecache = new CacheTexture(GetBimTexture(bim, bump), -1);
8379
+ bimtextures.put(texdata, texturecache);
8380
+
8381
+ //BufferedImage bim3 = new BufferedImage(bump?tex.bw:tex.pw, bump?tex.bh:tex.ph, BufferedImage.TYPE_INT_RGB);
8382
+
8383
+ //Object bim2 = CreateBim(texturecache.texturedata);
8384
+ //bim2 = bim;
8385
+ }
8386
+ else
8387
+ if (texname.endsWith("DEFAULT_TEXTURE")) // ||*/ tex.equals(""))
82468388 {
82478389 assert(!bump);
82488390 // if (bump)
....@@ -8253,19 +8395,23 @@
82538395 // }
82548396 // else
82558397 // {
8256
- texture = textures.get(tex);
8257
- if (texture == null)
8398
+ // texturecache = textures.get(texname); // suspicious
8399
+ if (texturecache == null)
82588400 {
8259
- texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
8401
+ texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
82608402 }
8403
+ else
8404
+ new Exception().printStackTrace();
82618405 // }
82628406 } else
8263
- if (tex.equals("DEFAULT_TEXTURE_BUMP")) // ||*/ tex.equals(""))
8407
+ if (texname.endsWith("DEFAULT_TEXTURE_BUMP")) // ||*/ tex.equals(""))
82648408 {
82658409 assert(bump);
8266
- texture = textures.get(tex);
8267
- if (texture == null)
8268
- texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
8410
+ // texturecache = textures.get(texname); // suspicious
8411
+ if (texturecache == null)
8412
+ texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
8413
+ else
8414
+ new Exception().printStackTrace();
82698415 } else
82708416 {
82718417 //if (tex.equals("IMMORTAL"))
....@@ -8273,11 +8419,13 @@
82738419 // texture = GetResourceTexture("default.png");
82748420 //} else
82758421 //{
8276
- if (tex.equals("WHITE_NOISE"))
8422
+ if (texname.endsWith("WHITE_NOISE"))
82778423 {
8278
- texture = textures.get(tex);
8279
- if (texture == null)
8280
- texture = new CacheTexture(GetResourceTexture("whitenoise.png", bump),resolution);
8424
+ // texturecache = textures.get(texname); // suspicious
8425
+ if (texturecache == null)
8426
+ texturecache = new CacheTexture(GetResourceTexture("whitenoise.png", bump),resolution);
8427
+ else
8428
+ new Exception().printStackTrace();
82818429 } else
82828430 {
82838431 if (textureon)
....@@ -8336,19 +8484,19 @@
83368484 if (texturedata == null)
83378485 throw new Exception();
83388486
8339
- texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
8487
+ texturecache = new CacheTexture(texturedata,resolution);
83408488 //texture = GetTexture(tex, bump);
83418489 }
83428490 }
83438491 //}
83448492 }
83458493
8346
- if (/*CACHETEXTURE &&*/ texture != null && textureon)
8494
+ if (texdata == null && /*CACHETEXTURE &&*/ texturecache != null && textureon)
83478495 {
83488496 //return false;
83498497
83508498 // System.out.println("CACHE +++++++++++++++ TEXTURE : " + texname + " (" + texture.getEstimatedMemorySize() + ")");
8351
- if (texturedata != null && (texname.endsWith(".jpg") || texname.endsWith(".JPG")))
8499
+ if (texturedata != null && texname.toLowerCase().endsWith(".jpg"))
83528500 {
83538501 // String ext = "_highres";
83548502 // if (REDUCETEXTURE)
....@@ -8365,52 +8513,17 @@
83658513 File cachefile = new File(texname.substring(0, texname.length()-4)+ext+".jpg");
83668514 if (!cachefile.exists())
83678515 {
8368
- // cache to disk
8369
- Buffer buffer = texturedata.getBuffer(); // getMipmapData();
8370
- //buffers[0].
8371
-
8372
- ByteBuffer bytebuf = (ByteBuffer)buffer; // ).asIntBuffer();
8373
- int[] pixels = new int[bytebuf.capacity()/3];
8374
-
8375
- // squared size heuristic...
8376
- if ((int)Math.sqrt(pixels.length) == Math.sqrt(pixels.length))
8516
+ //if (texturedata.getWidth() == texturedata.getHeight())
83778517 {
8378
- for (int i=pixels.length; --i>=0;)
8379
- {
8380
- int i3 = i*3;
8381
- pixels[i] = 0xFF;
8382
- pixels[i] <<= 8;
8383
- pixels[i] |= bytebuf.get(i3+2) & 0xFF;
8384
- pixels[i] <<= 8;
8385
- pixels[i] |= bytebuf.get(i3+1) & 0xFF;
8386
- pixels[i] <<= 8;
8387
- pixels[i] |= bytebuf.get(i3) & 0xFF;
8388
- }
8389
-
8390
- /*
8391
- int r=0,g=0,b=0,a=0;
8392
- for (int i=0; i<width; i++)
8393
- for (int j=0; j<height; j++)
8394
- {
8395
- int index = j*width+i;
8396
- int p = pixels[index];
8397
- a = ((p>>24) & 0xFF);
8398
- r = ((p>>16) & 0xFF);
8399
- g = ((p>>8) & 0xFF);
8400
- b = (p & 0xFF);
8401
- pixels[index] = (a<<24) | (b<<16) | (g<<8) | r;
8402
- }
8403
- /**/
8404
- int width = (int)Math.sqrt(pixels.length); // squared
8405
- int height = width;
8406
- BufferedImage rendImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // ImageIO.read(infile);
8407
- rendImage.setRGB(0,0,width,height,pixels,width*(height-1),-width);
8518
+ BufferedImage rendImage = CreateBim(texturedata);
8519
+
84088520 ImageWriter writer = null;
84098521 Iterator iter = ImageIO.getImageWritersByFormatName("jpg");
84108522 if (iter.hasNext()) {
84118523 writer = (ImageWriter)iter.next();
84128524 }
8413
- float compressionQuality = 0.9f;
8525
+
8526
+ float compressionQuality = 0.85f;
84148527 try
84158528 {
84168529 ImageOutputStream ios = ImageIO.createImageOutputStream(cachefile);
....@@ -8427,18 +8540,20 @@
84278540 }
84288541 }
84298542 }
8430
-
8543
+
8544
+ Hashtable<cTexture, CacheTexture> textures = bump ? texturebump : texturepigment;
8545
+
84318546 //System.out.println("Texture = " + tex);
8432
- if (textures.containsKey(texname))
8547
+ if (textures.containsKey(tex))
84338548 {
8434
- CacheTexture thetex = textures.get(texname);
8549
+ CacheTexture thetex = textures.get(tex);
84358550 thetex.texture.disable();
84368551 thetex.texture.dispose();
8437
- textures.remove(texname);
8552
+ textures.remove(tex);
84388553 }
84398554
8440
- texture.texturedata = texturedata;
8441
- textures.put(texname, texture);
8555
+ //texture.texturedata = texturedata;
8556
+ textures.put(tex, texturecache);
84428557
84438558 // newtex = true;
84448559 }
....@@ -8454,10 +8569,44 @@
84548569 }
84558570 }
84568571
8457
- return texture;
8572
+ return texturecache;
84588573 }
84598574
8460
- com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception
8575
+ static void EmbedTextures(cTexture tex)
8576
+ {
8577
+ if (tex.pigmentdata == null)
8578
+ {
8579
+ //String texname = Object3D.GetPigment(tex);
8580
+
8581
+ CacheTexture texturecache = texturepigment.get(tex);
8582
+
8583
+ if (texturecache != null)
8584
+ {
8585
+ tex.pw = texturecache.texturedata.getWidth();
8586
+ tex.ph = texturecache.texturedata.getHeight();
8587
+ tex.pigmentdata = //CompressJPEG(CreateBim
8588
+ ((ByteBuffer)texturecache.texturedata.getBuffer()).array()
8589
+ ;
8590
+ //, tex.pw, tex.ph), 0.5f);
8591
+ }
8592
+ }
8593
+
8594
+ if (tex.bumpdata == null)
8595
+ {
8596
+ //String texname = Object3D.GetBump(tex);
8597
+
8598
+ CacheTexture texturecache = texturebump.get(tex);
8599
+
8600
+ if (texturecache != null)
8601
+ {
8602
+ tex.bw = texturecache.texturedata.getWidth();
8603
+ tex.bh = texturecache.texturedata.getHeight();
8604
+ tex.bumpdata = CompressJPEG(CreateBim(((ByteBuffer)texturecache.texturedata.getBuffer()).array(), tex.bw, tex.bh), 0.5f);
8605
+ }
8606
+ }
8607
+ }
8608
+
8609
+ com.sun.opengl.util.texture.Texture GetTexture(cTexture tex, boolean bump, int resolution) throws Exception
84618610 {
84628611 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
84638612
....@@ -8475,21 +8624,21 @@
84758624 return texture!=null?texture.texture:null;
84768625 }
84778626
8478
- public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception
8627
+ public com.sun.opengl.util.texture.TextureData GetTextureData(cTexture tex, boolean bump, int resolution) throws Exception
84798628 {
84808629 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
84818630
84828631 return texture!=null?texture.texturedata:null;
84838632 }
84848633
8485
- boolean BindTexture(String tex, boolean bump, int resolution) throws Exception
8634
+ boolean BindTexture(cTexture tex, boolean bump, int resolution) throws Exception
84868635 {
84878636 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
84888637 {
84898638 return false;
84908639 }
84918640
8492
- boolean newtex = false;
8641
+ //boolean newtex = false;
84938642
84948643 com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
84958644
....@@ -8521,9 +8670,75 @@
85218670 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT);
85228671 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT);
85238672
8524
- return newtex;
8673
+ return true; // Warning: not used.
85258674 }
85268675
8676
+ public static byte[] CompressJPEG(BufferedImage image, float quality)
8677
+ {
8678
+ try
8679
+ {
8680
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
8681
+ Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("jpg");
8682
+ ImageWriter writer = writers.next();
8683
+
8684
+ ImageWriteParam param = writer.getDefaultWriteParam();
8685
+ param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
8686
+ param.setCompressionQuality(quality);
8687
+
8688
+ ImageOutputStream ios = ImageIO.createImageOutputStream(baos);
8689
+ writer.setOutput(ios);
8690
+ writer.write(null, new IIOImage(image, null, null), param);
8691
+
8692
+ byte[] data = baos.toByteArray();
8693
+ writer.dispose();
8694
+ return data;
8695
+ }
8696
+ catch (Exception e)
8697
+ {
8698
+ e.printStackTrace();
8699
+ return null;
8700
+ }
8701
+ }
8702
+
8703
+ public static BufferedImage DecompressJPEG(byte[] image, int w, int h) throws IOException
8704
+ {
8705
+ ByteArrayInputStream baos = new ByteArrayInputStream(image);
8706
+ Iterator<ImageReader> writers = ImageIO.getImageReadersByFormatName("jpg");
8707
+ ImageReader reader = writers.next();
8708
+
8709
+ BufferedImage bim = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
8710
+
8711
+ ImageReadParam param = reader.getDefaultReadParam();
8712
+ param.setDestination(bim);
8713
+ //param.setDestinationType(ImageTypeSpecifier.createFromBufferedImageType(BufferedImage.TYPE_INT_RGB));
8714
+
8715
+ ImageInputStream ios = ImageIO.createImageInputStream(baos);
8716
+ reader.setInput(ios);
8717
+ BufferedImage bim2 = reader.read(0, param);
8718
+ reader.dispose();
8719
+
8720
+// WritableRaster raster = bim2.getRaster();
8721
+// DataBufferByte data = (DataBufferByte) raster.getDataBuffer();
8722
+// byte[] bytes = data.getData();
8723
+//
8724
+// int[] pixels = new int[bytes.length/3];
8725
+// for (int i=pixels.length; --i>=0;)
8726
+// {
8727
+// int i3 = i*3;
8728
+// pixels[i] = 0xFF;
8729
+// pixels[i] <<= 8;
8730
+// pixels[i] |= bytes[i3+2] & 0xFF;
8731
+// pixels[i] <<= 8;
8732
+// pixels[i] |= bytes[i3+1] & 0xFF;
8733
+// pixels[i] <<= 8;
8734
+// pixels[i] |= bytes[i3] & 0xFF;
8735
+// }
8736
+//
8737
+// bim.setRGB(0,0,w,h, pixels, w*(h-1),-w);
8738
+
8739
+ return bim;
8740
+ }
8741
+
85278742 ShadowBuffer shadowPBuf;
85288743 AntialiasBuffer antialiasPBuf;
85298744 int MAXSTACK;
....@@ -9359,11 +9574,35 @@
93599574 jy8[3] = 0.5f;
93609575 }
93619576
9362
- float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
9577
+ float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
93639578 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
93649579 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
93659580 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
93669581
9582
+ void ResetOptions()
9583
+ {
9584
+ options1[0] = 100;
9585
+ options1[1] = 0.025f;
9586
+ options1[2] = 0.01f;
9587
+ options1[3] = 0;
9588
+ options1[4] = 0;
9589
+
9590
+ options2[0] = 0;
9591
+ options2[1] = 0.75f;
9592
+ options2[2] = 0;
9593
+ options2[3] = 0;
9594
+
9595
+ options3[0] = 1;
9596
+ options3[1] = 1;
9597
+ options3[2] = 1;
9598
+ options3[3] = 0;
9599
+
9600
+ options4[0] = 1;
9601
+ options4[1] = 0;
9602
+ options4[2] = 1;
9603
+ options4[3] = 0;
9604
+ }
9605
+
93679606 static int imagecount = 0; // movie generation
93689607
93699608 static int jitter = 0;
....@@ -10474,6 +10713,7 @@
1047410713 ANTIALIAS = 0;
1047510714 //System.out.println("RESTART");
1047610715 AAtimer.restart();
10716
+ Globals.TIMERRUNNING = true;
1047710717 }
1047810718 }
1047910719 }
....@@ -10541,7 +10781,8 @@
1054110781 ambientOcclusion = false;
1054210782 }
1054310783
10544
- if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
10784
+ if (//Globals.lighttouched &&
10785
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1054510786 {
1054610787 //if (RENDERSHADOW) // ?
1054710788 if (!IsFrozen())
....@@ -10981,9 +11222,9 @@
1098111222
1098211223 gl.glMatrixMode(GL.GL_MODELVIEW);
1098311224
10984
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
10985
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
10986
-//gl.glEnable(gl.GL_MULTISAMPLE);
11225
+gl.glEnable(gl.GL_POLYGON_SMOOTH);
11226
+gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11227
+gl.glEnable(gl.GL_MULTISAMPLE);
1098711228 } else
1098811229 {
1098911230 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -10994,7 +11235,7 @@
1099411235 //System.out.println("BLENDING ON");
1099511236 gl.glEnable(GL.GL_BLEND);
1099611237 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
10997
-
11238
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1099811239 gl.glMatrixMode(gl.GL_PROJECTION);
1099911240 gl.glLoadIdentity();
1100011241
....@@ -11243,7 +11484,7 @@
1124311484 }
1124411485 }
1124511486
11246
- if (false) // fast && !IsFreezed() && DrawMode() != SELECTION && !ambientOcclusion)
11487
+ if (false) //RENDERPROGRAM > 0 && DrawMode() == DEFAULT) // fast && !IsFreezed() && DrawMode() != SELECTION && !ambientOcclusion)
1124711488 {
1124811489 //gl.glDepthFunc(GL.GL_LEQUAL);
1124911490 //gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
....@@ -11251,24 +11492,21 @@
1125111492
1125211493 boolean texon = textureon;
1125311494
11254
- if (RENDERPROGRAM > 0)
11255
- {
11256
- gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB);
11257
- textureon = false;
11258
- }
11495
+ gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB);
11496
+ textureon = false;
11497
+
1125911498 //gl.glDisable(GL.GL_VERTEX_PROGRAM_ARB);
1126011499 //System.out.println("ALLO");
1126111500 gl.glColorMask(false, false, false, false);
1126211501 DrawObject(gl);
11263
- if (RENDERPROGRAM > 0)
11264
- {
11265
- gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB);
11266
- textureon = texon;
11267
- }
11502
+
11503
+ gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB);
11504
+ textureon = texon;
11505
+
1126811506 gl.glColorMask(true, true, true, true);
1126911507
1127011508 gl.glDepthFunc(GL.GL_EQUAL);
11271
- //gl.glDepthMask(false);
11509
+ gl.glDepthMask(false);
1127211510 }
1127311511
1127411512 if (false) // DrawMode() == SHADOW)
....@@ -11451,15 +11689,36 @@
1145111689
1145211690 static boolean zoomonce = false;
1145311691
11692
+ static void CreateSelectedPoint()
11693
+ {
11694
+ if (selectedpoint == null)
11695
+ {
11696
+ debugpointG = new Sphere();
11697
+ debugpointP = new Sphere();
11698
+ debugpointC = new Sphere();
11699
+ debugpointR = new Sphere();
11700
+
11701
+ selectedpoint = new Superellipsoid();
11702
+
11703
+ for (int i=0; i<8; i++)
11704
+ {
11705
+ debugpoints[i] = new Sphere();
11706
+ }
11707
+ }
11708
+ }
11709
+
1145411710 void DrawObject(GL gl, boolean draw)
1145511711 {
11712
+ // To clear camera values
11713
+ ResetOptions();
11714
+
1145611715 //System.out.println("DRAW OBJECT " + mouseDown);
1145711716 // DrawMode() = SELECTION;
1145811717 //GL gl = getGL();
1145911718 if ((TRACK || SHADOWTRACK) || zoomonce)
1146011719 {
1146111720 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11462
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11721
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1146311722 pingthread.StepToTarget(true); // true);
1146411723 // zoomonce = false;
1146511724 }
....@@ -11531,8 +11790,9 @@
1153111790
1153211791 if (DrawMode() == DEFAULT)
1153311792 {
11534
- if (DEBUG)
11793
+ if (Globals.DEBUG)
1153511794 {
11795
+ CreateSelectedPoint();
1153611796 float radius = 0.05f;
1153711797 if (selectedpoint.radius != radius)
1153811798 {
....@@ -11586,20 +11846,32 @@
1158611846 ReleaseTextures(DEFAULT_TEXTURES);
1158711847
1158811848 if (CLEANCACHE)
11589
- for (java.util.Enumeration<String> e = textures.keys() ; e.hasMoreElements();)
11849
+ for (java.util.Enumeration<cTexture> e = texturepigment.keys() ; e.hasMoreElements();)
1159011850 {
11591
- String tex = e.nextElement();
11851
+ cTexture tex = e.nextElement();
1159211852
1159311853 // System.out.println("Texture --------- " + tex);
1159411854
11595
- if (tex.equals("WHITE_NOISE"))
11855
+ if (tex.equals("WHITE_NOISE:"))
1159611856 continue;
1159711857
11598
- if (!usedtextures.containsKey(tex))
11858
+ if (!usedtextures.contains(tex))
1159911859 {
11860
+ CacheTexture gettex = texturepigment.get(tex);
1160011861 // System.out.println("DISPOSE +++++++++++++++ " + tex);
11601
- textures.get(tex).texture.dispose();
11602
- textures.remove(tex);
11862
+ if (gettex != null)
11863
+ {
11864
+ gettex.texture.dispose();
11865
+ texturepigment.remove(tex);
11866
+ }
11867
+
11868
+ gettex = texturebump.get(tex);
11869
+ // System.out.println("DISPOSE +++++++++++++++ " + tex);
11870
+ if (gettex != null)
11871
+ {
11872
+ gettex.texture.dispose();
11873
+ texturebump.remove(tex);
11874
+ }
1160311875 }
1160411876 }
1160511877 }
....@@ -12019,7 +12291,7 @@
1201912291 for (int i = tp.size(); --i >= 0;)
1202012292 {
1202112293 //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12022
- LA.xformPos(light, tp.get(i).GlobalTransform(), light);
12294
+ LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
1202312295 }
1202412296
1202512297
....@@ -13289,7 +13561,8 @@
1328913561 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1329013562 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1329113563 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13292
- Object3D.cVector2[] vector2buffer;
13564
+
13565
+ //Object3D.cVector2[] vector2buffer;
1329313566
1329413567 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1329513568 // OUT : diff, spec
....@@ -13305,9 +13578,10 @@
1330513578 "DP3 " + dest + ".z," + "normals," + "eye;" +
1330613579 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1330713580 //"MOV " + dest + ".w," + "normal.z;" +
13308
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13309
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13310
- //"MOV " + dest + ".z," + "params2.w;" +
13581
+// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET
13582
+// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13583
+
13584
+ "MOV " + dest + ".z," + "params2.w;" + // EXACT
1331113585 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1331213586 "RCP " + dest + ".w," + dest + ".w;" +
1331313587 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13812,6 +14086,7 @@
1381214086 else
1381314087 if (evt.getSource() == AAtimer)
1381414088 {
14089
+ Globals.TIMERRUNNING = false;
1381514090 if (mouseDown)
1381614091 {
1381714092 //new Exception().printStackTrace();
....@@ -13871,7 +14146,7 @@
1387114146
1387214147 // fev 2014???
1387314148 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13874
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
14149
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1387514150 pingthread.StepToTarget(true); // true);
1387614151 }
1387714152 // if (!LIVE)
....@@ -13886,6 +14161,7 @@
1388614161 return;
1388714162
1388814163 AAtimer.restart(); //
14164
+ Globals.TIMERRUNNING = true;
1388914165
1389014166 // waslive = LIVE;
1389114167 // LIVE = false;
....@@ -14224,12 +14500,12 @@
1422414500 void GoDown(int mod)
1422514501 {
1422614502 MODIFIERS |= COMMAND;
14227
- /*
14503
+ /**/
1422814504 if((mod&SHIFT) == SHIFT)
1422914505 manipCamera.RotatePosition(0, -speed);
1423014506 else
14231
- manipCamera.BackForth(0, -speed*delta, getWidth());
14232
- */
14507
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14508
+ /**/
1423314509 if ((mod & SHIFT) == SHIFT)
1423414510 {
1423514511 mouseMode = mouseMode; // VR??
....@@ -14245,12 +14521,12 @@
1424514521 void GoUp(int mod)
1424614522 {
1424714523 MODIFIERS |= COMMAND;
14248
- /*
14524
+ /**/
1424914525 if((mod&SHIFT) == SHIFT)
1425014526 manipCamera.RotatePosition(0, speed);
1425114527 else
14252
- manipCamera.BackForth(0, speed*delta, getWidth());
14253
- */
14528
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14529
+ /**/
1425414530 if ((mod & SHIFT) == SHIFT)
1425514531 {
1425614532 mouseMode = mouseMode;
....@@ -14266,12 +14542,12 @@
1426614542 void GoLeft(int mod)
1426714543 {
1426814544 MODIFIERS |= COMMAND;
14269
- /*
14545
+ /**/
1427014546 if((mod&SHIFT) == SHIFT)
14271
- manipCamera.RotatePosition(speed, 0);
14272
- else
1427314547 manipCamera.Translate(speed*delta, 0, getWidth());
14274
- */
14548
+ else
14549
+ manipCamera.RotatePosition(speed, 0);
14550
+ /**/
1427514551 if ((mod & SHIFT) == SHIFT)
1427614552 {
1427714553 mouseMode = mouseMode;
....@@ -14287,12 +14563,12 @@
1428714563 void GoRight(int mod)
1428814564 {
1428914565 MODIFIERS |= COMMAND;
14290
- /*
14566
+ /**/
1429114567 if((mod&SHIFT) == SHIFT)
14292
- manipCamera.RotatePosition(-speed, 0);
14293
- else
1429414568 manipCamera.Translate(-speed*delta, 0, getWidth());
14295
- */
14569
+ else
14570
+ manipCamera.RotatePosition(-speed, 0);
14571
+ /**/
1429614572 if ((mod & SHIFT) == SHIFT)
1429714573 {
1429814574 mouseMode = mouseMode;
....@@ -14349,7 +14625,8 @@
1434914625 info.camera = renderCamera;
1435014626 info.x = x;
1435114627 info.y = y;
14352
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14628
+ object.GetWindow().copy
14629
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1435314630 } else
1435414631 {
1435514632 if (x < startX)
....@@ -14513,7 +14790,9 @@
1451314790 ci.camera = renderCamera;
1451414791 if (!isRenderer)
1451514792 {
14516
- if (object.editWindow.copy.doEditClick(ci, 0))
14793
+ //ObjEditor editWindow = object.editWindow;
14794
+ //Object3D copy = editWindow.copy;
14795
+ if (object.doEditClick(ci, 0))
1451714796 {
1451814797 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1451914798 } else
....@@ -14528,7 +14807,8 @@
1452814807 Globals.MOUSEDRAGGED = false;
1452914808
1453014809 movingcamera = false;
14531
- X = Y = 0;
14810
+ X = 0; // getBounds().width/2;
14811
+ Y = 0; // getBounds().height/2;
1453214812 //System.out.println("mouseReleased: " + e);
1453314813 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1453414814 }
....@@ -14784,7 +15064,8 @@
1478415064 // break;
1478515065 case 'T':
1478615066 CACHETEXTURE ^= true;
14787
- textures.clear();
15067
+ texturepigment.clear();
15068
+ texturebump.clear();
1478815069 // repaint();
1478915070 break;
1479015071 case 'Y':
....@@ -14869,7 +15150,9 @@
1486915150 case 'E' : COMPACT ^= true;
1487015151 repaint();
1487115152 break;
14872
- case 'W' : DEBUGHSB ^= true;
15153
+ case 'W' : // Wide Window (fullscreen)
15154
+ //DEBUGHSB ^= true;
15155
+ ObjEditor.theFrame.ToggleFullScreen();
1487315156 repaint();
1487415157 break;
1487515158 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14894,8 +15177,8 @@
1489415177 RevertCamera();
1489515178 repaint();
1489615179 break;
14897
- case 'L':
1489815180 case 'l':
15181
+ //case 'L':
1489915182 if (lightMode)
1490015183 {
1490115184 lightMode = false;
....@@ -15038,9 +15321,9 @@
1503815321 case '_':
1503915322 kompactbit = 5;
1504015323 break;
15041
- case '+':
15042
- kompactbit = 6;
15043
- break;
15324
+// case '+':
15325
+// kompactbit = 6;
15326
+// break;
1504415327 case ' ':
1504515328 lightMode ^= true;
1504615329 Globals.lighttouched = true;
....@@ -15052,6 +15335,7 @@
1505215335 case ESC:
1505315336 RENDERPROGRAM += 1;
1505415337 RENDERPROGRAM %= 3;
15338
+
1505515339 repaint();
1505615340 break;
1505715341 case 'Z':
....@@ -15091,8 +15375,9 @@
1509115375 case DELETE:
1509215376 ClearSelection();
1509315377 break;
15094
- /*
1509515378 case '+':
15379
+
15380
+ /*
1509615381 //fontsize += 1;
1509715382 bbzoom *= 2;
1509815383 repaint();
....@@ -15109,17 +15394,17 @@
1510915394 case '=':
1511015395 IncDepth();
1511115396 //fontsize += 1;
15112
- object.editWindow.refreshContents(true);
15397
+ object.GetWindow().refreshContents(true);
1511315398 maskbit = 6;
1511415399 break;
1511515400 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1511615401 DecDepth();
1511715402 maskbit = 5;
1511815403 //if(fontsize > 1) fontsize -= 1;
15119
- if (object.editWindow == null)
15120
- new Exception().printStackTrace();
15121
- else
15122
- object.editWindow.refreshContents(true);
15404
+// if (object.editWindow == null)
15405
+// new Exception().printStackTrace();
15406
+// else
15407
+ object.GetWindow().refreshContents(true);
1512315408 break;
1512415409 case '{':
1512515410 manipCamera.shaper_fovy /= 1.1;
....@@ -15343,7 +15628,7 @@
1534315628 }
1534415629 */
1534515630
15346
- object.editWindow.EditSelection();
15631
+ object.GetWindow().EditSelection(false);
1534715632 }
1534815633
1534915634 void SelectParent()
....@@ -15360,10 +15645,10 @@
1536015645 {
1536115646 //selectees.remove(i);
1536215647 System.out.println("select parent of " + elem);
15363
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15648
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1536415649 } else
1536515650 {
15366
- group.editWindow.Select(elem.GetTreePath(), first, true);
15651
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1536715652 }
1536815653
1536915654 first = false;
....@@ -15405,12 +15690,12 @@
1540515690 for (int j = 0; j < group.children.size(); j++)
1540615691 {
1540715692 elem = (Object3D) group.children.elementAt(j);
15408
- object.editWindow.Select(elem.GetTreePath(), first, true);
15693
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1540915694 first = false;
1541015695 }
1541115696 } else
1541215697 {
15413
- object.editWindow.Select(elem.GetTreePath(), first, true);
15698
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1541415699 }
1541515700
1541615701 first = false;
....@@ -15421,21 +15706,21 @@
1542115706 {
1542215707 //Composite group = (Composite) object;
1542315708 Object3D group = object;
15424
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15709
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1542515710 }
1542615711
1542715712 void ResetTransform(int mask)
1542815713 {
1542915714 //Composite group = (Composite) object;
1543015715 Object3D group = object;
15431
- group.editWindow.ResetTransform(mask);
15716
+ group.GetWindow().ResetTransform(mask);
1543215717 }
1543315718
1543415719 void FlipTransform()
1543515720 {
1543615721 //Composite group = (Composite) object;
1543715722 Object3D group = object;
15438
- group.editWindow.FlipTransform();
15723
+ group.GetWindow().FlipTransform();
1543915724 // group.editWindow.ReduceMesh(true);
1544015725 }
1544115726
....@@ -15443,7 +15728,7 @@
1544315728 {
1544415729 //Composite group = (Composite) object;
1544515730 Object3D group = object;
15446
- group.editWindow.PrintMemory();
15731
+ group.GetWindow().PrintMemory();
1544715732 // group.editWindow.ReduceMesh(true);
1544815733 }
1544915734
....@@ -15451,7 +15736,7 @@
1545115736 {
1545215737 //Composite group = (Composite) object;
1545315738 Object3D group = object;
15454
- group.editWindow.ResetCentroid();
15739
+ group.GetWindow().ResetCentroid();
1545515740 }
1545615741
1545715742 void IncDepth()
....@@ -15627,6 +15912,7 @@
1562715912 info.bounds.y += (height - desired) / 2;
1562815913 }
1562915914 }
15915
+
1563015916 info.g = gr;
1563115917 info.camera = renderCamera;
1563215918 /*
....@@ -15636,23 +15922,44 @@
1563615922 */
1563715923 if (!isRenderer)
1563815924 {
15639
- object.drawEditHandles(info, 0);
15640
-
15641
- if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15925
+ Grafreed.Assert(object != null);
15926
+ Grafreed.Assert(object.selection != null);
15927
+ if (object.selection.Size() > 0)
1564215928 {
15643
- switch (object.selection.get(0).hitSomething)
15929
+ int hitSomething = object.selection.get(0).hitSomething;
15930
+
15931
+ info.DX = 0;
15932
+ info.DY = 0;
15933
+ info.W = 1;
15934
+ if (hitSomething == Object3D.hitCenter)
1564415935 {
15645
- case Object3D.hitCenter: gr.setColor(Color.pink);
15646
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15647
- break;
15648
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15649
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15650
- break;
15651
- case Object3D.hitScale: gr.setColor(Color.cyan);
15652
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15653
- break;
15936
+ info.DX = X;
15937
+ if (X != 0)
15938
+ info.DX -= info.bounds.width/2;
15939
+
15940
+ info.DY = Y;
15941
+ if (Y != 0)
15942
+ info.DY -= info.bounds.height/2;
1565415943 }
15655
-
15944
+
15945
+ object.drawEditHandles(info, 0);
15946
+
15947
+ if (drag && (X != 0 || Y != 0))
15948
+ {
15949
+ switch (hitSomething)
15950
+ {
15951
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15952
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15953
+ break;
15954
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15955
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15956
+ break;
15957
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15958
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15959
+ break;
15960
+ }
15961
+
15962
+ }
1565615963 }
1565715964 }
1565815965 }
....@@ -16355,16 +16662,16 @@
1635516662 cStatic.objectstack[materialdepth++] = checker;
1635616663 //System.out.println("material " + material);
1635716664 //Applet3D.tracein(this, selected);
16358
- vector2buffer = checker.projectedVertices;
16665
+ //vector2buffer = checker.projectedVertices;
1635916666
1636016667 //checker.GetMaterial().Draw(this, false); // true);
16361
- DrawMaterial(checker.GetMaterial(), false); // true);
16668
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1636216669
1636316670 materialdepth -= 1;
1636416671 if (materialdepth > 0)
1636516672 {
16366
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16367
- DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
16673
+ //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16674
+ DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
1636816675 }
1636916676 //checker.GetMaterial().opacity = 1f;
1637016677 ////checker.GetMaterial().ambient = 1f;
....@@ -16450,6 +16757,14 @@
1645016757 }
1645116758 }
1645216759
16760
+ private Object3D GetFolder()
16761
+ {
16762
+ Object3D folder = object.GetWindow().copy;
16763
+ if (object.GetWindow().copy.selection.Size() > 0)
16764
+ folder = object.GetWindow().copy.selection.elementAt(0);
16765
+ return folder;
16766
+ }
16767
+
1645316768 class SelectBuffer implements GLEventListener
1645416769 {
1645516770
....@@ -16529,6 +16844,17 @@
1652916844
1653016845 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1653116846
16847
+ if (PAINTMODE)
16848
+ {
16849
+ if (object.GetWindow().copy.selection.Size() > 0)
16850
+ {
16851
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
16852
+
16853
+ // Make what you paint not selectable.
16854
+ paintobj.ResetSelectable();
16855
+ }
16856
+ }
16857
+
1653216858 //int tmp = selection_view;
1653316859 //selection_view = -1;
1653416860 int temp = DrawMode();
....@@ -16540,6 +16866,17 @@
1654016866 // temp = DEFAULT; // patch for selection debug
1654116867 Globals.drawMode = temp; // WARNING
1654216868
16869
+ if (PAINTMODE)
16870
+ {
16871
+ if (object.GetWindow().copy.selection.Size() > 0)
16872
+ {
16873
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
16874
+
16875
+ // Revert.
16876
+ paintobj.RestoreSelectable();
16877
+ }
16878
+ }
16879
+
1654316880 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1654416881
1654516882 // trying different ways of getting the depth info over
....@@ -16587,6 +16924,8 @@
1658716924 // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]);
1658816925 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1658916926 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
16927
+
16928
+ CreateSelectedPoint();
1659016929
1659116930 // Will fit the mesh !!!
1659216931 selectedpoint.toParent[0][0] = 0.0001;
....@@ -16641,29 +16980,31 @@
1664116980 }
1664216981
1664316982 if (!movingcamera && !PAINTMODE)
16644
- object.editWindow.ScreenFitPoint(); // fev 2014
16983
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1664516984
16646
- if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16985
+ if (PAINTMODE) // && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1664716986 {
16648
- Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16987
+ //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1664916988
16650
- Object3D group = new Object3D("inst" + paintcount++);
16989
+ if (object.GetWindow().copy.selection.Size() > 0)
16990
+ {
16991
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1665116992
16652
- group.CreateMaterial(); // use a void leaf to select instances
16653
-
16654
- group.add(paintobj); // link
16655
-
16656
- object.editWindow.SnapObject(group);
16657
-
16658
- Object3D folder = object.editWindow.copy;
16659
-
16660
- if (object.editWindow.copy.selection.Size() > 0)
16661
- folder = object.editWindow.copy.selection.elementAt(0);
16662
-
16663
- folder.add(group);
16664
-
16665
- object.editWindow.ResetModel();
16666
- object.editWindow.refreshContents();
16993
+ Object3D inst = new Object3D("inst" + paintcount++);
16994
+
16995
+ inst.CreateMaterial(); // use a void leaf to select instances
16996
+
16997
+ inst.add(paintobj); // link
16998
+
16999
+ object.GetWindow().SnapObject(inst);
17000
+
17001
+ Object3D folder = paintFolder; // GetFolder();
17002
+
17003
+ folder.add(inst);
17004
+
17005
+ object.GetWindow().ResetModel();
17006
+ object.GetWindow().refreshContents();
17007
+ }
1666717008 }
1666817009 else
1666917010 paintcount = 0;
....@@ -16702,6 +17043,11 @@
1670217043 //System.out.println("objects[color] = " + objects[color]);
1670317044 //objects[color].Select();
1670417045 indexcount = 0;
17046
+ ObjEditor window = object.GetWindow();
17047
+ if (window != null && deselect)
17048
+ {
17049
+ window.Select(null, deselect, true);
17050
+ }
1670517051 object.Select(color, deselect);
1670617052 }
1670717053
....@@ -17227,23 +17573,15 @@
1722717573 int AAbuffersize = 0;
1722817574
1722917575 //double[] selectedpoint = new double[3];
17230
- static Superellipsoid selectedpoint = new Superellipsoid();
17576
+ static Superellipsoid selectedpoint;
1723117577 static Sphere previousselectedpoint = null;
17232
- static Sphere debugpointG = new Sphere();
17233
- static Sphere debugpointP = new Sphere();
17234
- static Sphere debugpointC = new Sphere();
17235
- static Sphere debugpointR = new Sphere();
17578
+ static Sphere debugpointG;
17579
+ static Sphere debugpointP;
17580
+ static Sphere debugpointC;
17581
+ static Sphere debugpointR;
1723617582
1723717583 static Sphere debugpoints[] = new Sphere[8];
1723817584
17239
- static
17240
- {
17241
- for (int i=0; i<8; i++)
17242
- {
17243
- debugpoints[i] = new Sphere();
17244
- }
17245
- }
17246
-
1724717585 static void InitPoints(float radius)
1724817586 {
1724917587 for (int i=0; i<8; i++)