Normand Briere
2019-07-21 5a546232b84ce65d8779d29e9171e7e2df013614
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 {
....@@ -7900,7 +7930,7 @@
79007930 String pigment = Object3D.GetPigment(tex);
79017931 String bump = Object3D.GetBump(tex);
79027932
7903
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7933
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79047934 {
79057935 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79067936 // System.out.println("; bump = " + bump);
....@@ -7917,6 +7947,64 @@
79177947
79187948 ReleaseTexture(bump, true);
79197949 ReleaseTexture(pigment, false);
7950
+ }
7951
+
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);
79208008 }
79218009
79228010 void ReleaseTexture(String tex, boolean bump)
....@@ -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)
....@@ -8043,7 +8131,7 @@
80438131 usedtextures.put(pigment, pigment);
80448132 usedtextures.put(bump, bump);
80458133
8046
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8134
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
80478135 {
80488136 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
80498137 // System.out.println("; bump = " + bump);
....@@ -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,21 +8503,21 @@
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
+ boolean BindTexture(String tex, boolean bump, int resolution) throws Exception
83318514 {
83328515 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
83338516 {
83348517 return false;
83358518 }
83368519
8337
- boolean newtex = false;
8520
+ //boolean newtex = false;
83388521
83398522 com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
83408523
....@@ -8366,7 +8549,7 @@
83668549 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT);
83678550 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT);
83688551
8369
- return newtex;
8552
+ return true; // Warning: not used.
83708553 }
83718554
83728555 ShadowBuffer shadowPBuf;
....@@ -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;" +
....@@ -12754,7 +13008,7 @@
1275413008 "MUL final.y, fragment.texcoord[0].x, c256;" +
1275513009 "FLR final.x, final.y;" +
1275613010 "SUB final.y, final.y, final.x;" +
12757
- //"MUL final.x, final.x, c256i;" +
13011
+ "MUL final.x, final.x, c256i;" +
1275813012 "MOV final.z, zero.x;" +
1275913013 "MOV final.a, one.w;":""
1276013014 ) +
....@@ -12762,7 +13016,7 @@
1276213016 "MUL final.y, fragment.texcoord[0].y, c256;" +
1276313017 "FLR final.x, final.y;" +
1276413018 "SUB final.y, final.y, final.x;" +
12765
- //"MUL final.x, final.x, c256i;" +
13019
+ "MUL final.x, final.x, c256i;" +
1276613020 "MOV final.z, zero.x;" +
1276713021 "MOV final.a, one.w;":""
1276813022 ) +
....@@ -12805,7 +13059,7 @@
1280513059 //once = true;
1280613060 }
1280713061
12808
- System.out.print("Program #" + mode + "; length = " + program.length());
13062
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
1280913063 System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
1281013064 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1281113065
....@@ -12938,12 +13192,16 @@
1293813192
1293913193 "ADD " + depth + ".z, " + depth + ".z, temp.x;" +
1294013194 //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing!
13195
+
13196
+ // Compare fragment depth in light space with shadowmap.
1294113197 "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" +
1294213198 "SGE temp.y, temp.x, zero.x;" +
12943
- "SUB " + shadow + ".y, one.x, temp.y;" +
13199
+ "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded
13200
+
13201
+ // Reverse comparison
1294413202 "SUB temp.x, one.x, temp.x;" +
1294513203 "MUL " + shadow + ".x, temp.x, temp.y;" +
12946
- "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded
13204
+ "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse
1294713205 "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth
1294813206
1294913207 "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" +
....@@ -12957,6 +13215,10 @@
1295713215 // No shadow for backface
1295813216 "DP3 temp.x, normal, lightd;" +
1295913217 "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;" +
1296013222 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1296113223 "";
1296213224 }
....@@ -13103,7 +13365,8 @@
1310313365 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1310413366 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1310513367 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13106
- Object3D.cVector2[] vector2buffer;
13368
+
13369
+ //Object3D.cVector2[] vector2buffer;
1310713370
1310813371 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1310913372 // OUT : diff, spec
....@@ -13119,9 +13382,10 @@
1311913382 "DP3 " + dest + ".z," + "normals," + "eye;" +
1312013383 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1312113384 //"MOV " + dest + ".w," + "normal.z;" +
13122
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13123
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13124
- //"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
1312513389 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1312613390 "RCP " + dest + ".w," + dest + ".w;" +
1312713391 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13515,7 +13779,7 @@
1351513779 public void mousePressed(MouseEvent e)
1351613780 {
1351713781 //System.out.println("mousePressed: " + e);
13518
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13782
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1351913783 }
1352013784
1352113785 static long prevtime = 0;
....@@ -13591,8 +13855,8 @@
1359113855 // mode |= META;
1359213856 //}
1359313857
13594
- SetMouseMode(WHEEL | e.getModifiersEx());
13595
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13858
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13859
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1359613860 anchorX = ax;
1359713861 anchorY = ay;
1359813862 prevX = px;
....@@ -13626,6 +13890,7 @@
1362613890 else
1362713891 if (evt.getSource() == AAtimer)
1362813892 {
13893
+ Globals.TIMERRUNNING = false;
1362913894 if (mouseDown)
1363013895 {
1363113896 //new Exception().printStackTrace();
....@@ -13651,6 +13916,10 @@
1365113916 // LIVE = waslive;
1365213917 // wasliveok = true;
1365313918 // waslive = false;
13919
+
13920
+ // May 2019 Forget it:
13921
+ if (true)
13922
+ return;
1365413923
1365513924 // source == timer
1365613925 if (mouseDown)
....@@ -13681,7 +13950,7 @@
1368113950
1368213951 // fev 2014???
1368313952 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13684
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13953
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1368513954 pingthread.StepToTarget(true); // true);
1368613955 }
1368713956 // if (!LIVE)
....@@ -13690,12 +13959,13 @@
1369013959
1369113960 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1369213961
13693
- void clickStart(int x, int y, int modifiers)
13962
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1369413963 {
1369513964 if (!wasliveok)
1369613965 return;
1369713966
1369813967 AAtimer.restart(); //
13968
+ Globals.TIMERRUNNING = true;
1369913969
1370013970 // waslive = LIVE;
1370113971 // LIVE = false;
....@@ -13707,7 +13977,7 @@
1370713977 // touched = true; // main DL
1370813978 if (isRenderer)
1370913979 {
13710
- SetMouseMode(modifiers);
13980
+ SetMouseMode(modifiers, modifiersex);
1371113981 }
1371213982
1371313983 selectX = anchorX = x;
....@@ -13720,7 +13990,7 @@
1372013990 clicked = true;
1372113991 hold = false;
1372213992
13723
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13993
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1372413994 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1372513995 {
1372613996 // System.out.println("RESTART II " + modifiers);
....@@ -13751,7 +14021,7 @@
1375114021 info.camera = renderCamera;
1375214022 info.x = x;
1375314023 info.y = y;
13754
- info.modifiers = modifiers;
14024
+ info.modifiers = modifiersex;
1375514025 editObj = object.doEditClick(info, 0);
1375614026 if (!editObj)
1375714027 {
....@@ -13768,9 +14038,12 @@
1376814038
1376914039 public void mouseDragged(MouseEvent e)
1377014040 {
14041
+ Globals.MOUSEDRAGGED = true;
14042
+
1377114043 //System.out.println("mouseDragged: " + e);
1377214044 if (isRenderer)
1377314045 movingcamera = true;
14046
+
1377414047 //if (drawing)
1377514048 //return;
1377614049 if ((e.getModifiersEx() & CTRL) != 0
....@@ -13780,7 +14053,7 @@
1378014053 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1378114054 }
1378214055 else
13783
- drag(e.getX(), e.getY(), e.getModifiersEx());
14056
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1378414057
1378514058 //try { Thread.sleep(1); } catch (Exception ex) {}
1378614059 }
....@@ -14017,7 +14290,7 @@
1401714290 {
1401814291 Globals.lighttouched = true;
1401914292 }
14020
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14293
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1402114294 }
1402214295 //else
1402314296 }
....@@ -14031,12 +14304,12 @@
1403114304 void GoDown(int mod)
1403214305 {
1403314306 MODIFIERS |= COMMAND;
14034
- /*
14307
+ /**/
1403514308 if((mod&SHIFT) == SHIFT)
1403614309 manipCamera.RotatePosition(0, -speed);
1403714310 else
14038
- manipCamera.BackForth(0, -speed*delta, getWidth());
14039
- */
14311
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14312
+ /**/
1404014313 if ((mod & SHIFT) == SHIFT)
1404114314 {
1404214315 mouseMode = mouseMode; // VR??
....@@ -14052,12 +14325,12 @@
1405214325 void GoUp(int mod)
1405314326 {
1405414327 MODIFIERS |= COMMAND;
14055
- /*
14328
+ /**/
1405614329 if((mod&SHIFT) == SHIFT)
1405714330 manipCamera.RotatePosition(0, speed);
1405814331 else
14059
- manipCamera.BackForth(0, speed*delta, getWidth());
14060
- */
14332
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14333
+ /**/
1406114334 if ((mod & SHIFT) == SHIFT)
1406214335 {
1406314336 mouseMode = mouseMode;
....@@ -14073,12 +14346,12 @@
1407314346 void GoLeft(int mod)
1407414347 {
1407514348 MODIFIERS |= COMMAND;
14076
- /*
14349
+ /**/
1407714350 if((mod&SHIFT) == SHIFT)
14078
- manipCamera.RotatePosition(speed, 0);
14079
- else
1408014351 manipCamera.Translate(speed*delta, 0, getWidth());
14081
- */
14352
+ else
14353
+ manipCamera.RotatePosition(speed, 0);
14354
+ /**/
1408214355 if ((mod & SHIFT) == SHIFT)
1408314356 {
1408414357 mouseMode = mouseMode;
....@@ -14094,12 +14367,12 @@
1409414367 void GoRight(int mod)
1409514368 {
1409614369 MODIFIERS |= COMMAND;
14097
- /*
14370
+ /**/
1409814371 if((mod&SHIFT) == SHIFT)
14099
- manipCamera.RotatePosition(-speed, 0);
14100
- else
1410114372 manipCamera.Translate(-speed*delta, 0, getWidth());
14102
- */
14373
+ else
14374
+ manipCamera.RotatePosition(-speed, 0);
14375
+ /**/
1410314376 if ((mod & SHIFT) == SHIFT)
1410414377 {
1410514378 mouseMode = mouseMode;
....@@ -14117,7 +14390,7 @@
1411714390 int X, Y;
1411814391 boolean SX, SY;
1411914392
14120
- void drag(int x, int y, int modifiers)
14393
+ void drag(int x, int y, int modifiers, int modifiersex)
1412114394 {
1412214395 if (IsFrozen())
1412314396 {
....@@ -14126,17 +14399,17 @@
1412614399
1412714400 drag = true; // NEW
1412814401
14129
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14402
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1413014403
1413114404 X = x;
1413214405 Y = y;
1413314406 // floating state for animation
14134
- MODIFIERS = modifiers;
14135
- modifiers &= ~1024;
14407
+ MODIFIERS = modifiersex;
14408
+ modifiersex &= ~1024;
1413614409 if (false) // modifiers != 0)
1413714410 {
1413814411 //new Exception().printStackTrace();
14139
- System.out.println("mouseDragged: " + modifiers);
14412
+ System.out.println("mouseDragged: " + modifiersex);
1414014413 System.out.println("SHIFT = " + SHIFT);
1414114414 System.out.println("CONTROL = " + COMMAND);
1414214415 System.out.println("META = " + META);
....@@ -14156,7 +14429,8 @@
1415614429 info.camera = renderCamera;
1415714430 info.x = x;
1415814431 info.y = y;
14159
- object.editWindow.copy.doEditDrag(info);
14432
+ object.GetWindow().copy
14433
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1416014434 } else
1416114435 {
1416214436 if (x < startX)
....@@ -14320,7 +14594,9 @@
1432014594 ci.camera = renderCamera;
1432114595 if (!isRenderer)
1432214596 {
14323
- if (object.editWindow.copy.doEditClick(ci, 0))
14597
+ //ObjEditor editWindow = object.editWindow;
14598
+ //Object3D copy = editWindow.copy;
14599
+ if (object.doEditClick(ci, 0))
1432414600 {
1432514601 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1432614602 } else
....@@ -14332,7 +14608,11 @@
1433214608
1433314609 public void mouseReleased(MouseEvent e)
1433414610 {
14611
+ Globals.MOUSEDRAGGED = false;
14612
+
1433514613 movingcamera = false;
14614
+ X = 0; // getBounds().width/2;
14615
+ Y = 0; // getBounds().height/2;
1433614616 //System.out.println("mouseReleased: " + e);
1433714617 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1433814618 }
....@@ -14355,9 +14635,9 @@
1435514635 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1435614636 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1435714637
14358
- if (control || command || IsFrozen())
14638
+// No delay if (control || command || IsFrozen())
1435914639 timeout = true;
14360
- else
14640
+// ?? May 2019 else
1436114641 // timer.setDelay((modifiers & 128) != 0?0:350);
1436214642 mouseDown = false;
1436314643 if (!control && !command) // june 2013
....@@ -14467,7 +14747,7 @@
1446714747 System.out.println("keyReleased: " + e);
1446814748 }
1446914749
14470
- void SetMouseMode(int modifiers)
14750
+ void SetMouseMode(int modifiers, int modifiersex)
1447114751 {
1447214752 //System.out.println("SetMouseMode = " + modifiers);
1447314753 //modifiers &= ~1024;
....@@ -14479,25 +14759,25 @@
1447914759 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1448014760 // return;
1448114761 //System.out.println("SetMode = " + modifiers);
14482
- if ((modifiers & WHEEL) == WHEEL)
14762
+ if ((modifiersex & WHEEL) == WHEEL)
1448314763 {
1448414764 mouseMode |= ZOOM;
1448514765 }
1448614766
1448714767 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14488
- if (capsLocked || (modifiers & META) == META)
14768
+ if (capsLocked) // || (modifiers & META) == META)
1448914769 {
1449014770 mouseMode |= VR; // BACKFORTH;
1449114771 }
14492
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14772
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1449314773 {
1449414774 mouseMode |= SELECT;
1449514775 }
14496
- if ((modifiers & COMMAND) == COMMAND)
14776
+ if ((modifiersex & COMMAND) == COMMAND)
1449714777 {
1449814778 mouseMode |= SELECT;
1449914779 }
14500
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14780
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1450114781 {
1450214782 mouseMode &= ~VR;
1450314783 mouseMode |= TRANSLATE;
....@@ -14526,7 +14806,7 @@
1452614806
1452714807 if (isRenderer) //
1452814808 {
14529
- SetMouseMode(modifiers);
14809
+ SetMouseMode(0, modifiers);
1453014810 }
1453114811
1453214812 Globals.theRenderer.keyPressed(key);
....@@ -14673,7 +14953,9 @@
1467314953 case 'E' : COMPACT ^= true;
1467414954 repaint();
1467514955 break;
14676
- case 'W' : DEBUGHSB ^= true;
14956
+ case 'W' : // Wide Window (fullscreen)
14957
+ //DEBUGHSB ^= true;
14958
+ ObjEditor.theFrame.ToggleFullScreen();
1467714959 repaint();
1467814960 break;
1467914961 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14698,8 +14980,8 @@
1469814980 RevertCamera();
1469914981 repaint();
1470014982 break;
14701
- case 'L':
1470214983 case 'l':
14984
+ //case 'L':
1470314985 if (lightMode)
1470414986 {
1470514987 lightMode = false;
....@@ -14842,9 +15124,9 @@
1484215124 case '_':
1484315125 kompactbit = 5;
1484415126 break;
14845
- case '+':
14846
- kompactbit = 6;
14847
- break;
15127
+// case '+':
15128
+// kompactbit = 6;
15129
+// break;
1484815130 case ' ':
1484915131 lightMode ^= true;
1485015132 Globals.lighttouched = true;
....@@ -14856,13 +15138,14 @@
1485615138 case ESC:
1485715139 RENDERPROGRAM += 1;
1485815140 RENDERPROGRAM %= 3;
15141
+
1485915142 repaint();
1486015143 break;
1486115144 case 'Z':
1486215145 //RESIZETEXTURE ^= true;
1486315146 //break;
1486415147 case 'z':
14865
- RENDERSHADOW ^= true;
15148
+ Globals.RENDERSHADOW ^= true;
1486615149 Globals.lighttouched = true;
1486715150 repaint();
1486815151 break;
....@@ -14895,8 +15178,9 @@
1489515178 case DELETE:
1489615179 ClearSelection();
1489715180 break;
14898
- /*
1489915181 case '+':
15182
+
15183
+ /*
1490015184 //fontsize += 1;
1490115185 bbzoom *= 2;
1490215186 repaint();
....@@ -14913,17 +15197,17 @@
1491315197 case '=':
1491415198 IncDepth();
1491515199 //fontsize += 1;
14916
- object.editWindow.refreshContents(true);
15200
+ object.GetWindow().refreshContents(true);
1491715201 maskbit = 6;
1491815202 break;
1491915203 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1492015204 DecDepth();
1492115205 maskbit = 5;
1492215206 //if(fontsize > 1) fontsize -= 1;
14923
- if (object.editWindow == null)
14924
- new Exception().printStackTrace();
14925
- else
14926
- object.editWindow.refreshContents(true);
15207
+// if (object.editWindow == null)
15208
+// new Exception().printStackTrace();
15209
+// else
15210
+ object.GetWindow().refreshContents(true);
1492715211 break;
1492815212 case '{':
1492915213 manipCamera.shaper_fovy /= 1.1;
....@@ -14986,7 +15270,7 @@
1498615270 //mode = ROTATE;
1498715271 if ((MODIFIERS & COMMAND) == 0) // VR??
1498815272 {
14989
- SetMouseMode(modifiers);
15273
+ SetMouseMode(0, modifiers);
1499015274 }
1499115275 }
1499215276
....@@ -15122,7 +15406,7 @@
1512215406 {
1512315407 //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
1512415408 //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15125
- 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)
1512615410 {
1512715411 mouseMoved(e);
1512815412 } else
....@@ -15147,7 +15431,7 @@
1514715431 }
1514815432 */
1514915433
15150
- object.editWindow.EditSelection();
15434
+ object.GetWindow().EditSelection(false);
1515115435 }
1515215436
1515315437 void SelectParent()
....@@ -15164,10 +15448,10 @@
1516415448 {
1516515449 //selectees.remove(i);
1516615450 System.out.println("select parent of " + elem);
15167
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15451
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1516815452 } else
1516915453 {
15170
- group.editWindow.Select(elem.GetTreePath(), first, true);
15454
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1517115455 }
1517215456
1517315457 first = false;
....@@ -15209,12 +15493,12 @@
1520915493 for (int j = 0; j < group.children.size(); j++)
1521015494 {
1521115495 elem = (Object3D) group.children.elementAt(j);
15212
- object.editWindow.Select(elem.GetTreePath(), first, true);
15496
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1521315497 first = false;
1521415498 }
1521515499 } else
1521615500 {
15217
- object.editWindow.Select(elem.GetTreePath(), first, true);
15501
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1521815502 }
1521915503
1522015504 first = false;
....@@ -15225,21 +15509,21 @@
1522515509 {
1522615510 //Composite group = (Composite) object;
1522715511 Object3D group = object;
15228
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15512
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1522915513 }
1523015514
1523115515 void ResetTransform(int mask)
1523215516 {
1523315517 //Composite group = (Composite) object;
1523415518 Object3D group = object;
15235
- group.editWindow.ResetTransform(mask);
15519
+ group.GetWindow().ResetTransform(mask);
1523615520 }
1523715521
1523815522 void FlipTransform()
1523915523 {
1524015524 //Composite group = (Composite) object;
1524115525 Object3D group = object;
15242
- group.editWindow.FlipTransform();
15526
+ group.GetWindow().FlipTransform();
1524315527 // group.editWindow.ReduceMesh(true);
1524415528 }
1524515529
....@@ -15247,7 +15531,7 @@
1524715531 {
1524815532 //Composite group = (Composite) object;
1524915533 Object3D group = object;
15250
- group.editWindow.PrintMemory();
15534
+ group.GetWindow().PrintMemory();
1525115535 // group.editWindow.ReduceMesh(true);
1525215536 }
1525315537
....@@ -15255,7 +15539,7 @@
1525515539 {
1525615540 //Composite group = (Composite) object;
1525715541 Object3D group = object;
15258
- group.editWindow.ResetCentroid();
15542
+ group.GetWindow().ResetCentroid();
1525915543 }
1526015544
1526115545 void IncDepth()
....@@ -15341,7 +15625,9 @@
1534115625 info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom));
1534215626 //Image img = CreateImage(width, height);
1534315627 //System.out.println("width = " + width + "; height = " + height + "\n");
15628
+
1534415629 Graphics gr = g; // img.getGraphics();
15630
+
1534515631 if (!hasMarquee)
1534615632 {
1534715633 if (Xmin < Xmax) // !locked)
....@@ -15429,6 +15715,7 @@
1542915715 info.bounds.y += (height - desired) / 2;
1543015716 }
1543115717 }
15718
+
1543215719 info.g = gr;
1543315720 info.camera = renderCamera;
1543415721 /*
....@@ -15438,15 +15725,55 @@
1543815725 */
1543915726 if (!isRenderer)
1544015727 {
15441
- 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
+ }
1544215767 }
1544315768 }
15769
+
1544415770 if (isRenderer)
1544515771 {
1544615772 //gr.setColor(Color.black);
1544715773 //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1);
1544815774 //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3);
1544915775 }
15776
+
1545015777 if (hasMarquee)
1545115778 {
1545215779 gr.setXORMode(Color.white);
....@@ -15559,6 +15886,7 @@
1555915886 public boolean mouseDown(Event evt, int x, int y)
1556015887 {
1556115888 System.out.println("mouseDown: " + evt);
15889
+ System.exit(0);
1556215890 /*
1556315891 locked = true;
1556415892 drag = false;
....@@ -15602,7 +15930,7 @@
1560215930 {
1560315931 keyPressed(0, modifiers);
1560415932 }
15605
- clickStart(x, y, modifiers);
15933
+ // clickStart(x, y, modifiers);
1560615934 return true;
1560715935 }
1560815936
....@@ -15720,7 +16048,7 @@
1572016048 {
1572116049 keyReleased(0, 0);
1572216050 }
15723
- drag(x, y, modifiers);
16051
+ drag(x, y, 0, modifiers);
1572416052 return true;
1572516053 }
1572616054
....@@ -15852,7 +16180,7 @@
1585216180 Object3D object;
1585316181 static Object3D trackedobject;
1585416182 Camera renderCamera; // Light or Eye (or Occlusion)
15855
- /*static*/ Camera manipCamera; // Light or Eye
16183
+ /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light
1585616184 /*static*/ Camera eyeCamera;
1585716185 /*static*/ Camera lightCamera;
1585816186 int cameracount;
....@@ -16137,16 +16465,16 @@
1613716465 cStatic.objectstack[materialdepth++] = checker;
1613816466 //System.out.println("material " + material);
1613916467 //Applet3D.tracein(this, selected);
16140
- vector2buffer = checker.projectedVertices;
16468
+ //vector2buffer = checker.projectedVertices;
1614116469
1614216470 //checker.GetMaterial().Draw(this, false); // true);
16143
- DrawMaterial(checker.GetMaterial(), false); // true);
16471
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1614416472
1614516473 materialdepth -= 1;
1614616474 if (materialdepth > 0)
1614716475 {
16148
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16149
- 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);
1615016478 }
1615116479 //checker.GetMaterial().opacity = 1f;
1615216480 ////checker.GetMaterial().ambient = 1f;
....@@ -16232,6 +16560,14 @@
1623216560 }
1623316561 }
1623416562
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
+
1623516571 class SelectBuffer implements GLEventListener
1623616572 {
1623716573
....@@ -16311,6 +16647,17 @@
1631116647
1631216648 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1631316649
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
+
1631416661 //int tmp = selection_view;
1631516662 //selection_view = -1;
1631616663 int temp = DrawMode();
....@@ -16322,6 +16669,17 @@
1632216669 // temp = DEFAULT; // patch for selection debug
1632316670 Globals.drawMode = temp; // WARNING
1632416671
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
+
1632516683 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1632616684
1632716685 // trying different ways of getting the depth info over
....@@ -16369,6 +16727,8 @@
1636916727 // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]);
1637016728 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1637116729 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
16730
+
16731
+ CreateSelectedPoint();
1637216732
1637316733 // Will fit the mesh !!!
1637416734 selectedpoint.toParent[0][0] = 0.0001;
....@@ -16418,34 +16778,36 @@
1641816778 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]));
1641916779 }
1642016780
16421
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16781
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1642216782 }
1642316783 }
1642416784
1642516785 if (!movingcamera && !PAINTMODE)
16426
- object.editWindow.ScreenFitPoint(); // fev 2014
16786
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1642716787
16428
- 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)
1642916789 {
16430
- 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);
1643116791
16432
- Object3D group = new Object3D("inst" + paintcount++);
16792
+ if (object.GetWindow().copy.selection.Size() > 0)
16793
+ {
16794
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1643316795
16434
- group.CreateMaterial(); // use a void leaf to select instances
16435
-
16436
- group.add(paintobj); // link
16437
-
16438
- object.editWindow.SnapObject(group);
16439
-
16440
- Object3D folder = object.editWindow.copy;
16441
-
16442
- if (object.editWindow.copy.selection.Size() > 0)
16443
- folder = object.editWindow.copy.selection.elementAt(0);
16444
-
16445
- folder.add(group);
16446
-
16447
- object.editWindow.ResetModel();
16448
- 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
+ }
1644916811 }
1645016812 else
1645116813 paintcount = 0;
....@@ -16484,6 +16846,11 @@
1648416846 //System.out.println("objects[color] = " + objects[color]);
1648516847 //objects[color].Select();
1648616848 indexcount = 0;
16849
+ ObjEditor window = object.GetWindow();
16850
+ if (window != null && deselect)
16851
+ {
16852
+ window.Select(null, deselect, true);
16853
+ }
1648716854 object.Select(color, deselect);
1648816855 }
1648916856
....@@ -16583,7 +16950,7 @@
1658316950 gl.glDisable(gl.GL_CULL_FACE);
1658416951 }
1658516952
16586
- if (!RENDERSHADOW)
16953
+ if (!Globals.RENDERSHADOW)
1658716954 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1658816955
1658916956 // SB gl.glPolygonOffset(2.5f, 10);
....@@ -16593,7 +16960,7 @@
1659316960 //gl.glColorMask(false, false, false, false);
1659416961
1659516962 //render_scene_from_light_view(gl, drawable, 0, 0);
16596
- if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
16963
+ if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed())
1659716964 {
1659816965 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1659916966
....@@ -17009,23 +17376,15 @@
1700917376 int AAbuffersize = 0;
1701017377
1701117378 //double[] selectedpoint = new double[3];
17012
- static Superellipsoid selectedpoint = new Superellipsoid();
17379
+ static Superellipsoid selectedpoint;
1701317380 static Sphere previousselectedpoint = null;
17014
- static Sphere debugpointG = new Sphere();
17015
- static Sphere debugpointP = new Sphere();
17016
- static Sphere debugpointC = new Sphere();
17017
- static Sphere debugpointR = new Sphere();
17381
+ static Sphere debugpointG;
17382
+ static Sphere debugpointP;
17383
+ static Sphere debugpointC;
17384
+ static Sphere debugpointR;
1701817385
1701917386 static Sphere debugpoints[] = new Sphere[8];
1702017387
17021
- static
17022
- {
17023
- for (int i=0; i<8; i++)
17024
- {
17025
- debugpoints[i] = new Sphere();
17026
- }
17027
- }
17028
-
1702917388 static void InitPoints(float radius)
1703017389 {
1703117390 for (int i=0; i<8; i++)