Normand Briere
2019-07-21 40f408aaee14abd85d391008b4d22977dc586b50
CameraPane.java
....@@ -37,7 +37,6 @@
3737 static boolean[] selectedstack = new boolean[65536];
3838 static int materialdepth = 0;
3939
40
- static boolean DEBUG = false;
4140 static boolean FRUSTUM = false; // still bogus true; // frustum culling
4241
4342 // camera change fix
....@@ -61,7 +60,7 @@
6160 //boolean REDUCETEXTURE = true;
6261 boolean CACHETEXTURE = true;
6362 boolean CLEANCACHE = false; // true;
64
- boolean MIPMAP = false; // true;
63
+ boolean MIPMAP = true; // false; // true;
6564 boolean COMPRESSTEXTURE = false;
6665 boolean KOMPACTTEXTURE = false; // true;
6766 boolean RESIZETEXTURE = false;
....@@ -327,7 +326,7 @@
327326 cStatic.objectstack[materialdepth++] = obj;
328327 //System.out.println("material " + material);
329328 //Applet3D.tracein(this, selected);
330
- display.vector2buffer = obj.projectedVertices;
329
+ //display.vector2buffer = obj.projectedVertices;
331330 if (obj instanceof Camera)
332331 {
333332 display.options1[0] = material.shift;
....@@ -336,14 +335,28 @@
336335 display.options1[2] = material.shadowbias;
337336 display.options1[3] = material.aniso;
338337 display.options1[4] = material.anisoV;
338
+// System.out.println("display.options1[0] " + display.options1[0]);
339
+// System.out.println("display.options1[1] " + display.options1[1]);
340
+// System.out.println("display.options1[2] " + display.options1[2]);
341
+// System.out.println("display.options1[3] " + display.options1[3]);
342
+// System.out.println("display.options1[4] " + display.options1[4]);
339343 display.options2[0] = material.opacity;
340344 display.options2[1] = material.diffuse;
341345 display.options2[2] = material.factor;
346
+// System.out.println("display.options2[0] " + display.options2[0]);
347
+// System.out.println("display.options2[1] " + display.options2[1]);
348
+// System.out.println("display.options2[2] " + display.options2[2]);
342349
343350 cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
351
+// System.out.println("display.options3[0] " + display.options3[0]);
352
+// System.out.println("display.options3[1] " + display.options3[1]);
353
+// System.out.println("display.options3[2] " + display.options3[2]);
344354 display.options4[0] = material.cameralight/0.2f;
345355 display.options4[1] = material.subsurface;
346356 display.options4[2] = material.sheen;
357
+// System.out.println("display.options4[0] " + display.options4[0]);
358
+// System.out.println("display.options4[1] " + display.options4[1]);
359
+// System.out.println("display.options4[2] " + display.options4[2]);
347360
348361 // if (display.CURRENTANTIALIAS > 0)
349362 // display.options3[3] /= 4;
....@@ -359,7 +372,7 @@
359372 /**/
360373 } else
361374 {
362
- DrawMaterial(material, selected);
375
+ DrawMaterial(material, selected, obj.projectedVertices);
363376 }
364377 } else
365378 {
....@@ -383,8 +396,8 @@
383396 cStatic.objectstack[materialdepth++] = obj;
384397 //System.out.println("material " + material);
385398 //Applet3D.tracein("selected ", selected);
386
- display.vector2buffer = obj.projectedVertices;
387
- display.DrawMaterial(material, selected);
399
+ //display.vector2buffer = obj.projectedVertices;
400
+ display.DrawMaterial(material, selected, obj.projectedVertices);
388401 }
389402 }
390403
....@@ -401,8 +414,8 @@
401414 materialdepth -= 1;
402415 if (materialdepth > 0)
403416 {
404
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
405
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
417
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
418
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
406419 }
407420 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
408421 } else if (selected && CameraPane.flash && obj.GetMaterial() != null)
....@@ -422,8 +435,8 @@
422435 materialdepth -= 1;
423436 if (materialdepth > 0)
424437 {
425
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
426
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
438
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
439
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
427440 }
428441 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
429442 //else
....@@ -1611,7 +1624,7 @@
16111624 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16121625 }
16131626
1614
- void DrawMaterial(cMaterial material, boolean selected)
1627
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16151628 {
16161629 CameraPane display = this;
16171630 //new Exception().printStackTrace();
....@@ -1646,7 +1659,7 @@
16461659 colorV[0] = display.modelParams0[0] * material.diffuse;
16471660 colorV[1] = display.modelParams0[1] * material.diffuse;
16481661 colorV[2] = display.modelParams0[2] * material.diffuse;
1649
- colorV[3] = material.opacity;
1662
+ colorV[3] = 1; // material.opacity;
16501663
16511664 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16521665 //System.out.println("Opacity = " + opacity);
....@@ -1754,9 +1767,9 @@
17541767 display.modelParams7[2] = 0;
17551768 display.modelParams7[3] = 0;
17561769
1757
- display.modelParams6[0] = 100; // criss de bug de bump
1770
+ //display.modelParams6[0] = 100; // criss de bug de bump
17581771
1759
- Object3D.cVector2[] extparams = display.vector2buffer;
1772
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17601773 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17611774 {
17621775 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -2052,7 +2065,7 @@
20522065 //System.err.println("Oeil on");
20532066 OEIL = true;
20542067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2055
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20562069 //pingthread.StepToTarget(true);
20572070 }
20582071
....@@ -2267,7 +2280,7 @@
22672280
22682281 void ToggleDebug()
22692282 {
2270
- DEBUG ^= true;
2283
+ Globals.DEBUG ^= true;
22712284 }
22722285
22732286 void ToggleLookAt()
....@@ -2285,10 +2298,17 @@
22852298 HANDLES ^= true;
22862299 }
22872300
2301
+ Object3D paintFolder;
2302
+
22882303 void TogglePaint()
22892304 {
22902305 PAINTMODE ^= true;
22912306 paintcount = 0;
2307
+
2308
+ if (PAINTMODE)
2309
+ {
2310
+ paintFolder = GetFolder();
2311
+ }
22922312 }
22932313
22942314 void SwapCamera(int a, int b)
....@@ -2402,9 +2422,10 @@
24022422 /**/
24032423
24042424 // TEXTURE static Texture texture;
2405
- static public java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/> textures
2406
- = new java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/>();
2407
- static public java.util.Hashtable<String, String> usedtextures = new java.util.Hashtable<String, String>();
2425
+ static public java.util.Hashtable<String, CacheTexture> textures = new java.util.Hashtable<String, CacheTexture>();
2426
+ static public java.util.Hashtable<BufferedImage, CacheTexture> bimtextures = new java.util.Hashtable<BufferedImage, CacheTexture>();
2427
+ static public java.util.HashSet<String> usedtextures = new java.util.HashSet<String>();
2428
+
24082429 int pigmentdepth = 0;
24092430 public com.sun.opengl.util.texture.Texture[] pigmentstack = new com.sun.opengl.util.texture.Texture[65536];
24102431 int bumpdepth = 0;
....@@ -2426,6 +2447,33 @@
24262447 true,
24272448 com.sun.opengl.util.texture.TextureIO.PNG);
24282449 } catch (java.io.IOException e)
2450
+ {
2451
+ throw new javax.media.opengl.GLException(e);
2452
+ }
2453
+
2454
+ if (bump)
2455
+ texturedata = ConvertBump(texturedata, false);
2456
+
2457
+ com.sun.opengl.util.texture.Texture texture =
2458
+ com.sun.opengl.util.texture.TextureIO.newTexture(texturedata);
2459
+
2460
+ texture.setTexParameteri(javax.media.opengl.GL.GL_TEXTURE_WRAP_S, javax.media.opengl.GL.GL_REPEAT);
2461
+ texture.setTexParameteri(javax.media.opengl.GL.GL_TEXTURE_WRAP_T, javax.media.opengl.GL.GL_REPEAT);
2462
+
2463
+ return texture;
2464
+ }
2465
+
2466
+ com.sun.opengl.util.texture.Texture GetBimTexture(BufferedImage name, boolean bump)
2467
+ {
2468
+ TextureData texturedata = null;
2469
+
2470
+ try
2471
+ {
2472
+ texturedata =
2473
+ com.sun.opengl.util.texture.TextureIO.newTextureData(
2474
+ name,
2475
+ true);
2476
+ } catch (Exception e)
24292477 {
24302478 throw new javax.media.opengl.GLException(e);
24312479 }
....@@ -3512,6 +3560,8 @@
35123560
35133561 System.out.println("LOADING TEXTURE : " + name);
35143562
3563
+ Object x = texturedata.getMipmapData(); // .getBuffer();
3564
+
35153565 //
35163566 if (false) // compressbit > 0)
35173567 {
....@@ -7910,7 +7960,7 @@
79107960 String pigment = Object3D.GetPigment(tex);
79117961 String bump = Object3D.GetBump(tex);
79127962
7913
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7963
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79147964 {
79157965 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79167966 // System.out.println("; bump = " + bump);
....@@ -7944,7 +7994,7 @@
79447994
79457995 String pigment = Object3D.GetPigment(tex);
79467996
7947
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7997
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79487998 {
79497999 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79508000 // System.out.println("; bump = " + bump);
....@@ -7973,7 +8023,7 @@
79738023
79748024 String bump = Object3D.GetBump(tex);
79758025
7976
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8026
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79778027 {
79788028 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79798029 // System.out.println("; bump = " + bump);
....@@ -8092,47 +8142,50 @@
80928142
80938143 /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
80948144 {
8095
- if (// DrawMode() != 0 || /*tex == null ||*/
8096
- ambientOcclusion ) // || !textureon)
8097
- {
8098
- return; // false;
8099
- }
8100
-
8101
- if (tex == null)
8102
- {
8103
- BindTexture(null,false,resolution);
8104
- BindTexture(null,true,resolution);
8105
- return;
8106
- }
8145
+// if (// DrawMode() != 0 || /*tex == null ||*/
8146
+// ambientOcclusion ) // || !textureon)
8147
+// {
8148
+// return; // false;
8149
+// }
8150
+//
8151
+// if (tex == null)
8152
+// {
8153
+// BindTexture(null,false,resolution);
8154
+// BindTexture(null,true,resolution);
8155
+// return;
8156
+// }
8157
+//
8158
+// String pigment = Object3D.GetPigment(tex);
8159
+// String bump = Object3D.GetBump(tex);
8160
+//
8161
+// usedtextures.add(pigment);
8162
+// usedtextures.add(bump);
8163
+//
8164
+// //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8165
+// {
8166
+// // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8167
+// // System.out.println("; bump = " + bump);
8168
+// }
8169
+//
8170
+// if (bump.equals(""))
8171
+// {
8172
+// bump = null;
8173
+// }
8174
+// if (pigment.equals(""))
8175
+// {
8176
+// pigment = null;
8177
+// }
8178
+//
8179
+// GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8180
+// BindTexture(pigment, false, resolution);
8181
+// GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8182
+// BindTexture(bump, true, resolution);
8183
+// GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8184
+//
8185
+// return; // true;
81078186
8108
- String pigment = Object3D.GetPigment(tex);
8109
- String bump = Object3D.GetBump(tex);
8110
-
8111
- usedtextures.put(pigment, pigment);
8112
- usedtextures.put(bump, bump);
8113
-
8114
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8115
- {
8116
- // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8117
- // System.out.println("; bump = " + bump);
8118
- }
8119
-
8120
- if (bump.equals(""))
8121
- {
8122
- bump = null;
8123
- }
8124
- if (pigment.equals(""))
8125
- {
8126
- pigment = null;
8127
- }
8128
-
8129
- GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8130
- BindTexture(pigment, false, resolution);
8131
- GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8132
- BindTexture(bump, true, resolution);
8133
- GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8134
-
8135
- return; // true;
8187
+ BindPigmentTexture(tex, resolution);
8188
+ BindBumpTexture(tex, resolution);
81368189 }
81378190
81388191 /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE
....@@ -8145,15 +8198,15 @@
81458198
81468199 if (tex == null)
81478200 {
8148
- BindTexture(null,false,resolution);
8201
+ BindTexture(null, null,false,resolution);
81498202 return;
81508203 }
81518204
81528205 String pigment = Object3D.GetPigment(tex);
81538206
8154
- usedtextures.put(pigment, pigment);
8207
+ usedtextures.add(pigment);
81558208
8156
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8209
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81578210 {
81588211 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81598212 // System.out.println("; bump = " + bump);
....@@ -8165,7 +8218,7 @@
81658218 }
81668219
81678220 GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8168
- BindTexture(pigment, false, resolution);
8221
+ BindTexture(tex.pigmenttexture, pigment, false, resolution);
81698222 }
81708223
81718224 /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE
....@@ -8178,15 +8231,15 @@
81788231
81798232 if (tex == null)
81808233 {
8181
- BindTexture(null,true,resolution);
8234
+ BindTexture(null, null,true,resolution);
81828235 return;
81838236 }
81848237
81858238 String bump = Object3D.GetBump(tex);
81868239
8187
- usedtextures.put(bump, bump);
8240
+ usedtextures.add(bump);
81888241
8189
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8242
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81908243 {
81918244 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81928245 // System.out.println("; bump = " + bump);
....@@ -8198,7 +8251,7 @@
81988251 }
81998252
82008253 GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8201
- BindTexture(bump, true, resolution);
8254
+ BindTexture(tex.bumptexture, bump, true, resolution);
82028255 GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
82038256 }
82048257
....@@ -8222,9 +8275,9 @@
82228275 return fileExists;
82238276 }
82248277
8225
- CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception
8278
+ CacheTexture GetCacheTexture(java.awt.image.BufferedImage bim, String tex, boolean bump, int resolution) throws Exception
82268279 {
8227
- CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
8280
+ CacheTexture texturecache = null;
82288281
82298282 if (tex != null)
82308283 {
....@@ -8244,12 +8297,22 @@
82448297 }
82458298
82468299 if (CACHETEXTURE)
8247
- texture = textures.get(texname); // TEXTURE CACHE
8248
-
8249
- TextureData texturedata = null;
8250
-
8251
- if (texture == null || texture.resolution < resolution)
82528300 {
8301
+ if (bim == null)
8302
+ texturecache = textures.get(texname); // TEXTURE CACHE
8303
+ else
8304
+ texturecache = bimtextures.get(bim); // TEXTURE CACHE
8305
+ }
8306
+
8307
+ if (texturecache == null || texturecache.resolution < resolution)
8308
+ {
8309
+ TextureData texturedata = null;
8310
+
8311
+ if (bim == null)
8312
+ {
8313
+
8314
+ }
8315
+ else
82538316 if (tex.equals("DEFAULT_TEXTURE")) // ||*/ tex.equals(""))
82548317 {
82558318 assert(!bump);
....@@ -8261,19 +8324,19 @@
82618324 // }
82628325 // else
82638326 // {
8264
- texture = textures.get(tex);
8265
- if (texture == null)
8327
+ texturecache = textures.get(tex);
8328
+ if (texturecache == null)
82668329 {
8267
- texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
8330
+ texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
82688331 }
82698332 // }
82708333 } else
82718334 if (tex.equals("DEFAULT_TEXTURE_BUMP")) // ||*/ tex.equals(""))
82728335 {
82738336 assert(bump);
8274
- texture = textures.get(tex);
8275
- if (texture == null)
8276
- texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
8337
+ texturecache = textures.get(tex);
8338
+ if (texturecache == null)
8339
+ texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution);
82778340 } else
82788341 {
82798342 //if (tex.equals("IMMORTAL"))
....@@ -8283,9 +8346,9 @@
82838346 //{
82848347 if (tex.equals("WHITE_NOISE"))
82858348 {
8286
- texture = textures.get(tex);
8287
- if (texture == null)
8288
- texture = new CacheTexture(GetResourceTexture("whitenoise.png", bump),resolution);
8349
+ texturecache = textures.get(tex);
8350
+ if (texturecache == null)
8351
+ texturecache = new CacheTexture(GetResourceTexture("whitenoise.png", bump),resolution);
82898352 } else
82908353 {
82918354 if (textureon)
....@@ -8344,19 +8407,19 @@
83448407 if (texturedata == null)
83458408 throw new Exception();
83468409
8347
- texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
8410
+ texturecache = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
83488411 //texture = GetTexture(tex, bump);
83498412 }
83508413 }
83518414 //}
83528415 }
83538416
8354
- if (/*CACHETEXTURE &&*/ texture != null && textureon)
8417
+ if (/*CACHETEXTURE &&*/ texturecache != null && textureon)
83558418 {
83568419 //return false;
83578420
83588421 // System.out.println("CACHE +++++++++++++++ TEXTURE : " + texname + " (" + texture.getEstimatedMemorySize() + ")");
8359
- if (texturedata != null && (texname.endsWith(".jpg") || texname.endsWith(".JPG")))
8422
+ if (texturedata != null && texname.toLowerCase().endsWith(".jpg"))
83608423 {
83618424 // String ext = "_highres";
83628425 // if (REDUCETEXTURE)
....@@ -8445,8 +8508,8 @@
84458508 textures.remove(texname);
84468509 }
84478510
8448
- texture.texturedata = texturedata;
8449
- textures.put(texname, texture);
8511
+ //texture.texturedata = texturedata;
8512
+ textures.put(texname, texturecache);
84508513
84518514 // newtex = true;
84528515 }
....@@ -8462,12 +8525,12 @@
84628525 }
84638526 }
84648527
8465
- return texture;
8528
+ return texturecache;
84668529 }
84678530
8468
- com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception
8531
+ com.sun.opengl.util.texture.Texture GetTexture(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception
84698532 {
8470
- CacheTexture texture = GetCacheTexture(tex, bump, resolution);
8533
+ CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution);
84718534
84728535 if (bump)
84738536 {
....@@ -8483,23 +8546,23 @@
84838546 return texture!=null?texture.texture:null;
84848547 }
84858548
8486
- public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception
8549
+ public com.sun.opengl.util.texture.TextureData GetTextureData(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception
84878550 {
8488
- CacheTexture texture = GetCacheTexture(tex, bump, resolution);
8551
+ CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution);
84898552
84908553 return texture!=null?texture.texturedata:null;
84918554 }
84928555
8493
- boolean BindTexture(String tex, boolean bump, int resolution) throws Exception
8556
+ boolean BindTexture(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception
84948557 {
84958558 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
84968559 {
84978560 return false;
84988561 }
84998562
8500
- boolean newtex = false;
8563
+ //boolean newtex = false;
85018564
8502
- com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
8565
+ com.sun.opengl.util.texture.Texture texture = GetTexture(stream, tex, bump, resolution);
85038566
85048567 if (texture == null)
85058568 return false;
....@@ -8529,7 +8592,7 @@
85298592 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT);
85308593 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT);
85318594
8532
- return newtex;
8595
+ return true; // Warning: not used.
85338596 }
85348597
85358598 ShadowBuffer shadowPBuf;
....@@ -9367,11 +9430,35 @@
93679430 jy8[3] = 0.5f;
93689431 }
93699432
9370
- float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
9433
+ float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
93719434 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
93729435 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
93739436 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
93749437
9438
+ void ResetOptions()
9439
+ {
9440
+ options1[0] = 100;
9441
+ options1[1] = 0.025f;
9442
+ options1[2] = 0.01f;
9443
+ options1[3] = 0;
9444
+ options1[4] = 0;
9445
+
9446
+ options2[0] = 0;
9447
+ options2[1] = 0.75f;
9448
+ options2[2] = 0;
9449
+ options2[3] = 0;
9450
+
9451
+ options3[0] = 1;
9452
+ options3[1] = 1;
9453
+ options3[2] = 1;
9454
+ options3[3] = 0;
9455
+
9456
+ options4[0] = 1;
9457
+ options4[1] = 0;
9458
+ options4[2] = 1;
9459
+ options4[3] = 0;
9460
+ }
9461
+
93759462 static int imagecount = 0; // movie generation
93769463
93779464 static int jitter = 0;
....@@ -10482,6 +10569,7 @@
1048210569 ANTIALIAS = 0;
1048310570 //System.out.println("RESTART");
1048410571 AAtimer.restart();
10572
+ Globals.TIMERRUNNING = true;
1048510573 }
1048610574 }
1048710575 }
....@@ -10549,7 +10637,8 @@
1054910637 ambientOcclusion = false;
1055010638 }
1055110639
10552
- if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
10640
+ if (//Globals.lighttouched &&
10641
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1055310642 {
1055410643 //if (RENDERSHADOW) // ?
1055510644 if (!IsFrozen())
....@@ -10960,7 +11049,7 @@
1096011049
1096111050 try
1096211051 {
10963
- BindTexture(NOISE_TEXTURE, false, 2);
11052
+ BindTexture(null, NOISE_TEXTURE, false, 2);
1096411053 }
1096511054 catch (Exception e)
1096611055 {
....@@ -10989,9 +11078,9 @@
1098911078
1099011079 gl.glMatrixMode(GL.GL_MODELVIEW);
1099111080
10992
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
10993
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
10994
-//gl.glEnable(gl.GL_MULTISAMPLE);
11081
+gl.glEnable(gl.GL_POLYGON_SMOOTH);
11082
+gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11083
+gl.glEnable(gl.GL_MULTISAMPLE);
1099511084 } else
1099611085 {
1099711086 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -11002,7 +11091,7 @@
1100211091 //System.out.println("BLENDING ON");
1100311092 gl.glEnable(GL.GL_BLEND);
1100411093 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
11005
-
11094
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1100611095 gl.glMatrixMode(gl.GL_PROJECTION);
1100711096 gl.glLoadIdentity();
1100811097
....@@ -11459,15 +11548,36 @@
1145911548
1146011549 static boolean zoomonce = false;
1146111550
11551
+ static void CreateSelectedPoint()
11552
+ {
11553
+ if (selectedpoint == null)
11554
+ {
11555
+ debugpointG = new Sphere();
11556
+ debugpointP = new Sphere();
11557
+ debugpointC = new Sphere();
11558
+ debugpointR = new Sphere();
11559
+
11560
+ selectedpoint = new Superellipsoid();
11561
+
11562
+ for (int i=0; i<8; i++)
11563
+ {
11564
+ debugpoints[i] = new Sphere();
11565
+ }
11566
+ }
11567
+ }
11568
+
1146211569 void DrawObject(GL gl, boolean draw)
1146311570 {
11571
+ // To clear camera values
11572
+ ResetOptions();
11573
+
1146411574 //System.out.println("DRAW OBJECT " + mouseDown);
1146511575 // DrawMode() = SELECTION;
1146611576 //GL gl = getGL();
1146711577 if ((TRACK || SHADOWTRACK) || zoomonce)
1146811578 {
1146911579 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11470
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11580
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1147111581 pingthread.StepToTarget(true); // true);
1147211582 // zoomonce = false;
1147311583 }
....@@ -11539,8 +11649,9 @@
1153911649
1154011650 if (DrawMode() == DEFAULT)
1154111651 {
11542
- if (DEBUG)
11652
+ if (Globals.DEBUG)
1154311653 {
11654
+ CreateSelectedPoint();
1154411655 float radius = 0.05f;
1154511656 if (selectedpoint.radius != radius)
1154611657 {
....@@ -11603,7 +11714,7 @@
1160311714 if (tex.equals("WHITE_NOISE"))
1160411715 continue;
1160511716
11606
- if (!usedtextures.containsKey(tex))
11717
+ if (!usedtextures.contains(tex))
1160711718 {
1160811719 // System.out.println("DISPOSE +++++++++++++++ " + tex);
1160911720 textures.get(tex).texture.dispose();
....@@ -12027,7 +12138,7 @@
1202712138 for (int i = tp.size(); --i >= 0;)
1202812139 {
1202912140 //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12030
- LA.xformPos(light, tp.get(i).GlobalTransform(), light);
12141
+ LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
1203112142 }
1203212143
1203312144
....@@ -13297,7 +13408,8 @@
1329713408 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1329813409 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1329913410 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13300
- Object3D.cVector2[] vector2buffer;
13411
+
13412
+ //Object3D.cVector2[] vector2buffer;
1330113413
1330213414 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1330313415 // OUT : diff, spec
....@@ -13313,9 +13425,10 @@
1331313425 "DP3 " + dest + ".z," + "normals," + "eye;" +
1331413426 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1331513427 //"MOV " + dest + ".w," + "normal.z;" +
13316
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13317
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13318
- //"MOV " + dest + ".z," + "params2.w;" +
13428
+// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET
13429
+// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13430
+
13431
+ "MOV " + dest + ".z," + "params2.w;" + // EXACT
1331913432 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1332013433 "RCP " + dest + ".w," + dest + ".w;" +
1332113434 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13820,6 +13933,7 @@
1382013933 else
1382113934 if (evt.getSource() == AAtimer)
1382213935 {
13936
+ Globals.TIMERRUNNING = false;
1382313937 if (mouseDown)
1382413938 {
1382513939 //new Exception().printStackTrace();
....@@ -13879,7 +13993,7 @@
1387913993
1388013994 // fev 2014???
1388113995 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13882
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13996
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1388313997 pingthread.StepToTarget(true); // true);
1388413998 }
1388513999 // if (!LIVE)
....@@ -13894,6 +14008,7 @@
1389414008 return;
1389514009
1389614010 AAtimer.restart(); //
14011
+ Globals.TIMERRUNNING = true;
1389714012
1389814013 // waslive = LIVE;
1389914014 // LIVE = false;
....@@ -14232,12 +14347,12 @@
1423214347 void GoDown(int mod)
1423314348 {
1423414349 MODIFIERS |= COMMAND;
14235
- /*
14350
+ /**/
1423614351 if((mod&SHIFT) == SHIFT)
1423714352 manipCamera.RotatePosition(0, -speed);
1423814353 else
14239
- manipCamera.BackForth(0, -speed*delta, getWidth());
14240
- */
14354
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14355
+ /**/
1424114356 if ((mod & SHIFT) == SHIFT)
1424214357 {
1424314358 mouseMode = mouseMode; // VR??
....@@ -14253,12 +14368,12 @@
1425314368 void GoUp(int mod)
1425414369 {
1425514370 MODIFIERS |= COMMAND;
14256
- /*
14371
+ /**/
1425714372 if((mod&SHIFT) == SHIFT)
1425814373 manipCamera.RotatePosition(0, speed);
1425914374 else
14260
- manipCamera.BackForth(0, speed*delta, getWidth());
14261
- */
14375
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14376
+ /**/
1426214377 if ((mod & SHIFT) == SHIFT)
1426314378 {
1426414379 mouseMode = mouseMode;
....@@ -14274,12 +14389,12 @@
1427414389 void GoLeft(int mod)
1427514390 {
1427614391 MODIFIERS |= COMMAND;
14277
- /*
14392
+ /**/
1427814393 if((mod&SHIFT) == SHIFT)
14279
- manipCamera.RotatePosition(speed, 0);
14280
- else
1428114394 manipCamera.Translate(speed*delta, 0, getWidth());
14282
- */
14395
+ else
14396
+ manipCamera.RotatePosition(speed, 0);
14397
+ /**/
1428314398 if ((mod & SHIFT) == SHIFT)
1428414399 {
1428514400 mouseMode = mouseMode;
....@@ -14295,12 +14410,12 @@
1429514410 void GoRight(int mod)
1429614411 {
1429714412 MODIFIERS |= COMMAND;
14298
- /*
14413
+ /**/
1429914414 if((mod&SHIFT) == SHIFT)
14300
- manipCamera.RotatePosition(-speed, 0);
14301
- else
1430214415 manipCamera.Translate(-speed*delta, 0, getWidth());
14303
- */
14416
+ else
14417
+ manipCamera.RotatePosition(-speed, 0);
14418
+ /**/
1430414419 if ((mod & SHIFT) == SHIFT)
1430514420 {
1430614421 mouseMode = mouseMode;
....@@ -14357,7 +14472,8 @@
1435714472 info.camera = renderCamera;
1435814473 info.x = x;
1435914474 info.y = y;
14360
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14475
+ object.GetWindow().copy
14476
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1436114477 } else
1436214478 {
1436314479 if (x < startX)
....@@ -14521,7 +14637,9 @@
1452114637 ci.camera = renderCamera;
1452214638 if (!isRenderer)
1452314639 {
14524
- if (object.editWindow.copy.doEditClick(ci, 0))
14640
+ //ObjEditor editWindow = object.editWindow;
14641
+ //Object3D copy = editWindow.copy;
14642
+ if (object.doEditClick(ci, 0))
1452514643 {
1452614644 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1452714645 } else
....@@ -14536,7 +14654,8 @@
1453614654 Globals.MOUSEDRAGGED = false;
1453714655
1453814656 movingcamera = false;
14539
- X = Y = 0;
14657
+ X = 0; // getBounds().width/2;
14658
+ Y = 0; // getBounds().height/2;
1454014659 //System.out.println("mouseReleased: " + e);
1454114660 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1454214661 }
....@@ -14877,7 +14996,9 @@
1487714996 case 'E' : COMPACT ^= true;
1487814997 repaint();
1487914998 break;
14880
- case 'W' : DEBUGHSB ^= true;
14999
+ case 'W' : // Wide Window (fullscreen)
15000
+ //DEBUGHSB ^= true;
15001
+ ObjEditor.theFrame.ToggleFullScreen();
1488115002 repaint();
1488215003 break;
1488315004 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14902,8 +15023,8 @@
1490215023 RevertCamera();
1490315024 repaint();
1490415025 break;
14905
- case 'L':
1490615026 case 'l':
15027
+ //case 'L':
1490715028 if (lightMode)
1490815029 {
1490915030 lightMode = false;
....@@ -15046,9 +15167,9 @@
1504615167 case '_':
1504715168 kompactbit = 5;
1504815169 break;
15049
- case '+':
15050
- kompactbit = 6;
15051
- break;
15170
+// case '+':
15171
+// kompactbit = 6;
15172
+// break;
1505215173 case ' ':
1505315174 lightMode ^= true;
1505415175 Globals.lighttouched = true;
....@@ -15060,6 +15181,7 @@
1506015181 case ESC:
1506115182 RENDERPROGRAM += 1;
1506215183 RENDERPROGRAM %= 3;
15184
+
1506315185 repaint();
1506415186 break;
1506515187 case 'Z':
....@@ -15099,8 +15221,9 @@
1509915221 case DELETE:
1510015222 ClearSelection();
1510115223 break;
15102
- /*
1510315224 case '+':
15225
+
15226
+ /*
1510415227 //fontsize += 1;
1510515228 bbzoom *= 2;
1510615229 repaint();
....@@ -15117,17 +15240,17 @@
1511715240 case '=':
1511815241 IncDepth();
1511915242 //fontsize += 1;
15120
- object.editWindow.refreshContents(true);
15243
+ object.GetWindow().refreshContents(true);
1512115244 maskbit = 6;
1512215245 break;
1512315246 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1512415247 DecDepth();
1512515248 maskbit = 5;
1512615249 //if(fontsize > 1) fontsize -= 1;
15127
- if (object.editWindow == null)
15128
- new Exception().printStackTrace();
15129
- else
15130
- object.editWindow.refreshContents(true);
15250
+// if (object.editWindow == null)
15251
+// new Exception().printStackTrace();
15252
+// else
15253
+ object.GetWindow().refreshContents(true);
1513115254 break;
1513215255 case '{':
1513315256 manipCamera.shaper_fovy /= 1.1;
....@@ -15351,7 +15474,7 @@
1535115474 }
1535215475 */
1535315476
15354
- object.editWindow.EditSelection();
15477
+ object.GetWindow().EditSelection(false);
1535515478 }
1535615479
1535715480 void SelectParent()
....@@ -15368,10 +15491,10 @@
1536815491 {
1536915492 //selectees.remove(i);
1537015493 System.out.println("select parent of " + elem);
15371
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15494
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1537215495 } else
1537315496 {
15374
- group.editWindow.Select(elem.GetTreePath(), first, true);
15497
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1537515498 }
1537615499
1537715500 first = false;
....@@ -15413,12 +15536,12 @@
1541315536 for (int j = 0; j < group.children.size(); j++)
1541415537 {
1541515538 elem = (Object3D) group.children.elementAt(j);
15416
- object.editWindow.Select(elem.GetTreePath(), first, true);
15539
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1541715540 first = false;
1541815541 }
1541915542 } else
1542015543 {
15421
- object.editWindow.Select(elem.GetTreePath(), first, true);
15544
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1542215545 }
1542315546
1542415547 first = false;
....@@ -15429,21 +15552,21 @@
1542915552 {
1543015553 //Composite group = (Composite) object;
1543115554 Object3D group = object;
15432
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15555
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1543315556 }
1543415557
1543515558 void ResetTransform(int mask)
1543615559 {
1543715560 //Composite group = (Composite) object;
1543815561 Object3D group = object;
15439
- group.editWindow.ResetTransform(mask);
15562
+ group.GetWindow().ResetTransform(mask);
1544015563 }
1544115564
1544215565 void FlipTransform()
1544315566 {
1544415567 //Composite group = (Composite) object;
1544515568 Object3D group = object;
15446
- group.editWindow.FlipTransform();
15569
+ group.GetWindow().FlipTransform();
1544715570 // group.editWindow.ReduceMesh(true);
1544815571 }
1544915572
....@@ -15451,7 +15574,7 @@
1545115574 {
1545215575 //Composite group = (Composite) object;
1545315576 Object3D group = object;
15454
- group.editWindow.PrintMemory();
15577
+ group.GetWindow().PrintMemory();
1545515578 // group.editWindow.ReduceMesh(true);
1545615579 }
1545715580
....@@ -15459,7 +15582,7 @@
1545915582 {
1546015583 //Composite group = (Composite) object;
1546115584 Object3D group = object;
15462
- group.editWindow.ResetCentroid();
15585
+ group.GetWindow().ResetCentroid();
1546315586 }
1546415587
1546515588 void IncDepth()
....@@ -15635,6 +15758,7 @@
1563515758 info.bounds.y += (height - desired) / 2;
1563615759 }
1563715760 }
15761
+
1563815762 info.g = gr;
1563915763 info.camera = renderCamera;
1564015764 /*
....@@ -15644,23 +15768,44 @@
1564415768 */
1564515769 if (!isRenderer)
1564615770 {
15647
- object.drawEditHandles(info, 0);
15648
-
15649
- if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15771
+ Grafreed.Assert(object != null);
15772
+ Grafreed.Assert(object.selection != null);
15773
+ if (object.selection.Size() > 0)
1565015774 {
15651
- switch (object.selection.get(0).hitSomething)
15775
+ int hitSomething = object.selection.get(0).hitSomething;
15776
+
15777
+ info.DX = 0;
15778
+ info.DY = 0;
15779
+ info.W = 1;
15780
+ if (hitSomething == Object3D.hitCenter)
1565215781 {
15653
- case Object3D.hitCenter: gr.setColor(Color.pink);
15654
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15655
- break;
15656
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15657
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15658
- break;
15659
- case Object3D.hitScale: gr.setColor(Color.cyan);
15660
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15661
- break;
15782
+ info.DX = X;
15783
+ if (X != 0)
15784
+ info.DX -= info.bounds.width/2;
15785
+
15786
+ info.DY = Y;
15787
+ if (Y != 0)
15788
+ info.DY -= info.bounds.height/2;
1566215789 }
15663
-
15790
+
15791
+ object.drawEditHandles(info, 0);
15792
+
15793
+ if (drag && (X != 0 || Y != 0))
15794
+ {
15795
+ switch (hitSomething)
15796
+ {
15797
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15798
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15799
+ break;
15800
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15801
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15802
+ break;
15803
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15804
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15805
+ break;
15806
+ }
15807
+
15808
+ }
1566415809 }
1566515810 }
1566615811 }
....@@ -16363,16 +16508,16 @@
1636316508 cStatic.objectstack[materialdepth++] = checker;
1636416509 //System.out.println("material " + material);
1636516510 //Applet3D.tracein(this, selected);
16366
- vector2buffer = checker.projectedVertices;
16511
+ //vector2buffer = checker.projectedVertices;
1636716512
1636816513 //checker.GetMaterial().Draw(this, false); // true);
16369
- DrawMaterial(checker.GetMaterial(), false); // true);
16514
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1637016515
1637116516 materialdepth -= 1;
1637216517 if (materialdepth > 0)
1637316518 {
16374
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16375
- DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
16519
+ //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16520
+ DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
1637616521 }
1637716522 //checker.GetMaterial().opacity = 1f;
1637816523 ////checker.GetMaterial().ambient = 1f;
....@@ -16458,6 +16603,14 @@
1645816603 }
1645916604 }
1646016605
16606
+ private Object3D GetFolder()
16607
+ {
16608
+ Object3D folder = object.GetWindow().copy;
16609
+ if (object.GetWindow().copy.selection.Size() > 0)
16610
+ folder = object.GetWindow().copy.selection.elementAt(0);
16611
+ return folder;
16612
+ }
16613
+
1646116614 class SelectBuffer implements GLEventListener
1646216615 {
1646316616
....@@ -16537,6 +16690,17 @@
1653716690
1653816691 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1653916692
16693
+ if (PAINTMODE)
16694
+ {
16695
+ if (object.GetWindow().copy.selection.Size() > 0)
16696
+ {
16697
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
16698
+
16699
+ // Make what you paint not selectable.
16700
+ paintobj.ResetSelectable();
16701
+ }
16702
+ }
16703
+
1654016704 //int tmp = selection_view;
1654116705 //selection_view = -1;
1654216706 int temp = DrawMode();
....@@ -16548,6 +16712,17 @@
1654816712 // temp = DEFAULT; // patch for selection debug
1654916713 Globals.drawMode = temp; // WARNING
1655016714
16715
+ if (PAINTMODE)
16716
+ {
16717
+ if (object.GetWindow().copy.selection.Size() > 0)
16718
+ {
16719
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
16720
+
16721
+ // Revert.
16722
+ paintobj.RestoreSelectable();
16723
+ }
16724
+ }
16725
+
1655116726 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1655216727
1655316728 // trying different ways of getting the depth info over
....@@ -16595,6 +16770,8 @@
1659516770 // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]);
1659616771 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1659716772 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
16773
+
16774
+ CreateSelectedPoint();
1659816775
1659916776 // Will fit the mesh !!!
1660016777 selectedpoint.toParent[0][0] = 0.0001;
....@@ -16649,29 +16826,31 @@
1664916826 }
1665016827
1665116828 if (!movingcamera && !PAINTMODE)
16652
- object.editWindow.ScreenFitPoint(); // fev 2014
16829
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1665316830
16654
- if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16831
+ if (PAINTMODE) // && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1665516832 {
16656
- Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16833
+ //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1665716834
16658
- Object3D group = new Object3D("inst" + paintcount++);
16835
+ if (object.GetWindow().copy.selection.Size() > 0)
16836
+ {
16837
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1665916838
16660
- group.CreateMaterial(); // use a void leaf to select instances
16661
-
16662
- group.add(paintobj); // link
16663
-
16664
- object.editWindow.SnapObject(group);
16665
-
16666
- Object3D folder = object.editWindow.copy;
16667
-
16668
- if (object.editWindow.copy.selection.Size() > 0)
16669
- folder = object.editWindow.copy.selection.elementAt(0);
16670
-
16671
- folder.add(group);
16672
-
16673
- object.editWindow.ResetModel();
16674
- object.editWindow.refreshContents();
16839
+ Object3D inst = new Object3D("inst" + paintcount++);
16840
+
16841
+ inst.CreateMaterial(); // use a void leaf to select instances
16842
+
16843
+ inst.add(paintobj); // link
16844
+
16845
+ object.GetWindow().SnapObject(inst);
16846
+
16847
+ Object3D folder = paintFolder; // GetFolder();
16848
+
16849
+ folder.add(inst);
16850
+
16851
+ object.GetWindow().ResetModel();
16852
+ object.GetWindow().refreshContents();
16853
+ }
1667516854 }
1667616855 else
1667716856 paintcount = 0;
....@@ -16710,6 +16889,11 @@
1671016889 //System.out.println("objects[color] = " + objects[color]);
1671116890 //objects[color].Select();
1671216891 indexcount = 0;
16892
+ ObjEditor window = object.GetWindow();
16893
+ if (window != null && deselect)
16894
+ {
16895
+ window.Select(null, deselect, true);
16896
+ }
1671316897 object.Select(color, deselect);
1671416898 }
1671516899
....@@ -17235,23 +17419,15 @@
1723517419 int AAbuffersize = 0;
1723617420
1723717421 //double[] selectedpoint = new double[3];
17238
- static Superellipsoid selectedpoint = new Superellipsoid();
17422
+ static Superellipsoid selectedpoint;
1723917423 static Sphere previousselectedpoint = null;
17240
- static Sphere debugpointG = new Sphere();
17241
- static Sphere debugpointP = new Sphere();
17242
- static Sphere debugpointC = new Sphere();
17243
- static Sphere debugpointR = new Sphere();
17424
+ static Sphere debugpointG;
17425
+ static Sphere debugpointP;
17426
+ static Sphere debugpointC;
17427
+ static Sphere debugpointR;
1724417428
1724517429 static Sphere debugpoints[] = new Sphere[8];
1724617430
17247
- static
17248
- {
17249
- for (int i=0; i<8; i++)
17250
- {
17251
- debugpoints[i] = new Sphere();
17252
- }
17253
- }
17254
-
1725517431 static void InitPoints(float radius)
1725617432 {
1725717433 for (int i=0; i<8; i++)