Normand Briere
2019-06-25 d2f456cf5280f59425084532bd2397ec625f7577
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
....@@ -106,7 +105,7 @@
106105 static boolean OEIL = true;
107106 static boolean OEILONCE = false; // do oeilon then oeiloff
108107 static boolean LOOKAT = true;
109
-static boolean RANDOM = true; // false;
108
+static boolean SWITCH = true; // false;
110109 static boolean HANDLES = false; // selection doesn't work!!
111110 static boolean PAINTMODE = false;
112111
....@@ -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,9 +2274,9 @@
22652274 LOOKAT ^= true;
22662275 }
22672276
2268
- void ToggleRandom()
2277
+ void ToggleSwitch()
22692278 {
2270
- RANDOM ^= true;
2279
+ SWITCH ^= true;
22712280 }
22722281
22732282 void ToggleHandles()
....@@ -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,12 +8229,18 @@
80758229 {
80768230 String texname = tex;
80778231
8078
- String[] split = tex.split("Textures");
8079
- if (split.length > 1)
8080
- texname = "/Users/nbriere/Textures" + split[split.length-1];
8081
- else
8082
- if (!texname.startsWith("/"))
8083
- texname = "/Users/nbriere/Textures/" + texname;
8232
+ String fallbackTextureName = defaultDirectory + "/Textures/" + texname;
8233
+
8234
+// String[] split = tex.split("Textures");
8235
+// if (split.length > 1)
8236
+// texname = "/Users/nbriere/Textures" + split[split.length-1];
8237
+// else
8238
+// if (!texname.startsWith("/"))
8239
+// texname = "/Users/nbriere/Textures/" + texname;
8240
+ if (!FileExists(tex))
8241
+ {
8242
+ texname = fallbackTextureName;
8243
+ }
80848244
80858245 if (CACHETEXTURE)
80868246 texture = textures.get(texname); // TEXTURE CACHE
....@@ -8149,7 +8309,7 @@
81498309 }
81508310
81518311 cachename = texname.substring(0, texname.length()-4)+ext+".jpg";
8152
- if (!new File(cachename).exists())
8312
+ if (!FileExists(cachename))
81538313 cachename = texname;
81548314 else
81558315 processbump = false; // don't process bump map again
....@@ -8171,7 +8331,7 @@
81718331 }
81728332
81738333 cachename = texname.substring(0, texname.length()-4)+ext+".png";
8174
- if (!new File(cachename).exists())
8334
+ if (!FileExists(cachename))
81758335 cachename = texname;
81768336 else
81778337 processbump = false; // don't process bump map again
....@@ -8180,7 +8340,9 @@
81808340 texturedata = GetFileTexture(cachename, processbump, resolution);
81818341
81828342
8183
- if (texturedata != null)
8343
+ if (texturedata == null)
8344
+ throw new Exception();
8345
+
81848346 texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
81858347 //texture = GetTexture(tex, bump);
81868348 }
....@@ -8302,7 +8464,7 @@
83028464 return texture;
83038465 }
83048466
8305
- 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
83068468 {
83078469 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83088470
....@@ -8320,14 +8482,14 @@
83208482 return texture!=null?texture.texture:null;
83218483 }
83228484
8323
- 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
83248486 {
83258487 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83268488
83278489 return texture!=null?texture.texturedata:null;
83288490 }
83298491
8330
- boolean BindTexture(String tex, boolean bump, int resolution)
8492
+ boolean BindTexture(String tex, boolean bump, int resolution) throws Exception
83318493 {
83328494 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
83338495 {
....@@ -9304,8 +9466,8 @@
93049466 assert (parentcam != renderCamera);
93059467
93069468 if (renderCamera != lightCamera)
9307
- for (int count = parentcam.GetTransformCount(); --count>=0;)
9308
- LA.matConcat(matrix, parentcam.toParent, matrix);
9469
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
9470
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
93099471
93109472 // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix);
93119473
....@@ -9320,8 +9482,8 @@
93209482 LA.matCopy(renderCamera.fromScreen, matrix);
93219483
93229484 if (renderCamera != lightCamera)
9323
- for (int count = parentcam.GetTransformCount(); --count>=0;)
9324
- LA.matConcat(parentcam.fromParent, matrix, matrix);
9485
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
9486
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
93259487
93269488 // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix);
93279489
....@@ -9538,7 +9700,7 @@
95389700
95399701 if (!BOXMODE)
95409702 {
9541
- System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")");
9703
+ System.out.println("image: " + fullname + " (wav cursor=" + (Grafreed.wav.cursor / 735 / 4) + ")");
95429704 }
95439705
95449706 if (!BOXMODE)
....@@ -9576,7 +9738,7 @@
95769738 ABORTED = false;
95779739 }
95789740 else
9579
- GrafreeD.wav.cursor += 735 * ACSIZE;
9741
+ Grafreed.wav.cursor += 735 * ACSIZE;
95809742
95819743 if (false)
95829744 {
....@@ -10239,11 +10401,11 @@
1023910401
1024010402 public void display(GLAutoDrawable drawable)
1024110403 {
10242
- if (GrafreeD.savesound && GrafreeD.hassound)
10404
+ if (Grafreed.savesound && Grafreed.hassound)
1024310405 {
10244
- GrafreeD.wav.save();
10245
- GrafreeD.savesound = false;
10246
- GrafreeD.hassound = false;
10406
+ Grafreed.wav.save();
10407
+ Grafreed.savesound = false;
10408
+ Grafreed.hassound = false;
1024710409 }
1024810410 // if (DEBUG_SELECTION)
1024910411 // {
....@@ -10319,6 +10481,7 @@
1031910481 ANTIALIAS = 0;
1032010482 //System.out.println("RESTART");
1032110483 AAtimer.restart();
10484
+ Globals.TIMERRUNNING = true;
1032210485 }
1032310486 }
1032410487 }
....@@ -10373,7 +10536,7 @@
1037310536 Object3D theobject = object;
1037410537 Object3D theparent = object.parent;
1037510538 object.parent = null;
10376
- object = (Object3D)GrafreeD.clone(object);
10539
+ object = (Object3D)Grafreed.clone(object);
1037710540 object.Stripify();
1037810541 if (theobject.selection == null || theobject.selection.Size() == 0)
1037910542 theobject.PreprocessOcclusion(this);
....@@ -10386,13 +10549,14 @@
1038610549 ambientOcclusion = false;
1038710550 }
1038810551
10389
- if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN)
10552
+ if (//Globals.lighttouched &&
10553
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1039010554 {
1039110555 //if (RENDERSHADOW) // ?
1039210556 if (!IsFrozen())
1039310557 {
1039410558 // dec 2012
10395
- if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0))
10559
+ if (!ambientOcclusion && !(!flash && DrawMode() == DEFAULT && ANTIALIAS > 0))
1039610560 {
1039710561 Globals.framecount++;
1039810562 shadowbuffer.display();
....@@ -10519,8 +10683,8 @@
1051910683
1052010684 // if (parentcam != renderCamera) // not a light
1052110685 if (cam != lightCamera)
10522
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10523
- LA.matConcat(matrix, parentcam.toParent, matrix);
10686
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
10687
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
1052410688
1052510689 for (int j = 0; j < 4; j++)
1052610690 {
....@@ -10534,8 +10698,8 @@
1053410698
1053510699 // if (parentcam != renderCamera) // not a light
1053610700 if (cam != lightCamera)
10537
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10538
- LA.matConcat(parentcam.fromParent, matrix, matrix);
10701
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
10702
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
1053910703
1054010704 //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix);
1054110705
....@@ -10794,7 +10958,16 @@
1079410958 // Bump noise
1079510959 gl.glActiveTexture(GL.GL_TEXTURE6);
1079610960 //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise);
10797
- BindTexture(NOISE_TEXTURE, false, 2);
10961
+
10962
+ try
10963
+ {
10964
+ BindTexture(NOISE_TEXTURE, false, 2);
10965
+ }
10966
+ catch (Exception e)
10967
+ {
10968
+ System.err.println("FAILED: " + NOISE_TEXTURE);
10969
+ }
10970
+
1079810971
1079910972 gl.glActiveTexture(GL.GL_TEXTURE0);
1080010973 gl.glEnable(GL.GL_TEXTURE_2D);
....@@ -10919,8 +11092,8 @@
1091911092 System.err.println("parentcam != renderCamera");
1092011093
1092111094 // if (cam != lightCamera)
10922
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10923
- LA.xformDir(lightposition, parentcam.toParent, lightposition); // may 2013
11095
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
11096
+ LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013
1092411097 }
1092511098
1092611099 LA.xformDir(lightposition, cam.toScreen, lightposition);
....@@ -10941,8 +11114,8 @@
1094111114 if (true) // TODO
1094211115 {
1094311116 if (cam != lightCamera)
10944
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10945
- LA.xformDir(light0, parentcam.toParent, light0); // may 2013
11117
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
11118
+ LA.xformDir(light0, parentcam.GlobalTransform(), light0); // may 2013
1094611119 }
1094711120
1094811121 LA.xformPos(light0, cam.toScreen, light0);
....@@ -11279,13 +11452,31 @@
1127911452 e.printStackTrace();
1128011453 }
1128111454
11282
- if (GrafreeD.RENDERME > 0)
11283
- GrafreeD.RENDERME--; // mechante magouille
11455
+ if (Grafreed.RENDERME > 0)
11456
+ Grafreed.RENDERME--; // mechante magouille
1128411457
1128511458 Globals.ONESTEP = false;
1128611459 }
1128711460
1128811461 static boolean zoomonce = false;
11462
+
11463
+ static void CreateSelectedPoint()
11464
+ {
11465
+ if (selectedpoint == null)
11466
+ {
11467
+ debugpointG = new Sphere();
11468
+ debugpointP = new Sphere();
11469
+ debugpointC = new Sphere();
11470
+ debugpointR = new Sphere();
11471
+
11472
+ selectedpoint = new Superellipsoid();
11473
+
11474
+ for (int i=0; i<8; i++)
11475
+ {
11476
+ debugpoints[i] = new Sphere();
11477
+ }
11478
+ }
11479
+ }
1128911480
1129011481 void DrawObject(GL gl, boolean draw)
1129111482 {
....@@ -11350,7 +11541,14 @@
1135011541
1135111542 usedtextures.clear();
1135211543
11353
- BindTextures(DEFAULT_TEXTURES, 2);
11544
+ try
11545
+ {
11546
+ BindTextures(DEFAULT_TEXTURES, 2);
11547
+ }
11548
+ catch (Exception e)
11549
+ {
11550
+ System.err.println("FAILED: " + DEFAULT_TEXTURES);
11551
+ }
1135411552 }
1135511553 //System.out.println("--> " + stackdepth);
1135611554 // GrafreeD.traceon();
....@@ -11360,8 +11558,9 @@
1136011558
1136111559 if (DrawMode() == DEFAULT)
1136211560 {
11363
- if (DEBUG)
11561
+ if (Globals.DEBUG)
1136411562 {
11563
+ CreateSelectedPoint();
1136511564 float radius = 0.05f;
1136611565 if (selectedpoint.radius != radius)
1136711566 {
....@@ -11441,7 +11640,14 @@
1144111640 if (checker != null && DrawMode() == DEFAULT)
1144211641 {
1144311642 //BindTexture(IMMORTAL_TEXTURE);
11444
- BindTextures(checker.GetTextures(), checker.texres);
11643
+ try
11644
+ {
11645
+ BindTextures(checker.GetTextures(), checker.texres);
11646
+ }
11647
+ catch (Exception e)
11648
+ {
11649
+ System.err.println("FAILED: " + checker.GetTextures());
11650
+ }
1144511651 // NEAREST
1144611652 GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR);
1144711653 DrawChecker(gl);
....@@ -11523,7 +11729,7 @@
1152311729 return;
1152411730 }
1152511731
11526
- String string = obj.GetToolTip();
11732
+ String string = obj.toString(); //.GetToolTip();
1152711733
1152811734 GL gl = GetGL();
1152911735
....@@ -11840,8 +12046,8 @@
1184012046 //obj.TransformToWorld(light, light);
1184112047 for (int i = tp.size(); --i >= 0;)
1184212048 {
11843
- for (int count = tp.get(i).GetTransformCount(); --count>=0;)
11844
- LA.xformPos(light, tp.get(i).toParent, light);
12049
+ //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12050
+ LA.xformPos(light, tp.get(i).GlobalTransform(), light);
1184512051 }
1184612052
1184712053
....@@ -11858,8 +12064,8 @@
1185812064 parentcam = cameras[0];
1185912065 }
1186012066
11861
- for (int count = parentcam.GetTransformCount(); --count>=0;)
11862
- LA.xformPos(light, parentcam.toParent, light); // may 2013
12067
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
12068
+ LA.xformPos(light, parentcam.GlobalTransform(), light); // may 2013
1186312069
1186412070 LA.xformPos(light, renderCamera.toScreen, light);
1186512071
....@@ -12473,8 +12679,8 @@
1247312679
1247412680 // display shadow only (bump == 0)
1247512681 "SUB temp.x, half.x, shadow.x;" +
12476
- "MOV temp.y, -params6.x;" +
12477
- "SLT temp.z, temp.y, zero.x;" +
12682
+ "MOV temp.y, -params5.z;" + // params6.x;" +
12683
+ "SLT temp.z, temp.y, -one2048th.x;" +
1247812684 "SUB temp.y, one.x, temp.z;" +
1247912685 "MUL temp.x, temp.x, temp.y;" +
1248012686 "KIL temp.x;" +
....@@ -12754,7 +12960,7 @@
1275412960 "MUL final.y, fragment.texcoord[0].x, c256;" +
1275512961 "FLR final.x, final.y;" +
1275612962 "SUB final.y, final.y, final.x;" +
12757
- //"MUL final.x, final.x, c256i;" +
12963
+ "MUL final.x, final.x, c256i;" +
1275812964 "MOV final.z, zero.x;" +
1275912965 "MOV final.a, one.w;":""
1276012966 ) +
....@@ -12762,7 +12968,7 @@
1276212968 "MUL final.y, fragment.texcoord[0].y, c256;" +
1276312969 "FLR final.x, final.y;" +
1276412970 "SUB final.y, final.y, final.x;" +
12765
- //"MUL final.x, final.x, c256i;" +
12971
+ "MUL final.x, final.x, c256i;" +
1276612972 "MOV final.z, zero.x;" +
1276712973 "MOV final.a, one.w;":""
1276812974 ) +
....@@ -12805,7 +13011,7 @@
1280513011 //once = true;
1280613012 }
1280713013
12808
- System.out.print("Program #" + mode + "; length = " + program.length());
13014
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
1280913015 System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
1281013016 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1281113017
....@@ -12938,12 +13144,16 @@
1293813144
1293913145 "ADD " + depth + ".z, " + depth + ".z, temp.x;" +
1294013146 //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing!
13147
+
13148
+ // Compare fragment depth in light space with shadowmap.
1294113149 "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" +
1294213150 "SGE temp.y, temp.x, zero.x;" +
12943
- "SUB " + shadow + ".y, one.x, temp.y;" +
13151
+ "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded
13152
+
13153
+ // Reverse comparison
1294413154 "SUB temp.x, one.x, temp.x;" +
1294513155 "MUL " + shadow + ".x, temp.x, temp.y;" +
12946
- "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded
13156
+ "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse
1294713157 "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth
1294813158
1294913159 "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" +
....@@ -12957,6 +13167,10 @@
1295713167 // No shadow for backface
1295813168 "DP3 temp.x, normal, lightd;" +
1295913169 "SLT temp.x, temp.x, zero.x;" + // shadoweps
13170
+ "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
13171
+
13172
+ // No shadow when out of frustrum
13173
+ "SGE temp.x, " + depth + ".z, one.z;" +
1296013174 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1296113175 "";
1296213176 }
....@@ -13103,7 +13317,8 @@
1310313317 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1310413318 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1310513319 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13106
- Object3D.cVector2[] vector2buffer;
13320
+
13321
+ //Object3D.cVector2[] vector2buffer;
1310713322
1310813323 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1310913324 // OUT : diff, spec
....@@ -13515,7 +13730,7 @@
1351513730 public void mousePressed(MouseEvent e)
1351613731 {
1351713732 //System.out.println("mousePressed: " + e);
13518
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13733
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1351913734 }
1352013735
1352113736 static long prevtime = 0;
....@@ -13591,8 +13806,8 @@
1359113806 // mode |= META;
1359213807 //}
1359313808
13594
- SetMouseMode(WHEEL | e.getModifiersEx());
13595
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13809
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13810
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1359613811 anchorX = ax;
1359713812 anchorY = ay;
1359813813 prevX = px;
....@@ -13626,6 +13841,7 @@
1362613841 else
1362713842 if (evt.getSource() == AAtimer)
1362813843 {
13844
+ Globals.TIMERRUNNING = false;
1362913845 if (mouseDown)
1363013846 {
1363113847 //new Exception().printStackTrace();
....@@ -13651,6 +13867,10 @@
1365113867 // LIVE = waslive;
1365213868 // wasliveok = true;
1365313869 // waslive = false;
13870
+
13871
+ // May 2019 Forget it:
13872
+ if (true)
13873
+ return;
1365413874
1365513875 // source == timer
1365613876 if (mouseDown)
....@@ -13690,12 +13910,13 @@
1369013910
1369113911 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1369213912
13693
- void clickStart(int x, int y, int modifiers)
13913
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1369413914 {
1369513915 if (!wasliveok)
1369613916 return;
1369713917
1369813918 AAtimer.restart(); //
13919
+ Globals.TIMERRUNNING = true;
1369913920
1370013921 // waslive = LIVE;
1370113922 // LIVE = false;
....@@ -13707,7 +13928,7 @@
1370713928 // touched = true; // main DL
1370813929 if (isRenderer)
1370913930 {
13710
- SetMouseMode(modifiers);
13931
+ SetMouseMode(modifiers, modifiersex);
1371113932 }
1371213933
1371313934 selectX = anchorX = x;
....@@ -13720,7 +13941,7 @@
1372013941 clicked = true;
1372113942 hold = false;
1372213943
13723
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13944
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1372413945 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1372513946 {
1372613947 // System.out.println("RESTART II " + modifiers);
....@@ -13751,7 +13972,7 @@
1375113972 info.camera = renderCamera;
1375213973 info.x = x;
1375313974 info.y = y;
13754
- info.modifiers = modifiers;
13975
+ info.modifiers = modifiersex;
1375513976 editObj = object.doEditClick(info, 0);
1375613977 if (!editObj)
1375713978 {
....@@ -13768,9 +13989,12 @@
1376813989
1376913990 public void mouseDragged(MouseEvent e)
1377013991 {
13992
+ Globals.MOUSEDRAGGED = true;
13993
+
1377113994 //System.out.println("mouseDragged: " + e);
1377213995 if (isRenderer)
1377313996 movingcamera = true;
13997
+
1377413998 //if (drawing)
1377513999 //return;
1377614000 if ((e.getModifiersEx() & CTRL) != 0
....@@ -13780,7 +14004,7 @@
1378014004 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1378114005 }
1378214006 else
13783
- drag(e.getX(), e.getY(), e.getModifiersEx());
14007
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1378414008
1378514009 //try { Thread.sleep(1); } catch (Exception ex) {}
1378614010 }
....@@ -14017,7 +14241,7 @@
1401714241 {
1401814242 Globals.lighttouched = true;
1401914243 }
14020
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14244
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1402114245 }
1402214246 //else
1402314247 }
....@@ -14117,7 +14341,7 @@
1411714341 int X, Y;
1411814342 boolean SX, SY;
1411914343
14120
- void drag(int x, int y, int modifiers)
14344
+ void drag(int x, int y, int modifiers, int modifiersex)
1412114345 {
1412214346 if (IsFrozen())
1412314347 {
....@@ -14126,17 +14350,17 @@
1412614350
1412714351 drag = true; // NEW
1412814352
14129
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14353
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1413014354
1413114355 X = x;
1413214356 Y = y;
1413314357 // floating state for animation
14134
- MODIFIERS = modifiers;
14135
- modifiers &= ~1024;
14358
+ MODIFIERS = modifiersex;
14359
+ modifiersex &= ~1024;
1413614360 if (false) // modifiers != 0)
1413714361 {
1413814362 //new Exception().printStackTrace();
14139
- System.out.println("mouseDragged: " + modifiers);
14363
+ System.out.println("mouseDragged: " + modifiersex);
1414014364 System.out.println("SHIFT = " + SHIFT);
1414114365 System.out.println("CONTROL = " + COMMAND);
1414214366 System.out.println("META = " + META);
....@@ -14156,7 +14380,8 @@
1415614380 info.camera = renderCamera;
1415714381 info.x = x;
1415814382 info.y = y;
14159
- object.editWindow.copy.doEditDrag(info);
14383
+ object.GetWindow().copy
14384
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1416014385 } else
1416114386 {
1416214387 if (x < startX)
....@@ -14320,7 +14545,9 @@
1432014545 ci.camera = renderCamera;
1432114546 if (!isRenderer)
1432214547 {
14323
- if (object.editWindow.copy.doEditClick(ci, 0))
14548
+ //ObjEditor editWindow = object.editWindow;
14549
+ //Object3D copy = editWindow.copy;
14550
+ if (object.doEditClick(ci, 0))
1432414551 {
1432514552 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1432614553 } else
....@@ -14332,7 +14559,10 @@
1433214559
1433314560 public void mouseReleased(MouseEvent e)
1433414561 {
14562
+ Globals.MOUSEDRAGGED = false;
14563
+
1433514564 movingcamera = false;
14565
+ X = Y = 0;
1433614566 //System.out.println("mouseReleased: " + e);
1433714567 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1433814568 }
....@@ -14355,9 +14585,9 @@
1435514585 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1435614586 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1435714587
14358
- if (control || command || IsFrozen())
14588
+// No delay if (control || command || IsFrozen())
1435914589 timeout = true;
14360
- else
14590
+// ?? May 2019 else
1436114591 // timer.setDelay((modifiers & 128) != 0?0:350);
1436214592 mouseDown = false;
1436314593 if (!control && !command) // june 2013
....@@ -14467,7 +14697,7 @@
1446714697 System.out.println("keyReleased: " + e);
1446814698 }
1446914699
14470
- void SetMouseMode(int modifiers)
14700
+ void SetMouseMode(int modifiers, int modifiersex)
1447114701 {
1447214702 //System.out.println("SetMouseMode = " + modifiers);
1447314703 //modifiers &= ~1024;
....@@ -14479,25 +14709,25 @@
1447914709 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1448014710 // return;
1448114711 //System.out.println("SetMode = " + modifiers);
14482
- if ((modifiers & WHEEL) == WHEEL)
14712
+ if ((modifiersex & WHEEL) == WHEEL)
1448314713 {
1448414714 mouseMode |= ZOOM;
1448514715 }
1448614716
1448714717 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14488
- if (capsLocked || (modifiers & META) == META)
14718
+ if (capsLocked) // || (modifiers & META) == META)
1448914719 {
1449014720 mouseMode |= VR; // BACKFORTH;
1449114721 }
14492
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14722
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1449314723 {
1449414724 mouseMode |= SELECT;
1449514725 }
14496
- if ((modifiers & COMMAND) == COMMAND)
14726
+ if ((modifiersex & COMMAND) == COMMAND)
1449714727 {
1449814728 mouseMode |= SELECT;
1449914729 }
14500
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14730
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1450114731 {
1450214732 mouseMode &= ~VR;
1450314733 mouseMode |= TRANSLATE;
....@@ -14526,7 +14756,7 @@
1452614756
1452714757 if (isRenderer) //
1452814758 {
14529
- SetMouseMode(modifiers);
14759
+ SetMouseMode(0, modifiers);
1453014760 }
1453114761
1453214762 Globals.theRenderer.keyPressed(key);
....@@ -14698,8 +14928,14 @@
1469814928 RevertCamera();
1469914929 repaint();
1470014930 break;
14701
- case 'L':
1470214931 case 'l':
14932
+ lightMode ^= true;
14933
+ Globals.lighttouched = true;
14934
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14935
+ targetLookAt.set(manipCamera.lookAt);
14936
+ repaint();
14937
+ break;
14938
+ case 'L':
1470314939 if (lightMode)
1470414940 {
1470514941 lightMode = false;
....@@ -14846,23 +15082,21 @@
1484615082 kompactbit = 6;
1484715083 break;
1484815084 case ' ':
14849
- lightMode ^= true;
14850
- Globals.lighttouched = true;
14851
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14852
- targetLookAt.set(manipCamera.lookAt);
15085
+ ObjEditor.theFrame.ToggleFullScreen();
1485315086 repaint();
1485415087 break;
1485515088 //case '`' :
1485615089 case ESC:
1485715090 RENDERPROGRAM += 1;
1485815091 RENDERPROGRAM %= 3;
15092
+
1485915093 repaint();
1486015094 break;
1486115095 case 'Z':
1486215096 //RESIZETEXTURE ^= true;
1486315097 //break;
1486415098 case 'z':
14865
- RENDERSHADOW ^= true;
15099
+ Globals.RENDERSHADOW ^= true;
1486615100 Globals.lighttouched = true;
1486715101 repaint();
1486815102 break;
....@@ -14986,7 +15220,7 @@
1498615220 //mode = ROTATE;
1498715221 if ((MODIFIERS & COMMAND) == 0) // VR??
1498815222 {
14989
- SetMouseMode(modifiers);
15223
+ SetMouseMode(0, modifiers);
1499015224 }
1499115225 }
1499215226
....@@ -15122,7 +15356,7 @@
1512215356 {
1512315357 //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
1512415358 //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15125
- if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (mouseMode & SELECT) == 0)
15359
+ if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0)
1512615360 {
1512715361 mouseMoved(e);
1512815362 } else
....@@ -15147,7 +15381,7 @@
1514715381 }
1514815382 */
1514915383
15150
- object.editWindow.EditSelection();
15384
+ object.editWindow.EditSelection(false);
1515115385 }
1515215386
1515315387 void SelectParent()
....@@ -15341,7 +15575,9 @@
1534115575 info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom));
1534215576 //Image img = CreateImage(width, height);
1534315577 //System.out.println("width = " + width + "; height = " + height + "\n");
15578
+
1534415579 Graphics gr = g; // img.getGraphics();
15580
+
1534515581 if (!hasMarquee)
1534615582 {
1534715583 if (Xmin < Xmax) // !locked)
....@@ -15439,14 +15675,33 @@
1543915675 if (!isRenderer)
1544015676 {
1544115677 object.drawEditHandles(info, 0);
15678
+
15679
+ if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15680
+ {
15681
+ switch (object.selection.get(0).hitSomething)
15682
+ {
15683
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15684
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15685
+ break;
15686
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15687
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15688
+ break;
15689
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15690
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15691
+ break;
15692
+ }
15693
+
15694
+ }
1544215695 }
1544315696 }
15697
+
1544415698 if (isRenderer)
1544515699 {
1544615700 //gr.setColor(Color.black);
1544715701 //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1);
1544815702 //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3);
1544915703 }
15704
+
1545015705 if (hasMarquee)
1545115706 {
1545215707 gr.setXORMode(Color.white);
....@@ -15559,6 +15814,7 @@
1555915814 public boolean mouseDown(Event evt, int x, int y)
1556015815 {
1556115816 System.out.println("mouseDown: " + evt);
15817
+ System.exit(0);
1556215818 /*
1556315819 locked = true;
1556415820 drag = false;
....@@ -15602,7 +15858,7 @@
1560215858 {
1560315859 keyPressed(0, modifiers);
1560415860 }
15605
- clickStart(x, y, modifiers);
15861
+ // clickStart(x, y, modifiers);
1560615862 return true;
1560715863 }
1560815864
....@@ -15720,7 +15976,7 @@
1572015976 {
1572115977 keyReleased(0, 0);
1572215978 }
15723
- drag(x, y, modifiers);
15979
+ drag(x, y, 0, modifiers);
1572415980 return true;
1572515981 }
1572615982
....@@ -15852,7 +16108,7 @@
1585216108 Object3D object;
1585316109 static Object3D trackedobject;
1585416110 Camera renderCamera; // Light or Eye (or Occlusion)
15855
- /*static*/ Camera manipCamera; // Light or Eye
16111
+ /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light
1585616112 /*static*/ Camera eyeCamera;
1585716113 /*static*/ Camera lightCamera;
1585816114 int cameracount;
....@@ -16137,16 +16393,16 @@
1613716393 cStatic.objectstack[materialdepth++] = checker;
1613816394 //System.out.println("material " + material);
1613916395 //Applet3D.tracein(this, selected);
16140
- vector2buffer = checker.projectedVertices;
16396
+ //vector2buffer = checker.projectedVertices;
1614116397
1614216398 //checker.GetMaterial().Draw(this, false); // true);
16143
- DrawMaterial(checker.GetMaterial(), false); // true);
16399
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1614416400
1614516401 materialdepth -= 1;
1614616402 if (materialdepth > 0)
1614716403 {
16148
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16149
- DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
16404
+ //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16405
+ DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
1615016406 }
1615116407 //checker.GetMaterial().opacity = 1f;
1615216408 ////checker.GetMaterial().ambient = 1f;
....@@ -16370,6 +16626,8 @@
1637016626 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1637116627 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
1637216628
16629
+ CreateSelectedPoint();
16630
+
1637316631 // Will fit the mesh !!!
1637416632 selectedpoint.toParent[0][0] = 0.0001;
1637516633 selectedpoint.toParent[1][1] = 0.0001;
....@@ -16418,16 +16676,16 @@
1641816676 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]));
1641916677 }
1642016678
16421
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16679
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1642216680 }
1642316681 }
1642416682
1642516683 if (!movingcamera && !PAINTMODE)
1642616684 object.editWindow.ScreenFitPoint(); // fev 2014
1642716685
16428
- if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16686
+ if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1642916687 {
16430
- Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16688
+ Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1643116689
1643216690 Object3D group = new Object3D("inst" + paintcount++);
1643316691
....@@ -16583,7 +16841,7 @@
1658316841 gl.glDisable(gl.GL_CULL_FACE);
1658416842 }
1658516843
16586
- if (!RENDERSHADOW)
16844
+ if (!Globals.RENDERSHADOW)
1658716845 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1658816846
1658916847 // SB gl.glPolygonOffset(2.5f, 10);
....@@ -16593,7 +16851,7 @@
1659316851 //gl.glColorMask(false, false, false, false);
1659416852
1659516853 //render_scene_from_light_view(gl, drawable, 0, 0);
16596
- if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
16854
+ if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed())
1659716855 {
1659816856 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1659916857
....@@ -17009,23 +17267,15 @@
1700917267 int AAbuffersize = 0;
1701017268
1701117269 //double[] selectedpoint = new double[3];
17012
- static Superellipsoid selectedpoint = new Superellipsoid();
17270
+ static Superellipsoid selectedpoint;
1701317271 static Sphere previousselectedpoint = null;
17014
- static Sphere debugpointG = new Sphere();
17015
- static Sphere debugpointP = new Sphere();
17016
- static Sphere debugpointC = new Sphere();
17017
- static Sphere debugpointR = new Sphere();
17272
+ static Sphere debugpointG;
17273
+ static Sphere debugpointP;
17274
+ static Sphere debugpointC;
17275
+ static Sphere debugpointR;
1701817276
1701917277 static Sphere debugpoints[] = new Sphere[8];
1702017278
17021
- static
17022
- {
17023
- for (int i=0; i<8; i++)
17024
- {
17025
- debugpoints[i] = new Sphere();
17026
- }
17027
- }
17028
-
1702917279 static void InitPoints(float radius)
1703017280 {
1703117281 for (int i=0; i<8; i++)