Normand Briere
2019-06-25 ecff440ceef3ad352aa64cedbb913107ec4863a5
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
....@@ -149,6 +148,8 @@
149148 defaultcaps.setAccumBlueBits(16);
150149 defaultcaps.setAccumAlphaBits(16);
151150 }
151
+
152
+ private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory();
152153
153154 void SetAsGLRenderer(boolean b)
154155 {
....@@ -325,7 +326,7 @@
325326 cStatic.objectstack[materialdepth++] = obj;
326327 //System.out.println("material " + material);
327328 //Applet3D.tracein(this, selected);
328
- display.vector2buffer = obj.projectedVertices;
329
+ //display.vector2buffer = obj.projectedVertices;
329330 if (obj instanceof Camera)
330331 {
331332 display.options1[0] = material.shift;
....@@ -357,7 +358,7 @@
357358 /**/
358359 } else
359360 {
360
- DrawMaterial(material, selected);
361
+ DrawMaterial(material, selected, obj.projectedVertices);
361362 }
362363 } else
363364 {
....@@ -381,8 +382,8 @@
381382 cStatic.objectstack[materialdepth++] = obj;
382383 //System.out.println("material " + material);
383384 //Applet3D.tracein("selected ", selected);
384
- display.vector2buffer = obj.projectedVertices;
385
- display.DrawMaterial(material, selected);
385
+ //display.vector2buffer = obj.projectedVertices;
386
+ display.DrawMaterial(material, selected, obj.projectedVertices);
386387 }
387388 }
388389
....@@ -399,8 +400,8 @@
399400 materialdepth -= 1;
400401 if (materialdepth > 0)
401402 {
402
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
403
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
403
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
404
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
404405 }
405406 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
406407 } else if (selected && CameraPane.flash && obj.GetMaterial() != null)
....@@ -420,8 +421,8 @@
420421 materialdepth -= 1;
421422 if (materialdepth > 0)
422423 {
423
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
424
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
424
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
425
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
425426 }
426427 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
427428 //else
....@@ -462,10 +463,12 @@
462463 if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
463464 {
464465 //gl.glBegin(gl.GL_TRIANGLES);
465
- boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
466
+ boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0)
467
+ // TEST LIVE NORMALS && !obj.dontselect
468
+ ;
466469 if (!hasnorm)
467470 {
468
- // System.out.println("FUCK!!");
471
+ // System.out.println("Mesh normal");
469472 LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0);
470473 LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1);
471474 LA.vecCross(obj.v0, obj.v1, obj.v2);
....@@ -1190,10 +1193,12 @@
11901193 gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
11911194 }
11921195 }
1196
+
11931197 if (flipV)
11941198 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
11951199 else
11961200 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1201
+
11971202 //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
11981203 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
11991204
....@@ -1213,10 +1218,12 @@
12131218 gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
12141219 }
12151220 }
1221
+
12161222 if (flipV)
12171223 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
12181224 else
12191225 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1226
+
12201227 //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
12211228 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
12221229
....@@ -1244,8 +1251,10 @@
12441251 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
12451252 else
12461253 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1254
+
12471255 //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
12481256 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
1257
+
12491258 count2 += 2;
12501259 count3 += 3;
12511260 }
....@@ -1601,7 +1610,7 @@
16011610 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16021611 }
16031612
1604
- void DrawMaterial(cMaterial material, boolean selected)
1613
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16051614 {
16061615 CameraPane display = this;
16071616 //new Exception().printStackTrace();
....@@ -1628,7 +1637,7 @@
16281637
16291638 cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0);
16301639
1631
- float[] colorV = GrafreeD.colorV;
1640
+ float[] colorV = Grafreed.colorV;
16321641
16331642 /**/
16341643 if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0)
....@@ -1636,7 +1645,7 @@
16361645 colorV[0] = display.modelParams0[0] * material.diffuse;
16371646 colorV[1] = display.modelParams0[1] * material.diffuse;
16381647 colorV[2] = display.modelParams0[2] * material.diffuse;
1639
- colorV[3] = material.opacity;
1648
+ colorV[3] = 1; // material.opacity;
16401649
16411650 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16421651 //System.out.println("Opacity = " + opacity);
....@@ -1744,9 +1753,9 @@
17441753 display.modelParams7[2] = 0;
17451754 display.modelParams7[3] = 0;
17461755
1747
- display.modelParams6[0] = 100; // criss de bug de bump
1756
+ //display.modelParams6[0] = 100; // criss de bug de bump
17481757
1749
- Object3D.cVector2[] extparams = display.vector2buffer;
1758
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17501759 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17511760 {
17521761 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -1888,7 +1897,7 @@
18881897 void PushMatrix(double[][] matrix)
18891898 {
18901899 // GrafreeD.tracein(matrix);
1891
- PushMatrix(matrix,1);
1900
+ PushMatrix(matrix, 1);
18921901 }
18931902
18941903 void PushMatrix()
....@@ -2140,7 +2149,7 @@
21402149 System.err.println("LIVE = " + Globals.isLIVE());
21412150
21422151 if (!Globals.isLIVE()) // save sound
2143
- GrafreeD.savesound = true; // wav.save();
2152
+ Grafreed.savesound = true; // wav.save();
21442153 // else
21452154 repaint(); // start loop // may 2013
21462155 }
....@@ -2257,7 +2266,7 @@
22572266
22582267 void ToggleDebug()
22592268 {
2260
- DEBUG ^= true;
2269
+ Globals.DEBUG ^= true;
22612270 }
22622271
22632272 void ToggleLookAt()
....@@ -2265,7 +2274,7 @@
22652274 LOOKAT ^= true;
22662275 }
22672276
2268
- void ToggleRandom()
2277
+ void ToggleSwitch()
22692278 {
22702279 SWITCH ^= true;
22712280 }
....@@ -2374,7 +2383,7 @@
23742383 {
23752384 return currentGL;
23762385 }
2377
-
2386
+
23782387 /**/
23792388 class CacheTexture
23802389 {
....@@ -7919,6 +7928,64 @@
79197928 ReleaseTexture(pigment, false);
79207929 }
79217930
7931
+ public void ReleasePigmentTexture(cTexture tex) // INTERFACE
7932
+ {
7933
+ if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
7934
+ {
7935
+ return;
7936
+ }
7937
+
7938
+ if (tex == null)
7939
+ {
7940
+ ReleaseTexture(null, false);
7941
+ return;
7942
+ }
7943
+
7944
+ String pigment = Object3D.GetPigment(tex);
7945
+
7946
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7947
+ {
7948
+ // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
7949
+ // System.out.println("; bump = " + bump);
7950
+ }
7951
+
7952
+ if (pigment.equals(""))
7953
+ {
7954
+ pigment = null;
7955
+ }
7956
+
7957
+ ReleaseTexture(pigment, false);
7958
+ }
7959
+
7960
+ public void ReleaseBumpTexture(cTexture tex) // INTERFACE
7961
+ {
7962
+ if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
7963
+ {
7964
+ return;
7965
+ }
7966
+
7967
+ if (tex == null)
7968
+ {
7969
+ ReleaseTexture(null, true);
7970
+ return;
7971
+ }
7972
+
7973
+ String bump = Object3D.GetBump(tex);
7974
+
7975
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7976
+ {
7977
+ // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
7978
+ // System.out.println("; bump = " + bump);
7979
+ }
7980
+
7981
+ if (bump.equals(""))
7982
+ {
7983
+ bump = null;
7984
+ }
7985
+
7986
+ ReleaseTexture(bump, true);
7987
+ }
7988
+
79227989 void ReleaseTexture(String tex, boolean bump)
79237990 {
79247991 if (// DrawMode() != 0 || /*tex == null ||*/
....@@ -8022,7 +8089,7 @@
80228089 }
80238090 }
80248091
8025
- /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE
8092
+ /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
80268093 {
80278094 if (// DrawMode() != 0 || /*tex == null ||*/
80288095 ambientOcclusion ) // || !textureon)
....@@ -8067,7 +8134,94 @@
80678134 return; // true;
80688135 }
80698136
8070
- CacheTexture GetCacheTexture(String tex, boolean bump, int resolution)
8137
+ /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE
8138
+ {
8139
+ if (// DrawMode() != 0 || /*tex == null ||*/
8140
+ ambientOcclusion ) // || !textureon)
8141
+ {
8142
+ return; // false;
8143
+ }
8144
+
8145
+ if (tex == null)
8146
+ {
8147
+ BindTexture(null,false,resolution);
8148
+ return;
8149
+ }
8150
+
8151
+ String pigment = Object3D.GetPigment(tex);
8152
+
8153
+ usedtextures.put(pigment, pigment);
8154
+
8155
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8156
+ {
8157
+ // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8158
+ // System.out.println("; bump = " + bump);
8159
+ }
8160
+
8161
+ if (pigment.equals(""))
8162
+ {
8163
+ pigment = null;
8164
+ }
8165
+
8166
+ GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8167
+ BindTexture(pigment, false, resolution);
8168
+ }
8169
+
8170
+ /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE
8171
+ {
8172
+ if (// DrawMode() != 0 || /*tex == null ||*/
8173
+ ambientOcclusion ) // || !textureon)
8174
+ {
8175
+ return; // false;
8176
+ }
8177
+
8178
+ if (tex == null)
8179
+ {
8180
+ BindTexture(null,true,resolution);
8181
+ return;
8182
+ }
8183
+
8184
+ String bump = Object3D.GetBump(tex);
8185
+
8186
+ usedtextures.put(bump, bump);
8187
+
8188
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8189
+ {
8190
+ // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8191
+ // System.out.println("; bump = " + bump);
8192
+ }
8193
+
8194
+ if (bump.equals(""))
8195
+ {
8196
+ bump = null;
8197
+ }
8198
+
8199
+ GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8200
+ BindTexture(bump, true, resolution);
8201
+ GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8202
+ }
8203
+
8204
+ java.util.HashSet<String> missingTextures = new java.util.HashSet<String>();
8205
+
8206
+ private boolean FileExists(String tex)
8207
+ {
8208
+ if (missingTextures.contains(tex))
8209
+ {
8210
+ return false;
8211
+ }
8212
+
8213
+ boolean fileExists = new File(tex).exists();
8214
+
8215
+ if (!fileExists)
8216
+ {
8217
+ // If file exists, the "new File()" is not executed sgain
8218
+ missingTextures.add(tex);
8219
+ }
8220
+
8221
+ return fileExists;
8222
+ }
8223
+
8224
+ CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception
80718225 {
80728226 CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
80738227
....@@ -8075,15 +8229,17 @@
80758229 {
80768230 String texname = tex;
80778231
8232
+ String fallbackTextureName = defaultDirectory + "/Textures/" + texname;
8233
+
80788234 // String[] split = tex.split("Textures");
80798235 // if (split.length > 1)
80808236 // texname = "/Users/nbriere/Textures" + split[split.length-1];
80818237 // else
80828238 // if (!texname.startsWith("/"))
80838239 // texname = "/Users/nbriere/Textures/" + texname;
8084
- if (!new File(tex).exists())
8240
+ if (!FileExists(tex))
80858241 {
8086
- texname = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory() + "/Textures/" + texname;
8242
+ texname = fallbackTextureName;
80878243 }
80888244
80898245 if (CACHETEXTURE)
....@@ -8153,7 +8309,7 @@
81538309 }
81548310
81558311 cachename = texname.substring(0, texname.length()-4)+ext+".jpg";
8156
- if (!new File(cachename).exists())
8312
+ if (!FileExists(cachename))
81578313 cachename = texname;
81588314 else
81598315 processbump = false; // don't process bump map again
....@@ -8175,7 +8331,7 @@
81758331 }
81768332
81778333 cachename = texname.substring(0, texname.length()-4)+ext+".png";
8178
- if (!new File(cachename).exists())
8334
+ if (!FileExists(cachename))
81798335 cachename = texname;
81808336 else
81818337 processbump = false; // don't process bump map again
....@@ -8184,7 +8340,9 @@
81848340 texturedata = GetFileTexture(cachename, processbump, resolution);
81858341
81868342
8187
- if (texturedata != null)
8343
+ if (texturedata == null)
8344
+ throw new Exception();
8345
+
81888346 texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
81898347 //texture = GetTexture(tex, bump);
81908348 }
....@@ -8306,7 +8464,7 @@
83068464 return texture;
83078465 }
83088466
8309
- com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution)
8467
+ com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception
83108468 {
83118469 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83128470
....@@ -8324,14 +8482,14 @@
83248482 return texture!=null?texture.texture:null;
83258483 }
83268484
8327
- public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution)
8485
+ public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception
83288486 {
83298487 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83308488
83318489 return texture!=null?texture.texturedata:null;
83328490 }
83338491
8334
- boolean BindTexture(String tex, boolean bump, int resolution)
8492
+ boolean BindTexture(String tex, boolean bump, int resolution) throws Exception
83358493 {
83368494 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
83378495 {
....@@ -9208,11 +9366,35 @@
92089366 jy8[3] = 0.5f;
92099367 }
92109368
9211
- float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
9369
+ float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
92129370 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
92139371 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
92149372 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
92159373
9374
+ void ResetOptions()
9375
+ {
9376
+ options1[0] = 100;
9377
+ options1[1] = 0.00001f;
9378
+ options1[2] = 20;
9379
+ options1[3] = 0;
9380
+ options1[4] = 0;
9381
+
9382
+ options2[0] = 0;
9383
+ options2[1] = 1;
9384
+ options2[2] = 0;
9385
+ options2[3] = 0;
9386
+
9387
+ options3[0] = 1;
9388
+ options3[1] = 1;
9389
+ options3[2] = 1;
9390
+ options3[3] = 0;
9391
+
9392
+ options4[0] = 1;
9393
+ options4[1] = 0;
9394
+ options4[2] = 1;
9395
+ options4[3] = 0;
9396
+ }
9397
+
92169398 static int imagecount = 0; // movie generation
92179399
92189400 static int jitter = 0;
....@@ -9308,8 +9490,8 @@
93089490 assert (parentcam != renderCamera);
93099491
93109492 if (renderCamera != lightCamera)
9311
- for (int count = parentcam.GetTransformCount(); --count>=0;)
9312
- LA.matConcat(matrix, parentcam.toParent, matrix);
9493
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
9494
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
93139495
93149496 // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix);
93159497
....@@ -9324,8 +9506,8 @@
93249506 LA.matCopy(renderCamera.fromScreen, matrix);
93259507
93269508 if (renderCamera != lightCamera)
9327
- for (int count = parentcam.GetTransformCount(); --count>=0;)
9328
- LA.matConcat(parentcam.fromParent, matrix, matrix);
9509
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
9510
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
93299511
93309512 // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix);
93319513
....@@ -9542,7 +9724,7 @@
95429724
95439725 if (!BOXMODE)
95449726 {
9545
- System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")");
9727
+ System.out.println("image: " + fullname + " (wav cursor=" + (Grafreed.wav.cursor / 735 / 4) + ")");
95469728 }
95479729
95489730 if (!BOXMODE)
....@@ -9580,7 +9762,7 @@
95809762 ABORTED = false;
95819763 }
95829764 else
9583
- GrafreeD.wav.cursor += 735 * ACSIZE;
9765
+ Grafreed.wav.cursor += 735 * ACSIZE;
95849766
95859767 if (false)
95869768 {
....@@ -10243,11 +10425,11 @@
1024310425
1024410426 public void display(GLAutoDrawable drawable)
1024510427 {
10246
- if (GrafreeD.savesound && GrafreeD.hassound)
10428
+ if (Grafreed.savesound && Grafreed.hassound)
1024710429 {
10248
- GrafreeD.wav.save();
10249
- GrafreeD.savesound = false;
10250
- GrafreeD.hassound = false;
10430
+ Grafreed.wav.save();
10431
+ Grafreed.savesound = false;
10432
+ Grafreed.hassound = false;
1025110433 }
1025210434 // if (DEBUG_SELECTION)
1025310435 // {
....@@ -10323,6 +10505,7 @@
1032310505 ANTIALIAS = 0;
1032410506 //System.out.println("RESTART");
1032510507 AAtimer.restart();
10508
+ Globals.TIMERRUNNING = true;
1032610509 }
1032710510 }
1032810511 }
....@@ -10377,7 +10560,7 @@
1037710560 Object3D theobject = object;
1037810561 Object3D theparent = object.parent;
1037910562 object.parent = null;
10380
- object = (Object3D)GrafreeD.clone(object);
10563
+ object = (Object3D)Grafreed.clone(object);
1038110564 object.Stripify();
1038210565 if (theobject.selection == null || theobject.selection.Size() == 0)
1038310566 theobject.PreprocessOcclusion(this);
....@@ -10390,13 +10573,14 @@
1039010573 ambientOcclusion = false;
1039110574 }
1039210575
10393
- if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN)
10576
+ if (//Globals.lighttouched &&
10577
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1039410578 {
1039510579 //if (RENDERSHADOW) // ?
1039610580 if (!IsFrozen())
1039710581 {
1039810582 // dec 2012
10399
- if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0))
10583
+ if (!ambientOcclusion && !(!flash && DrawMode() == DEFAULT && ANTIALIAS > 0))
1040010584 {
1040110585 Globals.framecount++;
1040210586 shadowbuffer.display();
....@@ -10523,8 +10707,8 @@
1052310707
1052410708 // if (parentcam != renderCamera) // not a light
1052510709 if (cam != lightCamera)
10526
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10527
- LA.matConcat(matrix, parentcam.toParent, matrix);
10710
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
10711
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
1052810712
1052910713 for (int j = 0; j < 4; j++)
1053010714 {
....@@ -10538,8 +10722,8 @@
1053810722
1053910723 // if (parentcam != renderCamera) // not a light
1054010724 if (cam != lightCamera)
10541
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10542
- LA.matConcat(parentcam.fromParent, matrix, matrix);
10725
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
10726
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
1054310727
1054410728 //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix);
1054510729
....@@ -10798,7 +10982,16 @@
1079810982 // Bump noise
1079910983 gl.glActiveTexture(GL.GL_TEXTURE6);
1080010984 //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise);
10801
- BindTexture(NOISE_TEXTURE, false, 2);
10985
+
10986
+ try
10987
+ {
10988
+ BindTexture(NOISE_TEXTURE, false, 2);
10989
+ }
10990
+ catch (Exception e)
10991
+ {
10992
+ System.err.println("FAILED: " + NOISE_TEXTURE);
10993
+ }
10994
+
1080210995
1080310996 gl.glActiveTexture(GL.GL_TEXTURE0);
1080410997 gl.glEnable(GL.GL_TEXTURE_2D);
....@@ -10923,8 +11116,8 @@
1092311116 System.err.println("parentcam != renderCamera");
1092411117
1092511118 // if (cam != lightCamera)
10926
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10927
- LA.xformDir(lightposition, parentcam.toParent, lightposition); // may 2013
11119
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
11120
+ LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013
1092811121 }
1092911122
1093011123 LA.xformDir(lightposition, cam.toScreen, lightposition);
....@@ -10945,8 +11138,8 @@
1094511138 if (true) // TODO
1094611139 {
1094711140 if (cam != lightCamera)
10948
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10949
- LA.xformDir(light0, parentcam.toParent, light0); // may 2013
11141
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
11142
+ LA.xformDir(light0, parentcam.GlobalTransform(), light0); // may 2013
1095011143 }
1095111144
1095211145 LA.xformPos(light0, cam.toScreen, light0);
....@@ -11283,16 +11476,37 @@
1128311476 e.printStackTrace();
1128411477 }
1128511478
11286
- if (GrafreeD.RENDERME > 0)
11287
- GrafreeD.RENDERME--; // mechante magouille
11479
+ if (Grafreed.RENDERME > 0)
11480
+ Grafreed.RENDERME--; // mechante magouille
1128811481
1128911482 Globals.ONESTEP = false;
1129011483 }
1129111484
1129211485 static boolean zoomonce = false;
1129311486
11487
+ static void CreateSelectedPoint()
11488
+ {
11489
+ if (selectedpoint == null)
11490
+ {
11491
+ debugpointG = new Sphere();
11492
+ debugpointP = new Sphere();
11493
+ debugpointC = new Sphere();
11494
+ debugpointR = new Sphere();
11495
+
11496
+ selectedpoint = new Superellipsoid();
11497
+
11498
+ for (int i=0; i<8; i++)
11499
+ {
11500
+ debugpoints[i] = new Sphere();
11501
+ }
11502
+ }
11503
+ }
11504
+
1129411505 void DrawObject(GL gl, boolean draw)
1129511506 {
11507
+ // To clear camera values
11508
+ ResetOptions();
11509
+
1129611510 //System.out.println("DRAW OBJECT " + mouseDown);
1129711511 // DrawMode() = SELECTION;
1129811512 //GL gl = getGL();
....@@ -11354,7 +11568,14 @@
1135411568
1135511569 usedtextures.clear();
1135611570
11357
- BindTextures(DEFAULT_TEXTURES, 2);
11571
+ try
11572
+ {
11573
+ BindTextures(DEFAULT_TEXTURES, 2);
11574
+ }
11575
+ catch (Exception e)
11576
+ {
11577
+ System.err.println("FAILED: " + DEFAULT_TEXTURES);
11578
+ }
1135811579 }
1135911580 //System.out.println("--> " + stackdepth);
1136011581 // GrafreeD.traceon();
....@@ -11364,8 +11585,9 @@
1136411585
1136511586 if (DrawMode() == DEFAULT)
1136611587 {
11367
- if (DEBUG)
11588
+ if (Globals.DEBUG)
1136811589 {
11590
+ CreateSelectedPoint();
1136911591 float radius = 0.05f;
1137011592 if (selectedpoint.radius != radius)
1137111593 {
....@@ -11445,7 +11667,14 @@
1144511667 if (checker != null && DrawMode() == DEFAULT)
1144611668 {
1144711669 //BindTexture(IMMORTAL_TEXTURE);
11448
- BindTextures(checker.GetTextures(), checker.texres);
11670
+ try
11671
+ {
11672
+ BindTextures(checker.GetTextures(), checker.texres);
11673
+ }
11674
+ catch (Exception e)
11675
+ {
11676
+ System.err.println("FAILED: " + checker.GetTextures());
11677
+ }
1144911678 // NEAREST
1145011679 GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR);
1145111680 DrawChecker(gl);
....@@ -11527,7 +11756,7 @@
1152711756 return;
1152811757 }
1152911758
11530
- String string = obj.GetToolTip();
11759
+ String string = obj.toString(); //.GetToolTip();
1153111760
1153211761 GL gl = GetGL();
1153311762
....@@ -11844,8 +12073,8 @@
1184412073 //obj.TransformToWorld(light, light);
1184512074 for (int i = tp.size(); --i >= 0;)
1184612075 {
11847
- for (int count = tp.get(i).GetTransformCount(); --count>=0;)
11848
- LA.xformPos(light, tp.get(i).toParent, light);
12076
+ //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12077
+ LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
1184912078 }
1185012079
1185112080
....@@ -11862,8 +12091,8 @@
1186212091 parentcam = cameras[0];
1186312092 }
1186412093
11865
- for (int count = parentcam.GetTransformCount(); --count>=0;)
11866
- LA.xformPos(light, parentcam.toParent, light); // may 2013
12094
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
12095
+ LA.xformPos(light, parentcam.GlobalTransform(), light); // may 2013
1186712096
1186812097 LA.xformPos(light, renderCamera.toScreen, light);
1186912098
....@@ -12477,8 +12706,8 @@
1247712706
1247812707 // display shadow only (bump == 0)
1247912708 "SUB temp.x, half.x, shadow.x;" +
12480
- "MOV temp.y, -params6.x;" +
12481
- "SLT temp.z, temp.y, zero.x;" +
12709
+ "MOV temp.y, -params5.z;" + // params6.x;" +
12710
+ "SLT temp.z, temp.y, -one2048th.x;" +
1248212711 "SUB temp.y, one.x, temp.z;" +
1248312712 "MUL temp.x, temp.x, temp.y;" +
1248412713 "KIL temp.x;" +
....@@ -12809,7 +13038,7 @@
1280913038 //once = true;
1281013039 }
1281113040
12812
- System.out.print("Program #" + mode + "; length = " + program.length());
13041
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
1281313042 System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
1281413043 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1281513044
....@@ -12942,12 +13171,16 @@
1294213171
1294313172 "ADD " + depth + ".z, " + depth + ".z, temp.x;" +
1294413173 //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing!
13174
+
13175
+ // Compare fragment depth in light space with shadowmap.
1294513176 "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" +
1294613177 "SGE temp.y, temp.x, zero.x;" +
12947
- "SUB " + shadow + ".y, one.x, temp.y;" +
13178
+ "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded
13179
+
13180
+ // Reverse comparison
1294813181 "SUB temp.x, one.x, temp.x;" +
1294913182 "MUL " + shadow + ".x, temp.x, temp.y;" +
12950
- "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded
13183
+ "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse
1295113184 "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth
1295213185
1295313186 "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" +
....@@ -12961,6 +13194,10 @@
1296113194 // No shadow for backface
1296213195 "DP3 temp.x, normal, lightd;" +
1296313196 "SLT temp.x, temp.x, zero.x;" + // shadoweps
13197
+ "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
13198
+
13199
+ // No shadow when out of frustrum
13200
+ "SGE temp.x, " + depth + ".z, one.z;" +
1296413201 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1296513202 "";
1296613203 }
....@@ -13107,7 +13344,8 @@
1310713344 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1310813345 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1310913346 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13110
- Object3D.cVector2[] vector2buffer;
13347
+
13348
+ //Object3D.cVector2[] vector2buffer;
1311113349
1311213350 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1311313351 // OUT : diff, spec
....@@ -13519,7 +13757,7 @@
1351913757 public void mousePressed(MouseEvent e)
1352013758 {
1352113759 //System.out.println("mousePressed: " + e);
13522
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13760
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1352313761 }
1352413762
1352513763 static long prevtime = 0;
....@@ -13595,8 +13833,8 @@
1359513833 // mode |= META;
1359613834 //}
1359713835
13598
- SetMouseMode(WHEEL | e.getModifiersEx());
13599
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13836
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13837
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1360013838 anchorX = ax;
1360113839 anchorY = ay;
1360213840 prevX = px;
....@@ -13630,6 +13868,7 @@
1363013868 else
1363113869 if (evt.getSource() == AAtimer)
1363213870 {
13871
+ Globals.TIMERRUNNING = false;
1363313872 if (mouseDown)
1363413873 {
1363513874 //new Exception().printStackTrace();
....@@ -13655,6 +13894,10 @@
1365513894 // LIVE = waslive;
1365613895 // wasliveok = true;
1365713896 // waslive = false;
13897
+
13898
+ // May 2019 Forget it:
13899
+ if (true)
13900
+ return;
1365813901
1365913902 // source == timer
1366013903 if (mouseDown)
....@@ -13694,12 +13937,13 @@
1369413937
1369513938 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1369613939
13697
- void clickStart(int x, int y, int modifiers)
13940
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1369813941 {
1369913942 if (!wasliveok)
1370013943 return;
1370113944
1370213945 AAtimer.restart(); //
13946
+ Globals.TIMERRUNNING = true;
1370313947
1370413948 // waslive = LIVE;
1370513949 // LIVE = false;
....@@ -13711,7 +13955,7 @@
1371113955 // touched = true; // main DL
1371213956 if (isRenderer)
1371313957 {
13714
- SetMouseMode(modifiers);
13958
+ SetMouseMode(modifiers, modifiersex);
1371513959 }
1371613960
1371713961 selectX = anchorX = x;
....@@ -13724,7 +13968,7 @@
1372413968 clicked = true;
1372513969 hold = false;
1372613970
13727
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13971
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1372813972 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1372913973 {
1373013974 // System.out.println("RESTART II " + modifiers);
....@@ -13755,7 +13999,7 @@
1375513999 info.camera = renderCamera;
1375614000 info.x = x;
1375714001 info.y = y;
13758
- info.modifiers = modifiers;
14002
+ info.modifiers = modifiersex;
1375914003 editObj = object.doEditClick(info, 0);
1376014004 if (!editObj)
1376114005 {
....@@ -13772,9 +14016,12 @@
1377214016
1377314017 public void mouseDragged(MouseEvent e)
1377414018 {
14019
+ Globals.MOUSEDRAGGED = true;
14020
+
1377514021 //System.out.println("mouseDragged: " + e);
1377614022 if (isRenderer)
1377714023 movingcamera = true;
14024
+
1377814025 //if (drawing)
1377914026 //return;
1378014027 if ((e.getModifiersEx() & CTRL) != 0
....@@ -13784,7 +14031,7 @@
1378414031 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1378514032 }
1378614033 else
13787
- drag(e.getX(), e.getY(), e.getModifiersEx());
14034
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1378814035
1378914036 //try { Thread.sleep(1); } catch (Exception ex) {}
1379014037 }
....@@ -14021,7 +14268,7 @@
1402114268 {
1402214269 Globals.lighttouched = true;
1402314270 }
14024
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14271
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1402514272 }
1402614273 //else
1402714274 }
....@@ -14121,7 +14368,7 @@
1412114368 int X, Y;
1412214369 boolean SX, SY;
1412314370
14124
- void drag(int x, int y, int modifiers)
14371
+ void drag(int x, int y, int modifiers, int modifiersex)
1412514372 {
1412614373 if (IsFrozen())
1412714374 {
....@@ -14130,17 +14377,17 @@
1413014377
1413114378 drag = true; // NEW
1413214379
14133
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14380
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1413414381
1413514382 X = x;
1413614383 Y = y;
1413714384 // floating state for animation
14138
- MODIFIERS = modifiers;
14139
- modifiers &= ~1024;
14385
+ MODIFIERS = modifiersex;
14386
+ modifiersex &= ~1024;
1414014387 if (false) // modifiers != 0)
1414114388 {
1414214389 //new Exception().printStackTrace();
14143
- System.out.println("mouseDragged: " + modifiers);
14390
+ System.out.println("mouseDragged: " + modifiersex);
1414414391 System.out.println("SHIFT = " + SHIFT);
1414514392 System.out.println("CONTROL = " + COMMAND);
1414614393 System.out.println("META = " + META);
....@@ -14160,7 +14407,8 @@
1416014407 info.camera = renderCamera;
1416114408 info.x = x;
1416214409 info.y = y;
14163
- object.editWindow.copy.doEditDrag(info);
14410
+ object.GetWindow().copy
14411
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1416414412 } else
1416514413 {
1416614414 if (x < startX)
....@@ -14324,7 +14572,9 @@
1432414572 ci.camera = renderCamera;
1432514573 if (!isRenderer)
1432614574 {
14327
- if (object.editWindow.copy.doEditClick(ci, 0))
14575
+ //ObjEditor editWindow = object.editWindow;
14576
+ //Object3D copy = editWindow.copy;
14577
+ if (object.doEditClick(ci, 0))
1432814578 {
1432914579 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1433014580 } else
....@@ -14336,7 +14586,10 @@
1433614586
1433714587 public void mouseReleased(MouseEvent e)
1433814588 {
14589
+ Globals.MOUSEDRAGGED = false;
14590
+
1433914591 movingcamera = false;
14592
+ X = Y = 0;
1434014593 //System.out.println("mouseReleased: " + e);
1434114594 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1434214595 }
....@@ -14359,9 +14612,9 @@
1435914612 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1436014613 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1436114614
14362
- if (control || command || IsFrozen())
14615
+// No delay if (control || command || IsFrozen())
1436314616 timeout = true;
14364
- else
14617
+// ?? May 2019 else
1436514618 // timer.setDelay((modifiers & 128) != 0?0:350);
1436614619 mouseDown = false;
1436714620 if (!control && !command) // june 2013
....@@ -14471,7 +14724,7 @@
1447114724 System.out.println("keyReleased: " + e);
1447214725 }
1447314726
14474
- void SetMouseMode(int modifiers)
14727
+ void SetMouseMode(int modifiers, int modifiersex)
1447514728 {
1447614729 //System.out.println("SetMouseMode = " + modifiers);
1447714730 //modifiers &= ~1024;
....@@ -14483,7 +14736,7 @@
1448314736 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1448414737 // return;
1448514738 //System.out.println("SetMode = " + modifiers);
14486
- if ((modifiers & WHEEL) == WHEEL)
14739
+ if ((modifiersex & WHEEL) == WHEEL)
1448714740 {
1448814741 mouseMode |= ZOOM;
1448914742 }
....@@ -14493,15 +14746,15 @@
1449314746 {
1449414747 mouseMode |= VR; // BACKFORTH;
1449514748 }
14496
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14749
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1449714750 {
1449814751 mouseMode |= SELECT;
1449914752 }
14500
- if ((modifiers & COMMAND) == COMMAND)
14753
+ if ((modifiersex & COMMAND) == COMMAND)
1450114754 {
1450214755 mouseMode |= SELECT;
1450314756 }
14504
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14757
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1450514758 {
1450614759 mouseMode &= ~VR;
1450714760 mouseMode |= TRANSLATE;
....@@ -14530,7 +14783,7 @@
1453014783
1453114784 if (isRenderer) //
1453214785 {
14533
- SetMouseMode(modifiers);
14786
+ SetMouseMode(0, modifiers);
1453414787 }
1453514788
1453614789 Globals.theRenderer.keyPressed(key);
....@@ -14702,8 +14955,14 @@
1470214955 RevertCamera();
1470314956 repaint();
1470414957 break;
14705
- case 'L':
1470614958 case 'l':
14959
+ lightMode ^= true;
14960
+ Globals.lighttouched = true;
14961
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14962
+ targetLookAt.set(manipCamera.lookAt);
14963
+ repaint();
14964
+ break;
14965
+ case 'L':
1470714966 if (lightMode)
1470814967 {
1470914968 lightMode = false;
....@@ -14850,23 +15109,21 @@
1485015109 kompactbit = 6;
1485115110 break;
1485215111 case ' ':
14853
- lightMode ^= true;
14854
- Globals.lighttouched = true;
14855
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14856
- targetLookAt.set(manipCamera.lookAt);
15112
+ ObjEditor.theFrame.ToggleFullScreen();
1485715113 repaint();
1485815114 break;
1485915115 //case '`' :
1486015116 case ESC:
1486115117 RENDERPROGRAM += 1;
1486215118 RENDERPROGRAM %= 3;
15119
+
1486315120 repaint();
1486415121 break;
1486515122 case 'Z':
1486615123 //RESIZETEXTURE ^= true;
1486715124 //break;
1486815125 case 'z':
14869
- RENDERSHADOW ^= true;
15126
+ Globals.RENDERSHADOW ^= true;
1487015127 Globals.lighttouched = true;
1487115128 repaint();
1487215129 break;
....@@ -14990,7 +15247,7 @@
1499015247 //mode = ROTATE;
1499115248 if ((MODIFIERS & COMMAND) == 0) // VR??
1499215249 {
14993
- SetMouseMode(modifiers);
15250
+ SetMouseMode(0, modifiers);
1499415251 }
1499515252 }
1499615253
....@@ -15151,7 +15408,7 @@
1515115408 }
1515215409 */
1515315410
15154
- object.editWindow.EditSelection();
15411
+ object.editWindow.EditSelection(false);
1515515412 }
1515615413
1515715414 void SelectParent()
....@@ -15345,7 +15602,9 @@
1534515602 info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom));
1534615603 //Image img = CreateImage(width, height);
1534715604 //System.out.println("width = " + width + "; height = " + height + "\n");
15605
+
1534815606 Graphics gr = g; // img.getGraphics();
15607
+
1534915608 if (!hasMarquee)
1535015609 {
1535115610 if (Xmin < Xmax) // !locked)
....@@ -15443,14 +15702,33 @@
1544315702 if (!isRenderer)
1544415703 {
1544515704 object.drawEditHandles(info, 0);
15705
+
15706
+ if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15707
+ {
15708
+ switch (object.selection.get(0).hitSomething)
15709
+ {
15710
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15711
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15712
+ break;
15713
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15714
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15715
+ break;
15716
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15717
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15718
+ break;
15719
+ }
15720
+
15721
+ }
1544615722 }
1544715723 }
15724
+
1544815725 if (isRenderer)
1544915726 {
1545015727 //gr.setColor(Color.black);
1545115728 //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1);
1545215729 //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3);
1545315730 }
15731
+
1545415732 if (hasMarquee)
1545515733 {
1545615734 gr.setXORMode(Color.white);
....@@ -15563,6 +15841,7 @@
1556315841 public boolean mouseDown(Event evt, int x, int y)
1556415842 {
1556515843 System.out.println("mouseDown: " + evt);
15844
+ System.exit(0);
1556615845 /*
1556715846 locked = true;
1556815847 drag = false;
....@@ -15606,7 +15885,7 @@
1560615885 {
1560715886 keyPressed(0, modifiers);
1560815887 }
15609
- clickStart(x, y, modifiers);
15888
+ // clickStart(x, y, modifiers);
1561015889 return true;
1561115890 }
1561215891
....@@ -15724,7 +16003,7 @@
1572416003 {
1572516004 keyReleased(0, 0);
1572616005 }
15727
- drag(x, y, modifiers);
16006
+ drag(x, y, 0, modifiers);
1572816007 return true;
1572916008 }
1573016009
....@@ -15856,7 +16135,7 @@
1585616135 Object3D object;
1585716136 static Object3D trackedobject;
1585816137 Camera renderCamera; // Light or Eye (or Occlusion)
15859
- /*static*/ Camera manipCamera; // Light or Eye
16138
+ /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light
1586016139 /*static*/ Camera eyeCamera;
1586116140 /*static*/ Camera lightCamera;
1586216141 int cameracount;
....@@ -16141,16 +16420,16 @@
1614116420 cStatic.objectstack[materialdepth++] = checker;
1614216421 //System.out.println("material " + material);
1614316422 //Applet3D.tracein(this, selected);
16144
- vector2buffer = checker.projectedVertices;
16423
+ //vector2buffer = checker.projectedVertices;
1614516424
1614616425 //checker.GetMaterial().Draw(this, false); // true);
16147
- DrawMaterial(checker.GetMaterial(), false); // true);
16426
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1614816427
1614916428 materialdepth -= 1;
1615016429 if (materialdepth > 0)
1615116430 {
16152
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16153
- DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
16431
+ //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16432
+ DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
1615416433 }
1615516434 //checker.GetMaterial().opacity = 1f;
1615616435 ////checker.GetMaterial().ambient = 1f;
....@@ -16374,6 +16653,8 @@
1637416653 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1637516654 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
1637616655
16656
+ CreateSelectedPoint();
16657
+
1637716658 // Will fit the mesh !!!
1637816659 selectedpoint.toParent[0][0] = 0.0001;
1637916660 selectedpoint.toParent[1][1] = 0.0001;
....@@ -16422,16 +16703,16 @@
1642216703 System.out.println("; fromto " + sel + " " + Trunk(previousselectedpoint.toParent[3][0]) + " " + Trunk(previousselectedpoint.toParent[3][2]) + " " + Trunk(selectedpoint.toParent[3][0]) + " " + Trunk(selectedpoint.toParent[3][2]));
1642316704 }
1642416705
16425
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16706
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1642616707 }
1642716708 }
1642816709
1642916710 if (!movingcamera && !PAINTMODE)
1643016711 object.editWindow.ScreenFitPoint(); // fev 2014
1643116712
16432
- if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16713
+ if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1643316714 {
16434
- Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16715
+ Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1643516716
1643616717 Object3D group = new Object3D("inst" + paintcount++);
1643716718
....@@ -16587,7 +16868,7 @@
1658716868 gl.glDisable(gl.GL_CULL_FACE);
1658816869 }
1658916870
16590
- if (!RENDERSHADOW)
16871
+ if (!Globals.RENDERSHADOW)
1659116872 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1659216873
1659316874 // SB gl.glPolygonOffset(2.5f, 10);
....@@ -16597,7 +16878,7 @@
1659716878 //gl.glColorMask(false, false, false, false);
1659816879
1659916880 //render_scene_from_light_view(gl, drawable, 0, 0);
16600
- if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
16881
+ if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed())
1660116882 {
1660216883 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1660316884
....@@ -17013,23 +17294,15 @@
1701317294 int AAbuffersize = 0;
1701417295
1701517296 //double[] selectedpoint = new double[3];
17016
- static Superellipsoid selectedpoint = new Superellipsoid();
17297
+ static Superellipsoid selectedpoint;
1701717298 static Sphere previousselectedpoint = null;
17018
- static Sphere debugpointG = new Sphere();
17019
- static Sphere debugpointP = new Sphere();
17020
- static Sphere debugpointC = new Sphere();
17021
- static Sphere debugpointR = new Sphere();
17299
+ static Sphere debugpointG;
17300
+ static Sphere debugpointP;
17301
+ static Sphere debugpointC;
17302
+ static Sphere debugpointR;
1702217303
1702317304 static Sphere debugpoints[] = new Sphere[8];
1702417305
17025
- static
17026
- {
17027
- for (int i=0; i<8; i++)
17028
- {
17029
- debugpoints[i] = new Sphere();
17030
- }
17031
- }
17032
-
1703317306 static void InitPoints(float radius)
1703417307 {
1703517308 for (int i=0; i<8; i++)