Normand Briere
2019-06-25 ecff440ceef3ad352aa64cedbb913107ec4863a5
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;
....@@ -359,7 +358,7 @@
359358 /**/
360359 } else
361360 {
362
- DrawMaterial(material, selected);
361
+ DrawMaterial(material, selected, obj.projectedVertices);
363362 }
364363 } else
365364 {
....@@ -383,8 +382,8 @@
383382 cStatic.objectstack[materialdepth++] = obj;
384383 //System.out.println("material " + material);
385384 //Applet3D.tracein("selected ", selected);
386
- display.vector2buffer = obj.projectedVertices;
387
- display.DrawMaterial(material, selected);
385
+ //display.vector2buffer = obj.projectedVertices;
386
+ display.DrawMaterial(material, selected, obj.projectedVertices);
388387 }
389388 }
390389
....@@ -401,8 +400,8 @@
401400 materialdepth -= 1;
402401 if (materialdepth > 0)
403402 {
404
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
405
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
403
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
404
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
406405 }
407406 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
408407 } else if (selected && CameraPane.flash && obj.GetMaterial() != null)
....@@ -422,8 +421,8 @@
422421 materialdepth -= 1;
423422 if (materialdepth > 0)
424423 {
425
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
426
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
424
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
425
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
427426 }
428427 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
429428 //else
....@@ -1611,7 +1610,7 @@
16111610 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16121611 }
16131612
1614
- void DrawMaterial(cMaterial material, boolean selected)
1613
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16151614 {
16161615 CameraPane display = this;
16171616 //new Exception().printStackTrace();
....@@ -1646,7 +1645,7 @@
16461645 colorV[0] = display.modelParams0[0] * material.diffuse;
16471646 colorV[1] = display.modelParams0[1] * material.diffuse;
16481647 colorV[2] = display.modelParams0[2] * material.diffuse;
1649
- colorV[3] = material.opacity;
1648
+ colorV[3] = 1; // material.opacity;
16501649
16511650 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16521651 //System.out.println("Opacity = " + opacity);
....@@ -1754,9 +1753,9 @@
17541753 display.modelParams7[2] = 0;
17551754 display.modelParams7[3] = 0;
17561755
1757
- display.modelParams6[0] = 100; // criss de bug de bump
1756
+ //display.modelParams6[0] = 100; // criss de bug de bump
17581757
1759
- Object3D.cVector2[] extparams = display.vector2buffer;
1758
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17601759 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17611760 {
17621761 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -2267,7 +2266,7 @@
22672266
22682267 void ToggleDebug()
22692268 {
2270
- DEBUG ^= true;
2269
+ Globals.DEBUG ^= true;
22712270 }
22722271
22732272 void ToggleLookAt()
....@@ -9367,11 +9366,35 @@
93679366 jy8[3] = 0.5f;
93689367 }
93699368
9370
- float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
9369
+ float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
93719370 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
93729371 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
93739372 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
93749373
9374
+ void ResetOptions()
9375
+ {
9376
+ options1[0] = 100;
9377
+ options1[1] = 0.00001f;
9378
+ options1[2] = 20;
9379
+ options1[3] = 0;
9380
+ options1[4] = 0;
9381
+
9382
+ options2[0] = 0;
9383
+ options2[1] = 1;
9384
+ options2[2] = 0;
9385
+ options2[3] = 0;
9386
+
9387
+ options3[0] = 1;
9388
+ options3[1] = 1;
9389
+ options3[2] = 1;
9390
+ options3[3] = 0;
9391
+
9392
+ options4[0] = 1;
9393
+ options4[1] = 0;
9394
+ options4[2] = 1;
9395
+ options4[3] = 0;
9396
+ }
9397
+
93759398 static int imagecount = 0; // movie generation
93769399
93779400 static int jitter = 0;
....@@ -10482,6 +10505,7 @@
1048210505 ANTIALIAS = 0;
1048310506 //System.out.println("RESTART");
1048410507 AAtimer.restart();
10508
+ Globals.TIMERRUNNING = true;
1048510509 }
1048610510 }
1048710511 }
....@@ -10549,7 +10573,8 @@
1054910573 ambientOcclusion = false;
1055010574 }
1055110575
10552
- if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
10576
+ if (//Globals.lighttouched &&
10577
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1055310578 {
1055410579 //if (RENDERSHADOW) // ?
1055510580 if (!IsFrozen())
....@@ -11459,8 +11484,29 @@
1145911484
1146011485 static boolean zoomonce = false;
1146111486
11487
+ static void CreateSelectedPoint()
11488
+ {
11489
+ if (selectedpoint == null)
11490
+ {
11491
+ debugpointG = new Sphere();
11492
+ debugpointP = new Sphere();
11493
+ debugpointC = new Sphere();
11494
+ debugpointR = new Sphere();
11495
+
11496
+ selectedpoint = new Superellipsoid();
11497
+
11498
+ for (int i=0; i<8; i++)
11499
+ {
11500
+ debugpoints[i] = new Sphere();
11501
+ }
11502
+ }
11503
+ }
11504
+
1146211505 void DrawObject(GL gl, boolean draw)
1146311506 {
11507
+ // To clear camera values
11508
+ ResetOptions();
11509
+
1146411510 //System.out.println("DRAW OBJECT " + mouseDown);
1146511511 // DrawMode() = SELECTION;
1146611512 //GL gl = getGL();
....@@ -11539,8 +11585,9 @@
1153911585
1154011586 if (DrawMode() == DEFAULT)
1154111587 {
11542
- if (DEBUG)
11588
+ if (Globals.DEBUG)
1154311589 {
11590
+ CreateSelectedPoint();
1154411591 float radius = 0.05f;
1154511592 if (selectedpoint.radius != radius)
1154611593 {
....@@ -12027,7 +12074,7 @@
1202712074 for (int i = tp.size(); --i >= 0;)
1202812075 {
1202912076 //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12030
- LA.xformPos(light, tp.get(i).GlobalTransform(), light);
12077
+ LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
1203112078 }
1203212079
1203312080
....@@ -13297,7 +13344,8 @@
1329713344 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1329813345 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1329913346 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13300
- Object3D.cVector2[] vector2buffer;
13347
+
13348
+ //Object3D.cVector2[] vector2buffer;
1330113349
1330213350 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1330313351 // OUT : diff, spec
....@@ -13820,6 +13868,7 @@
1382013868 else
1382113869 if (evt.getSource() == AAtimer)
1382213870 {
13871
+ Globals.TIMERRUNNING = false;
1382313872 if (mouseDown)
1382413873 {
1382513874 //new Exception().printStackTrace();
....@@ -13894,6 +13943,7 @@
1389413943 return;
1389513944
1389613945 AAtimer.restart(); //
13946
+ Globals.TIMERRUNNING = true;
1389713947
1389813948 // waslive = LIVE;
1389913949 // LIVE = false;
....@@ -14357,7 +14407,8 @@
1435714407 info.camera = renderCamera;
1435814408 info.x = x;
1435914409 info.y = y;
14360
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14410
+ object.GetWindow().copy
14411
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1436114412 } else
1436214413 {
1436314414 if (x < startX)
....@@ -14521,7 +14572,9 @@
1452114572 ci.camera = renderCamera;
1452214573 if (!isRenderer)
1452314574 {
14524
- if (object.editWindow.copy.doEditClick(ci, 0))
14575
+ //ObjEditor editWindow = object.editWindow;
14576
+ //Object3D copy = editWindow.copy;
14577
+ if (object.doEditClick(ci, 0))
1452514578 {
1452614579 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1452714580 } else
....@@ -14902,8 +14955,14 @@
1490214955 RevertCamera();
1490314956 repaint();
1490414957 break;
14905
- case 'L':
1490614958 case 'l':
14959
+ lightMode ^= true;
14960
+ Globals.lighttouched = true;
14961
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14962
+ targetLookAt.set(manipCamera.lookAt);
14963
+ repaint();
14964
+ break;
14965
+ case 'L':
1490714966 if (lightMode)
1490814967 {
1490914968 lightMode = false;
....@@ -15050,16 +15109,14 @@
1505015109 kompactbit = 6;
1505115110 break;
1505215111 case ' ':
15053
- lightMode ^= true;
15054
- Globals.lighttouched = true;
15055
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15056
- targetLookAt.set(manipCamera.lookAt);
15112
+ ObjEditor.theFrame.ToggleFullScreen();
1505715113 repaint();
1505815114 break;
1505915115 //case '`' :
1506015116 case ESC:
1506115117 RENDERPROGRAM += 1;
1506215118 RENDERPROGRAM %= 3;
15119
+
1506315120 repaint();
1506415121 break;
1506515122 case 'Z':
....@@ -15351,7 +15408,7 @@
1535115408 }
1535215409 */
1535315410
15354
- object.editWindow.EditSelection();
15411
+ object.editWindow.EditSelection(false);
1535515412 }
1535615413
1535715414 void SelectParent()
....@@ -16363,16 +16420,16 @@
1636316420 cStatic.objectstack[materialdepth++] = checker;
1636416421 //System.out.println("material " + material);
1636516422 //Applet3D.tracein(this, selected);
16366
- vector2buffer = checker.projectedVertices;
16423
+ //vector2buffer = checker.projectedVertices;
1636716424
1636816425 //checker.GetMaterial().Draw(this, false); // true);
16369
- DrawMaterial(checker.GetMaterial(), false); // true);
16426
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1637016427
1637116428 materialdepth -= 1;
1637216429 if (materialdepth > 0)
1637316430 {
16374
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16375
- DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
16431
+ //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16432
+ DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
1637616433 }
1637716434 //checker.GetMaterial().opacity = 1f;
1637816435 ////checker.GetMaterial().ambient = 1f;
....@@ -16595,6 +16652,8 @@
1659516652 // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]);
1659616653 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1659716654 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
16655
+
16656
+ CreateSelectedPoint();
1659816657
1659916658 // Will fit the mesh !!!
1660016659 selectedpoint.toParent[0][0] = 0.0001;
....@@ -17235,23 +17294,15 @@
1723517294 int AAbuffersize = 0;
1723617295
1723717296 //double[] selectedpoint = new double[3];
17238
- static Superellipsoid selectedpoint = new Superellipsoid();
17297
+ static Superellipsoid selectedpoint;
1723917298 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();
17299
+ static Sphere debugpointG;
17300
+ static Sphere debugpointP;
17301
+ static Sphere debugpointC;
17302
+ static Sphere debugpointR;
1724417303
1724517304 static Sphere debugpoints[] = new Sphere[8];
1724617305
17247
- static
17248
- {
17249
- for (int i=0; i<8; i++)
17250
- {
17251
- debugpoints[i] = new Sphere();
17252
- }
17253
- }
17254
-
1725517306 static void InitPoints(float radius)
1725617307 {
1725717308 for (int i=0; i<8; i++)