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
....@@ -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;
....@@ -334,14 +335,28 @@
334335 display.options1[2] = material.shadowbias;
335336 display.options1[3] = material.aniso;
336337 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]);
337343 display.options2[0] = material.opacity;
338344 display.options2[1] = material.diffuse;
339345 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]);
340349
341350 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]);
342354 display.options4[0] = material.cameralight/0.2f;
343355 display.options4[1] = material.subsurface;
344356 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]);
345360
346361 // if (display.CURRENTANTIALIAS > 0)
347362 // display.options3[3] /= 4;
....@@ -357,7 +372,7 @@
357372 /**/
358373 } else
359374 {
360
- DrawMaterial(material, selected);
375
+ DrawMaterial(material, selected, obj.projectedVertices);
361376 }
362377 } else
363378 {
....@@ -381,8 +396,8 @@
381396 cStatic.objectstack[materialdepth++] = obj;
382397 //System.out.println("material " + material);
383398 //Applet3D.tracein("selected ", selected);
384
- display.vector2buffer = obj.projectedVertices;
385
- display.DrawMaterial(material, selected);
399
+ //display.vector2buffer = obj.projectedVertices;
400
+ display.DrawMaterial(material, selected, obj.projectedVertices);
386401 }
387402 }
388403
....@@ -399,8 +414,8 @@
399414 materialdepth -= 1;
400415 if (materialdepth > 0)
401416 {
402
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
403
- 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);
404419 }
405420 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
406421 } else if (selected && CameraPane.flash && obj.GetMaterial() != null)
....@@ -420,8 +435,8 @@
420435 materialdepth -= 1;
421436 if (materialdepth > 0)
422437 {
423
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
424
- 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);
425440 }
426441 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
427442 //else
....@@ -462,10 +477,12 @@
462477 if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
463478 {
464479 //gl.glBegin(gl.GL_TRIANGLES);
465
- 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
+ ;
466483 if (!hasnorm)
467484 {
468
- // System.out.println("FUCK!!");
485
+ // System.out.println("Mesh normal");
469486 LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0);
470487 LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1);
471488 LA.vecCross(obj.v0, obj.v1, obj.v2);
....@@ -1190,10 +1207,12 @@
11901207 gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
11911208 }
11921209 }
1210
+
11931211 if (flipV)
11941212 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
11951213 else
11961214 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1215
+
11971216 //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
11981217 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
11991218
....@@ -1213,10 +1232,12 @@
12131232 gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
12141233 }
12151234 }
1235
+
12161236 if (flipV)
12171237 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
12181238 else
12191239 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1240
+
12201241 //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
12211242 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
12221243
....@@ -1244,8 +1265,10 @@
12441265 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
12451266 else
12461267 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1268
+
12471269 //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
12481270 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
1271
+
12491272 count2 += 2;
12501273 count3 += 3;
12511274 }
....@@ -1601,7 +1624,7 @@
16011624 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16021625 }
16031626
1604
- void DrawMaterial(cMaterial material, boolean selected)
1627
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16051628 {
16061629 CameraPane display = this;
16071630 //new Exception().printStackTrace();
....@@ -1628,7 +1651,7 @@
16281651
16291652 cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0);
16301653
1631
- float[] colorV = GrafreeD.colorV;
1654
+ float[] colorV = Grafreed.colorV;
16321655
16331656 /**/
16341657 if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0)
....@@ -1636,7 +1659,7 @@
16361659 colorV[0] = display.modelParams0[0] * material.diffuse;
16371660 colorV[1] = display.modelParams0[1] * material.diffuse;
16381661 colorV[2] = display.modelParams0[2] * material.diffuse;
1639
- colorV[3] = material.opacity;
1662
+ colorV[3] = 1; // material.opacity;
16401663
16411664 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16421665 //System.out.println("Opacity = " + opacity);
....@@ -1744,9 +1767,9 @@
17441767 display.modelParams7[2] = 0;
17451768 display.modelParams7[3] = 0;
17461769
1747
- display.modelParams6[0] = 100; // criss de bug de bump
1770
+ //display.modelParams6[0] = 100; // criss de bug de bump
17481771
1749
- Object3D.cVector2[] extparams = display.vector2buffer;
1772
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17501773 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17511774 {
17521775 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -1888,7 +1911,7 @@
18881911 void PushMatrix(double[][] matrix)
18891912 {
18901913 // GrafreeD.tracein(matrix);
1891
- PushMatrix(matrix,1);
1914
+ PushMatrix(matrix, 1);
18921915 }
18931916
18941917 void PushMatrix()
....@@ -2042,7 +2065,7 @@
20422065 //System.err.println("Oeil on");
20432066 OEIL = true;
20442067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2045
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20462069 //pingthread.StepToTarget(true);
20472070 }
20482071
....@@ -2140,7 +2163,7 @@
21402163 System.err.println("LIVE = " + Globals.isLIVE());
21412164
21422165 if (!Globals.isLIVE()) // save sound
2143
- GrafreeD.savesound = true; // wav.save();
2166
+ Grafreed.savesound = true; // wav.save();
21442167 // else
21452168 repaint(); // start loop // may 2013
21462169 }
....@@ -2257,7 +2280,7 @@
22572280
22582281 void ToggleDebug()
22592282 {
2260
- DEBUG ^= true;
2283
+ Globals.DEBUG ^= true;
22612284 }
22622285
22632286 void ToggleLookAt()
....@@ -2265,9 +2288,9 @@
22652288 LOOKAT ^= true;
22662289 }
22672290
2268
- void ToggleRandom()
2291
+ void ToggleSwitch()
22692292 {
2270
- RANDOM ^= true;
2293
+ SWITCH ^= true;
22712294 }
22722295
22732296 void ToggleHandles()
....@@ -2275,10 +2298,17 @@
22752298 HANDLES ^= true;
22762299 }
22772300
2301
+ Object3D paintFolder;
2302
+
22782303 void TogglePaint()
22792304 {
22802305 PAINTMODE ^= true;
22812306 paintcount = 0;
2307
+
2308
+ if (PAINTMODE)
2309
+ {
2310
+ paintFolder = GetFolder();
2311
+ }
22822312 }
22832313
22842314 void SwapCamera(int a, int b)
....@@ -2374,7 +2404,7 @@
23742404 {
23752405 return currentGL;
23762406 }
2377
-
2407
+
23782408 /**/
23792409 class CacheTexture
23802410 {
....@@ -7919,6 +7949,64 @@
79197949 ReleaseTexture(pigment, false);
79207950 }
79217951
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
+
79228010 void ReleaseTexture(String tex, boolean bump)
79238011 {
79248012 if (// DrawMode() != 0 || /*tex == null ||*/
....@@ -8022,7 +8110,7 @@
80228110 }
80238111 }
80248112
8025
- /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE
8113
+ /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
80268114 {
80278115 if (// DrawMode() != 0 || /*tex == null ||*/
80288116 ambientOcclusion ) // || !textureon)
....@@ -8067,7 +8155,94 @@
80678155 return; // true;
80688156 }
80698157
8070
- 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
80718246 {
80728247 CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
80738248
....@@ -8075,12 +8250,18 @@
80758250 {
80768251 String texname = tex;
80778252
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;
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
+ }
80848265
80858266 if (CACHETEXTURE)
80868267 texture = textures.get(texname); // TEXTURE CACHE
....@@ -8149,7 +8330,7 @@
81498330 }
81508331
81518332 cachename = texname.substring(0, texname.length()-4)+ext+".jpg";
8152
- if (!new File(cachename).exists())
8333
+ if (!FileExists(cachename))
81538334 cachename = texname;
81548335 else
81558336 processbump = false; // don't process bump map again
....@@ -8171,7 +8352,7 @@
81718352 }
81728353
81738354 cachename = texname.substring(0, texname.length()-4)+ext+".png";
8174
- if (!new File(cachename).exists())
8355
+ if (!FileExists(cachename))
81758356 cachename = texname;
81768357 else
81778358 processbump = false; // don't process bump map again
....@@ -8180,7 +8361,9 @@
81808361 texturedata = GetFileTexture(cachename, processbump, resolution);
81818362
81828363
8183
- if (texturedata != null)
8364
+ if (texturedata == null)
8365
+ throw new Exception();
8366
+
81848367 texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
81858368 //texture = GetTexture(tex, bump);
81868369 }
....@@ -8302,7 +8485,7 @@
83028485 return texture;
83038486 }
83048487
8305
- 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
83068489 {
83078490 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83088491
....@@ -8320,14 +8503,14 @@
83208503 return texture!=null?texture.texture:null;
83218504 }
83228505
8323
- 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
83248507 {
83258508 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83268509
83278510 return texture!=null?texture.texturedata:null;
83288511 }
83298512
8330
- boolean BindTexture(String tex, boolean bump, int resolution)
8513
+ com.sun.opengl.util.texture.Texture BindTexture(String tex, boolean bump, int resolution) throws Exception
83318514 {
83328515 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
83338516 {
....@@ -8339,7 +8522,7 @@
83398522 com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
83408523
83418524 if (texture == null)
8342
- return false;
8525
+ return texture;
83438526 /**/
83448527
83458528 if (textureon || tex.equals("DEFAULT_TEXTURE") || tex.equals("DEFAULT_TEXTURE_BUMP") || tex.equals("WHITE_NOISE")) // || tex.equals("IMMORTAL"))
....@@ -9204,11 +9387,35 @@
92049387 jy8[3] = 0.5f;
92059388 }
92069389
9207
- 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
92089391 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
92099392 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
92109393 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
92119394
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
+
92129419 static int imagecount = 0; // movie generation
92139420
92149421 static int jitter = 0;
....@@ -9304,8 +9511,8 @@
93049511 assert (parentcam != renderCamera);
93059512
93069513 if (renderCamera != lightCamera)
9307
- for (int count = parentcam.GetTransformCount(); --count>=0;)
9308
- LA.matConcat(matrix, parentcam.toParent, matrix);
9514
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
9515
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
93099516
93109517 // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix);
93119518
....@@ -9320,8 +9527,8 @@
93209527 LA.matCopy(renderCamera.fromScreen, matrix);
93219528
93229529 if (renderCamera != lightCamera)
9323
- for (int count = parentcam.GetTransformCount(); --count>=0;)
9324
- LA.matConcat(parentcam.fromParent, matrix, matrix);
9530
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
9531
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
93259532
93269533 // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix);
93279534
....@@ -9538,7 +9745,7 @@
95389745
95399746 if (!BOXMODE)
95409747 {
9541
- 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) + ")");
95429749 }
95439750
95449751 if (!BOXMODE)
....@@ -9576,7 +9783,7 @@
95769783 ABORTED = false;
95779784 }
95789785 else
9579
- GrafreeD.wav.cursor += 735 * ACSIZE;
9786
+ Grafreed.wav.cursor += 735 * ACSIZE;
95809787
95819788 if (false)
95829789 {
....@@ -10239,11 +10446,11 @@
1023910446
1024010447 public void display(GLAutoDrawable drawable)
1024110448 {
10242
- if (GrafreeD.savesound && GrafreeD.hassound)
10449
+ if (Grafreed.savesound && Grafreed.hassound)
1024310450 {
10244
- GrafreeD.wav.save();
10245
- GrafreeD.savesound = false;
10246
- GrafreeD.hassound = false;
10451
+ Grafreed.wav.save();
10452
+ Grafreed.savesound = false;
10453
+ Grafreed.hassound = false;
1024710454 }
1024810455 // if (DEBUG_SELECTION)
1024910456 // {
....@@ -10319,6 +10526,7 @@
1031910526 ANTIALIAS = 0;
1032010527 //System.out.println("RESTART");
1032110528 AAtimer.restart();
10529
+ Globals.TIMERRUNNING = true;
1032210530 }
1032310531 }
1032410532 }
....@@ -10373,7 +10581,7 @@
1037310581 Object3D theobject = object;
1037410582 Object3D theparent = object.parent;
1037510583 object.parent = null;
10376
- object = (Object3D)GrafreeD.clone(object);
10584
+ object = (Object3D)Grafreed.clone(object);
1037710585 object.Stripify();
1037810586 if (theobject.selection == null || theobject.selection.Size() == 0)
1037910587 theobject.PreprocessOcclusion(this);
....@@ -10386,13 +10594,14 @@
1038610594 ambientOcclusion = false;
1038710595 }
1038810596
10389
- if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN)
10597
+ if (//Globals.lighttouched &&
10598
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1039010599 {
1039110600 //if (RENDERSHADOW) // ?
1039210601 if (!IsFrozen())
1039310602 {
1039410603 // dec 2012
10395
- if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0))
10604
+ if (!ambientOcclusion && !(!flash && DrawMode() == DEFAULT && ANTIALIAS > 0))
1039610605 {
1039710606 Globals.framecount++;
1039810607 shadowbuffer.display();
....@@ -10519,8 +10728,8 @@
1051910728
1052010729 // if (parentcam != renderCamera) // not a light
1052110730 if (cam != lightCamera)
10522
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10523
- LA.matConcat(matrix, parentcam.toParent, matrix);
10731
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
10732
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
1052410733
1052510734 for (int j = 0; j < 4; j++)
1052610735 {
....@@ -10534,8 +10743,8 @@
1053410743
1053510744 // if (parentcam != renderCamera) // not a light
1053610745 if (cam != lightCamera)
10537
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10538
- LA.matConcat(parentcam.fromParent, matrix, matrix);
10746
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
10747
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
1053910748
1054010749 //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix);
1054110750
....@@ -10794,7 +11003,16 @@
1079411003 // Bump noise
1079511004 gl.glActiveTexture(GL.GL_TEXTURE6);
1079611005 //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise);
10797
- 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
+
1079811016
1079911017 gl.glActiveTexture(GL.GL_TEXTURE0);
1080011018 gl.glEnable(GL.GL_TEXTURE_2D);
....@@ -10817,9 +11035,9 @@
1081711035
1081811036 gl.glMatrixMode(GL.GL_MODELVIEW);
1081911037
10820
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
10821
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
10822
-//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);
1082311041 } else
1082411042 {
1082511043 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -10830,7 +11048,7 @@
1083011048 //System.out.println("BLENDING ON");
1083111049 gl.glEnable(GL.GL_BLEND);
1083211050 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
10833
-
11051
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1083411052 gl.glMatrixMode(gl.GL_PROJECTION);
1083511053 gl.glLoadIdentity();
1083611054
....@@ -10919,8 +11137,8 @@
1091911137 System.err.println("parentcam != renderCamera");
1092011138
1092111139 // if (cam != lightCamera)
10922
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10923
- 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
1092411142 }
1092511143
1092611144 LA.xformDir(lightposition, cam.toScreen, lightposition);
....@@ -10941,8 +11159,8 @@
1094111159 if (true) // TODO
1094211160 {
1094311161 if (cam != lightCamera)
10944
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10945
- 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
1094611164 }
1094711165
1094811166 LA.xformPos(light0, cam.toScreen, light0);
....@@ -11279,23 +11497,44 @@
1127911497 e.printStackTrace();
1128011498 }
1128111499
11282
- if (GrafreeD.RENDERME > 0)
11283
- GrafreeD.RENDERME--; // mechante magouille
11500
+ if (Grafreed.RENDERME > 0)
11501
+ Grafreed.RENDERME--; // mechante magouille
1128411502
1128511503 Globals.ONESTEP = false;
1128611504 }
1128711505
1128811506 static boolean zoomonce = false;
1128911507
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
+
1129011526 void DrawObject(GL gl, boolean draw)
1129111527 {
11528
+ // To clear camera values
11529
+ ResetOptions();
11530
+
1129211531 //System.out.println("DRAW OBJECT " + mouseDown);
1129311532 // DrawMode() = SELECTION;
1129411533 //GL gl = getGL();
1129511534 if ((TRACK || SHADOWTRACK) || zoomonce)
1129611535 {
1129711536 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11298
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11537
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1129911538 pingthread.StepToTarget(true); // true);
1130011539 // zoomonce = false;
1130111540 }
....@@ -11350,7 +11589,14 @@
1135011589
1135111590 usedtextures.clear();
1135211591
11353
- 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
+ }
1135411600 }
1135511601 //System.out.println("--> " + stackdepth);
1135611602 // GrafreeD.traceon();
....@@ -11360,8 +11606,9 @@
1136011606
1136111607 if (DrawMode() == DEFAULT)
1136211608 {
11363
- if (DEBUG)
11609
+ if (Globals.DEBUG)
1136411610 {
11611
+ CreateSelectedPoint();
1136511612 float radius = 0.05f;
1136611613 if (selectedpoint.radius != radius)
1136711614 {
....@@ -11441,7 +11688,14 @@
1144111688 if (checker != null && DrawMode() == DEFAULT)
1144211689 {
1144311690 //BindTexture(IMMORTAL_TEXTURE);
11444
- 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
+ }
1144511699 // NEAREST
1144611700 GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR);
1144711701 DrawChecker(gl);
....@@ -11523,7 +11777,7 @@
1152311777 return;
1152411778 }
1152511779
11526
- String string = obj.GetToolTip();
11780
+ String string = obj.toString(); //.GetToolTip();
1152711781
1152811782 GL gl = GetGL();
1152911783
....@@ -11840,8 +12094,8 @@
1184012094 //obj.TransformToWorld(light, light);
1184112095 for (int i = tp.size(); --i >= 0;)
1184212096 {
11843
- for (int count = tp.get(i).GetTransformCount(); --count>=0;)
11844
- 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);
1184512099 }
1184612100
1184712101
....@@ -11858,8 +12112,8 @@
1185812112 parentcam = cameras[0];
1185912113 }
1186012114
11861
- for (int count = parentcam.GetTransformCount(); --count>=0;)
11862
- 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
1186312117
1186412118 LA.xformPos(light, renderCamera.toScreen, light);
1186512119
....@@ -12473,8 +12727,8 @@
1247312727
1247412728 // display shadow only (bump == 0)
1247512729 "SUB temp.x, half.x, shadow.x;" +
12476
- "MOV temp.y, -params6.x;" +
12477
- "SLT temp.z, temp.y, zero.x;" +
12730
+ "MOV temp.y, -params5.z;" + // params6.x;" +
12731
+ "SLT temp.z, temp.y, -one2048th.x;" +
1247812732 "SUB temp.y, one.x, temp.z;" +
1247912733 "MUL temp.x, temp.x, temp.y;" +
1248012734 "KIL temp.x;" +
....@@ -12603,8 +12857,10 @@
1260312857 "MAX ndotl.x, ndotl.x, -ndotl.x;" +
1260412858
1260512859 "SUB temp.x, one.x, ndotl.x;" +
12606
- "ADD temp.x, temp.x, options2.z;" + // lightsheen
12607
- "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
1260812864 "MUL temp.x, temp.x, temp.y;" +
1260912865
1261012866 "MUL saturation, saturation, temp.xxxx;" +
....@@ -12752,7 +13008,7 @@
1275213008 "MUL final.y, fragment.texcoord[0].x, c256;" +
1275313009 "FLR final.x, final.y;" +
1275413010 "SUB final.y, final.y, final.x;" +
12755
- //"MUL final.x, final.x, c256i;" +
13011
+ "MUL final.x, final.x, c256i;" +
1275613012 "MOV final.z, zero.x;" +
1275713013 "MOV final.a, one.w;":""
1275813014 ) +
....@@ -12760,7 +13016,7 @@
1276013016 "MUL final.y, fragment.texcoord[0].y, c256;" +
1276113017 "FLR final.x, final.y;" +
1276213018 "SUB final.y, final.y, final.x;" +
12763
- //"MUL final.x, final.x, c256i;" +
13019
+ "MUL final.x, final.x, c256i;" +
1276413020 "MOV final.z, zero.x;" +
1276513021 "MOV final.a, one.w;":""
1276613022 ) +
....@@ -12803,7 +13059,7 @@
1280313059 //once = true;
1280413060 }
1280513061
12806
- System.out.print("Program #" + mode + "; length = " + program.length());
13062
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
1280713063 System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
1280813064 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1280913065
....@@ -12936,12 +13192,16 @@
1293613192
1293713193 "ADD " + depth + ".z, " + depth + ".z, temp.x;" +
1293813194 //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing!
13195
+
13196
+ // Compare fragment depth in light space with shadowmap.
1293913197 "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" +
1294013198 "SGE temp.y, temp.x, zero.x;" +
12941
- "SUB " + shadow + ".y, one.x, temp.y;" +
13199
+ "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded
13200
+
13201
+ // Reverse comparison
1294213202 "SUB temp.x, one.x, temp.x;" +
1294313203 "MUL " + shadow + ".x, temp.x, temp.y;" +
12944
- "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded
13204
+ "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse
1294513205 "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth
1294613206
1294713207 "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" +
....@@ -12955,6 +13215,10 @@
1295513215 // No shadow for backface
1295613216 "DP3 temp.x, normal, lightd;" +
1295713217 "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;" +
1295813222 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1295913223 "";
1296013224 }
....@@ -13101,7 +13365,8 @@
1310113365 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1310213366 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1310313367 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13104
- Object3D.cVector2[] vector2buffer;
13368
+
13369
+ //Object3D.cVector2[] vector2buffer;
1310513370
1310613371 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1310713372 // OUT : diff, spec
....@@ -13117,9 +13382,10 @@
1311713382 "DP3 " + dest + ".z," + "normals," + "eye;" +
1311813383 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1311913384 //"MOV " + dest + ".w," + "normal.z;" +
13120
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13121
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13122
- //"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
1312313389 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1312413390 "RCP " + dest + ".w," + dest + ".w;" +
1312513391 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13513,7 +13779,7 @@
1351313779 public void mousePressed(MouseEvent e)
1351413780 {
1351513781 //System.out.println("mousePressed: " + e);
13516
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13782
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1351713783 }
1351813784
1351913785 static long prevtime = 0;
....@@ -13589,8 +13855,8 @@
1358913855 // mode |= META;
1359013856 //}
1359113857
13592
- SetMouseMode(WHEEL | e.getModifiersEx());
13593
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13858
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13859
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1359413860 anchorX = ax;
1359513861 anchorY = ay;
1359613862 prevX = px;
....@@ -13624,6 +13890,7 @@
1362413890 else
1362513891 if (evt.getSource() == AAtimer)
1362613892 {
13893
+ Globals.TIMERRUNNING = false;
1362713894 if (mouseDown)
1362813895 {
1362913896 //new Exception().printStackTrace();
....@@ -13649,6 +13916,10 @@
1364913916 // LIVE = waslive;
1365013917 // wasliveok = true;
1365113918 // waslive = false;
13919
+
13920
+ // May 2019 Forget it:
13921
+ if (true)
13922
+ return;
1365213923
1365313924 // source == timer
1365413925 if (mouseDown)
....@@ -13679,7 +13950,7 @@
1367913950
1368013951 // fev 2014???
1368113952 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13682
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13953
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1368313954 pingthread.StepToTarget(true); // true);
1368413955 }
1368513956 // if (!LIVE)
....@@ -13688,12 +13959,13 @@
1368813959
1368913960 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1369013961
13691
- void clickStart(int x, int y, int modifiers)
13962
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1369213963 {
1369313964 if (!wasliveok)
1369413965 return;
1369513966
1369613967 AAtimer.restart(); //
13968
+ Globals.TIMERRUNNING = true;
1369713969
1369813970 // waslive = LIVE;
1369913971 // LIVE = false;
....@@ -13705,7 +13977,7 @@
1370513977 // touched = true; // main DL
1370613978 if (isRenderer)
1370713979 {
13708
- SetMouseMode(modifiers);
13980
+ SetMouseMode(modifiers, modifiersex);
1370913981 }
1371013982
1371113983 selectX = anchorX = x;
....@@ -13718,7 +13990,7 @@
1371813990 clicked = true;
1371913991 hold = false;
1372013992
13721
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13993
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1372213994 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1372313995 {
1372413996 // System.out.println("RESTART II " + modifiers);
....@@ -13749,7 +14021,7 @@
1374914021 info.camera = renderCamera;
1375014022 info.x = x;
1375114023 info.y = y;
13752
- info.modifiers = modifiers;
14024
+ info.modifiers = modifiersex;
1375314025 editObj = object.doEditClick(info, 0);
1375414026 if (!editObj)
1375514027 {
....@@ -13766,9 +14038,12 @@
1376614038
1376714039 public void mouseDragged(MouseEvent e)
1376814040 {
14041
+ Globals.MOUSEDRAGGED = true;
14042
+
1376914043 //System.out.println("mouseDragged: " + e);
1377014044 if (isRenderer)
1377114045 movingcamera = true;
14046
+
1377214047 //if (drawing)
1377314048 //return;
1377414049 if ((e.getModifiersEx() & CTRL) != 0
....@@ -13778,7 +14053,7 @@
1377814053 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1377914054 }
1378014055 else
13781
- drag(e.getX(), e.getY(), e.getModifiersEx());
14056
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1378214057
1378314058 //try { Thread.sleep(1); } catch (Exception ex) {}
1378414059 }
....@@ -14015,7 +14290,7 @@
1401514290 {
1401614291 Globals.lighttouched = true;
1401714292 }
14018
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14293
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1401914294 }
1402014295 //else
1402114296 }
....@@ -14029,12 +14304,12 @@
1402914304 void GoDown(int mod)
1403014305 {
1403114306 MODIFIERS |= COMMAND;
14032
- /*
14307
+ /**/
1403314308 if((mod&SHIFT) == SHIFT)
1403414309 manipCamera.RotatePosition(0, -speed);
1403514310 else
14036
- manipCamera.BackForth(0, -speed*delta, getWidth());
14037
- */
14311
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14312
+ /**/
1403814313 if ((mod & SHIFT) == SHIFT)
1403914314 {
1404014315 mouseMode = mouseMode; // VR??
....@@ -14050,12 +14325,12 @@
1405014325 void GoUp(int mod)
1405114326 {
1405214327 MODIFIERS |= COMMAND;
14053
- /*
14328
+ /**/
1405414329 if((mod&SHIFT) == SHIFT)
1405514330 manipCamera.RotatePosition(0, speed);
1405614331 else
14057
- manipCamera.BackForth(0, speed*delta, getWidth());
14058
- */
14332
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14333
+ /**/
1405914334 if ((mod & SHIFT) == SHIFT)
1406014335 {
1406114336 mouseMode = mouseMode;
....@@ -14071,12 +14346,12 @@
1407114346 void GoLeft(int mod)
1407214347 {
1407314348 MODIFIERS |= COMMAND;
14074
- /*
14349
+ /**/
1407514350 if((mod&SHIFT) == SHIFT)
14076
- manipCamera.RotatePosition(speed, 0);
14077
- else
1407814351 manipCamera.Translate(speed*delta, 0, getWidth());
14079
- */
14352
+ else
14353
+ manipCamera.RotatePosition(speed, 0);
14354
+ /**/
1408014355 if ((mod & SHIFT) == SHIFT)
1408114356 {
1408214357 mouseMode = mouseMode;
....@@ -14092,12 +14367,12 @@
1409214367 void GoRight(int mod)
1409314368 {
1409414369 MODIFIERS |= COMMAND;
14095
- /*
14370
+ /**/
1409614371 if((mod&SHIFT) == SHIFT)
14097
- manipCamera.RotatePosition(-speed, 0);
14098
- else
1409914372 manipCamera.Translate(-speed*delta, 0, getWidth());
14100
- */
14373
+ else
14374
+ manipCamera.RotatePosition(-speed, 0);
14375
+ /**/
1410114376 if ((mod & SHIFT) == SHIFT)
1410214377 {
1410314378 mouseMode = mouseMode;
....@@ -14115,7 +14390,7 @@
1411514390 int X, Y;
1411614391 boolean SX, SY;
1411714392
14118
- void drag(int x, int y, int modifiers)
14393
+ void drag(int x, int y, int modifiers, int modifiersex)
1411914394 {
1412014395 if (IsFrozen())
1412114396 {
....@@ -14124,17 +14399,17 @@
1412414399
1412514400 drag = true; // NEW
1412614401
14127
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14402
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1412814403
1412914404 X = x;
1413014405 Y = y;
1413114406 // floating state for animation
14132
- MODIFIERS = modifiers;
14133
- modifiers &= ~1024;
14407
+ MODIFIERS = modifiersex;
14408
+ modifiersex &= ~1024;
1413414409 if (false) // modifiers != 0)
1413514410 {
1413614411 //new Exception().printStackTrace();
14137
- System.out.println("mouseDragged: " + modifiers);
14412
+ System.out.println("mouseDragged: " + modifiersex);
1413814413 System.out.println("SHIFT = " + SHIFT);
1413914414 System.out.println("CONTROL = " + COMMAND);
1414014415 System.out.println("META = " + META);
....@@ -14154,7 +14429,8 @@
1415414429 info.camera = renderCamera;
1415514430 info.x = x;
1415614431 info.y = y;
14157
- object.editWindow.copy.doEditDrag(info);
14432
+ object.GetWindow().copy
14433
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1415814434 } else
1415914435 {
1416014436 if (x < startX)
....@@ -14318,7 +14594,9 @@
1431814594 ci.camera = renderCamera;
1431914595 if (!isRenderer)
1432014596 {
14321
- if (object.editWindow.copy.doEditClick(ci, 0))
14597
+ //ObjEditor editWindow = object.editWindow;
14598
+ //Object3D copy = editWindow.copy;
14599
+ if (object.doEditClick(ci, 0))
1432214600 {
1432314601 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1432414602 } else
....@@ -14330,7 +14608,11 @@
1433014608
1433114609 public void mouseReleased(MouseEvent e)
1433214610 {
14611
+ Globals.MOUSEDRAGGED = false;
14612
+
1433314613 movingcamera = false;
14614
+ X = 0; // getBounds().width/2;
14615
+ Y = 0; // getBounds().height/2;
1433414616 //System.out.println("mouseReleased: " + e);
1433514617 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1433614618 }
....@@ -14353,9 +14635,9 @@
1435314635 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1435414636 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1435514637
14356
- if (control || command || IsFrozen())
14638
+// No delay if (control || command || IsFrozen())
1435714639 timeout = true;
14358
- else
14640
+// ?? May 2019 else
1435914641 // timer.setDelay((modifiers & 128) != 0?0:350);
1436014642 mouseDown = false;
1436114643 if (!control && !command) // june 2013
....@@ -14465,7 +14747,7 @@
1446514747 System.out.println("keyReleased: " + e);
1446614748 }
1446714749
14468
- void SetMouseMode(int modifiers)
14750
+ void SetMouseMode(int modifiers, int modifiersex)
1446914751 {
1447014752 //System.out.println("SetMouseMode = " + modifiers);
1447114753 //modifiers &= ~1024;
....@@ -14477,25 +14759,25 @@
1447714759 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1447814760 // return;
1447914761 //System.out.println("SetMode = " + modifiers);
14480
- if ((modifiers & WHEEL) == WHEEL)
14762
+ if ((modifiersex & WHEEL) == WHEEL)
1448114763 {
1448214764 mouseMode |= ZOOM;
1448314765 }
1448414766
1448514767 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14486
- if (capsLocked || (modifiers & META) == META)
14768
+ if (capsLocked) // || (modifiers & META) == META)
1448714769 {
1448814770 mouseMode |= VR; // BACKFORTH;
1448914771 }
14490
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14772
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1449114773 {
1449214774 mouseMode |= SELECT;
1449314775 }
14494
- if ((modifiers & COMMAND) == COMMAND)
14776
+ if ((modifiersex & COMMAND) == COMMAND)
1449514777 {
1449614778 mouseMode |= SELECT;
1449714779 }
14498
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14780
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1449914781 {
1450014782 mouseMode &= ~VR;
1450114783 mouseMode |= TRANSLATE;
....@@ -14524,7 +14806,7 @@
1452414806
1452514807 if (isRenderer) //
1452614808 {
14527
- SetMouseMode(modifiers);
14809
+ SetMouseMode(0, modifiers);
1452814810 }
1452914811
1453014812 Globals.theRenderer.keyPressed(key);
....@@ -14671,7 +14953,9 @@
1467114953 case 'E' : COMPACT ^= true;
1467214954 repaint();
1467314955 break;
14674
- case 'W' : DEBUGHSB ^= true;
14956
+ case 'W' : // Wide Window (fullscreen)
14957
+ //DEBUGHSB ^= true;
14958
+ ObjEditor.theFrame.ToggleFullScreen();
1467514959 repaint();
1467614960 break;
1467714961 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14696,8 +14980,8 @@
1469614980 RevertCamera();
1469714981 repaint();
1469814982 break;
14699
- case 'L':
1470014983 case 'l':
14984
+ //case 'L':
1470114985 if (lightMode)
1470214986 {
1470314987 lightMode = false;
....@@ -14840,9 +15124,9 @@
1484015124 case '_':
1484115125 kompactbit = 5;
1484215126 break;
14843
- case '+':
14844
- kompactbit = 6;
14845
- break;
15127
+// case '+':
15128
+// kompactbit = 6;
15129
+// break;
1484615130 case ' ':
1484715131 lightMode ^= true;
1484815132 Globals.lighttouched = true;
....@@ -14854,13 +15138,14 @@
1485415138 case ESC:
1485515139 RENDERPROGRAM += 1;
1485615140 RENDERPROGRAM %= 3;
15141
+
1485715142 repaint();
1485815143 break;
1485915144 case 'Z':
1486015145 //RESIZETEXTURE ^= true;
1486115146 //break;
1486215147 case 'z':
14863
- RENDERSHADOW ^= true;
15148
+ Globals.RENDERSHADOW ^= true;
1486415149 Globals.lighttouched = true;
1486515150 repaint();
1486615151 break;
....@@ -14893,8 +15178,9 @@
1489315178 case DELETE:
1489415179 ClearSelection();
1489515180 break;
14896
- /*
1489715181 case '+':
15182
+
15183
+ /*
1489815184 //fontsize += 1;
1489915185 bbzoom *= 2;
1490015186 repaint();
....@@ -14911,17 +15197,17 @@
1491115197 case '=':
1491215198 IncDepth();
1491315199 //fontsize += 1;
14914
- object.editWindow.refreshContents(true);
15200
+ object.GetWindow().refreshContents(true);
1491515201 maskbit = 6;
1491615202 break;
1491715203 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1491815204 DecDepth();
1491915205 maskbit = 5;
1492015206 //if(fontsize > 1) fontsize -= 1;
14921
- if (object.editWindow == null)
14922
- new Exception().printStackTrace();
14923
- else
14924
- object.editWindow.refreshContents(true);
15207
+// if (object.editWindow == null)
15208
+// new Exception().printStackTrace();
15209
+// else
15210
+ object.GetWindow().refreshContents(true);
1492515211 break;
1492615212 case '{':
1492715213 manipCamera.shaper_fovy /= 1.1;
....@@ -14984,7 +15270,7 @@
1498415270 //mode = ROTATE;
1498515271 if ((MODIFIERS & COMMAND) == 0) // VR??
1498615272 {
14987
- SetMouseMode(modifiers);
15273
+ SetMouseMode(0, modifiers);
1498815274 }
1498915275 }
1499015276
....@@ -15120,7 +15406,7 @@
1512015406 {
1512115407 //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
1512215408 //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15123
- 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)
1512415410 {
1512515411 mouseMoved(e);
1512615412 } else
....@@ -15145,7 +15431,7 @@
1514515431 }
1514615432 */
1514715433
15148
- object.editWindow.EditSelection();
15434
+ object.GetWindow().EditSelection(false);
1514915435 }
1515015436
1515115437 void SelectParent()
....@@ -15162,10 +15448,10 @@
1516215448 {
1516315449 //selectees.remove(i);
1516415450 System.out.println("select parent of " + elem);
15165
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15451
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1516615452 } else
1516715453 {
15168
- group.editWindow.Select(elem.GetTreePath(), first, true);
15454
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1516915455 }
1517015456
1517115457 first = false;
....@@ -15207,12 +15493,12 @@
1520715493 for (int j = 0; j < group.children.size(); j++)
1520815494 {
1520915495 elem = (Object3D) group.children.elementAt(j);
15210
- object.editWindow.Select(elem.GetTreePath(), first, true);
15496
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1521115497 first = false;
1521215498 }
1521315499 } else
1521415500 {
15215
- object.editWindow.Select(elem.GetTreePath(), first, true);
15501
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1521615502 }
1521715503
1521815504 first = false;
....@@ -15223,21 +15509,21 @@
1522315509 {
1522415510 //Composite group = (Composite) object;
1522515511 Object3D group = object;
15226
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15512
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1522715513 }
1522815514
1522915515 void ResetTransform(int mask)
1523015516 {
1523115517 //Composite group = (Composite) object;
1523215518 Object3D group = object;
15233
- group.editWindow.ResetTransform(mask);
15519
+ group.GetWindow().ResetTransform(mask);
1523415520 }
1523515521
1523615522 void FlipTransform()
1523715523 {
1523815524 //Composite group = (Composite) object;
1523915525 Object3D group = object;
15240
- group.editWindow.FlipTransform();
15526
+ group.GetWindow().FlipTransform();
1524115527 // group.editWindow.ReduceMesh(true);
1524215528 }
1524315529
....@@ -15245,7 +15531,7 @@
1524515531 {
1524615532 //Composite group = (Composite) object;
1524715533 Object3D group = object;
15248
- group.editWindow.PrintMemory();
15534
+ group.GetWindow().PrintMemory();
1524915535 // group.editWindow.ReduceMesh(true);
1525015536 }
1525115537
....@@ -15253,7 +15539,7 @@
1525315539 {
1525415540 //Composite group = (Composite) object;
1525515541 Object3D group = object;
15256
- group.editWindow.ResetCentroid();
15542
+ group.GetWindow().ResetCentroid();
1525715543 }
1525815544
1525915545 void IncDepth()
....@@ -15339,7 +15625,9 @@
1533915625 info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom));
1534015626 //Image img = CreateImage(width, height);
1534115627 //System.out.println("width = " + width + "; height = " + height + "\n");
15628
+
1534215629 Graphics gr = g; // img.getGraphics();
15630
+
1534315631 if (!hasMarquee)
1534415632 {
1534515633 if (Xmin < Xmax) // !locked)
....@@ -15427,6 +15715,7 @@
1542715715 info.bounds.y += (height - desired) / 2;
1542815716 }
1542915717 }
15718
+
1543015719 info.g = gr;
1543115720 info.camera = renderCamera;
1543215721 /*
....@@ -15436,15 +15725,55 @@
1543615725 */
1543715726 if (!isRenderer)
1543815727 {
15439
- 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
+ }
1544015767 }
1544115768 }
15769
+
1544215770 if (isRenderer)
1544315771 {
1544415772 //gr.setColor(Color.black);
1544515773 //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1);
1544615774 //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3);
1544715775 }
15776
+
1544815777 if (hasMarquee)
1544915778 {
1545015779 gr.setXORMode(Color.white);
....@@ -15557,6 +15886,7 @@
1555715886 public boolean mouseDown(Event evt, int x, int y)
1555815887 {
1555915888 System.out.println("mouseDown: " + evt);
15889
+ System.exit(0);
1556015890 /*
1556115891 locked = true;
1556215892 drag = false;
....@@ -15600,7 +15930,7 @@
1560015930 {
1560115931 keyPressed(0, modifiers);
1560215932 }
15603
- clickStart(x, y, modifiers);
15933
+ // clickStart(x, y, modifiers);
1560415934 return true;
1560515935 }
1560615936
....@@ -15718,7 +16048,7 @@
1571816048 {
1571916049 keyReleased(0, 0);
1572016050 }
15721
- drag(x, y, modifiers);
16051
+ drag(x, y, 0, modifiers);
1572216052 return true;
1572316053 }
1572416054
....@@ -15850,7 +16180,7 @@
1585016180 Object3D object;
1585116181 static Object3D trackedobject;
1585216182 Camera renderCamera; // Light or Eye (or Occlusion)
15853
- /*static*/ Camera manipCamera; // Light or Eye
16183
+ /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light
1585416184 /*static*/ Camera eyeCamera;
1585516185 /*static*/ Camera lightCamera;
1585616186 int cameracount;
....@@ -16135,16 +16465,16 @@
1613516465 cStatic.objectstack[materialdepth++] = checker;
1613616466 //System.out.println("material " + material);
1613716467 //Applet3D.tracein(this, selected);
16138
- vector2buffer = checker.projectedVertices;
16468
+ //vector2buffer = checker.projectedVertices;
1613916469
1614016470 //checker.GetMaterial().Draw(this, false); // true);
16141
- DrawMaterial(checker.GetMaterial(), false); // true);
16471
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1614216472
1614316473 materialdepth -= 1;
1614416474 if (materialdepth > 0)
1614516475 {
16146
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16147
- 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);
1614816478 }
1614916479 //checker.GetMaterial().opacity = 1f;
1615016480 ////checker.GetMaterial().ambient = 1f;
....@@ -16230,6 +16560,14 @@
1623016560 }
1623116561 }
1623216562
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
+
1623316571 class SelectBuffer implements GLEventListener
1623416572 {
1623516573
....@@ -16309,6 +16647,17 @@
1630916647
1631016648 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1631116649
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
+
1631216661 //int tmp = selection_view;
1631316662 //selection_view = -1;
1631416663 int temp = DrawMode();
....@@ -16320,6 +16669,17 @@
1632016669 // temp = DEFAULT; // patch for selection debug
1632116670 Globals.drawMode = temp; // WARNING
1632216671
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
+
1632316683 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1632416684
1632516685 // trying different ways of getting the depth info over
....@@ -16367,6 +16727,8 @@
1636716727 // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]);
1636816728 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1636916729 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
16730
+
16731
+ CreateSelectedPoint();
1637016732
1637116733 // Will fit the mesh !!!
1637216734 selectedpoint.toParent[0][0] = 0.0001;
....@@ -16416,34 +16778,36 @@
1641616778 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]));
1641716779 }
1641816780
16419
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16781
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1642016782 }
1642116783 }
1642216784
1642316785 if (!movingcamera && !PAINTMODE)
16424
- object.editWindow.ScreenFitPoint(); // fev 2014
16786
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1642516787
16426
- 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)
1642716789 {
16428
- 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);
1642916791
16430
- Object3D group = new Object3D("inst" + paintcount++);
16792
+ if (object.GetWindow().copy.selection.Size() > 0)
16793
+ {
16794
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1643116795
16432
- group.CreateMaterial(); // use a void leaf to select instances
16433
-
16434
- group.add(paintobj); // link
16435
-
16436
- object.editWindow.SnapObject(group);
16437
-
16438
- Object3D folder = object.editWindow.copy;
16439
-
16440
- if (object.editWindow.copy.selection.Size() > 0)
16441
- folder = object.editWindow.copy.selection.elementAt(0);
16442
-
16443
- folder.add(group);
16444
-
16445
- object.editWindow.ResetModel();
16446
- 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
+ }
1644716811 }
1644816812 else
1644916813 paintcount = 0;
....@@ -16482,6 +16846,11 @@
1648216846 //System.out.println("objects[color] = " + objects[color]);
1648316847 //objects[color].Select();
1648416848 indexcount = 0;
16849
+ ObjEditor window = object.GetWindow();
16850
+ if (window != null && deselect)
16851
+ {
16852
+ window.Select(null, deselect, true);
16853
+ }
1648516854 object.Select(color, deselect);
1648616855 }
1648716856
....@@ -16581,7 +16950,7 @@
1658116950 gl.glDisable(gl.GL_CULL_FACE);
1658216951 }
1658316952
16584
- if (!RENDERSHADOW)
16953
+ if (!Globals.RENDERSHADOW)
1658516954 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1658616955
1658716956 // SB gl.glPolygonOffset(2.5f, 10);
....@@ -16591,7 +16960,7 @@
1659116960 //gl.glColorMask(false, false, false, false);
1659216961
1659316962 //render_scene_from_light_view(gl, drawable, 0, 0);
16594
- if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
16963
+ if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed())
1659516964 {
1659616965 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1659716966
....@@ -17007,23 +17376,15 @@
1700717376 int AAbuffersize = 0;
1700817377
1700917378 //double[] selectedpoint = new double[3];
17010
- static Superellipsoid selectedpoint = new Superellipsoid();
17379
+ static Superellipsoid selectedpoint;
1701117380 static Sphere previousselectedpoint = null;
17012
- static Sphere debugpointG = new Sphere();
17013
- static Sphere debugpointP = new Sphere();
17014
- static Sphere debugpointC = new Sphere();
17015
- static Sphere debugpointR = new Sphere();
17381
+ static Sphere debugpointG;
17382
+ static Sphere debugpointP;
17383
+ static Sphere debugpointC;
17384
+ static Sphere debugpointR;
1701617385
1701717386 static Sphere debugpoints[] = new Sphere[8];
1701817387
17019
- static
17020
- {
17021
- for (int i=0; i<8; i++)
17022
- {
17023
- debugpoints[i] = new Sphere();
17024
- }
17025
- }
17026
-
1702717388 static void InitPoints(float radius)
1702817389 {
1702917390 for (int i=0; i<8; i++)