Normand Briere
2019-06-27 1807e7752960ac229cddd34b100e92cadbac9459
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
....@@ -1611,7 +1624,7 @@
16111624 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16121625 }
16131626
1614
- void DrawMaterial(cMaterial material, boolean selected)
1627
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16151628 {
16161629 CameraPane display = this;
16171630 //new Exception().printStackTrace();
....@@ -1646,7 +1659,7 @@
16461659 colorV[0] = display.modelParams0[0] * material.diffuse;
16471660 colorV[1] = display.modelParams0[1] * material.diffuse;
16481661 colorV[2] = display.modelParams0[2] * material.diffuse;
1649
- colorV[3] = material.opacity;
1662
+ colorV[3] = 1; // material.opacity;
16501663
16511664 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16521665 //System.out.println("Opacity = " + opacity);
....@@ -1754,9 +1767,9 @@
17541767 display.modelParams7[2] = 0;
17551768 display.modelParams7[3] = 0;
17561769
1757
- display.modelParams6[0] = 100; // criss de bug de bump
1770
+ //display.modelParams6[0] = 100; // criss de bug de bump
17581771
1759
- Object3D.cVector2[] extparams = display.vector2buffer;
1772
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17601773 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17611774 {
17621775 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -2267,7 +2280,7 @@
22672280
22682281 void ToggleDebug()
22692282 {
2270
- DEBUG ^= true;
2283
+ Globals.DEBUG ^= true;
22712284 }
22722285
22732286 void ToggleLookAt()
....@@ -9367,11 +9380,35 @@
93679380 jy8[3] = 0.5f;
93689381 }
93699382
9370
- float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
9383
+ float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
93719384 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
93729385 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
93739386 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
93749387
9388
+ void ResetOptions()
9389
+ {
9390
+ options1[0] = 100;
9391
+ options1[1] = 0.025f;
9392
+ options1[2] = 0.01f;
9393
+ options1[3] = 0;
9394
+ options1[4] = 0;
9395
+
9396
+ options2[0] = 0;
9397
+ options2[1] = 0.75f;
9398
+ options2[2] = 0;
9399
+ options2[3] = 0;
9400
+
9401
+ options3[0] = 1;
9402
+ options3[1] = 1;
9403
+ options3[2] = 1;
9404
+ options3[3] = 0;
9405
+
9406
+ options4[0] = 1;
9407
+ options4[1] = 0;
9408
+ options4[2] = 1;
9409
+ options4[3] = 0;
9410
+ }
9411
+
93759412 static int imagecount = 0; // movie generation
93769413
93779414 static int jitter = 0;
....@@ -10482,6 +10519,7 @@
1048210519 ANTIALIAS = 0;
1048310520 //System.out.println("RESTART");
1048410521 AAtimer.restart();
10522
+ Globals.TIMERRUNNING = true;
1048510523 }
1048610524 }
1048710525 }
....@@ -10549,7 +10587,8 @@
1054910587 ambientOcclusion = false;
1055010588 }
1055110589
10552
- if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
10590
+ if (//Globals.lighttouched &&
10591
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1055310592 {
1055410593 //if (RENDERSHADOW) // ?
1055510594 if (!IsFrozen())
....@@ -11459,8 +11498,29 @@
1145911498
1146011499 static boolean zoomonce = false;
1146111500
11501
+ static void CreateSelectedPoint()
11502
+ {
11503
+ if (selectedpoint == null)
11504
+ {
11505
+ debugpointG = new Sphere();
11506
+ debugpointP = new Sphere();
11507
+ debugpointC = new Sphere();
11508
+ debugpointR = new Sphere();
11509
+
11510
+ selectedpoint = new Superellipsoid();
11511
+
11512
+ for (int i=0; i<8; i++)
11513
+ {
11514
+ debugpoints[i] = new Sphere();
11515
+ }
11516
+ }
11517
+ }
11518
+
1146211519 void DrawObject(GL gl, boolean draw)
1146311520 {
11521
+ // To clear camera values
11522
+ ResetOptions();
11523
+
1146411524 //System.out.println("DRAW OBJECT " + mouseDown);
1146511525 // DrawMode() = SELECTION;
1146611526 //GL gl = getGL();
....@@ -11539,8 +11599,9 @@
1153911599
1154011600 if (DrawMode() == DEFAULT)
1154111601 {
11542
- if (DEBUG)
11602
+ if (Globals.DEBUG)
1154311603 {
11604
+ CreateSelectedPoint();
1154411605 float radius = 0.05f;
1154511606 if (selectedpoint.radius != radius)
1154611607 {
....@@ -12027,7 +12088,7 @@
1202712088 for (int i = tp.size(); --i >= 0;)
1202812089 {
1202912090 //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12030
- LA.xformPos(light, tp.get(i).GlobalTransform(), light);
12091
+ LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
1203112092 }
1203212093
1203312094
....@@ -13297,7 +13358,8 @@
1329713358 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1329813359 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1329913360 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13300
- Object3D.cVector2[] vector2buffer;
13361
+
13362
+ //Object3D.cVector2[] vector2buffer;
1330113363
1330213364 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1330313365 // OUT : diff, spec
....@@ -13820,6 +13882,7 @@
1382013882 else
1382113883 if (evt.getSource() == AAtimer)
1382213884 {
13885
+ Globals.TIMERRUNNING = false;
1382313886 if (mouseDown)
1382413887 {
1382513888 //new Exception().printStackTrace();
....@@ -13894,6 +13957,7 @@
1389413957 return;
1389513958
1389613959 AAtimer.restart(); //
13960
+ Globals.TIMERRUNNING = true;
1389713961
1389813962 // waslive = LIVE;
1389913963 // LIVE = false;
....@@ -14357,7 +14421,8 @@
1435714421 info.camera = renderCamera;
1435814422 info.x = x;
1435914423 info.y = y;
14360
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14424
+ object.GetWindow().copy
14425
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1436114426 } else
1436214427 {
1436314428 if (x < startX)
....@@ -14521,7 +14586,9 @@
1452114586 ci.camera = renderCamera;
1452214587 if (!isRenderer)
1452314588 {
14524
- if (object.editWindow.copy.doEditClick(ci, 0))
14589
+ //ObjEditor editWindow = object.editWindow;
14590
+ //Object3D copy = editWindow.copy;
14591
+ if (object.doEditClick(ci, 0))
1452514592 {
1452614593 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1452714594 } else
....@@ -14902,8 +14969,14 @@
1490214969 RevertCamera();
1490314970 repaint();
1490414971 break;
14905
- case 'L':
1490614972 case 'l':
14973
+ lightMode ^= true;
14974
+ Globals.lighttouched = true;
14975
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14976
+ targetLookAt.set(manipCamera.lookAt);
14977
+ repaint();
14978
+ break;
14979
+ case 'L':
1490714980 if (lightMode)
1490814981 {
1490914982 lightMode = false;
....@@ -15050,16 +15123,14 @@
1505015123 kompactbit = 6;
1505115124 break;
1505215125 case ' ':
15053
- lightMode ^= true;
15054
- Globals.lighttouched = true;
15055
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15056
- targetLookAt.set(manipCamera.lookAt);
15126
+ ObjEditor.theFrame.ToggleFullScreen();
1505715127 repaint();
1505815128 break;
1505915129 //case '`' :
1506015130 case ESC:
1506115131 RENDERPROGRAM += 1;
1506215132 RENDERPROGRAM %= 3;
15133
+
1506315134 repaint();
1506415135 break;
1506515136 case 'Z':
....@@ -15351,7 +15422,7 @@
1535115422 }
1535215423 */
1535315424
15354
- object.editWindow.EditSelection();
15425
+ object.editWindow.EditSelection(false);
1535515426 }
1535615427
1535715428 void SelectParent()
....@@ -16363,16 +16434,16 @@
1636316434 cStatic.objectstack[materialdepth++] = checker;
1636416435 //System.out.println("material " + material);
1636516436 //Applet3D.tracein(this, selected);
16366
- vector2buffer = checker.projectedVertices;
16437
+ //vector2buffer = checker.projectedVertices;
1636716438
1636816439 //checker.GetMaterial().Draw(this, false); // true);
16369
- DrawMaterial(checker.GetMaterial(), false); // true);
16440
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1637016441
1637116442 materialdepth -= 1;
1637216443 if (materialdepth > 0)
1637316444 {
16374
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16375
- DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
16445
+ //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16446
+ DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
1637616447 }
1637716448 //checker.GetMaterial().opacity = 1f;
1637816449 ////checker.GetMaterial().ambient = 1f;
....@@ -16596,6 +16667,8 @@
1659616667 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1659716668 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
1659816669
16670
+ CreateSelectedPoint();
16671
+
1659916672 // Will fit the mesh !!!
1660016673 selectedpoint.toParent[0][0] = 0.0001;
1660116674 selectedpoint.toParent[1][1] = 0.0001;
....@@ -16710,6 +16783,11 @@
1671016783 //System.out.println("objects[color] = " + objects[color]);
1671116784 //objects[color].Select();
1671216785 indexcount = 0;
16786
+ ObjEditor window = object.GetWindow();
16787
+ if (window != null && deselect)
16788
+ {
16789
+ window.Select(null, deselect, true);
16790
+ }
1671316791 object.Select(color, deselect);
1671416792 }
1671516793
....@@ -17235,23 +17313,15 @@
1723517313 int AAbuffersize = 0;
1723617314
1723717315 //double[] selectedpoint = new double[3];
17238
- static Superellipsoid selectedpoint = new Superellipsoid();
17316
+ static Superellipsoid selectedpoint;
1723917317 static Sphere previousselectedpoint = null;
17240
- static Sphere debugpointG = new Sphere();
17241
- static Sphere debugpointP = new Sphere();
17242
- static Sphere debugpointC = new Sphere();
17243
- static Sphere debugpointR = new Sphere();
17318
+ static Sphere debugpointG;
17319
+ static Sphere debugpointP;
17320
+ static Sphere debugpointC;
17321
+ static Sphere debugpointR;
1724417322
1724517323 static Sphere debugpoints[] = new Sphere[8];
1724617324
17247
- static
17248
- {
17249
- for (int i=0; i<8; i++)
17250
- {
17251
- debugpoints[i] = new Sphere();
17252
- }
17253
- }
17254
-
1725517325 static void InitPoints(float radius)
1725617326 {
1725717327 for (int i=0; i<8; i++)