Normand Briere
2019-07-20 0a52bd4800459cd9935f360d7ca9555b6bea2146
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
....@@ -56,8 +55,6 @@
5655 static int CURRENTANTIALIAS = 0; // 1;
5756 /*static*/ boolean RENDERSHADOW = true;
5857 /*static*/ int RENDERPROGRAM = 2; // 0 == none, 1 == fast, 2 == normal
59
- static boolean ANIMATION = false;
60
- static String filename;
6158
6259 boolean DISPLAYTEXT = false;
6360 //boolean REDUCETEXTURE = true;
....@@ -86,7 +83,7 @@
8683 static boolean FULLSCREEN = false;
8784 static boolean SUPPORT = true;
8885 static boolean INERTIA = true;
89
-static boolean FAST = true; // false;
86
+static boolean FAST = false;
9087 static boolean SLOWPOSE = false;
9188 static boolean FOOTCONTACT = true;
9289
....@@ -108,7 +105,7 @@
108105 static boolean OEIL = true;
109106 static boolean OEILONCE = false; // do oeilon then oeiloff
110107 static boolean LOOKAT = true;
111
-static boolean RANDOM = true; // false;
108
+static boolean SWITCH = true; // false;
112109 static boolean HANDLES = false; // selection doesn't work!!
113110 static boolean PAINTMODE = false;
114111
....@@ -151,6 +148,8 @@
151148 defaultcaps.setAccumBlueBits(16);
152149 defaultcaps.setAccumAlphaBits(16);
153150 }
151
+
152
+ private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory();
154153
155154 void SetAsGLRenderer(boolean b)
156155 {
....@@ -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
....@@ -464,10 +477,12 @@
464477 if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
465478 {
466479 //gl.glBegin(gl.GL_TRIANGLES);
467
- boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
480
+ boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0)
481
+ // TEST LIVE NORMALS && !obj.dontselect
482
+ ;
468483 if (!hasnorm)
469484 {
470
- // System.out.println("FUCK!!");
485
+ // System.out.println("Mesh normal");
471486 LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0);
472487 LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1);
473488 LA.vecCross(obj.v0, obj.v1, obj.v2);
....@@ -1192,10 +1207,12 @@
11921207 gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
11931208 }
11941209 }
1210
+
11951211 if (flipV)
11961212 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
11971213 else
11981214 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1215
+
11991216 //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
12001217 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
12011218
....@@ -1215,10 +1232,12 @@
12151232 gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
12161233 }
12171234 }
1235
+
12181236 if (flipV)
12191237 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
12201238 else
12211239 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1240
+
12221241 //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
12231242 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
12241243
....@@ -1246,8 +1265,10 @@
12461265 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
12471266 else
12481267 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1268
+
12491269 //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
12501270 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
1271
+
12511272 count2 += 2;
12521273 count3 += 3;
12531274 }
....@@ -1603,7 +1624,7 @@
16031624 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16041625 }
16051626
1606
- void DrawMaterial(cMaterial material, boolean selected)
1627
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16071628 {
16081629 CameraPane display = this;
16091630 //new Exception().printStackTrace();
....@@ -1630,7 +1651,7 @@
16301651
16311652 cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0);
16321653
1633
- float[] colorV = GrafreeD.colorV;
1654
+ float[] colorV = Grafreed.colorV;
16341655
16351656 /**/
16361657 if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0)
....@@ -1638,7 +1659,7 @@
16381659 colorV[0] = display.modelParams0[0] * material.diffuse;
16391660 colorV[1] = display.modelParams0[1] * material.diffuse;
16401661 colorV[2] = display.modelParams0[2] * material.diffuse;
1641
- colorV[3] = material.opacity;
1662
+ colorV[3] = 1; // material.opacity;
16421663
16431664 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16441665 //System.out.println("Opacity = " + opacity);
....@@ -1746,9 +1767,9 @@
17461767 display.modelParams7[2] = 0;
17471768 display.modelParams7[3] = 0;
17481769
1749
- display.modelParams6[0] = 100; // criss de bug de bump
1770
+ //display.modelParams6[0] = 100; // criss de bug de bump
17501771
1751
- Object3D.cVector2[] extparams = display.vector2buffer;
1772
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17521773 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17531774 {
17541775 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -1890,7 +1911,7 @@
18901911 void PushMatrix(double[][] matrix)
18911912 {
18921913 // GrafreeD.tracein(matrix);
1893
- PushMatrix(matrix,1);
1914
+ PushMatrix(matrix, 1);
18941915 }
18951916
18961917 void PushMatrix()
....@@ -2044,7 +2065,7 @@
20442065 //System.err.println("Oeil on");
20452066 OEIL = true;
20462067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2047
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20482069 //pingthread.StepToTarget(true);
20492070 }
20502071
....@@ -2142,7 +2163,7 @@
21422163 System.err.println("LIVE = " + Globals.isLIVE());
21432164
21442165 if (!Globals.isLIVE()) // save sound
2145
- GrafreeD.savesound = true; // wav.save();
2166
+ Grafreed.savesound = true; // wav.save();
21462167 // else
21472168 repaint(); // start loop // may 2013
21482169 }
....@@ -2259,7 +2280,7 @@
22592280
22602281 void ToggleDebug()
22612282 {
2262
- DEBUG ^= true;
2283
+ Globals.DEBUG ^= true;
22632284 }
22642285
22652286 void ToggleLookAt()
....@@ -2267,9 +2288,9 @@
22672288 LOOKAT ^= true;
22682289 }
22692290
2270
- void ToggleRandom()
2291
+ void ToggleSwitch()
22712292 {
2272
- RANDOM ^= true;
2293
+ SWITCH ^= true;
22732294 }
22742295
22752296 void ToggleHandles()
....@@ -2277,10 +2298,17 @@
22772298 HANDLES ^= true;
22782299 }
22792300
2301
+ Object3D paintFolder;
2302
+
22802303 void TogglePaint()
22812304 {
22822305 PAINTMODE ^= true;
22832306 paintcount = 0;
2307
+
2308
+ if (PAINTMODE)
2309
+ {
2310
+ paintFolder = GetFolder();
2311
+ }
22842312 }
22852313
22862314 void SwapCamera(int a, int b)
....@@ -2376,7 +2404,7 @@
23762404 {
23772405 return currentGL;
23782406 }
2379
-
2407
+
23802408 /**/
23812409 class CacheTexture
23822410 {
....@@ -4208,6 +4236,7 @@
42084236
42094237 com.sun.opengl.util.texture.Texture CompressTexture2(String name)
42104238 {
4239
+ new Exception().printStackTrace();
42114240 System.exit(0);
42124241 com.sun.opengl.util.texture.Texture texture = null;
42134242
....@@ -7920,6 +7949,64 @@
79207949 ReleaseTexture(pigment, false);
79217950 }
79227951
7952
+ public void ReleasePigmentTexture(cTexture tex) // INTERFACE
7953
+ {
7954
+ if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
7955
+ {
7956
+ return;
7957
+ }
7958
+
7959
+ if (tex == null)
7960
+ {
7961
+ ReleaseTexture(null, false);
7962
+ return;
7963
+ }
7964
+
7965
+ String pigment = Object3D.GetPigment(tex);
7966
+
7967
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7968
+ {
7969
+ // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
7970
+ // System.out.println("; bump = " + bump);
7971
+ }
7972
+
7973
+ if (pigment.equals(""))
7974
+ {
7975
+ pigment = null;
7976
+ }
7977
+
7978
+ ReleaseTexture(pigment, false);
7979
+ }
7980
+
7981
+ public void ReleaseBumpTexture(cTexture tex) // INTERFACE
7982
+ {
7983
+ if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
7984
+ {
7985
+ return;
7986
+ }
7987
+
7988
+ if (tex == null)
7989
+ {
7990
+ ReleaseTexture(null, true);
7991
+ return;
7992
+ }
7993
+
7994
+ String bump = Object3D.GetBump(tex);
7995
+
7996
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7997
+ {
7998
+ // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
7999
+ // System.out.println("; bump = " + bump);
8000
+ }
8001
+
8002
+ if (bump.equals(""))
8003
+ {
8004
+ bump = null;
8005
+ }
8006
+
8007
+ ReleaseTexture(bump, true);
8008
+ }
8009
+
79238010 void ReleaseTexture(String tex, boolean bump)
79248011 {
79258012 if (// DrawMode() != 0 || /*tex == null ||*/
....@@ -8023,7 +8110,7 @@
80238110 }
80248111 }
80258112
8026
- /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE
8113
+ /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
80278114 {
80288115 if (// DrawMode() != 0 || /*tex == null ||*/
80298116 ambientOcclusion ) // || !textureon)
....@@ -8068,7 +8155,94 @@
80688155 return; // true;
80698156 }
80708157
8071
- CacheTexture GetCacheTexture(String tex, boolean bump, int resolution)
8158
+ /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE
8159
+ {
8160
+ if (// DrawMode() != 0 || /*tex == null ||*/
8161
+ ambientOcclusion ) // || !textureon)
8162
+ {
8163
+ return; // false;
8164
+ }
8165
+
8166
+ if (tex == null)
8167
+ {
8168
+ BindTexture(null,false,resolution);
8169
+ return;
8170
+ }
8171
+
8172
+ String pigment = Object3D.GetPigment(tex);
8173
+
8174
+ usedtextures.put(pigment, pigment);
8175
+
8176
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8177
+ {
8178
+ // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8179
+ // System.out.println("; bump = " + bump);
8180
+ }
8181
+
8182
+ if (pigment.equals(""))
8183
+ {
8184
+ pigment = null;
8185
+ }
8186
+
8187
+ GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8188
+ BindTexture(pigment, false, resolution);
8189
+ }
8190
+
8191
+ /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE
8192
+ {
8193
+ if (// DrawMode() != 0 || /*tex == null ||*/
8194
+ ambientOcclusion ) // || !textureon)
8195
+ {
8196
+ return; // false;
8197
+ }
8198
+
8199
+ if (tex == null)
8200
+ {
8201
+ BindTexture(null,true,resolution);
8202
+ return;
8203
+ }
8204
+
8205
+ String bump = Object3D.GetBump(tex);
8206
+
8207
+ usedtextures.put(bump, bump);
8208
+
8209
+ if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8210
+ {
8211
+ // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
8212
+ // System.out.println("; bump = " + bump);
8213
+ }
8214
+
8215
+ if (bump.equals(""))
8216
+ {
8217
+ bump = null;
8218
+ }
8219
+
8220
+ GetGL().glActiveTexture(GetGL().GL_TEXTURE2);
8221
+ BindTexture(bump, true, resolution);
8222
+ GetGL().glActiveTexture(GetGL().GL_TEXTURE0);
8223
+ }
8224
+
8225
+ java.util.HashSet<String> missingTextures = new java.util.HashSet<String>();
8226
+
8227
+ private boolean FileExists(String tex)
8228
+ {
8229
+ if (missingTextures.contains(tex))
8230
+ {
8231
+ return false;
8232
+ }
8233
+
8234
+ boolean fileExists = new File(tex).exists();
8235
+
8236
+ if (!fileExists)
8237
+ {
8238
+ // If file exists, the "new File()" is not executed sgain
8239
+ missingTextures.add(tex);
8240
+ }
8241
+
8242
+ return fileExists;
8243
+ }
8244
+
8245
+ CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception
80728246 {
80738247 CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
80748248
....@@ -8076,12 +8250,18 @@
80768250 {
80778251 String texname = tex;
80788252
8079
- String[] split = tex.split("Textures");
8080
- if (split.length > 1)
8081
- texname = "/Users/nbriere/Textures" + split[split.length-1];
8082
- else
8083
- if (!texname.startsWith("/"))
8084
- texname = "/Users/nbriere/Textures/" + texname;
8253
+ String fallbackTextureName = defaultDirectory + "/Textures/" + texname;
8254
+
8255
+// String[] split = tex.split("Textures");
8256
+// if (split.length > 1)
8257
+// texname = "/Users/nbriere/Textures" + split[split.length-1];
8258
+// else
8259
+// if (!texname.startsWith("/"))
8260
+// texname = "/Users/nbriere/Textures/" + texname;
8261
+ if (!FileExists(tex))
8262
+ {
8263
+ texname = fallbackTextureName;
8264
+ }
80858265
80868266 if (CACHETEXTURE)
80878267 texture = textures.get(texname); // TEXTURE CACHE
....@@ -8150,7 +8330,7 @@
81508330 }
81518331
81528332 cachename = texname.substring(0, texname.length()-4)+ext+".jpg";
8153
- if (!new File(cachename).exists())
8333
+ if (!FileExists(cachename))
81548334 cachename = texname;
81558335 else
81568336 processbump = false; // don't process bump map again
....@@ -8172,7 +8352,7 @@
81728352 }
81738353
81748354 cachename = texname.substring(0, texname.length()-4)+ext+".png";
8175
- if (!new File(cachename).exists())
8355
+ if (!FileExists(cachename))
81768356 cachename = texname;
81778357 else
81788358 processbump = false; // don't process bump map again
....@@ -8181,7 +8361,9 @@
81818361 texturedata = GetFileTexture(cachename, processbump, resolution);
81828362
81838363
8184
- if (texturedata != null)
8364
+ if (texturedata == null)
8365
+ throw new Exception();
8366
+
81858367 texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
81868368 //texture = GetTexture(tex, bump);
81878369 }
....@@ -8303,7 +8485,7 @@
83038485 return texture;
83048486 }
83058487
8306
- com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution)
8488
+ com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception
83078489 {
83088490 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83098491
....@@ -8321,14 +8503,14 @@
83218503 return texture!=null?texture.texture:null;
83228504 }
83238505
8324
- public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution)
8506
+ public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception
83258507 {
83268508 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83278509
83288510 return texture!=null?texture.texturedata:null;
83298511 }
83308512
8331
- boolean BindTexture(String tex, boolean bump, int resolution)
8513
+ com.sun.opengl.util.texture.Texture BindTexture(String tex, boolean bump, int resolution) throws Exception
83328514 {
83338515 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
83348516 {
....@@ -8340,7 +8522,7 @@
83408522 com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
83418523
83428524 if (texture == null)
8343
- return false;
8525
+ return texture;
83448526 /**/
83458527
83468528 if (textureon || tex.equals("DEFAULT_TEXTURE") || tex.equals("DEFAULT_TEXTURE_BUMP") || tex.equals("WHITE_NOISE")) // || tex.equals("IMMORTAL"))
....@@ -9205,11 +9387,35 @@
92059387 jy8[3] = 0.5f;
92069388 }
92079389
9208
- float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
9390
+ float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
92099391 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
92109392 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
92119393 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
92129394
9395
+ void ResetOptions()
9396
+ {
9397
+ options1[0] = 100;
9398
+ options1[1] = 0.025f;
9399
+ options1[2] = 0.01f;
9400
+ options1[3] = 0;
9401
+ options1[4] = 0;
9402
+
9403
+ options2[0] = 0;
9404
+ options2[1] = 0.75f;
9405
+ options2[2] = 0;
9406
+ options2[3] = 0;
9407
+
9408
+ options3[0] = 1;
9409
+ options3[1] = 1;
9410
+ options3[2] = 1;
9411
+ options3[3] = 0;
9412
+
9413
+ options4[0] = 1;
9414
+ options4[1] = 0;
9415
+ options4[2] = 1;
9416
+ options4[3] = 0;
9417
+ }
9418
+
92139419 static int imagecount = 0; // movie generation
92149420
92159421 static int jitter = 0;
....@@ -9305,8 +9511,8 @@
93059511 assert (parentcam != renderCamera);
93069512
93079513 if (renderCamera != lightCamera)
9308
- for (int count = parentcam.GetTransformCount(); --count>=0;)
9309
- LA.matConcat(matrix, parentcam.toParent, matrix);
9514
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
9515
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
93109516
93119517 // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix);
93129518
....@@ -9321,8 +9527,8 @@
93219527 LA.matCopy(renderCamera.fromScreen, matrix);
93229528
93239529 if (renderCamera != lightCamera)
9324
- for (int count = parentcam.GetTransformCount(); --count>=0;)
9325
- LA.matConcat(parentcam.fromParent, matrix, matrix);
9530
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
9531
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
93269532
93279533 // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix);
93289534
....@@ -9394,7 +9600,7 @@
93949600 //gl.glFlush();
93959601 gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE);
93969602
9397
- if (ANIMATION && ABORTED)
9603
+ if (Globals.ANIMATION && ABORTED)
93989604 {
93999605 System.err.println(" ABORTED FRAME");
94009606 break;
....@@ -9424,7 +9630,7 @@
94249630 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
94259631
94269632 // save image
9427
- if (ANIMATION && !ABORTED)
9633
+ if (Globals.ANIMATION && !ABORTED)
94289634 {
94299635 VPwidth = viewport[2];
94309636 VPheight = viewport[3];
....@@ -9535,11 +9741,11 @@
95359741
95369742 // imagecount++;
95379743
9538
- String fullname = filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext;
9744
+ String fullname = Globals.filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext;
95399745
95409746 if (!BOXMODE)
95419747 {
9542
- System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")");
9748
+ System.out.println("image: " + fullname + " (wav cursor=" + (Grafreed.wav.cursor / 735 / 4) + ")");
95439749 }
95449750
95459751 if (!BOXMODE)
....@@ -9577,7 +9783,7 @@
95779783 ABORTED = false;
95789784 }
95799785 else
9580
- GrafreeD.wav.cursor += 735 * ACSIZE;
9786
+ Grafreed.wav.cursor += 735 * ACSIZE;
95819787
95829788 if (false)
95839789 {
....@@ -10240,11 +10446,11 @@
1024010446
1024110447 public void display(GLAutoDrawable drawable)
1024210448 {
10243
- if (GrafreeD.savesound && GrafreeD.hassound)
10449
+ if (Grafreed.savesound && Grafreed.hassound)
1024410450 {
10245
- GrafreeD.wav.save();
10246
- GrafreeD.savesound = false;
10247
- GrafreeD.hassound = false;
10451
+ Grafreed.wav.save();
10452
+ Grafreed.savesound = false;
10453
+ Grafreed.hassound = false;
1024810454 }
1024910455 // if (DEBUG_SELECTION)
1025010456 // {
....@@ -10320,6 +10526,7 @@
1032010526 ANTIALIAS = 0;
1032110527 //System.out.println("RESTART");
1032210528 AAtimer.restart();
10529
+ Globals.TIMERRUNNING = true;
1032310530 }
1032410531 }
1032510532 }
....@@ -10374,7 +10581,7 @@
1037410581 Object3D theobject = object;
1037510582 Object3D theparent = object.parent;
1037610583 object.parent = null;
10377
- object = (Object3D)GrafreeD.clone(object);
10584
+ object = (Object3D)Grafreed.clone(object);
1037810585 object.Stripify();
1037910586 if (theobject.selection == null || theobject.selection.Size() == 0)
1038010587 theobject.PreprocessOcclusion(this);
....@@ -10387,13 +10594,14 @@
1038710594 ambientOcclusion = false;
1038810595 }
1038910596
10390
- if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN)
10597
+ if (//Globals.lighttouched &&
10598
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1039110599 {
1039210600 //if (RENDERSHADOW) // ?
1039310601 if (!IsFrozen())
1039410602 {
1039510603 // dec 2012
10396
- if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0))
10604
+ if (!ambientOcclusion && !(!flash && DrawMode() == DEFAULT && ANTIALIAS > 0))
1039710605 {
1039810606 Globals.framecount++;
1039910607 shadowbuffer.display();
....@@ -10520,8 +10728,8 @@
1052010728
1052110729 // if (parentcam != renderCamera) // not a light
1052210730 if (cam != lightCamera)
10523
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10524
- LA.matConcat(matrix, parentcam.toParent, matrix);
10731
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
10732
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
1052510733
1052610734 for (int j = 0; j < 4; j++)
1052710735 {
....@@ -10535,8 +10743,8 @@
1053510743
1053610744 // if (parentcam != renderCamera) // not a light
1053710745 if (cam != lightCamera)
10538
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10539
- LA.matConcat(parentcam.fromParent, matrix, matrix);
10746
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
10747
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
1054010748
1054110749 //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix);
1054210750
....@@ -10795,7 +11003,16 @@
1079511003 // Bump noise
1079611004 gl.glActiveTexture(GL.GL_TEXTURE6);
1079711005 //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise);
10798
- BindTexture(NOISE_TEXTURE, false, 2);
11006
+
11007
+ try
11008
+ {
11009
+ BindTexture(NOISE_TEXTURE, false, 2);
11010
+ }
11011
+ catch (Exception e)
11012
+ {
11013
+ System.err.println("FAILED: " + NOISE_TEXTURE);
11014
+ }
11015
+
1079911016
1080011017 gl.glActiveTexture(GL.GL_TEXTURE0);
1080111018 gl.glEnable(GL.GL_TEXTURE_2D);
....@@ -10818,9 +11035,9 @@
1081811035
1081911036 gl.glMatrixMode(GL.GL_MODELVIEW);
1082011037
10821
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
10822
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
10823
-//gl.glEnable(gl.GL_MULTISAMPLE);
11038
+gl.glEnable(gl.GL_POLYGON_SMOOTH);
11039
+gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11040
+gl.glEnable(gl.GL_MULTISAMPLE);
1082411041 } else
1082511042 {
1082611043 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -10831,7 +11048,7 @@
1083111048 //System.out.println("BLENDING ON");
1083211049 gl.glEnable(GL.GL_BLEND);
1083311050 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
10834
-
11051
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1083511052 gl.glMatrixMode(gl.GL_PROJECTION);
1083611053 gl.glLoadIdentity();
1083711054
....@@ -10920,8 +11137,8 @@
1092011137 System.err.println("parentcam != renderCamera");
1092111138
1092211139 // if (cam != lightCamera)
10923
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10924
- LA.xformDir(lightposition, parentcam.toParent, lightposition); // may 2013
11140
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
11141
+ LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013
1092511142 }
1092611143
1092711144 LA.xformDir(lightposition, cam.toScreen, lightposition);
....@@ -10942,8 +11159,8 @@
1094211159 if (true) // TODO
1094311160 {
1094411161 if (cam != lightCamera)
10945
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10946
- LA.xformDir(light0, parentcam.toParent, light0); // may 2013
11162
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
11163
+ LA.xformDir(light0, parentcam.GlobalTransform(), light0); // may 2013
1094711164 }
1094811165
1094911166 LA.xformPos(light0, cam.toScreen, light0);
....@@ -11259,8 +11476,14 @@
1125911476 {
1126011477 renderpass++;
1126111478 // System.out.println("Draw object... ");
11479
+ STEP = 1;
1126211480 if (FAST) // in case there is no script
11263
- STEP = 16;
11481
+ STEP = 8;
11482
+
11483
+ if (CURRENTANTIALIAS == 0 || ACSIZE == 1)
11484
+ {
11485
+ STEP *= 4;
11486
+ }
1126411487
1126511488 //object.FullInvariants();
1126611489
....@@ -11274,23 +11497,44 @@
1127411497 e.printStackTrace();
1127511498 }
1127611499
11277
- if (GrafreeD.RENDERME > 0)
11278
- GrafreeD.RENDERME--; // mechante magouille
11500
+ if (Grafreed.RENDERME > 0)
11501
+ Grafreed.RENDERME--; // mechante magouille
1127911502
1128011503 Globals.ONESTEP = false;
1128111504 }
1128211505
1128311506 static boolean zoomonce = false;
1128411507
11508
+ static void CreateSelectedPoint()
11509
+ {
11510
+ if (selectedpoint == null)
11511
+ {
11512
+ debugpointG = new Sphere();
11513
+ debugpointP = new Sphere();
11514
+ debugpointC = new Sphere();
11515
+ debugpointR = new Sphere();
11516
+
11517
+ selectedpoint = new Superellipsoid();
11518
+
11519
+ for (int i=0; i<8; i++)
11520
+ {
11521
+ debugpoints[i] = new Sphere();
11522
+ }
11523
+ }
11524
+ }
11525
+
1128511526 void DrawObject(GL gl, boolean draw)
1128611527 {
11528
+ // To clear camera values
11529
+ ResetOptions();
11530
+
1128711531 //System.out.println("DRAW OBJECT " + mouseDown);
1128811532 // DrawMode() = SELECTION;
1128911533 //GL gl = getGL();
1129011534 if ((TRACK || SHADOWTRACK) || zoomonce)
1129111535 {
1129211536 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11293
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11537
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1129411538 pingthread.StepToTarget(true); // true);
1129511539 // zoomonce = false;
1129611540 }
....@@ -11345,7 +11589,14 @@
1134511589
1134611590 usedtextures.clear();
1134711591
11348
- BindTextures(DEFAULT_TEXTURES, 2);
11592
+ try
11593
+ {
11594
+ BindTextures(DEFAULT_TEXTURES, 2);
11595
+ }
11596
+ catch (Exception e)
11597
+ {
11598
+ System.err.println("FAILED: " + DEFAULT_TEXTURES);
11599
+ }
1134911600 }
1135011601 //System.out.println("--> " + stackdepth);
1135111602 // GrafreeD.traceon();
....@@ -11355,8 +11606,9 @@
1135511606
1135611607 if (DrawMode() == DEFAULT)
1135711608 {
11358
- if (DEBUG)
11609
+ if (Globals.DEBUG)
1135911610 {
11611
+ CreateSelectedPoint();
1136011612 float radius = 0.05f;
1136111613 if (selectedpoint.radius != radius)
1136211614 {
....@@ -11436,7 +11688,14 @@
1143611688 if (checker != null && DrawMode() == DEFAULT)
1143711689 {
1143811690 //BindTexture(IMMORTAL_TEXTURE);
11439
- BindTextures(checker.GetTextures(), checker.texres);
11691
+ try
11692
+ {
11693
+ BindTextures(checker.GetTextures(), checker.texres);
11694
+ }
11695
+ catch (Exception e)
11696
+ {
11697
+ System.err.println("FAILED: " + checker.GetTextures());
11698
+ }
1144011699 // NEAREST
1144111700 GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR);
1144211701 DrawChecker(gl);
....@@ -11518,7 +11777,7 @@
1151811777 return;
1151911778 }
1152011779
11521
- String string = obj.GetToolTip();
11780
+ String string = obj.toString(); //.GetToolTip();
1152211781
1152311782 GL gl = GetGL();
1152411783
....@@ -11835,8 +12094,8 @@
1183512094 //obj.TransformToWorld(light, light);
1183612095 for (int i = tp.size(); --i >= 0;)
1183712096 {
11838
- for (int count = tp.get(i).GetTransformCount(); --count>=0;)
11839
- LA.xformPos(light, tp.get(i).toParent, light);
12097
+ //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12098
+ LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
1184012099 }
1184112100
1184212101
....@@ -11853,8 +12112,8 @@
1185312112 parentcam = cameras[0];
1185412113 }
1185512114
11856
- for (int count = parentcam.GetTransformCount(); --count>=0;)
11857
- LA.xformPos(light, parentcam.toParent, light); // may 2013
12115
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
12116
+ LA.xformPos(light, parentcam.GlobalTransform(), light); // may 2013
1185812117
1185912118 LA.xformPos(light, renderCamera.toScreen, light);
1186012119
....@@ -12468,8 +12727,8 @@
1246812727
1246912728 // display shadow only (bump == 0)
1247012729 "SUB temp.x, half.x, shadow.x;" +
12471
- "MOV temp.y, -params6.x;" +
12472
- "SLT temp.z, temp.y, zero.x;" +
12730
+ "MOV temp.y, -params5.z;" + // params6.x;" +
12731
+ "SLT temp.z, temp.y, -one2048th.x;" +
1247312732 "SUB temp.y, one.x, temp.z;" +
1247412733 "MUL temp.x, temp.x, temp.y;" +
1247512734 "KIL temp.x;" +
....@@ -12598,8 +12857,10 @@
1259812857 "MAX ndotl.x, ndotl.x, -ndotl.x;" +
1259912858
1260012859 "SUB temp.x, one.x, ndotl.x;" +
12601
- "ADD temp.x, temp.x, options2.z;" + // lightsheen
12602
- "ADD temp.y, one.y, options2.y;" + // sursurface
12860
+ // Tuning for default skin
12861
+ //"ADD temp.x, temp.x, options2.z;" + // lightsheen
12862
+ "MAD temp.x, options2.z, half.y, temp.x;" + // lightsheen
12863
+ "ADD temp.y, one.y, options2.y;" + // subsurface
1260312864 "MUL temp.x, temp.x, temp.y;" +
1260412865
1260512866 "MUL saturation, saturation, temp.xxxx;" +
....@@ -12747,7 +13008,7 @@
1274713008 "MUL final.y, fragment.texcoord[0].x, c256;" +
1274813009 "FLR final.x, final.y;" +
1274913010 "SUB final.y, final.y, final.x;" +
12750
- //"MUL final.x, final.x, c256i;" +
13011
+ "MUL final.x, final.x, c256i;" +
1275113012 "MOV final.z, zero.x;" +
1275213013 "MOV final.a, one.w;":""
1275313014 ) +
....@@ -12755,7 +13016,7 @@
1275513016 "MUL final.y, fragment.texcoord[0].y, c256;" +
1275613017 "FLR final.x, final.y;" +
1275713018 "SUB final.y, final.y, final.x;" +
12758
- //"MUL final.x, final.x, c256i;" +
13019
+ "MUL final.x, final.x, c256i;" +
1275913020 "MOV final.z, zero.x;" +
1276013021 "MOV final.a, one.w;":""
1276113022 ) +
....@@ -12798,7 +13059,7 @@
1279813059 //once = true;
1279913060 }
1280013061
12801
- System.out.print("Program #" + mode + "; length = " + program.length());
13062
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
1280213063 System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
1280313064 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1280413065
....@@ -12931,12 +13192,16 @@
1293113192
1293213193 "ADD " + depth + ".z, " + depth + ".z, temp.x;" +
1293313194 //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing!
13195
+
13196
+ // Compare fragment depth in light space with shadowmap.
1293413197 "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" +
1293513198 "SGE temp.y, temp.x, zero.x;" +
12936
- "SUB " + shadow + ".y, one.x, temp.y;" +
13199
+ "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded
13200
+
13201
+ // Reverse comparison
1293713202 "SUB temp.x, one.x, temp.x;" +
1293813203 "MUL " + shadow + ".x, temp.x, temp.y;" +
12939
- "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded
13204
+ "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse
1294013205 "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth
1294113206
1294213207 "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" +
....@@ -12950,6 +13215,10 @@
1295013215 // No shadow for backface
1295113216 "DP3 temp.x, normal, lightd;" +
1295213217 "SLT temp.x, temp.x, zero.x;" + // shadoweps
13218
+ "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
13219
+
13220
+ // No shadow when out of frustrum
13221
+ "SGE temp.x, " + depth + ".z, one.z;" +
1295313222 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1295413223 "";
1295513224 }
....@@ -13096,7 +13365,8 @@
1309613365 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1309713366 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1309813367 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13099
- Object3D.cVector2[] vector2buffer;
13368
+
13369
+ //Object3D.cVector2[] vector2buffer;
1310013370
1310113371 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1310213372 // OUT : diff, spec
....@@ -13112,9 +13382,10 @@
1311213382 "DP3 " + dest + ".z," + "normals," + "eye;" +
1311313383 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1311413384 //"MOV " + dest + ".w," + "normal.z;" +
13115
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13116
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13117
- //"MOV " + dest + ".z," + "params2.w;" +
13385
+// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET
13386
+// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13387
+
13388
+ "MOV " + dest + ".z," + "params2.w;" + // EXACT
1311813389 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1311913390 "RCP " + dest + ".w," + dest + ".w;" +
1312013391 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13508,7 +13779,7 @@
1350813779 public void mousePressed(MouseEvent e)
1350913780 {
1351013781 //System.out.println("mousePressed: " + e);
13511
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13782
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1351213783 }
1351313784
1351413785 static long prevtime = 0;
....@@ -13584,8 +13855,8 @@
1358413855 // mode |= META;
1358513856 //}
1358613857
13587
- SetMouseMode(WHEEL | e.getModifiersEx());
13588
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13858
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13859
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1358913860 anchorX = ax;
1359013861 anchorY = ay;
1359113862 prevX = px;
....@@ -13619,6 +13890,7 @@
1361913890 else
1362013891 if (evt.getSource() == AAtimer)
1362113892 {
13893
+ Globals.TIMERRUNNING = false;
1362213894 if (mouseDown)
1362313895 {
1362413896 //new Exception().printStackTrace();
....@@ -13644,6 +13916,10 @@
1364413916 // LIVE = waslive;
1364513917 // wasliveok = true;
1364613918 // waslive = false;
13919
+
13920
+ // May 2019 Forget it:
13921
+ if (true)
13922
+ return;
1364713923
1364813924 // source == timer
1364913925 if (mouseDown)
....@@ -13674,7 +13950,7 @@
1367413950
1367513951 // fev 2014???
1367613952 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13677
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13953
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1367813954 pingthread.StepToTarget(true); // true);
1367913955 }
1368013956 // if (!LIVE)
....@@ -13683,12 +13959,13 @@
1368313959
1368413960 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1368513961
13686
- void clickStart(int x, int y, int modifiers)
13962
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1368713963 {
1368813964 if (!wasliveok)
1368913965 return;
1369013966
1369113967 AAtimer.restart(); //
13968
+ Globals.TIMERRUNNING = true;
1369213969
1369313970 // waslive = LIVE;
1369413971 // LIVE = false;
....@@ -13700,7 +13977,7 @@
1370013977 // touched = true; // main DL
1370113978 if (isRenderer)
1370213979 {
13703
- SetMouseMode(modifiers);
13980
+ SetMouseMode(modifiers, modifiersex);
1370413981 }
1370513982
1370613983 selectX = anchorX = x;
....@@ -13713,7 +13990,7 @@
1371313990 clicked = true;
1371413991 hold = false;
1371513992
13716
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13993
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1371713994 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1371813995 {
1371913996 // System.out.println("RESTART II " + modifiers);
....@@ -13744,7 +14021,7 @@
1374414021 info.camera = renderCamera;
1374514022 info.x = x;
1374614023 info.y = y;
13747
- info.modifiers = modifiers;
14024
+ info.modifiers = modifiersex;
1374814025 editObj = object.doEditClick(info, 0);
1374914026 if (!editObj)
1375014027 {
....@@ -13761,9 +14038,12 @@
1376114038
1376214039 public void mouseDragged(MouseEvent e)
1376314040 {
14041
+ Globals.MOUSEDRAGGED = true;
14042
+
1376414043 //System.out.println("mouseDragged: " + e);
1376514044 if (isRenderer)
1376614045 movingcamera = true;
14046
+
1376714047 //if (drawing)
1376814048 //return;
1376914049 if ((e.getModifiersEx() & CTRL) != 0
....@@ -13773,7 +14053,7 @@
1377314053 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1377414054 }
1377514055 else
13776
- drag(e.getX(), e.getY(), e.getModifiersEx());
14056
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1377714057
1377814058 //try { Thread.sleep(1); } catch (Exception ex) {}
1377914059 }
....@@ -13946,6 +14226,7 @@
1394614226
1394714227 public void run()
1394814228 {
14229
+ new Exception().printStackTrace();
1394914230 System.exit(0);
1395014231 for (;;)
1395114232 {
....@@ -14009,7 +14290,7 @@
1400914290 {
1401014291 Globals.lighttouched = true;
1401114292 }
14012
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14293
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1401314294 }
1401414295 //else
1401514296 }
....@@ -14023,12 +14304,12 @@
1402314304 void GoDown(int mod)
1402414305 {
1402514306 MODIFIERS |= COMMAND;
14026
- /*
14307
+ /**/
1402714308 if((mod&SHIFT) == SHIFT)
1402814309 manipCamera.RotatePosition(0, -speed);
1402914310 else
14030
- manipCamera.BackForth(0, -speed*delta, getWidth());
14031
- */
14311
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14312
+ /**/
1403214313 if ((mod & SHIFT) == SHIFT)
1403314314 {
1403414315 mouseMode = mouseMode; // VR??
....@@ -14044,12 +14325,12 @@
1404414325 void GoUp(int mod)
1404514326 {
1404614327 MODIFIERS |= COMMAND;
14047
- /*
14328
+ /**/
1404814329 if((mod&SHIFT) == SHIFT)
1404914330 manipCamera.RotatePosition(0, speed);
1405014331 else
14051
- manipCamera.BackForth(0, speed*delta, getWidth());
14052
- */
14332
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14333
+ /**/
1405314334 if ((mod & SHIFT) == SHIFT)
1405414335 {
1405514336 mouseMode = mouseMode;
....@@ -14065,12 +14346,12 @@
1406514346 void GoLeft(int mod)
1406614347 {
1406714348 MODIFIERS |= COMMAND;
14068
- /*
14349
+ /**/
1406914350 if((mod&SHIFT) == SHIFT)
14070
- manipCamera.RotatePosition(speed, 0);
14071
- else
1407214351 manipCamera.Translate(speed*delta, 0, getWidth());
14073
- */
14352
+ else
14353
+ manipCamera.RotatePosition(speed, 0);
14354
+ /**/
1407414355 if ((mod & SHIFT) == SHIFT)
1407514356 {
1407614357 mouseMode = mouseMode;
....@@ -14086,12 +14367,12 @@
1408614367 void GoRight(int mod)
1408714368 {
1408814369 MODIFIERS |= COMMAND;
14089
- /*
14370
+ /**/
1409014371 if((mod&SHIFT) == SHIFT)
14091
- manipCamera.RotatePosition(-speed, 0);
14092
- else
1409314372 manipCamera.Translate(-speed*delta, 0, getWidth());
14094
- */
14373
+ else
14374
+ manipCamera.RotatePosition(-speed, 0);
14375
+ /**/
1409514376 if ((mod & SHIFT) == SHIFT)
1409614377 {
1409714378 mouseMode = mouseMode;
....@@ -14109,7 +14390,7 @@
1410914390 int X, Y;
1411014391 boolean SX, SY;
1411114392
14112
- void drag(int x, int y, int modifiers)
14393
+ void drag(int x, int y, int modifiers, int modifiersex)
1411314394 {
1411414395 if (IsFrozen())
1411514396 {
....@@ -14118,17 +14399,17 @@
1411814399
1411914400 drag = true; // NEW
1412014401
14121
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14402
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1412214403
1412314404 X = x;
1412414405 Y = y;
1412514406 // floating state for animation
14126
- MODIFIERS = modifiers;
14127
- modifiers &= ~1024;
14407
+ MODIFIERS = modifiersex;
14408
+ modifiersex &= ~1024;
1412814409 if (false) // modifiers != 0)
1412914410 {
1413014411 //new Exception().printStackTrace();
14131
- System.out.println("mouseDragged: " + modifiers);
14412
+ System.out.println("mouseDragged: " + modifiersex);
1413214413 System.out.println("SHIFT = " + SHIFT);
1413314414 System.out.println("CONTROL = " + COMMAND);
1413414415 System.out.println("META = " + META);
....@@ -14148,7 +14429,8 @@
1414814429 info.camera = renderCamera;
1414914430 info.x = x;
1415014431 info.y = y;
14151
- object.editWindow.copy.doEditDrag(info);
14432
+ object.GetWindow().copy
14433
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1415214434 } else
1415314435 {
1415414436 if (x < startX)
....@@ -14312,7 +14594,9 @@
1431214594 ci.camera = renderCamera;
1431314595 if (!isRenderer)
1431414596 {
14315
- if (object.editWindow.copy.doEditClick(ci, 0))
14597
+ //ObjEditor editWindow = object.editWindow;
14598
+ //Object3D copy = editWindow.copy;
14599
+ if (object.doEditClick(ci, 0))
1431614600 {
1431714601 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1431814602 } else
....@@ -14324,7 +14608,11 @@
1432414608
1432514609 public void mouseReleased(MouseEvent e)
1432614610 {
14611
+ Globals.MOUSEDRAGGED = false;
14612
+
1432714613 movingcamera = false;
14614
+ X = 0; // getBounds().width/2;
14615
+ Y = 0; // getBounds().height/2;
1432814616 //System.out.println("mouseReleased: " + e);
1432914617 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1433014618 }
....@@ -14347,9 +14635,9 @@
1434714635 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1434814636 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1434914637
14350
- if (control || command || IsFrozen())
14638
+// No delay if (control || command || IsFrozen())
1435114639 timeout = true;
14352
- else
14640
+// ?? May 2019 else
1435314641 // timer.setDelay((modifiers & 128) != 0?0:350);
1435414642 mouseDown = false;
1435514643 if (!control && !command) // june 2013
....@@ -14459,7 +14747,7 @@
1445914747 System.out.println("keyReleased: " + e);
1446014748 }
1446114749
14462
- void SetMouseMode(int modifiers)
14750
+ void SetMouseMode(int modifiers, int modifiersex)
1446314751 {
1446414752 //System.out.println("SetMouseMode = " + modifiers);
1446514753 //modifiers &= ~1024;
....@@ -14471,25 +14759,25 @@
1447114759 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1447214760 // return;
1447314761 //System.out.println("SetMode = " + modifiers);
14474
- if ((modifiers & WHEEL) == WHEEL)
14762
+ if ((modifiersex & WHEEL) == WHEEL)
1447514763 {
1447614764 mouseMode |= ZOOM;
1447714765 }
1447814766
1447914767 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14480
- if (capsLocked || (modifiers & META) == META)
14768
+ if (capsLocked) // || (modifiers & META) == META)
1448114769 {
1448214770 mouseMode |= VR; // BACKFORTH;
1448314771 }
14484
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14772
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1448514773 {
1448614774 mouseMode |= SELECT;
1448714775 }
14488
- if ((modifiers & COMMAND) == COMMAND)
14776
+ if ((modifiersex & COMMAND) == COMMAND)
1448914777 {
1449014778 mouseMode |= SELECT;
1449114779 }
14492
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14780
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1449314781 {
1449414782 mouseMode &= ~VR;
1449514783 mouseMode |= TRANSLATE;
....@@ -14518,7 +14806,7 @@
1451814806
1451914807 if (isRenderer) //
1452014808 {
14521
- SetMouseMode(modifiers);
14809
+ SetMouseMode(0, modifiers);
1452214810 }
1452314811
1452414812 Globals.theRenderer.keyPressed(key);
....@@ -14665,7 +14953,9 @@
1466514953 case 'E' : COMPACT ^= true;
1466614954 repaint();
1466714955 break;
14668
- case 'W' : DEBUGHSB ^= true;
14956
+ case 'W' : // Wide Window (fullscreen)
14957
+ //DEBUGHSB ^= true;
14958
+ ObjEditor.theFrame.ToggleFullScreen();
1466914959 repaint();
1467014960 break;
1467114961 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14690,8 +14980,8 @@
1469014980 RevertCamera();
1469114981 repaint();
1469214982 break;
14693
- case 'L':
1469414983 case 'l':
14984
+ //case 'L':
1469514985 if (lightMode)
1469614986 {
1469714987 lightMode = false;
....@@ -14834,9 +15124,9 @@
1483415124 case '_':
1483515125 kompactbit = 5;
1483615126 break;
14837
- case '+':
14838
- kompactbit = 6;
14839
- break;
15127
+// case '+':
15128
+// kompactbit = 6;
15129
+// break;
1484015130 case ' ':
1484115131 lightMode ^= true;
1484215132 Globals.lighttouched = true;
....@@ -14848,13 +15138,14 @@
1484815138 case ESC:
1484915139 RENDERPROGRAM += 1;
1485015140 RENDERPROGRAM %= 3;
15141
+
1485115142 repaint();
1485215143 break;
1485315144 case 'Z':
1485415145 //RESIZETEXTURE ^= true;
1485515146 //break;
1485615147 case 'z':
14857
- RENDERSHADOW ^= true;
15148
+ Globals.RENDERSHADOW ^= true;
1485815149 Globals.lighttouched = true;
1485915150 repaint();
1486015151 break;
....@@ -14887,8 +15178,9 @@
1488715178 case DELETE:
1488815179 ClearSelection();
1488915180 break;
14890
- /*
1489115181 case '+':
15182
+
15183
+ /*
1489215184 //fontsize += 1;
1489315185 bbzoom *= 2;
1489415186 repaint();
....@@ -14905,17 +15197,17 @@
1490515197 case '=':
1490615198 IncDepth();
1490715199 //fontsize += 1;
14908
- object.editWindow.refreshContents(true);
15200
+ object.GetWindow().refreshContents(true);
1490915201 maskbit = 6;
1491015202 break;
1491115203 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1491215204 DecDepth();
1491315205 maskbit = 5;
1491415206 //if(fontsize > 1) fontsize -= 1;
14915
- if (object.editWindow == null)
14916
- new Exception().printStackTrace();
14917
- else
14918
- object.editWindow.refreshContents(true);
15207
+// if (object.editWindow == null)
15208
+// new Exception().printStackTrace();
15209
+// else
15210
+ object.GetWindow().refreshContents(true);
1491915211 break;
1492015212 case '{':
1492115213 manipCamera.shaper_fovy /= 1.1;
....@@ -14978,7 +15270,7 @@
1497815270 //mode = ROTATE;
1497915271 if ((MODIFIERS & COMMAND) == 0) // VR??
1498015272 {
14981
- SetMouseMode(modifiers);
15273
+ SetMouseMode(0, modifiers);
1498215274 }
1498315275 }
1498415276
....@@ -15114,7 +15406,7 @@
1511415406 {
1511515407 //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
1511615408 //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15117
- if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (mouseMode & SELECT) == 0)
15409
+ if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0)
1511815410 {
1511915411 mouseMoved(e);
1512015412 } else
....@@ -15139,11 +15431,12 @@
1513915431 }
1514015432 */
1514115433
15142
- object.editWindow.EditSelection();
15434
+ object.GetWindow().EditSelection(false);
1514315435 }
1514415436
1514515437 void SelectParent()
1514615438 {
15439
+ new Exception().printStackTrace();
1514715440 System.exit(0);
1514815441 Composite group = (Composite) object;
1514915442 java.util.Vector selectees = new java.util.Vector(group.selection);
....@@ -15155,10 +15448,10 @@
1515515448 {
1515615449 //selectees.remove(i);
1515715450 System.out.println("select parent of " + elem);
15158
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15451
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1515915452 } else
1516015453 {
15161
- group.editWindow.Select(elem.GetTreePath(), first, true);
15454
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1516215455 }
1516315456
1516415457 first = false;
....@@ -15167,6 +15460,7 @@
1516715460
1516815461 void SelectChildren()
1516915462 {
15463
+ new Exception().printStackTrace();
1517015464 System.exit(0);
1517115465 /*
1517215466 Composite group = (Composite) object;
....@@ -15199,12 +15493,12 @@
1519915493 for (int j = 0; j < group.children.size(); j++)
1520015494 {
1520115495 elem = (Object3D) group.children.elementAt(j);
15202
- object.editWindow.Select(elem.GetTreePath(), first, true);
15496
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1520315497 first = false;
1520415498 }
1520515499 } else
1520615500 {
15207
- object.editWindow.Select(elem.GetTreePath(), first, true);
15501
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1520815502 }
1520915503
1521015504 first = false;
....@@ -15215,21 +15509,21 @@
1521515509 {
1521615510 //Composite group = (Composite) object;
1521715511 Object3D group = object;
15218
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15512
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1521915513 }
1522015514
1522115515 void ResetTransform(int mask)
1522215516 {
1522315517 //Composite group = (Composite) object;
1522415518 Object3D group = object;
15225
- group.editWindow.ResetTransform(mask);
15519
+ group.GetWindow().ResetTransform(mask);
1522615520 }
1522715521
1522815522 void FlipTransform()
1522915523 {
1523015524 //Composite group = (Composite) object;
1523115525 Object3D group = object;
15232
- group.editWindow.FlipTransform();
15526
+ group.GetWindow().FlipTransform();
1523315527 // group.editWindow.ReduceMesh(true);
1523415528 }
1523515529
....@@ -15237,7 +15531,7 @@
1523715531 {
1523815532 //Composite group = (Composite) object;
1523915533 Object3D group = object;
15240
- group.editWindow.PrintMemory();
15534
+ group.GetWindow().PrintMemory();
1524115535 // group.editWindow.ReduceMesh(true);
1524215536 }
1524315537
....@@ -15245,7 +15539,7 @@
1524515539 {
1524615540 //Composite group = (Composite) object;
1524715541 Object3D group = object;
15248
- group.editWindow.ResetCentroid();
15542
+ group.GetWindow().ResetCentroid();
1524915543 }
1525015544
1525115545 void IncDepth()
....@@ -15331,7 +15625,9 @@
1533115625 info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom));
1533215626 //Image img = CreateImage(width, height);
1533315627 //System.out.println("width = " + width + "; height = " + height + "\n");
15628
+
1533415629 Graphics gr = g; // img.getGraphics();
15630
+
1533515631 if (!hasMarquee)
1533615632 {
1533715633 if (Xmin < Xmax) // !locked)
....@@ -15419,6 +15715,7 @@
1541915715 info.bounds.y += (height - desired) / 2;
1542015716 }
1542115717 }
15718
+
1542215719 info.g = gr;
1542315720 info.camera = renderCamera;
1542415721 /*
....@@ -15428,15 +15725,55 @@
1542815725 */
1542915726 if (!isRenderer)
1543015727 {
15431
- object.drawEditHandles(info, 0);
15728
+ Grafreed.Assert(object != null);
15729
+ Grafreed.Assert(object.selection != null);
15730
+ if (object.selection.Size() > 0)
15731
+ {
15732
+ int hitSomething = object.selection.get(0).hitSomething;
15733
+
15734
+ info.DX = 0;
15735
+ info.DY = 0;
15736
+ info.W = 1;
15737
+ if (hitSomething == Object3D.hitCenter)
15738
+ {
15739
+ info.DX = X;
15740
+ if (X != 0)
15741
+ info.DX -= info.bounds.width/2;
15742
+
15743
+ info.DY = Y;
15744
+ if (Y != 0)
15745
+ info.DY -= info.bounds.height/2;
15746
+ }
15747
+
15748
+ object.drawEditHandles(info, 0);
15749
+
15750
+ if (drag && (X != 0 || Y != 0))
15751
+ {
15752
+ switch (hitSomething)
15753
+ {
15754
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15755
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15756
+ break;
15757
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15758
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15759
+ break;
15760
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15761
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15762
+ break;
15763
+ }
15764
+
15765
+ }
15766
+ }
1543215767 }
1543315768 }
15769
+
1543415770 if (isRenderer)
1543515771 {
1543615772 //gr.setColor(Color.black);
1543715773 //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1);
1543815774 //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3);
1543915775 }
15776
+
1544015777 if (hasMarquee)
1544115778 {
1544215779 gr.setXORMode(Color.white);
....@@ -15549,6 +15886,7 @@
1554915886 public boolean mouseDown(Event evt, int x, int y)
1555015887 {
1555115888 System.out.println("mouseDown: " + evt);
15889
+ System.exit(0);
1555215890 /*
1555315891 locked = true;
1555415892 drag = false;
....@@ -15592,7 +15930,7 @@
1559215930 {
1559315931 keyPressed(0, modifiers);
1559415932 }
15595
- clickStart(x, y, modifiers);
15933
+ // clickStart(x, y, modifiers);
1559615934 return true;
1559715935 }
1559815936
....@@ -15710,7 +16048,7 @@
1571016048 {
1571116049 keyReleased(0, 0);
1571216050 }
15713
- drag(x, y, modifiers);
16051
+ drag(x, y, 0, modifiers);
1571416052 return true;
1571516053 }
1571616054
....@@ -15842,7 +16180,7 @@
1584216180 Object3D object;
1584316181 static Object3D trackedobject;
1584416182 Camera renderCamera; // Light or Eye (or Occlusion)
15845
- /*static*/ Camera manipCamera; // Light or Eye
16183
+ /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light
1584616184 /*static*/ Camera eyeCamera;
1584716185 /*static*/ Camera lightCamera;
1584816186 int cameracount;
....@@ -16127,16 +16465,16 @@
1612716465 cStatic.objectstack[materialdepth++] = checker;
1612816466 //System.out.println("material " + material);
1612916467 //Applet3D.tracein(this, selected);
16130
- vector2buffer = checker.projectedVertices;
16468
+ //vector2buffer = checker.projectedVertices;
1613116469
1613216470 //checker.GetMaterial().Draw(this, false); // true);
16133
- DrawMaterial(checker.GetMaterial(), false); // true);
16471
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1613416472
1613516473 materialdepth -= 1;
1613616474 if (materialdepth > 0)
1613716475 {
16138
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16139
- DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
16476
+ //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16477
+ DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
1614016478 }
1614116479 //checker.GetMaterial().opacity = 1f;
1614216480 ////checker.GetMaterial().ambient = 1f;
....@@ -16222,6 +16560,14 @@
1622216560 }
1622316561 }
1622416562
16563
+ private Object3D GetFolder()
16564
+ {
16565
+ Object3D folder = object.GetWindow().copy;
16566
+ if (object.GetWindow().copy.selection.Size() > 0)
16567
+ folder = object.GetWindow().copy.selection.elementAt(0);
16568
+ return folder;
16569
+ }
16570
+
1622516571 class SelectBuffer implements GLEventListener
1622616572 {
1622716573
....@@ -16280,6 +16626,7 @@
1628016626 {
1628116627 if (!selection)
1628216628 {
16629
+ new Exception().printStackTrace();
1628316630 System.exit(0);
1628416631 return;
1628516632 }
....@@ -16300,6 +16647,17 @@
1630016647
1630116648 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1630216649
16650
+ if (PAINTMODE)
16651
+ {
16652
+ if (object.GetWindow().copy.selection.Size() > 0)
16653
+ {
16654
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
16655
+
16656
+ // Make what you paint not selectable.
16657
+ paintobj.ResetSelectable();
16658
+ }
16659
+ }
16660
+
1630316661 //int tmp = selection_view;
1630416662 //selection_view = -1;
1630516663 int temp = DrawMode();
....@@ -16311,6 +16669,17 @@
1631116669 // temp = DEFAULT; // patch for selection debug
1631216670 Globals.drawMode = temp; // WARNING
1631316671
16672
+ if (PAINTMODE)
16673
+ {
16674
+ if (object.GetWindow().copy.selection.Size() > 0)
16675
+ {
16676
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
16677
+
16678
+ // Revert.
16679
+ paintobj.RestoreSelectable();
16680
+ }
16681
+ }
16682
+
1631416683 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1631516684
1631616685 // trying different ways of getting the depth info over
....@@ -16358,6 +16727,8 @@
1635816727 // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]);
1635916728 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1636016729 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
16730
+
16731
+ CreateSelectedPoint();
1636116732
1636216733 // Will fit the mesh !!!
1636316734 selectedpoint.toParent[0][0] = 0.0001;
....@@ -16407,34 +16778,36 @@
1640716778 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]));
1640816779 }
1640916780
16410
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16781
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1641116782 }
1641216783 }
1641316784
1641416785 if (!movingcamera && !PAINTMODE)
16415
- object.editWindow.ScreenFitPoint(); // fev 2014
16786
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1641616787
16417
- if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16788
+ if (PAINTMODE) // && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1641816789 {
16419
- Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16790
+ //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1642016791
16421
- Object3D group = new Object3D("inst" + paintcount++);
16792
+ if (object.GetWindow().copy.selection.Size() > 0)
16793
+ {
16794
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1642216795
16423
- group.CreateMaterial(); // use a void leaf to select instances
16424
-
16425
- group.add(paintobj); // link
16426
-
16427
- object.editWindow.SnapObject(group);
16428
-
16429
- Object3D folder = object.editWindow.copy;
16430
-
16431
- if (object.editWindow.copy.selection.Size() > 0)
16432
- folder = object.editWindow.copy.selection.elementAt(0);
16433
-
16434
- folder.add(group);
16435
-
16436
- object.editWindow.ResetModel();
16437
- object.editWindow.refreshContents();
16796
+ Object3D inst = new Object3D("inst" + paintcount++);
16797
+
16798
+ inst.CreateMaterial(); // use a void leaf to select instances
16799
+
16800
+ inst.add(paintobj); // link
16801
+
16802
+ object.GetWindow().SnapObject(inst);
16803
+
16804
+ Object3D folder = paintFolder; // GetFolder();
16805
+
16806
+ folder.add(inst);
16807
+
16808
+ object.GetWindow().ResetModel();
16809
+ object.GetWindow().refreshContents();
16810
+ }
1643816811 }
1643916812 else
1644016813 paintcount = 0;
....@@ -16473,6 +16846,11 @@
1647316846 //System.out.println("objects[color] = " + objects[color]);
1647416847 //objects[color].Select();
1647516848 indexcount = 0;
16849
+ ObjEditor window = object.GetWindow();
16850
+ if (window != null && deselect)
16851
+ {
16852
+ window.Select(null, deselect, true);
16853
+ }
1647616854 object.Select(color, deselect);
1647716855 }
1647816856
....@@ -16572,7 +16950,7 @@
1657216950 gl.glDisable(gl.GL_CULL_FACE);
1657316951 }
1657416952
16575
- if (!RENDERSHADOW)
16953
+ if (!Globals.RENDERSHADOW)
1657616954 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1657716955
1657816956 // SB gl.glPolygonOffset(2.5f, 10);
....@@ -16582,7 +16960,7 @@
1658216960 //gl.glColorMask(false, false, false, false);
1658316961
1658416962 //render_scene_from_light_view(gl, drawable, 0, 0);
16585
- if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
16963
+ if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed())
1658616964 {
1658716965 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1658816966
....@@ -16998,23 +17376,15 @@
1699817376 int AAbuffersize = 0;
1699917377
1700017378 //double[] selectedpoint = new double[3];
17001
- static Superellipsoid selectedpoint = new Superellipsoid();
17379
+ static Superellipsoid selectedpoint;
1700217380 static Sphere previousselectedpoint = null;
17003
- static Sphere debugpointG = new Sphere();
17004
- static Sphere debugpointP = new Sphere();
17005
- static Sphere debugpointC = new Sphere();
17006
- static Sphere debugpointR = new Sphere();
17381
+ static Sphere debugpointG;
17382
+ static Sphere debugpointP;
17383
+ static Sphere debugpointC;
17384
+ static Sphere debugpointR;
1700717385
1700817386 static Sphere debugpoints[] = new Sphere[8];
1700917387
17010
- static
17011
- {
17012
- for (int i=0; i<8; i++)
17013
- {
17014
- debugpoints[i] = new Sphere();
17015
- }
17016
- }
17017
-
1701817388 static void InitPoints(float radius)
1701917389 {
1702017390 for (int i=0; i<8; i++)