Normand Briere
2019-07-25 f2b6a33fdf84a06b958f9cb9d667a2eff3063d8b
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 {
....@@ -44,6 +48,39 @@
4448 static boolean ABORTED = false;
4549
4650 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
+ }
4784
4885 /*static*/ private boolean CULLFACE = false; // true;
4986 /*static*/ boolean NEAREST = false; // true;
....@@ -60,7 +97,7 @@
6097 //boolean REDUCETEXTURE = true;
6198 boolean CACHETEXTURE = true;
6299 boolean CLEANCACHE = false; // true;
63
- boolean MIPMAP = false; // true;
100
+ boolean MIPMAP = false; // true; // never works...
64101 boolean COMPRESSTEXTURE = false;
65102 boolean KOMPACTTEXTURE = false; // true;
66103 boolean RESIZETEXTURE = false;
....@@ -2405,6 +2442,21 @@
24052442 return currentGL;
24062443 }
24072444
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
+
24082460 /**/
24092461 class CacheTexture
24102462 {
....@@ -2413,28 +2465,31 @@
24132465
24142466 int resolution;
24152467
2416
- CacheTexture(com.sun.opengl.util.texture.Texture tex, int res)
2468
+ CacheTexture(com.sun.opengl.util.texture.TextureData texdata, int res)
24172469 {
2418
- texture = tex;
2470
+ texture = com.sun.opengl.util.texture.TextureIO.newTexture(texdata);
2471
+ texturedata = texdata;
24192472 resolution = res;
24202473 }
24212474 }
24222475 /**/
24232476
24242477 // TEXTURE static Texture texture;
2425
- static public java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/> textures
2426
- = new java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/>();
2427
- 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
+
24282483 int pigmentdepth = 0;
24292484 public com.sun.opengl.util.texture.Texture[] pigmentstack = new com.sun.opengl.util.texture.Texture[65536];
24302485 int bumpdepth = 0;
24312486 public com.sun.opengl.util.texture.Texture[] bumpstack = new com.sun.opengl.util.texture.Texture[65536];
24322487 //public static String DEFAULT_TEXTURE = "DEFAULT_TEXTURE";
24332488 public static cTexture DEFAULT_TEXTURES = new cTexture("DEFAULT_TEXTURE" + ":" + "DEFAULT_TEXTURE_BUMP");
2434
- public static String NOISE_TEXTURE = "WHITE_NOISE";
2489
+ public static cTexture NOISE_TEXTURE = new cTexture("WHITE_NOISE:");
24352490 // public static cTexture IMMORTAL_TEXTURE = new cTexture("IMMORTAL");
24362491
2437
- com.sun.opengl.util.texture.Texture GetResourceTexture(String name, boolean bump)
2492
+ com.sun.opengl.util.texture.TextureData GetResourceTexture(String name, boolean bump)
24382493 {
24392494 TextureData texturedata = null;
24402495
....@@ -2453,13 +2508,34 @@
24532508 if (bump)
24542509 texturedata = ConvertBump(texturedata, false);
24552510
2456
- com.sun.opengl.util.texture.Texture texture =
2457
- 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);
24582513
2459
- texture.setTexParameteri(javax.media.opengl.GL.GL_TEXTURE_WRAP_S, javax.media.opengl.GL.GL_REPEAT);
2460
- 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);
24612516
2462
- 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;
24632539 }
24642540
24652541 boolean HUESMOOTH = true; // wrap around bug... true;
....@@ -3532,6 +3608,8 @@
35323608
35333609 System.out.println("LOADING TEXTURE : " + name);
35343610
3611
+ Object x = texturedata.getMipmapData(); // .getBuffer();
3612
+
35353613 //
35363614 if (false) // compressbit > 0)
35373615 {
....@@ -7945,8 +8023,8 @@
79458023 pigment = null;
79468024 }
79478025
7948
- ReleaseTexture(bump, true);
7949
- ReleaseTexture(pigment, false);
8026
+ ReleaseTexture(tex, true);
8027
+ ReleaseTexture(tex, false);
79508028 }
79518029
79528030 public void ReleasePigmentTexture(cTexture tex) // INTERFACE
....@@ -7975,7 +8053,7 @@
79758053 pigment = null;
79768054 }
79778055
7978
- ReleaseTexture(pigment, false);
8056
+ ReleaseTexture(tex, false);
79798057 }
79808058
79818059 public void ReleaseBumpTexture(cTexture tex) // INTERFACE
....@@ -8004,10 +8082,10 @@
80048082 bump = null;
80058083 }
80068084
8007
- ReleaseTexture(bump, true);
8085
+ ReleaseTexture(tex, true);
80088086 }
80098087
8010
- void ReleaseTexture(String tex, boolean bump)
8088
+ void ReleaseTexture(cTexture tex, boolean bump)
80118089 {
80128090 if (// DrawMode() != 0 || /*tex == null ||*/
80138091 ambientOcclusion ) // || !textureon)
....@@ -8018,7 +8096,7 @@
80188096 CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
80198097
80208098 if (tex != null)
8021
- texture = textures.get(tex);
8099
+ texture = bump ? texturebump.get(tex) : texturepigment.get(tex);
80228100
80238101 // //assert( texture != null );
80248102 // if (texture == null)
....@@ -8112,47 +8190,50 @@
81128190
81138191 /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
81148192 {
8115
- if (// DrawMode() != 0 || /*tex == null ||*/
8116
- ambientOcclusion ) // || !textureon)
8117
- {
8118
- return; // false;
8119
- }
8120
-
8121
- if (tex == null)
8122
- {
8123
- BindTexture(null,false,resolution);
8124
- BindTexture(null,true,resolution);
8125
- return;
8126
- }
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;
81278234
8128
- String pigment = Object3D.GetPigment(tex);
8129
- String bump = Object3D.GetBump(tex);
8130
-
8131
- usedtextures.put(pigment, pigment);
8132
- usedtextures.put(bump, bump);
8133
-
8134
- //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8135
- {
8136
- // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8137
- // System.out.println("; bump = " + bump);
8138
- }
8139
-
8140
- if (bump.equals(""))
8141
- {
8142
- bump = null;
8143
- }
8144
- if (pigment.equals(""))
8145
- {
8146
- pigment = null;
8147
- }
8148
-
8149
- GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8150
- BindTexture(pigment, false, resolution);
8151
- GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8152
- BindTexture(bump, true, resolution);
8153
- GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8154
-
8155
- return; // true;
8235
+ BindPigmentTexture(tex, resolution);
8236
+ BindBumpTexture(tex, resolution);
81568237 }
81578238
81588239 /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE
....@@ -8171,7 +8252,7 @@
81718252
81728253 String pigment = Object3D.GetPigment(tex);
81738254
8174
- usedtextures.put(pigment, pigment);
8255
+ usedtextures.add(tex);
81758256
81768257 //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81778258 {
....@@ -8185,7 +8266,7 @@
81858266 }
81868267
81878268 GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8188
- BindTexture(pigment, false, resolution);
8269
+ BindTexture(tex, false, resolution);
81898270 }
81908271
81918272 /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE
....@@ -8204,7 +8285,7 @@
82048285
82058286 String bump = Object3D.GetBump(tex);
82068287
8207
- usedtextures.put(bump, bump);
8288
+ usedtextures.add(tex);
82088289
82098290 //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
82108291 {
....@@ -8218,7 +8299,7 @@
82188299 }
82198300
82208301 GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8221
- BindTexture(bump, true, resolution);
8302
+ BindTexture(tex, true, resolution);
82228303 GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
82238304 }
82248305
....@@ -8242,13 +8323,19 @@
82428323 return fileExists;
82438324 }
82448325
8245
- CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception
8326
+ CacheTexture GetCacheTexture(cTexture tex, boolean bump, int resolution) throws Exception
82468327 {
8247
- CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
8328
+ CacheTexture texturecache = null;
82488329
82498330 if (tex != null)
82508331 {
8251
- 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
+ }
82528339
82538340 String fallbackTextureName = defaultDirectory + "/Textures/" + texname;
82548341
....@@ -8258,19 +8345,46 @@
82588345 // else
82598346 // if (!texname.startsWith("/"))
82608347 // texname = "/Users/nbriere/Textures/" + texname;
8261
- if (!FileExists(tex))
8348
+ if (!FileExists(texname))
82628349 {
82638350 texname = fallbackTextureName;
82648351 }
82658352
82668353 if (CACHETEXTURE)
8267
- texture = textures.get(texname); // TEXTURE CACHE
8268
-
8269
- TextureData texturedata = null;
8270
-
8271
- if (texture == null || texture.resolution < resolution)
82728354 {
8273
- 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(""))
82748388 {
82758389 assert(!bump);
82768390 // if (bump)
....@@ -8281,19 +8395,23 @@
82818395 // }
82828396 // else
82838397 // {
8284
- texture = textures.get(tex);
8285
- if (texture == null)
8398
+ // texturecache = textures.get(texname); // suspicious
8399
+ if (texturecache == null)
82868400 {
8287
- texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
8401
+ texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
82888402 }
8403
+ else
8404
+ new Exception().printStackTrace();
82898405 // }
82908406 } else
8291
- if (tex.equals("DEFAULT_TEXTURE_BUMP")) // ||*/ tex.equals(""))
8407
+ if (texname.endsWith("DEFAULT_TEXTURE_BUMP")) // ||*/ tex.equals(""))
82928408 {
82938409 assert(bump);
8294
- texture = textures.get(tex);
8295
- if (texture == null)
8296
- 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();
82978415 } else
82988416 {
82998417 //if (tex.equals("IMMORTAL"))
....@@ -8301,11 +8419,13 @@
83018419 // texture = GetResourceTexture("default.png");
83028420 //} else
83038421 //{
8304
- if (tex.equals("WHITE_NOISE"))
8422
+ if (texname.endsWith("WHITE_NOISE"))
83058423 {
8306
- texture = textures.get(tex);
8307
- if (texture == null)
8308
- 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();
83098429 } else
83108430 {
83118431 if (textureon)
....@@ -8364,19 +8484,19 @@
83648484 if (texturedata == null)
83658485 throw new Exception();
83668486
8367
- texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
8487
+ texturecache = new CacheTexture(texturedata,resolution);
83688488 //texture = GetTexture(tex, bump);
83698489 }
83708490 }
83718491 //}
83728492 }
83738493
8374
- if (/*CACHETEXTURE &&*/ texture != null && textureon)
8494
+ if (texdata == null && /*CACHETEXTURE &&*/ texturecache != null && textureon)
83758495 {
83768496 //return false;
83778497
83788498 // System.out.println("CACHE +++++++++++++++ TEXTURE : " + texname + " (" + texture.getEstimatedMemorySize() + ")");
8379
- if (texturedata != null && (texname.endsWith(".jpg") || texname.endsWith(".JPG")))
8499
+ if (texturedata != null && texname.toLowerCase().endsWith(".jpg"))
83808500 {
83818501 // String ext = "_highres";
83828502 // if (REDUCETEXTURE)
....@@ -8393,52 +8513,17 @@
83938513 File cachefile = new File(texname.substring(0, texname.length()-4)+ext+".jpg");
83948514 if (!cachefile.exists())
83958515 {
8396
- // cache to disk
8397
- Buffer buffer = texturedata.getBuffer(); // getMipmapData();
8398
- //buffers[0].
8399
-
8400
- ByteBuffer bytebuf = (ByteBuffer)buffer; // ).asIntBuffer();
8401
- int[] pixels = new int[bytebuf.capacity()/3];
8402
-
8403
- // squared size heuristic...
8404
- if ((int)Math.sqrt(pixels.length) == Math.sqrt(pixels.length))
8516
+ //if (texturedata.getWidth() == texturedata.getHeight())
84058517 {
8406
- for (int i=pixels.length; --i>=0;)
8407
- {
8408
- int i3 = i*3;
8409
- pixels[i] = 0xFF;
8410
- pixels[i] <<= 8;
8411
- pixels[i] |= bytebuf.get(i3+2) & 0xFF;
8412
- pixels[i] <<= 8;
8413
- pixels[i] |= bytebuf.get(i3+1) & 0xFF;
8414
- pixels[i] <<= 8;
8415
- pixels[i] |= bytebuf.get(i3) & 0xFF;
8416
- }
8417
-
8418
- /*
8419
- int r=0,g=0,b=0,a=0;
8420
- for (int i=0; i<width; i++)
8421
- for (int j=0; j<height; j++)
8422
- {
8423
- int index = j*width+i;
8424
- int p = pixels[index];
8425
- a = ((p>>24) & 0xFF);
8426
- r = ((p>>16) & 0xFF);
8427
- g = ((p>>8) & 0xFF);
8428
- b = (p & 0xFF);
8429
- pixels[index] = (a<<24) | (b<<16) | (g<<8) | r;
8430
- }
8431
- /**/
8432
- int width = (int)Math.sqrt(pixels.length); // squared
8433
- int height = width;
8434
- BufferedImage rendImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // ImageIO.read(infile);
8435
- rendImage.setRGB(0,0,width,height,pixels,width*(height-1),-width);
8518
+ BufferedImage rendImage = CreateBim(texturedata);
8519
+
84368520 ImageWriter writer = null;
84378521 Iterator iter = ImageIO.getImageWritersByFormatName("jpg");
84388522 if (iter.hasNext()) {
84398523 writer = (ImageWriter)iter.next();
84408524 }
8441
- float compressionQuality = 0.9f;
8525
+
8526
+ float compressionQuality = 0.85f;
84428527 try
84438528 {
84448529 ImageOutputStream ios = ImageIO.createImageOutputStream(cachefile);
....@@ -8455,18 +8540,20 @@
84558540 }
84568541 }
84578542 }
8458
-
8543
+
8544
+ Hashtable<cTexture, CacheTexture> textures = bump ? texturebump : texturepigment;
8545
+
84598546 //System.out.println("Texture = " + tex);
8460
- if (textures.containsKey(texname))
8547
+ if (textures.containsKey(tex))
84618548 {
8462
- CacheTexture thetex = textures.get(texname);
8549
+ CacheTexture thetex = textures.get(tex);
84638550 thetex.texture.disable();
84648551 thetex.texture.dispose();
8465
- textures.remove(texname);
8552
+ textures.remove(tex);
84668553 }
84678554
8468
- texture.texturedata = texturedata;
8469
- textures.put(texname, texture);
8555
+ //texture.texturedata = texturedata;
8556
+ textures.put(tex, texturecache);
84708557
84718558 // newtex = true;
84728559 }
....@@ -8482,10 +8569,44 @@
84828569 }
84838570 }
84848571
8485
- return texture;
8572
+ return texturecache;
84868573 }
84878574
8488
- 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
84898610 {
84908611 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
84918612
....@@ -8503,14 +8624,14 @@
85038624 return texture!=null?texture.texture:null;
85048625 }
85058626
8506
- 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
85078628 {
85088629 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
85098630
85108631 return texture!=null?texture.texturedata:null;
85118632 }
85128633
8513
- boolean BindTexture(String tex, boolean bump, int resolution) throws Exception
8634
+ boolean BindTexture(cTexture tex, boolean bump, int resolution) throws Exception
85148635 {
85158636 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
85168637 {
....@@ -8552,6 +8673,72 @@
85528673 return true; // Warning: not used.
85538674 }
85548675
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
+
85558742 ShadowBuffer shadowPBuf;
85568743 AntialiasBuffer antialiasPBuf;
85578744 int MAXSTACK;
....@@ -9512,7 +9699,7 @@
95129699
95139700 if (renderCamera != lightCamera)
95149701 //for (int count = parentcam.GetTransformCount(); --count>=0;)
9515
- LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
9702
+ LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix);
95169703
95179704 // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix);
95189705
....@@ -9528,7 +9715,7 @@
95289715
95299716 if (renderCamera != lightCamera)
95309717 //for (int count = parentcam.GetTransformCount(); --count>=0;)
9531
- LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
9718
+ LA.matConcat(parentcam.GlobalTransform(), matrix, matrix);
95329719
95339720 // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix);
95349721
....@@ -10729,7 +10916,7 @@
1072910916 // if (parentcam != renderCamera) // not a light
1073010917 if (cam != lightCamera)
1073110918 //for (int count = parentcam.GetTransformCount(); --count>=0;)
10732
- LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
10919
+ LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix);
1073310920
1073410921 for (int j = 0; j < 4; j++)
1073510922 {
....@@ -10744,7 +10931,7 @@
1074410931 // if (parentcam != renderCamera) // not a light
1074510932 if (cam != lightCamera)
1074610933 //for (int count = parentcam.GetTransformCount(); --count>=0;)
10747
- LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
10934
+ LA.matConcat(parentcam.GlobalTransform(), matrix, matrix);
1074810935
1074910936 //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix);
1075010937
....@@ -11297,7 +11484,7 @@
1129711484 }
1129811485 }
1129911486
11300
- if (false) // fast && !IsFreezed() && DrawMode() != SELECTION && !ambientOcclusion)
11487
+ if (false) //RENDERPROGRAM > 0 && DrawMode() == DEFAULT) // fast && !IsFreezed() && DrawMode() != SELECTION && !ambientOcclusion)
1130111488 {
1130211489 //gl.glDepthFunc(GL.GL_LEQUAL);
1130311490 //gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
....@@ -11305,24 +11492,21 @@
1130511492
1130611493 boolean texon = textureon;
1130711494
11308
- if (RENDERPROGRAM > 0)
11309
- {
11310
- gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB);
11311
- textureon = false;
11312
- }
11495
+ gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB);
11496
+ textureon = false;
11497
+
1131311498 //gl.glDisable(GL.GL_VERTEX_PROGRAM_ARB);
1131411499 //System.out.println("ALLO");
1131511500 gl.glColorMask(false, false, false, false);
1131611501 DrawObject(gl);
11317
- if (RENDERPROGRAM > 0)
11318
- {
11319
- gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB);
11320
- textureon = texon;
11321
- }
11502
+
11503
+ gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB);
11504
+ textureon = texon;
11505
+
1132211506 gl.glColorMask(true, true, true, true);
1132311507
1132411508 gl.glDepthFunc(GL.GL_EQUAL);
11325
- //gl.glDepthMask(false);
11509
+ gl.glDepthMask(false);
1132611510 }
1132711511
1132811512 if (false) // DrawMode() == SHADOW)
....@@ -11662,20 +11846,32 @@
1166211846 ReleaseTextures(DEFAULT_TEXTURES);
1166311847
1166411848 if (CLEANCACHE)
11665
- for (java.util.Enumeration<String> e = textures.keys() ; e.hasMoreElements();)
11849
+ for (java.util.Enumeration<cTexture> e = texturepigment.keys() ; e.hasMoreElements();)
1166611850 {
11667
- String tex = e.nextElement();
11851
+ cTexture tex = e.nextElement();
1166811852
1166911853 // System.out.println("Texture --------- " + tex);
1167011854
11671
- if (tex.equals("WHITE_NOISE"))
11855
+ if (tex.equals("WHITE_NOISE:"))
1167211856 continue;
1167311857
11674
- if (!usedtextures.containsKey(tex))
11858
+ if (!usedtextures.contains(tex))
1167511859 {
11860
+ CacheTexture gettex = texturepigment.get(tex);
1167611861 // System.out.println("DISPOSE +++++++++++++++ " + tex);
11677
- textures.get(tex).texture.dispose();
11678
- 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
+ }
1167911875 }
1168011876 }
1168111877 }
....@@ -12204,7 +12400,52 @@
1220412400 //gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 127, lightParams, 0);
1220512401
1220612402 String program =
12403
+ // Min shader
1220712404 "!!ARBfp1.0\n" +
12405
+ "PARAM zero123 = { 0.0, 1.0, 2.0, 1.25 };" +
12406
+ "PARAM pow2 = { 0.5, 0.25, 0.125, 0.0 };" +
12407
+ "PARAM one = { 1.0, 1.0, 1.0, 1.0 };" +
12408
+ "PARAM eps = { 0.001, 0.001, 0.001, 1.0 };" +
12409
+ "PARAM infinity = { 100000000, 100000000, 100000000, 1.0 };" +
12410
+ "TEMP temp;" +
12411
+ "TEMP light;" +
12412
+ "TEMP ndotl;" +
12413
+ "TEMP normal;" +
12414
+ "TEMP depth;" +
12415
+
12416
+ "MAD normal, fragment.color, zero123.z, -zero123.y;" +
12417
+
12418
+ "MOV light, state.light[0].position;" +
12419
+ "DP3 ndotl.x, light, normal;" +
12420
+
12421
+ // shadow
12422
+ "MOV temp, fragment.texcoord[1];" +
12423
+ TextureFetch("depth", "temp", "1") +
12424
+ //"TEX depth, fragment.texcoord[1], texture[1], 2D;" +
12425
+ "SLT temp.x, fragment.texcoord[1].z, depth.z;" +
12426
+
12427
+
12428
+ // No shadow when out of frustum
12429
+ //"SGE temp.y, depth.z, zero123.y;" +
12430
+ //"LRP temp.x, temp.y, zero123.y, temp.x;" +
12431
+
12432
+ "MUL ndotl.x, ndotl.x, temp.x;" +
12433
+ "MAX ndotl.x, ndotl.x, pow2.y;" +
12434
+
12435
+ "TEX temp, fragment.texcoord[0], texture[0], 2D;" +
12436
+ "LRP temp, zero123.w, temp, one;" + // texture proportion
12437
+ "MUL temp, temp, ndotl.x;" +
12438
+
12439
+ "MUL temp, temp, zero123.z;" +
12440
+
12441
+ "MOV temp.w, zero123.y;" + // reset alpha
12442
+
12443
+ "MOV result.color, temp;" +
12444
+ "END";
12445
+
12446
+ String program2 =
12447
+ "!!ARBfp1.0\n" +
12448
+
1220812449 //"OPTION ARB_fragment_program_shadow;" +
1220912450 "PARAM light2cam0 = program.env[10];" +
1221012451 "PARAM light2cam1 = program.env[11];" +
....@@ -12319,8 +12560,7 @@
1231912560 "TEMP shininess;" +
1232012561 "\n" +
1232112562 "MOV texSamp, one;" +
12322
- //"TEX texSamp, fragment.texcoord[0], texture[0], 2D;" +
12323
-
12563
+
1232412564 "MOV mapgrid.x, one2048th.x;" +
1232512565 "MOV temp, fragment.texcoord[1];" +
1232612566 /*
....@@ -12725,7 +12965,7 @@
1272512965 "MAD shadow.x, buffer.x, frac.y, shadow.x;" +
1272612966 "") +
1272712967
12728
- // display shadow only (bump == 0)
12968
+ // display shadow only (fakedepth == 0)
1272912969 "SUB temp.x, half.x, shadow.x;" +
1273012970 "MOV temp.y, -params5.z;" + // params6.x;" +
1273112971 "SLT temp.z, temp.y, -one2048th.x;" +
....@@ -13157,20 +13397,20 @@
1315713397 return "TEX " + dest + ", " + src + ", texture[" + unit + "], 2D;" +
1315813398 "SGE " + src + ".w, " + src + ".x, eps.x;" +
1315913399 "SGE " + src + ".z, " + src + ".y, eps.x;" +
13400
+ "SLT " + dest + ".x, " + src + ".x, one.x;" +
13401
+ "SLT " + dest + ".y, " + src + ".y, one.x;" +
1316013402 "MUL " + src + ".w, " + src + ".z, " + src + ".w;" +
13161
- "SLT " + src + ".z, " + src + ".x, one.x;" +
13162
- "MUL " + src + ".w, " + src + ".z, " + src + ".w;" +
13163
- "SLT " + src + ".z, " + src + ".y, one.x;" +
13164
- "MUL " + src + ".w, " + src + ".z, " + src + ".w;" +
13403
+ "MUL " + src + ".w, " + dest + ".x, " + src + ".w;" +
13404
+ "MUL " + src + ".w, " + dest + ".y, " + src + ".w;" +
1316513405 //"SWZ buffer, temp, w,w,w,w;";
13166
- "MUL " + dest + ".z, " + dest + ".z, " + src + ".w;" +
13406
+ //"MUL " + dest + ".z, " + dest + ".z, " + src + ".w;" +
1316713407 "SUB " + src + ".z, " + "one.x, " + src + ".w;" +
1316813408 //"MUL " + src + ".z, " + src + ".z, infinity.x;" +
1316913409 //"ADD " + dest + ".z, " + dest + ".z, " + src + ".z;";
13170
- "MAD " + dest + ".z, " + src + ".z, infinity.x," + dest + ".z;";
13410
+ //"MAD " + dest + ".z, " + src + ".z, infinity.x," + dest + ".z;";
1317113411
13172
- //"LRP " + dest + ".z, " + src + ".w," + dest + ".z, infinity.x;";
13173
- //"LRP " + dest + ".z" + ", " + src + ".w, infinity.x," + dest + ".z;";
13412
+ //?? "LRP " + dest + ".z, " + src + ".w," + dest + ".z, infinity.x;";
13413
+ "LRP " + dest + ".z, " + src + ".z, infinity.x," + dest + ".z;";
1317413414 }
1317513415
1317613416 String Shadow(String depth, String shadow)
....@@ -13217,7 +13457,7 @@
1321713457 "SLT temp.x, temp.x, zero.x;" + // shadoweps
1321813458 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1321913459
13220
- // No shadow when out of frustrum
13460
+ // No shadow when out of frustum
1322113461 "SGE temp.x, " + depth + ".z, one.z;" +
1322213462 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1322313463 "";
....@@ -14015,14 +14255,15 @@
1401514255 drag = false;
1401614256 //System.out.println("Mouse DOWN");
1401714257 editObj = false;
14018
- ClickInfo info = new ClickInfo();
14019
- info.bounds.setBounds(0, 0, (int) (getBounds().width * zoom), (int) (getBounds().height * zoom));
14020
- info.pane = this;
14021
- info.camera = renderCamera;
14022
- info.x = x;
14023
- info.y = y;
14024
- info.modifiers = modifiersex;
14025
- editObj = object.doEditClick(info, 0);
14258
+ //ClickInfo info = new ClickInfo();
14259
+ object.clickInfo.bounds.setBounds(0, 0, (int) (getBounds().width * zoom), (int) (getBounds().height * zoom));
14260
+ object.clickInfo.pane = this;
14261
+ object.clickInfo.camera = renderCamera;
14262
+ object.clickInfo.x = x;
14263
+ object.clickInfo.y = y;
14264
+ object.clickInfo.modifiers = modifiersex;
14265
+ editObj = object.doEditClick(//info,
14266
+ 0);
1402614267 if (!editObj)
1402714268 {
1402814269 hasMarquee = true;
....@@ -14422,15 +14663,16 @@
1442214663 if (editObj)
1442314664 {
1442414665 drag = true;
14425
- ClickInfo info = new ClickInfo();
14426
- info.bounds.setBounds(0, 0,
14666
+ //ClickInfo info = new ClickInfo();
14667
+ object.clickInfo.bounds.setBounds(0, 0,
1442714668 (int) (getBounds().width * zoom), (int) (getBounds().height * zoom));
14428
- info.pane = this;
14429
- info.camera = renderCamera;
14430
- info.x = x;
14431
- info.y = y;
14432
- object.GetWindow().copy
14433
- .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14669
+ object.clickInfo.pane = this;
14670
+ object.clickInfo.camera = renderCamera;
14671
+ object.clickInfo.x = x;
14672
+ object.clickInfo.y = y;
14673
+ object //.GetWindow().copy
14674
+ .doEditDrag(//info,
14675
+ (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1443414676 } else
1443514677 {
1443614678 if (x < startX)
....@@ -14579,24 +14821,27 @@
1457914821 }
1458014822 }
1458114823
14824
+// ClickInfo clickInfo = new ClickInfo();
14825
+
1458214826 public void mouseMoved(MouseEvent e)
1458314827 {
1458414828 //System.out.println("mouseMoved: " + e);
1458514829 if (isRenderer)
1458614830 return;
1458714831
14588
- ClickInfo ci = new ClickInfo();
14589
- ci.x = e.getX();
14590
- ci.y = e.getY();
14591
- ci.modifiers = e.getModifiersEx();
14592
- ci.bounds.setBounds(0, 0, (int) (getBounds().width * zoom), (int) (getBounds().height * zoom));
14593
- ci.pane = this;
14594
- ci.camera = renderCamera;
14832
+ // Mouse cursor feedback
14833
+ object.clickInfo.x = e.getX();
14834
+ object.clickInfo.y = e.getY();
14835
+ object.clickInfo.modifiers = e.getModifiersEx();
14836
+ object.clickInfo.bounds.setBounds(0, 0, (int) (getBounds().width * zoom), (int) (getBounds().height * zoom));
14837
+ object.clickInfo.pane = this;
14838
+ object.clickInfo.camera = renderCamera;
1459514839 if (!isRenderer)
1459614840 {
1459714841 //ObjEditor editWindow = object.editWindow;
1459814842 //Object3D copy = editWindow.copy;
14599
- if (object.doEditClick(ci, 0))
14843
+ if (object.doEditClick(//clickInfo,
14844
+ 0))
1460014845 {
1460114846 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1460214847 } else
....@@ -14868,7 +15113,8 @@
1486815113 // break;
1486915114 case 'T':
1487015115 CACHETEXTURE ^= true;
14871
- textures.clear();
15116
+ texturepigment.clear();
15117
+ texturebump.clear();
1487215118 // repaint();
1487315119 break;
1487415120 case 'Y':
....@@ -15621,8 +15867,6 @@
1562115867
1562215868 int width = getBounds().width;
1562315869 int height = getBounds().height;
15624
- ClickInfo info = new ClickInfo();
15625
- info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom));
1562615870 //Image img = CreateImage(width, height);
1562715871 //System.out.println("width = " + width + "; height = " + height + "\n");
1562815872
....@@ -15699,31 +15943,37 @@
1569915943 }
1570015944 if (object != null && !hasMarquee)
1570115945 {
15946
+ if (object.clickInfo == null)
15947
+ object.clickInfo = new ClickInfo();
15948
+ ClickInfo info = object.clickInfo;
15949
+ //ClickInfo info = new ClickInfo();
15950
+ info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom));
15951
+
1570215952 if (isRenderer)
1570315953 {
15704
- info.flags++;
15954
+ object.clickInfo.flags++;
1570515955 double frameAspect = (double) width / (double) height;
1570615956 if (frameAspect > renderCamera.aspect)
1570715957 {
1570815958 int desired = (int) ((double) height * renderCamera.aspect);
15709
- info.bounds.width -= width - desired;
15710
- info.bounds.x += (width - desired) / 2;
15959
+ object.clickInfo.bounds.width -= width - desired;
15960
+ object.clickInfo.bounds.x += (width - desired) / 2;
1571115961 } else
1571215962 {
1571315963 int desired = (int) ((double) width / renderCamera.aspect);
15714
- info.bounds.height -= height - desired;
15715
- info.bounds.y += (height - desired) / 2;
15964
+ object.clickInfo.bounds.height -= height - desired;
15965
+ object.clickInfo.bounds.y += (height - desired) / 2;
1571615966 }
1571715967 }
1571815968
15719
- info.g = gr;
15720
- info.camera = renderCamera;
15969
+ object.clickInfo.g = gr;
15970
+ object.clickInfo.camera = renderCamera;
1572115971 /*
1572215972 // Memory intensive (brep.verticescopy)
1572315973 if (!(object instanceof Composite))
1572415974 object.draw(info, 0, false); // SLOW :
1572515975 */
15726
- if (!isRenderer)
15976
+ if (!isRenderer) // && drag)
1572715977 {
1572815978 Grafreed.Assert(object != null);
1572915979 Grafreed.Assert(object.selection != null);
....@@ -15731,9 +15981,9 @@
1573115981 {
1573215982 int hitSomething = object.selection.get(0).hitSomething;
1573315983
15734
- info.DX = 0;
15735
- info.DY = 0;
15736
- info.W = 1;
15984
+ object.clickInfo.DX = 0;
15985
+ object.clickInfo.DY = 0;
15986
+ object.clickInfo.W = 1;
1573715987 if (hitSomething == Object3D.hitCenter)
1573815988 {
1573915989 info.DX = X;
....@@ -15745,7 +15995,8 @@
1574515995 info.DY -= info.bounds.height/2;
1574615996 }
1574715997
15748
- object.drawEditHandles(info, 0);
15998
+ object.drawEditHandles(//info,
15999
+ 0);
1574916000
1575016001 if (drag && (X != 0 || Y != 0))
1575116002 {
....@@ -15758,7 +16009,7 @@
1575816009 gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
1575916010 break;
1576016011 case Object3D.hitScale: gr.setColor(Color.cyan);
15761
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
16012
+ gr.drawLine(X, Y, 0, 0);
1576216013 break;
1576316014 }
1576416015