Normand Briere
2019-07-21 76522bc3ee92bd50dbd946d7f865666be4ad7bac
CameraPane.java
....@@ -37,7 +37,6 @@
3737 static boolean[] selectedstack = new boolean[65536];
3838 static int materialdepth = 0;
3939
40
- static boolean DEBUG = false;
4140 static boolean FRUSTUM = false; // still bogus true; // frustum culling
4241
4342 // camera change fix
....@@ -149,6 +148,8 @@
149148 defaultcaps.setAccumBlueBits(16);
150149 defaultcaps.setAccumAlphaBits(16);
151150 }
151
+
152
+ private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory();
152153
153154 void SetAsGLRenderer(boolean b)
154155 {
....@@ -325,7 +326,7 @@
325326 cStatic.objectstack[materialdepth++] = obj;
326327 //System.out.println("material " + material);
327328 //Applet3D.tracein(this, selected);
328
- display.vector2buffer = obj.projectedVertices;
329
+ //display.vector2buffer = obj.projectedVertices;
329330 if (obj instanceof Camera)
330331 {
331332 display.options1[0] = material.shift;
....@@ -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();
....@@ -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
....@@ -2257,7 +2280,7 @@
22572280
22582281 void ToggleDebug()
22592282 {
2260
- DEBUG ^= true;
2283
+ Globals.DEBUG ^= true;
22612284 }
22622285
22632286 void ToggleLookAt()
....@@ -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)
....@@ -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,6 +8155,93 @@
80678155 return; // true;
80688156 }
80698157
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
+
80708245 CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception
80718246 {
80728247 CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
....@@ -8075,15 +8250,17 @@
80758250 {
80768251 String texname = tex;
80778252
8253
+ String fallbackTextureName = defaultDirectory + "/Textures/" + texname;
8254
+
80788255 // String[] split = tex.split("Textures");
80798256 // if (split.length > 1)
80808257 // texname = "/Users/nbriere/Textures" + split[split.length-1];
80818258 // else
80828259 // if (!texname.startsWith("/"))
80838260 // texname = "/Users/nbriere/Textures/" + texname;
8084
- if (!new File(tex).exists())
8261
+ if (!FileExists(tex))
80858262 {
8086
- texname = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory() + "/Textures/" + texname;
8263
+ texname = fallbackTextureName;
80878264 }
80888265
80898266 if (CACHETEXTURE)
....@@ -8153,7 +8330,7 @@
81538330 }
81548331
81558332 cachename = texname.substring(0, texname.length()-4)+ext+".jpg";
8156
- if (!new File(cachename).exists())
8333
+ if (!FileExists(cachename))
81578334 cachename = texname;
81588335 else
81598336 processbump = false; // don't process bump map again
....@@ -8175,7 +8352,7 @@
81758352 }
81768353
81778354 cachename = texname.substring(0, texname.length()-4)+ext+".png";
8178
- if (!new File(cachename).exists())
8355
+ if (!FileExists(cachename))
81798356 cachename = texname;
81808357 else
81818358 processbump = false; // don't process bump map again
....@@ -8340,7 +8517,7 @@
83408517 return false;
83418518 }
83428519
8343
- boolean newtex = false;
8520
+ //boolean newtex = false;
83448521
83458522 com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
83468523
....@@ -8372,7 +8549,7 @@
83728549 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT);
83738550 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT);
83748551
8375
- return newtex;
8552
+ return true; // Warning: not used.
83768553 }
83778554
83788555 ShadowBuffer shadowPBuf;
....@@ -9210,11 +9387,35 @@
92109387 jy8[3] = 0.5f;
92119388 }
92129389
9213
- 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
92149391 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
92159392 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
92169393 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
92179394
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
+
92189419 static int imagecount = 0; // movie generation
92199420
92209421 static int jitter = 0;
....@@ -9310,8 +9511,8 @@
93109511 assert (parentcam != renderCamera);
93119512
93129513 if (renderCamera != lightCamera)
9313
- for (int count = parentcam.GetTransformCount(); --count>=0;)
9314
- LA.matConcat(matrix, parentcam.toParent, matrix);
9514
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
9515
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
93159516
93169517 // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix);
93179518
....@@ -9326,8 +9527,8 @@
93269527 LA.matCopy(renderCamera.fromScreen, matrix);
93279528
93289529 if (renderCamera != lightCamera)
9329
- for (int count = parentcam.GetTransformCount(); --count>=0;)
9330
- LA.matConcat(parentcam.fromParent, matrix, matrix);
9530
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
9531
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
93319532
93329533 // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix);
93339534
....@@ -10325,6 +10526,7 @@
1032510526 ANTIALIAS = 0;
1032610527 //System.out.println("RESTART");
1032710528 AAtimer.restart();
10529
+ Globals.TIMERRUNNING = true;
1032810530 }
1032910531 }
1033010532 }
....@@ -10392,7 +10594,8 @@
1039210594 ambientOcclusion = false;
1039310595 }
1039410596
10395
- if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
10597
+ if (//Globals.lighttouched &&
10598
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1039610599 {
1039710600 //if (RENDERSHADOW) // ?
1039810601 if (!IsFrozen())
....@@ -10525,8 +10728,8 @@
1052510728
1052610729 // if (parentcam != renderCamera) // not a light
1052710730 if (cam != lightCamera)
10528
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10529
- LA.matConcat(matrix, parentcam.toParent, matrix);
10731
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
10732
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
1053010733
1053110734 for (int j = 0; j < 4; j++)
1053210735 {
....@@ -10540,8 +10743,8 @@
1054010743
1054110744 // if (parentcam != renderCamera) // not a light
1054210745 if (cam != lightCamera)
10543
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10544
- LA.matConcat(parentcam.fromParent, matrix, matrix);
10746
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
10747
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
1054510748
1054610749 //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix);
1054710750
....@@ -10832,9 +11035,9 @@
1083211035
1083311036 gl.glMatrixMode(GL.GL_MODELVIEW);
1083411037
10835
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
10836
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
10837
-//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);
1083811041 } else
1083911042 {
1084011043 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -10845,7 +11048,7 @@
1084511048 //System.out.println("BLENDING ON");
1084611049 gl.glEnable(GL.GL_BLEND);
1084711050 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
10848
-
11051
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1084911052 gl.glMatrixMode(gl.GL_PROJECTION);
1085011053 gl.glLoadIdentity();
1085111054
....@@ -10934,8 +11137,8 @@
1093411137 System.err.println("parentcam != renderCamera");
1093511138
1093611139 // if (cam != lightCamera)
10937
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10938
- 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
1093911142 }
1094011143
1094111144 LA.xformDir(lightposition, cam.toScreen, lightposition);
....@@ -10956,8 +11159,8 @@
1095611159 if (true) // TODO
1095711160 {
1095811161 if (cam != lightCamera)
10959
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10960
- 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
1096111164 }
1096211165
1096311166 LA.xformPos(light0, cam.toScreen, light0);
....@@ -11302,15 +11505,36 @@
1130211505
1130311506 static boolean zoomonce = false;
1130411507
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
+
1130511526 void DrawObject(GL gl, boolean draw)
1130611527 {
11528
+ // To clear camera values
11529
+ ResetOptions();
11530
+
1130711531 //System.out.println("DRAW OBJECT " + mouseDown);
1130811532 // DrawMode() = SELECTION;
1130911533 //GL gl = getGL();
1131011534 if ((TRACK || SHADOWTRACK) || zoomonce)
1131111535 {
1131211536 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11313
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11537
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1131411538 pingthread.StepToTarget(true); // true);
1131511539 // zoomonce = false;
1131611540 }
....@@ -11382,8 +11606,9 @@
1138211606
1138311607 if (DrawMode() == DEFAULT)
1138411608 {
11385
- if (DEBUG)
11609
+ if (Globals.DEBUG)
1138611610 {
11611
+ CreateSelectedPoint();
1138711612 float radius = 0.05f;
1138811613 if (selectedpoint.radius != radius)
1138911614 {
....@@ -11869,8 +12094,8 @@
1186912094 //obj.TransformToWorld(light, light);
1187012095 for (int i = tp.size(); --i >= 0;)
1187112096 {
11872
- for (int count = tp.get(i).GetTransformCount(); --count>=0;)
11873
- 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);
1187412099 }
1187512100
1187612101
....@@ -11887,8 +12112,8 @@
1188712112 parentcam = cameras[0];
1188812113 }
1188912114
11890
- for (int count = parentcam.GetTransformCount(); --count>=0;)
11891
- 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
1189212117
1189312118 LA.xformPos(light, renderCamera.toScreen, light);
1189412119
....@@ -13140,7 +13365,8 @@
1314013365 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1314113366 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1314213367 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13143
- Object3D.cVector2[] vector2buffer;
13368
+
13369
+ //Object3D.cVector2[] vector2buffer;
1314413370
1314513371 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1314613372 // OUT : diff, spec
....@@ -13156,9 +13382,10 @@
1315613382 "DP3 " + dest + ".z," + "normals," + "eye;" +
1315713383 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1315813384 //"MOV " + dest + ".w," + "normal.z;" +
13159
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13160
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13161
- //"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
1316213389 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1316313390 "RCP " + dest + ".w," + dest + ".w;" +
1316413391 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13663,6 +13890,7 @@
1366313890 else
1366413891 if (evt.getSource() == AAtimer)
1366513892 {
13893
+ Globals.TIMERRUNNING = false;
1366613894 if (mouseDown)
1366713895 {
1366813896 //new Exception().printStackTrace();
....@@ -13722,7 +13950,7 @@
1372213950
1372313951 // fev 2014???
1372413952 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13725
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13953
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1372613954 pingthread.StepToTarget(true); // true);
1372713955 }
1372813956 // if (!LIVE)
....@@ -13737,6 +13965,7 @@
1373713965 return;
1373813966
1373913967 AAtimer.restart(); //
13968
+ Globals.TIMERRUNNING = true;
1374013969
1374113970 // waslive = LIVE;
1374213971 // LIVE = false;
....@@ -13809,9 +14038,12 @@
1380914038
1381014039 public void mouseDragged(MouseEvent e)
1381114040 {
14041
+ Globals.MOUSEDRAGGED = true;
14042
+
1381214043 //System.out.println("mouseDragged: " + e);
1381314044 if (isRenderer)
1381414045 movingcamera = true;
14046
+
1381514047 //if (drawing)
1381614048 //return;
1381714049 if ((e.getModifiersEx() & CTRL) != 0
....@@ -14072,12 +14304,12 @@
1407214304 void GoDown(int mod)
1407314305 {
1407414306 MODIFIERS |= COMMAND;
14075
- /*
14307
+ /**/
1407614308 if((mod&SHIFT) == SHIFT)
1407714309 manipCamera.RotatePosition(0, -speed);
1407814310 else
14079
- manipCamera.BackForth(0, -speed*delta, getWidth());
14080
- */
14311
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14312
+ /**/
1408114313 if ((mod & SHIFT) == SHIFT)
1408214314 {
1408314315 mouseMode = mouseMode; // VR??
....@@ -14093,12 +14325,12 @@
1409314325 void GoUp(int mod)
1409414326 {
1409514327 MODIFIERS |= COMMAND;
14096
- /*
14328
+ /**/
1409714329 if((mod&SHIFT) == SHIFT)
1409814330 manipCamera.RotatePosition(0, speed);
1409914331 else
14100
- manipCamera.BackForth(0, speed*delta, getWidth());
14101
- */
14332
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14333
+ /**/
1410214334 if ((mod & SHIFT) == SHIFT)
1410314335 {
1410414336 mouseMode = mouseMode;
....@@ -14114,12 +14346,12 @@
1411414346 void GoLeft(int mod)
1411514347 {
1411614348 MODIFIERS |= COMMAND;
14117
- /*
14349
+ /**/
1411814350 if((mod&SHIFT) == SHIFT)
14119
- manipCamera.RotatePosition(speed, 0);
14120
- else
1412114351 manipCamera.Translate(speed*delta, 0, getWidth());
14122
- */
14352
+ else
14353
+ manipCamera.RotatePosition(speed, 0);
14354
+ /**/
1412314355 if ((mod & SHIFT) == SHIFT)
1412414356 {
1412514357 mouseMode = mouseMode;
....@@ -14135,12 +14367,12 @@
1413514367 void GoRight(int mod)
1413614368 {
1413714369 MODIFIERS |= COMMAND;
14138
- /*
14370
+ /**/
1413914371 if((mod&SHIFT) == SHIFT)
14140
- manipCamera.RotatePosition(-speed, 0);
14141
- else
1414214372 manipCamera.Translate(-speed*delta, 0, getWidth());
14143
- */
14373
+ else
14374
+ manipCamera.RotatePosition(-speed, 0);
14375
+ /**/
1414414376 if ((mod & SHIFT) == SHIFT)
1414514377 {
1414614378 mouseMode = mouseMode;
....@@ -14197,7 +14429,8 @@
1419714429 info.camera = renderCamera;
1419814430 info.x = x;
1419914431 info.y = y;
14200
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14432
+ object.GetWindow().copy
14433
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1420114434 } else
1420214435 {
1420314436 if (x < startX)
....@@ -14361,7 +14594,9 @@
1436114594 ci.camera = renderCamera;
1436214595 if (!isRenderer)
1436314596 {
14364
- if (object.editWindow.copy.doEditClick(ci, 0))
14597
+ //ObjEditor editWindow = object.editWindow;
14598
+ //Object3D copy = editWindow.copy;
14599
+ if (object.doEditClick(ci, 0))
1436514600 {
1436614601 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1436714602 } else
....@@ -14373,8 +14608,11 @@
1437314608
1437414609 public void mouseReleased(MouseEvent e)
1437514610 {
14611
+ Globals.MOUSEDRAGGED = false;
14612
+
1437614613 movingcamera = false;
14377
- X = Y = 0;
14614
+ X = 0; // getBounds().width/2;
14615
+ Y = 0; // getBounds().height/2;
1437814616 //System.out.println("mouseReleased: " + e);
1437914617 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1438014618 }
....@@ -14715,7 +14953,9 @@
1471514953 case 'E' : COMPACT ^= true;
1471614954 repaint();
1471714955 break;
14718
- case 'W' : DEBUGHSB ^= true;
14956
+ case 'W' : // Wide Window (fullscreen)
14957
+ //DEBUGHSB ^= true;
14958
+ ObjEditor.theFrame.ToggleFullScreen();
1471914959 repaint();
1472014960 break;
1472114961 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14740,8 +14980,8 @@
1474014980 RevertCamera();
1474114981 repaint();
1474214982 break;
14743
- case 'L':
1474414983 case 'l':
14984
+ //case 'L':
1474514985 if (lightMode)
1474614986 {
1474714987 lightMode = false;
....@@ -14884,9 +15124,9 @@
1488415124 case '_':
1488515125 kompactbit = 5;
1488615126 break;
14887
- case '+':
14888
- kompactbit = 6;
14889
- break;
15127
+// case '+':
15128
+// kompactbit = 6;
15129
+// break;
1489015130 case ' ':
1489115131 lightMode ^= true;
1489215132 Globals.lighttouched = true;
....@@ -14898,6 +15138,7 @@
1489815138 case ESC:
1489915139 RENDERPROGRAM += 1;
1490015140 RENDERPROGRAM %= 3;
15141
+
1490115142 repaint();
1490215143 break;
1490315144 case 'Z':
....@@ -14937,8 +15178,9 @@
1493715178 case DELETE:
1493815179 ClearSelection();
1493915180 break;
14940
- /*
1494115181 case '+':
15182
+
15183
+ /*
1494215184 //fontsize += 1;
1494315185 bbzoom *= 2;
1494415186 repaint();
....@@ -14955,17 +15197,17 @@
1495515197 case '=':
1495615198 IncDepth();
1495715199 //fontsize += 1;
14958
- object.editWindow.refreshContents(true);
15200
+ object.GetWindow().refreshContents(true);
1495915201 maskbit = 6;
1496015202 break;
1496115203 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1496215204 DecDepth();
1496315205 maskbit = 5;
1496415206 //if(fontsize > 1) fontsize -= 1;
14965
- if (object.editWindow == null)
14966
- new Exception().printStackTrace();
14967
- else
14968
- object.editWindow.refreshContents(true);
15207
+// if (object.editWindow == null)
15208
+// new Exception().printStackTrace();
15209
+// else
15210
+ object.GetWindow().refreshContents(true);
1496915211 break;
1497015212 case '{':
1497115213 manipCamera.shaper_fovy /= 1.1;
....@@ -15189,7 +15431,7 @@
1518915431 }
1519015432 */
1519115433
15192
- object.editWindow.EditSelection();
15434
+ object.GetWindow().EditSelection(false);
1519315435 }
1519415436
1519515437 void SelectParent()
....@@ -15206,10 +15448,10 @@
1520615448 {
1520715449 //selectees.remove(i);
1520815450 System.out.println("select parent of " + elem);
15209
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15451
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1521015452 } else
1521115453 {
15212
- group.editWindow.Select(elem.GetTreePath(), first, true);
15454
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1521315455 }
1521415456
1521515457 first = false;
....@@ -15251,12 +15493,12 @@
1525115493 for (int j = 0; j < group.children.size(); j++)
1525215494 {
1525315495 elem = (Object3D) group.children.elementAt(j);
15254
- object.editWindow.Select(elem.GetTreePath(), first, true);
15496
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1525515497 first = false;
1525615498 }
1525715499 } else
1525815500 {
15259
- object.editWindow.Select(elem.GetTreePath(), first, true);
15501
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1526015502 }
1526115503
1526215504 first = false;
....@@ -15267,21 +15509,21 @@
1526715509 {
1526815510 //Composite group = (Composite) object;
1526915511 Object3D group = object;
15270
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15512
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1527115513 }
1527215514
1527315515 void ResetTransform(int mask)
1527415516 {
1527515517 //Composite group = (Composite) object;
1527615518 Object3D group = object;
15277
- group.editWindow.ResetTransform(mask);
15519
+ group.GetWindow().ResetTransform(mask);
1527815520 }
1527915521
1528015522 void FlipTransform()
1528115523 {
1528215524 //Composite group = (Composite) object;
1528315525 Object3D group = object;
15284
- group.editWindow.FlipTransform();
15526
+ group.GetWindow().FlipTransform();
1528515527 // group.editWindow.ReduceMesh(true);
1528615528 }
1528715529
....@@ -15289,7 +15531,7 @@
1528915531 {
1529015532 //Composite group = (Composite) object;
1529115533 Object3D group = object;
15292
- group.editWindow.PrintMemory();
15534
+ group.GetWindow().PrintMemory();
1529315535 // group.editWindow.ReduceMesh(true);
1529415536 }
1529515537
....@@ -15297,7 +15539,7 @@
1529715539 {
1529815540 //Composite group = (Composite) object;
1529915541 Object3D group = object;
15300
- group.editWindow.ResetCentroid();
15542
+ group.GetWindow().ResetCentroid();
1530115543 }
1530215544
1530315545 void IncDepth()
....@@ -15473,6 +15715,7 @@
1547315715 info.bounds.y += (height - desired) / 2;
1547415716 }
1547515717 }
15718
+
1547615719 info.g = gr;
1547715720 info.camera = renderCamera;
1547815721 /*
....@@ -15482,18 +15725,44 @@
1548215725 */
1548315726 if (!isRenderer)
1548415727 {
15485
- object.drawEditHandles(info, 0);
15486
-
15487
- if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15728
+ Grafreed.Assert(object != null);
15729
+ Grafreed.Assert(object.selection != null);
15730
+ if (object.selection.Size() > 0)
1548815731 {
15489
- switch (object.selection.get(0).hitSomething)
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)
1549015738 {
15491
- case Object3D.hitCenter: gr.setColor(Color.pink); break;
15492
- case Object3D.hitRotate: gr.setColor(Color.green); break;
15493
- case Object3D.hitScale: gr.setColor(Color.cyan); break;
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;
1549415746 }
15495
-
15496
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
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
+ }
1549715766 }
1549815767 }
1549915768 }
....@@ -15911,7 +16180,7 @@
1591116180 Object3D object;
1591216181 static Object3D trackedobject;
1591316182 Camera renderCamera; // Light or Eye (or Occlusion)
15914
- /*static*/ Camera manipCamera; // Light or Eye
16183
+ /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light
1591516184 /*static*/ Camera eyeCamera;
1591616185 /*static*/ Camera lightCamera;
1591716186 int cameracount;
....@@ -16196,16 +16465,16 @@
1619616465 cStatic.objectstack[materialdepth++] = checker;
1619716466 //System.out.println("material " + material);
1619816467 //Applet3D.tracein(this, selected);
16199
- vector2buffer = checker.projectedVertices;
16468
+ //vector2buffer = checker.projectedVertices;
1620016469
1620116470 //checker.GetMaterial().Draw(this, false); // true);
16202
- DrawMaterial(checker.GetMaterial(), false); // true);
16471
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1620316472
1620416473 materialdepth -= 1;
1620516474 if (materialdepth > 0)
1620616475 {
16207
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16208
- 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);
1620916478 }
1621016479 //checker.GetMaterial().opacity = 1f;
1621116480 ////checker.GetMaterial().ambient = 1f;
....@@ -16291,6 +16560,14 @@
1629116560 }
1629216561 }
1629316562
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
+
1629416571 class SelectBuffer implements GLEventListener
1629516572 {
1629616573
....@@ -16370,6 +16647,17 @@
1637016647
1637116648 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1637216649
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
+
1637316661 //int tmp = selection_view;
1637416662 //selection_view = -1;
1637516663 int temp = DrawMode();
....@@ -16381,6 +16669,17 @@
1638116669 // temp = DEFAULT; // patch for selection debug
1638216670 Globals.drawMode = temp; // WARNING
1638316671
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
+
1638416683 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1638516684
1638616685 // trying different ways of getting the depth info over
....@@ -16428,6 +16727,8 @@
1642816727 // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]);
1642916728 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1643016729 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
16730
+
16731
+ CreateSelectedPoint();
1643116732
1643216733 // Will fit the mesh !!!
1643316734 selectedpoint.toParent[0][0] = 0.0001;
....@@ -16482,29 +16783,31 @@
1648216783 }
1648316784
1648416785 if (!movingcamera && !PAINTMODE)
16485
- object.editWindow.ScreenFitPoint(); // fev 2014
16786
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1648616787
16487
- 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)
1648816789 {
16489
- 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);
1649016791
16491
- Object3D group = new Object3D("inst" + paintcount++);
16792
+ if (object.GetWindow().copy.selection.Size() > 0)
16793
+ {
16794
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1649216795
16493
- group.CreateMaterial(); // use a void leaf to select instances
16494
-
16495
- group.add(paintobj); // link
16496
-
16497
- object.editWindow.SnapObject(group);
16498
-
16499
- Object3D folder = object.editWindow.copy;
16500
-
16501
- if (object.editWindow.copy.selection.Size() > 0)
16502
- folder = object.editWindow.copy.selection.elementAt(0);
16503
-
16504
- folder.add(group);
16505
-
16506
- object.editWindow.ResetModel();
16507
- 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
+ }
1650816811 }
1650916812 else
1651016813 paintcount = 0;
....@@ -16543,6 +16846,11 @@
1654316846 //System.out.println("objects[color] = " + objects[color]);
1654416847 //objects[color].Select();
1654516848 indexcount = 0;
16849
+ ObjEditor window = object.GetWindow();
16850
+ if (window != null && deselect)
16851
+ {
16852
+ window.Select(null, deselect, true);
16853
+ }
1654616854 object.Select(color, deselect);
1654716855 }
1654816856
....@@ -17068,23 +17376,15 @@
1706817376 int AAbuffersize = 0;
1706917377
1707017378 //double[] selectedpoint = new double[3];
17071
- static Superellipsoid selectedpoint = new Superellipsoid();
17379
+ static Superellipsoid selectedpoint;
1707217380 static Sphere previousselectedpoint = null;
17073
- static Sphere debugpointG = new Sphere();
17074
- static Sphere debugpointP = new Sphere();
17075
- static Sphere debugpointC = new Sphere();
17076
- static Sphere debugpointR = new Sphere();
17381
+ static Sphere debugpointG;
17382
+ static Sphere debugpointP;
17383
+ static Sphere debugpointC;
17384
+ static Sphere debugpointR;
1707717385
1707817386 static Sphere debugpoints[] = new Sphere[8];
1707917387
17080
- static
17081
- {
17082
- for (int i=0; i<8; i++)
17083
- {
17084
- debugpoints[i] = new Sphere();
17085
- }
17086
- }
17087
-
1708817388 static void InitPoints(float radius)
1708917389 {
1709017390 for (int i=0; i<8; i++)