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
....@@ -327,7 +326,7 @@
327326 cStatic.objectstack[materialdepth++] = obj;
328327 //System.out.println("material " + material);
329328 //Applet3D.tracein(this, selected);
330
- display.vector2buffer = obj.projectedVertices;
329
+ //display.vector2buffer = obj.projectedVertices;
331330 if (obj instanceof Camera)
332331 {
333332 display.options1[0] = material.shift;
....@@ -336,14 +335,28 @@
336335 display.options1[2] = material.shadowbias;
337336 display.options1[3] = material.aniso;
338337 display.options1[4] = material.anisoV;
338
+// System.out.println("display.options1[0] " + display.options1[0]);
339
+// System.out.println("display.options1[1] " + display.options1[1]);
340
+// System.out.println("display.options1[2] " + display.options1[2]);
341
+// System.out.println("display.options1[3] " + display.options1[3]);
342
+// System.out.println("display.options1[4] " + display.options1[4]);
339343 display.options2[0] = material.opacity;
340344 display.options2[1] = material.diffuse;
341345 display.options2[2] = material.factor;
346
+// System.out.println("display.options2[0] " + display.options2[0]);
347
+// System.out.println("display.options2[1] " + display.options2[1]);
348
+// System.out.println("display.options2[2] " + display.options2[2]);
342349
343350 cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
351
+// System.out.println("display.options3[0] " + display.options3[0]);
352
+// System.out.println("display.options3[1] " + display.options3[1]);
353
+// System.out.println("display.options3[2] " + display.options3[2]);
344354 display.options4[0] = material.cameralight/0.2f;
345355 display.options4[1] = material.subsurface;
346356 display.options4[2] = material.sheen;
357
+// System.out.println("display.options4[0] " + display.options4[0]);
358
+// System.out.println("display.options4[1] " + display.options4[1]);
359
+// System.out.println("display.options4[2] " + display.options4[2]);
347360
348361 // if (display.CURRENTANTIALIAS > 0)
349362 // display.options3[3] /= 4;
....@@ -359,7 +372,7 @@
359372 /**/
360373 } else
361374 {
362
- DrawMaterial(material, selected);
375
+ DrawMaterial(material, selected, obj.projectedVertices);
363376 }
364377 } else
365378 {
....@@ -383,8 +396,8 @@
383396 cStatic.objectstack[materialdepth++] = obj;
384397 //System.out.println("material " + material);
385398 //Applet3D.tracein("selected ", selected);
386
- display.vector2buffer = obj.projectedVertices;
387
- display.DrawMaterial(material, selected);
399
+ //display.vector2buffer = obj.projectedVertices;
400
+ display.DrawMaterial(material, selected, obj.projectedVertices);
388401 }
389402 }
390403
....@@ -401,8 +414,8 @@
401414 materialdepth -= 1;
402415 if (materialdepth > 0)
403416 {
404
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
405
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
417
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
418
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
406419 }
407420 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
408421 } else if (selected && CameraPane.flash && obj.GetMaterial() != null)
....@@ -422,8 +435,8 @@
422435 materialdepth -= 1;
423436 if (materialdepth > 0)
424437 {
425
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
426
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
438
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
439
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
427440 }
428441 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
429442 //else
....@@ -464,10 +477,12 @@
464477 if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
465478 {
466479 //gl.glBegin(gl.GL_TRIANGLES);
467
- boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
480
+ boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0)
481
+ // TEST LIVE NORMALS && !obj.dontselect
482
+ ;
468483 if (!hasnorm)
469484 {
470
- // System.out.println("FUCK!!");
485
+ // System.out.println("Mesh normal");
471486 LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0);
472487 LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1);
473488 LA.vecCross(obj.v0, obj.v1, obj.v2);
....@@ -1192,10 +1207,12 @@
11921207 gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
11931208 }
11941209 }
1210
+
11951211 if (flipV)
11961212 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
11971213 else
11981214 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1215
+
11991216 //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
12001217 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
12011218
....@@ -1215,10 +1232,12 @@
12151232 gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
12161233 }
12171234 }
1235
+
12181236 if (flipV)
12191237 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
12201238 else
12211239 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1240
+
12221241 //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
12231242 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
12241243
....@@ -1246,8 +1265,10 @@
12461265 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
12471266 else
12481267 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1268
+
12491269 //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
12501270 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
1271
+
12511272 count2 += 2;
12521273 count3 += 3;
12531274 }
....@@ -1603,7 +1624,7 @@
16031624 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16041625 }
16051626
1606
- void DrawMaterial(cMaterial material, boolean selected)
1627
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16071628 {
16081629 CameraPane display = this;
16091630 //new Exception().printStackTrace();
....@@ -1638,7 +1659,7 @@
16381659 colorV[0] = display.modelParams0[0] * material.diffuse;
16391660 colorV[1] = display.modelParams0[1] * material.diffuse;
16401661 colorV[2] = display.modelParams0[2] * material.diffuse;
1641
- colorV[3] = material.opacity;
1662
+ colorV[3] = 1; // material.opacity;
16421663
16431664 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16441665 //System.out.println("Opacity = " + opacity);
....@@ -1746,9 +1767,9 @@
17461767 display.modelParams7[2] = 0;
17471768 display.modelParams7[3] = 0;
17481769
1749
- display.modelParams6[0] = 100; // criss de bug de bump
1770
+ //display.modelParams6[0] = 100; // criss de bug de bump
17501771
1751
- Object3D.cVector2[] extparams = display.vector2buffer;
1772
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17521773 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17531774 {
17541775 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -2044,7 +2065,7 @@
20442065 //System.err.println("Oeil on");
20452066 OEIL = true;
20462067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2047
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20482069 //pingthread.StepToTarget(true);
20492070 }
20502071
....@@ -2259,7 +2280,7 @@
22592280
22602281 void ToggleDebug()
22612282 {
2262
- DEBUG ^= true;
2283
+ Globals.DEBUG ^= true;
22632284 }
22642285
22652286 void ToggleLookAt()
....@@ -2277,10 +2298,17 @@
22772298 HANDLES ^= true;
22782299 }
22792300
2301
+ Object3D paintFolder;
2302
+
22802303 void TogglePaint()
22812304 {
22822305 PAINTMODE ^= true;
22832306 paintcount = 0;
2307
+
2308
+ if (PAINTMODE)
2309
+ {
2310
+ paintFolder = GetFolder();
2311
+ }
22842312 }
22852313
22862314 void SwapCamera(int a, int b)
....@@ -7902,7 +7930,7 @@
79027930 String pigment = Object3D.GetPigment(tex);
79037931 String bump = Object3D.GetBump(tex);
79047932
7905
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7933
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79067934 {
79077935 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79087936 // System.out.println("; bump = " + bump);
....@@ -7936,7 +7964,7 @@
79367964
79377965 String pigment = Object3D.GetPigment(tex);
79387966
7939
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7967
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79407968 {
79417969 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79427970 // System.out.println("; bump = " + bump);
....@@ -7965,7 +7993,7 @@
79657993
79667994 String bump = Object3D.GetBump(tex);
79677995
7968
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7996
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79697997 {
79707998 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79717999 // System.out.println("; bump = " + bump);
....@@ -8103,7 +8131,7 @@
81038131 usedtextures.put(pigment, pigment);
81048132 usedtextures.put(bump, bump);
81058133
8106
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8134
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81078135 {
81088136 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81098137 // System.out.println("; bump = " + bump);
....@@ -8145,7 +8173,7 @@
81458173
81468174 usedtextures.put(pigment, pigment);
81478175
8148
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8176
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81498177 {
81508178 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81518179 // System.out.println("; bump = " + bump);
....@@ -8178,7 +8206,7 @@
81788206
81798207 usedtextures.put(bump, bump);
81808208
8181
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8209
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81828210 {
81838211 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81848212 // System.out.println("; bump = " + bump);
....@@ -8489,7 +8517,7 @@
84898517 return false;
84908518 }
84918519
8492
- boolean newtex = false;
8520
+ //boolean newtex = false;
84938521
84948522 com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
84958523
....@@ -8521,7 +8549,7 @@
85218549 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT);
85228550 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT);
85238551
8524
- return newtex;
8552
+ return true; // Warning: not used.
85258553 }
85268554
85278555 ShadowBuffer shadowPBuf;
....@@ -9359,11 +9387,35 @@
93599387 jy8[3] = 0.5f;
93609388 }
93619389
9362
- 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
93639391 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
93649392 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
93659393 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
93669394
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
+
93679419 static int imagecount = 0; // movie generation
93689420
93699421 static int jitter = 0;
....@@ -10474,6 +10526,7 @@
1047410526 ANTIALIAS = 0;
1047510527 //System.out.println("RESTART");
1047610528 AAtimer.restart();
10529
+ Globals.TIMERRUNNING = true;
1047710530 }
1047810531 }
1047910532 }
....@@ -10541,7 +10594,8 @@
1054110594 ambientOcclusion = false;
1054210595 }
1054310596
10544
- if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
10597
+ if (//Globals.lighttouched &&
10598
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1054510599 {
1054610600 //if (RENDERSHADOW) // ?
1054710601 if (!IsFrozen())
....@@ -10981,9 +11035,9 @@
1098111035
1098211036 gl.glMatrixMode(GL.GL_MODELVIEW);
1098311037
10984
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
10985
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
10986
-//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);
1098711041 } else
1098811042 {
1098911043 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -10994,7 +11048,7 @@
1099411048 //System.out.println("BLENDING ON");
1099511049 gl.glEnable(GL.GL_BLEND);
1099611050 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
10997
-
11051
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1099811052 gl.glMatrixMode(gl.GL_PROJECTION);
1099911053 gl.glLoadIdentity();
1100011054
....@@ -11451,15 +11505,36 @@
1145111505
1145211506 static boolean zoomonce = false;
1145311507
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
+
1145411526 void DrawObject(GL gl, boolean draw)
1145511527 {
11528
+ // To clear camera values
11529
+ ResetOptions();
11530
+
1145611531 //System.out.println("DRAW OBJECT " + mouseDown);
1145711532 // DrawMode() = SELECTION;
1145811533 //GL gl = getGL();
1145911534 if ((TRACK || SHADOWTRACK) || zoomonce)
1146011535 {
1146111536 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11462
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11537
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1146311538 pingthread.StepToTarget(true); // true);
1146411539 // zoomonce = false;
1146511540 }
....@@ -11531,8 +11606,9 @@
1153111606
1153211607 if (DrawMode() == DEFAULT)
1153311608 {
11534
- if (DEBUG)
11609
+ if (Globals.DEBUG)
1153511610 {
11611
+ CreateSelectedPoint();
1153611612 float radius = 0.05f;
1153711613 if (selectedpoint.radius != radius)
1153811614 {
....@@ -12019,7 +12095,7 @@
1201912095 for (int i = tp.size(); --i >= 0;)
1202012096 {
1202112097 //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12022
- LA.xformPos(light, tp.get(i).GlobalTransform(), light);
12098
+ LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
1202312099 }
1202412100
1202512101
....@@ -13289,7 +13365,8 @@
1328913365 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1329013366 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1329113367 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13292
- Object3D.cVector2[] vector2buffer;
13368
+
13369
+ //Object3D.cVector2[] vector2buffer;
1329313370
1329413371 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1329513372 // OUT : diff, spec
....@@ -13305,9 +13382,10 @@
1330513382 "DP3 " + dest + ".z," + "normals," + "eye;" +
1330613383 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1330713384 //"MOV " + dest + ".w," + "normal.z;" +
13308
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13309
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13310
- //"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
1331113389 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1331213390 "RCP " + dest + ".w," + dest + ".w;" +
1331313391 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13812,6 +13890,7 @@
1381213890 else
1381313891 if (evt.getSource() == AAtimer)
1381413892 {
13893
+ Globals.TIMERRUNNING = false;
1381513894 if (mouseDown)
1381613895 {
1381713896 //new Exception().printStackTrace();
....@@ -13871,7 +13950,7 @@
1387113950
1387213951 // fev 2014???
1387313952 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13874
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13953
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1387513954 pingthread.StepToTarget(true); // true);
1387613955 }
1387713956 // if (!LIVE)
....@@ -13886,6 +13965,7 @@
1388613965 return;
1388713966
1388813967 AAtimer.restart(); //
13968
+ Globals.TIMERRUNNING = true;
1388913969
1389013970 // waslive = LIVE;
1389113971 // LIVE = false;
....@@ -14224,12 +14304,12 @@
1422414304 void GoDown(int mod)
1422514305 {
1422614306 MODIFIERS |= COMMAND;
14227
- /*
14307
+ /**/
1422814308 if((mod&SHIFT) == SHIFT)
1422914309 manipCamera.RotatePosition(0, -speed);
1423014310 else
14231
- manipCamera.BackForth(0, -speed*delta, getWidth());
14232
- */
14311
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14312
+ /**/
1423314313 if ((mod & SHIFT) == SHIFT)
1423414314 {
1423514315 mouseMode = mouseMode; // VR??
....@@ -14245,12 +14325,12 @@
1424514325 void GoUp(int mod)
1424614326 {
1424714327 MODIFIERS |= COMMAND;
14248
- /*
14328
+ /**/
1424914329 if((mod&SHIFT) == SHIFT)
1425014330 manipCamera.RotatePosition(0, speed);
1425114331 else
14252
- manipCamera.BackForth(0, speed*delta, getWidth());
14253
- */
14332
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14333
+ /**/
1425414334 if ((mod & SHIFT) == SHIFT)
1425514335 {
1425614336 mouseMode = mouseMode;
....@@ -14266,12 +14346,12 @@
1426614346 void GoLeft(int mod)
1426714347 {
1426814348 MODIFIERS |= COMMAND;
14269
- /*
14349
+ /**/
1427014350 if((mod&SHIFT) == SHIFT)
14271
- manipCamera.RotatePosition(speed, 0);
14272
- else
1427314351 manipCamera.Translate(speed*delta, 0, getWidth());
14274
- */
14352
+ else
14353
+ manipCamera.RotatePosition(speed, 0);
14354
+ /**/
1427514355 if ((mod & SHIFT) == SHIFT)
1427614356 {
1427714357 mouseMode = mouseMode;
....@@ -14287,12 +14367,12 @@
1428714367 void GoRight(int mod)
1428814368 {
1428914369 MODIFIERS |= COMMAND;
14290
- /*
14370
+ /**/
1429114371 if((mod&SHIFT) == SHIFT)
14292
- manipCamera.RotatePosition(-speed, 0);
14293
- else
1429414372 manipCamera.Translate(-speed*delta, 0, getWidth());
14295
- */
14373
+ else
14374
+ manipCamera.RotatePosition(-speed, 0);
14375
+ /**/
1429614376 if ((mod & SHIFT) == SHIFT)
1429714377 {
1429814378 mouseMode = mouseMode;
....@@ -14349,7 +14429,8 @@
1434914429 info.camera = renderCamera;
1435014430 info.x = x;
1435114431 info.y = y;
14352
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14432
+ object.GetWindow().copy
14433
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1435314434 } else
1435414435 {
1435514436 if (x < startX)
....@@ -14513,7 +14594,9 @@
1451314594 ci.camera = renderCamera;
1451414595 if (!isRenderer)
1451514596 {
14516
- if (object.editWindow.copy.doEditClick(ci, 0))
14597
+ //ObjEditor editWindow = object.editWindow;
14598
+ //Object3D copy = editWindow.copy;
14599
+ if (object.doEditClick(ci, 0))
1451714600 {
1451814601 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1451914602 } else
....@@ -14528,7 +14611,8 @@
1452814611 Globals.MOUSEDRAGGED = false;
1452914612
1453014613 movingcamera = false;
14531
- X = Y = 0;
14614
+ X = 0; // getBounds().width/2;
14615
+ Y = 0; // getBounds().height/2;
1453214616 //System.out.println("mouseReleased: " + e);
1453314617 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1453414618 }
....@@ -14869,7 +14953,9 @@
1486914953 case 'E' : COMPACT ^= true;
1487014954 repaint();
1487114955 break;
14872
- case 'W' : DEBUGHSB ^= true;
14956
+ case 'W' : // Wide Window (fullscreen)
14957
+ //DEBUGHSB ^= true;
14958
+ ObjEditor.theFrame.ToggleFullScreen();
1487314959 repaint();
1487414960 break;
1487514961 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14894,8 +14980,8 @@
1489414980 RevertCamera();
1489514981 repaint();
1489614982 break;
14897
- case 'L':
1489814983 case 'l':
14984
+ //case 'L':
1489914985 if (lightMode)
1490014986 {
1490114987 lightMode = false;
....@@ -15038,9 +15124,9 @@
1503815124 case '_':
1503915125 kompactbit = 5;
1504015126 break;
15041
- case '+':
15042
- kompactbit = 6;
15043
- break;
15127
+// case '+':
15128
+// kompactbit = 6;
15129
+// break;
1504415130 case ' ':
1504515131 lightMode ^= true;
1504615132 Globals.lighttouched = true;
....@@ -15052,6 +15138,7 @@
1505215138 case ESC:
1505315139 RENDERPROGRAM += 1;
1505415140 RENDERPROGRAM %= 3;
15141
+
1505515142 repaint();
1505615143 break;
1505715144 case 'Z':
....@@ -15091,8 +15178,9 @@
1509115178 case DELETE:
1509215179 ClearSelection();
1509315180 break;
15094
- /*
1509515181 case '+':
15182
+
15183
+ /*
1509615184 //fontsize += 1;
1509715185 bbzoom *= 2;
1509815186 repaint();
....@@ -15109,17 +15197,17 @@
1510915197 case '=':
1511015198 IncDepth();
1511115199 //fontsize += 1;
15112
- object.editWindow.refreshContents(true);
15200
+ object.GetWindow().refreshContents(true);
1511315201 maskbit = 6;
1511415202 break;
1511515203 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1511615204 DecDepth();
1511715205 maskbit = 5;
1511815206 //if(fontsize > 1) fontsize -= 1;
15119
- if (object.editWindow == null)
15120
- new Exception().printStackTrace();
15121
- else
15122
- object.editWindow.refreshContents(true);
15207
+// if (object.editWindow == null)
15208
+// new Exception().printStackTrace();
15209
+// else
15210
+ object.GetWindow().refreshContents(true);
1512315211 break;
1512415212 case '{':
1512515213 manipCamera.shaper_fovy /= 1.1;
....@@ -15343,7 +15431,7 @@
1534315431 }
1534415432 */
1534515433
15346
- object.editWindow.EditSelection();
15434
+ object.GetWindow().EditSelection(false);
1534715435 }
1534815436
1534915437 void SelectParent()
....@@ -15360,10 +15448,10 @@
1536015448 {
1536115449 //selectees.remove(i);
1536215450 System.out.println("select parent of " + elem);
15363
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15451
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1536415452 } else
1536515453 {
15366
- group.editWindow.Select(elem.GetTreePath(), first, true);
15454
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1536715455 }
1536815456
1536915457 first = false;
....@@ -15405,12 +15493,12 @@
1540515493 for (int j = 0; j < group.children.size(); j++)
1540615494 {
1540715495 elem = (Object3D) group.children.elementAt(j);
15408
- object.editWindow.Select(elem.GetTreePath(), first, true);
15496
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1540915497 first = false;
1541015498 }
1541115499 } else
1541215500 {
15413
- object.editWindow.Select(elem.GetTreePath(), first, true);
15501
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1541415502 }
1541515503
1541615504 first = false;
....@@ -15421,21 +15509,21 @@
1542115509 {
1542215510 //Composite group = (Composite) object;
1542315511 Object3D group = object;
15424
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15512
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1542515513 }
1542615514
1542715515 void ResetTransform(int mask)
1542815516 {
1542915517 //Composite group = (Composite) object;
1543015518 Object3D group = object;
15431
- group.editWindow.ResetTransform(mask);
15519
+ group.GetWindow().ResetTransform(mask);
1543215520 }
1543315521
1543415522 void FlipTransform()
1543515523 {
1543615524 //Composite group = (Composite) object;
1543715525 Object3D group = object;
15438
- group.editWindow.FlipTransform();
15526
+ group.GetWindow().FlipTransform();
1543915527 // group.editWindow.ReduceMesh(true);
1544015528 }
1544115529
....@@ -15443,7 +15531,7 @@
1544315531 {
1544415532 //Composite group = (Composite) object;
1544515533 Object3D group = object;
15446
- group.editWindow.PrintMemory();
15534
+ group.GetWindow().PrintMemory();
1544715535 // group.editWindow.ReduceMesh(true);
1544815536 }
1544915537
....@@ -15451,7 +15539,7 @@
1545115539 {
1545215540 //Composite group = (Composite) object;
1545315541 Object3D group = object;
15454
- group.editWindow.ResetCentroid();
15542
+ group.GetWindow().ResetCentroid();
1545515543 }
1545615544
1545715545 void IncDepth()
....@@ -15627,6 +15715,7 @@
1562715715 info.bounds.y += (height - desired) / 2;
1562815716 }
1562915717 }
15718
+
1563015719 info.g = gr;
1563115720 info.camera = renderCamera;
1563215721 /*
....@@ -15636,23 +15725,44 @@
1563615725 */
1563715726 if (!isRenderer)
1563815727 {
15639
- object.drawEditHandles(info, 0);
15640
-
15641
- 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)
1564215731 {
15643
- 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)
1564415738 {
15645
- case Object3D.hitCenter: gr.setColor(Color.pink);
15646
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15647
- break;
15648
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15649
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15650
- break;
15651
- case Object3D.hitScale: gr.setColor(Color.cyan);
15652
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15653
- 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;
1565415746 }
15655
-
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
+ }
1565615766 }
1565715767 }
1565815768 }
....@@ -16355,16 +16465,16 @@
1635516465 cStatic.objectstack[materialdepth++] = checker;
1635616466 //System.out.println("material " + material);
1635716467 //Applet3D.tracein(this, selected);
16358
- vector2buffer = checker.projectedVertices;
16468
+ //vector2buffer = checker.projectedVertices;
1635916469
1636016470 //checker.GetMaterial().Draw(this, false); // true);
16361
- DrawMaterial(checker.GetMaterial(), false); // true);
16471
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1636216472
1636316473 materialdepth -= 1;
1636416474 if (materialdepth > 0)
1636516475 {
16366
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16367
- 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);
1636816478 }
1636916479 //checker.GetMaterial().opacity = 1f;
1637016480 ////checker.GetMaterial().ambient = 1f;
....@@ -16450,6 +16560,14 @@
1645016560 }
1645116561 }
1645216562
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
+
1645316571 class SelectBuffer implements GLEventListener
1645416572 {
1645516573
....@@ -16529,6 +16647,17 @@
1652916647
1653016648 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1653116649
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
+
1653216661 //int tmp = selection_view;
1653316662 //selection_view = -1;
1653416663 int temp = DrawMode();
....@@ -16540,6 +16669,17 @@
1654016669 // temp = DEFAULT; // patch for selection debug
1654116670 Globals.drawMode = temp; // WARNING
1654216671
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
+
1654316683 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1654416684
1654516685 // trying different ways of getting the depth info over
....@@ -16587,6 +16727,8 @@
1658716727 // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]);
1658816728 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1658916729 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
16730
+
16731
+ CreateSelectedPoint();
1659016732
1659116733 // Will fit the mesh !!!
1659216734 selectedpoint.toParent[0][0] = 0.0001;
....@@ -16641,29 +16783,31 @@
1664116783 }
1664216784
1664316785 if (!movingcamera && !PAINTMODE)
16644
- object.editWindow.ScreenFitPoint(); // fev 2014
16786
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1664516787
16646
- 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)
1664716789 {
16648
- 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);
1664916791
16650
- Object3D group = new Object3D("inst" + paintcount++);
16792
+ if (object.GetWindow().copy.selection.Size() > 0)
16793
+ {
16794
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1665116795
16652
- group.CreateMaterial(); // use a void leaf to select instances
16653
-
16654
- group.add(paintobj); // link
16655
-
16656
- object.editWindow.SnapObject(group);
16657
-
16658
- Object3D folder = object.editWindow.copy;
16659
-
16660
- if (object.editWindow.copy.selection.Size() > 0)
16661
- folder = object.editWindow.copy.selection.elementAt(0);
16662
-
16663
- folder.add(group);
16664
-
16665
- object.editWindow.ResetModel();
16666
- 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
+ }
1666716811 }
1666816812 else
1666916813 paintcount = 0;
....@@ -16702,6 +16846,11 @@
1670216846 //System.out.println("objects[color] = " + objects[color]);
1670316847 //objects[color].Select();
1670416848 indexcount = 0;
16849
+ ObjEditor window = object.GetWindow();
16850
+ if (window != null && deselect)
16851
+ {
16852
+ window.Select(null, deselect, true);
16853
+ }
1670516854 object.Select(color, deselect);
1670616855 }
1670716856
....@@ -17227,23 +17376,15 @@
1722717376 int AAbuffersize = 0;
1722817377
1722917378 //double[] selectedpoint = new double[3];
17230
- static Superellipsoid selectedpoint = new Superellipsoid();
17379
+ static Superellipsoid selectedpoint;
1723117380 static Sphere previousselectedpoint = null;
17232
- static Sphere debugpointG = new Sphere();
17233
- static Sphere debugpointP = new Sphere();
17234
- static Sphere debugpointC = new Sphere();
17235
- static Sphere debugpointR = new Sphere();
17381
+ static Sphere debugpointG;
17382
+ static Sphere debugpointP;
17383
+ static Sphere debugpointC;
17384
+ static Sphere debugpointR;
1723617385
1723717386 static Sphere debugpoints[] = new Sphere[8];
1723817387
17239
- static
17240
- {
17241
- for (int i=0; i<8; i++)
17242
- {
17243
- debugpoints[i] = new Sphere();
17244
- }
17245
- }
17246
-
1724717388 static void InitPoints(float radius)
1724817389 {
1724917390 for (int i=0; i<8; i++)