Normand Briere
2019-07-01 9079880942d022ee32fd3a543843e132e52deb1a
CameraPane.java
....@@ -326,7 +326,7 @@
326326 cStatic.objectstack[materialdepth++] = obj;
327327 //System.out.println("material " + material);
328328 //Applet3D.tracein(this, selected);
329
- display.vector2buffer = obj.projectedVertices;
329
+ //display.vector2buffer = obj.projectedVertices;
330330 if (obj instanceof Camera)
331331 {
332332 display.options1[0] = material.shift;
....@@ -335,14 +335,28 @@
335335 display.options1[2] = material.shadowbias;
336336 display.options1[3] = material.aniso;
337337 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]);
338343 display.options2[0] = material.opacity;
339344 display.options2[1] = material.diffuse;
340345 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]);
341349
342350 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]);
343354 display.options4[0] = material.cameralight/0.2f;
344355 display.options4[1] = material.subsurface;
345356 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]);
346360
347361 // if (display.CURRENTANTIALIAS > 0)
348362 // display.options3[3] /= 4;
....@@ -358,7 +372,7 @@
358372 /**/
359373 } else
360374 {
361
- DrawMaterial(material, selected);
375
+ DrawMaterial(material, selected, obj.projectedVertices);
362376 }
363377 } else
364378 {
....@@ -382,8 +396,8 @@
382396 cStatic.objectstack[materialdepth++] = obj;
383397 //System.out.println("material " + material);
384398 //Applet3D.tracein("selected ", selected);
385
- display.vector2buffer = obj.projectedVertices;
386
- display.DrawMaterial(material, selected);
399
+ //display.vector2buffer = obj.projectedVertices;
400
+ display.DrawMaterial(material, selected, obj.projectedVertices);
387401 }
388402 }
389403
....@@ -400,8 +414,8 @@
400414 materialdepth -= 1;
401415 if (materialdepth > 0)
402416 {
403
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
404
- 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);
405419 }
406420 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
407421 } else if (selected && CameraPane.flash && obj.GetMaterial() != null)
....@@ -421,8 +435,8 @@
421435 materialdepth -= 1;
422436 if (materialdepth > 0)
423437 {
424
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
425
- 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);
426440 }
427441 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
428442 //else
....@@ -1610,7 +1624,7 @@
16101624 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16111625 }
16121626
1613
- void DrawMaterial(cMaterial material, boolean selected)
1627
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16141628 {
16151629 CameraPane display = this;
16161630 //new Exception().printStackTrace();
....@@ -1645,7 +1659,7 @@
16451659 colorV[0] = display.modelParams0[0] * material.diffuse;
16461660 colorV[1] = display.modelParams0[1] * material.diffuse;
16471661 colorV[2] = display.modelParams0[2] * material.diffuse;
1648
- colorV[3] = material.opacity;
1662
+ colorV[3] = 1; // material.opacity;
16491663
16501664 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16511665 //System.out.println("Opacity = " + opacity);
....@@ -1753,9 +1767,9 @@
17531767 display.modelParams7[2] = 0;
17541768 display.modelParams7[3] = 0;
17551769
1756
- display.modelParams6[0] = 100; // criss de bug de bump
1770
+ //display.modelParams6[0] = 100; // criss de bug de bump
17571771
1758
- Object3D.cVector2[] extparams = display.vector2buffer;
1772
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17591773 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17601774 {
17611775 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -9366,11 +9380,35 @@
93669380 jy8[3] = 0.5f;
93679381 }
93689382
9369
- 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
93709384 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
93719385 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
93729386 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
93739387
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
+
93749412 static int imagecount = 0; // movie generation
93759413
93769414 static int jitter = 0;
....@@ -10481,6 +10519,7 @@
1048110519 ANTIALIAS = 0;
1048210520 //System.out.println("RESTART");
1048310521 AAtimer.restart();
10522
+ Globals.TIMERRUNNING = true;
1048410523 }
1048510524 }
1048610525 }
....@@ -10548,7 +10587,8 @@
1054810587 ambientOcclusion = false;
1054910588 }
1055010589
10551
- if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
10590
+ if (//Globals.lighttouched &&
10591
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1055210592 {
1055310593 //if (RENDERSHADOW) // ?
1055410594 if (!IsFrozen())
....@@ -11458,7 +11498,7 @@
1145811498
1145911499 static boolean zoomonce = false;
1146011500
11461
- void CreateSelectedPoint()
11501
+ static void CreateSelectedPoint()
1146211502 {
1146311503 if (selectedpoint == null)
1146411504 {
....@@ -11478,6 +11518,9 @@
1147811518
1147911519 void DrawObject(GL gl, boolean draw)
1148011520 {
11521
+ // To clear camera values
11522
+ ResetOptions();
11523
+
1148111524 //System.out.println("DRAW OBJECT " + mouseDown);
1148211525 // DrawMode() = SELECTION;
1148311526 //GL gl = getGL();
....@@ -12045,7 +12088,7 @@
1204512088 for (int i = tp.size(); --i >= 0;)
1204612089 {
1204712090 //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12048
- LA.xformPos(light, tp.get(i).GlobalTransform(), light);
12091
+ LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
1204912092 }
1205012093
1205112094
....@@ -13315,7 +13358,8 @@
1331513358 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1331613359 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1331713360 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13318
- Object3D.cVector2[] vector2buffer;
13361
+
13362
+ //Object3D.cVector2[] vector2buffer;
1331913363
1332013364 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1332113365 // OUT : diff, spec
....@@ -13331,9 +13375,10 @@
1333113375 "DP3 " + dest + ".z," + "normals," + "eye;" +
1333213376 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1333313377 //"MOV " + dest + ".w," + "normal.z;" +
13334
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13335
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13336
- //"MOV " + dest + ".z," + "params2.w;" +
13378
+// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET
13379
+// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13380
+
13381
+ "MOV " + dest + ".z," + "params2.w;" + // EXACT
1333713382 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1333813383 "RCP " + dest + ".w," + dest + ".w;" +
1333913384 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13838,6 +13883,7 @@
1383813883 else
1383913884 if (evt.getSource() == AAtimer)
1384013885 {
13886
+ Globals.TIMERRUNNING = false;
1384113887 if (mouseDown)
1384213888 {
1384313889 //new Exception().printStackTrace();
....@@ -13912,6 +13958,7 @@
1391213958 return;
1391313959
1391413960 AAtimer.restart(); //
13961
+ Globals.TIMERRUNNING = true;
1391513962
1391613963 // waslive = LIVE;
1391713964 // LIVE = false;
....@@ -14375,7 +14422,8 @@
1437514422 info.camera = renderCamera;
1437614423 info.x = x;
1437714424 info.y = y;
14378
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14425
+ object.GetWindow().copy
14426
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1437914427 } else
1438014428 {
1438114429 if (x < startX)
....@@ -14539,7 +14587,9 @@
1453914587 ci.camera = renderCamera;
1454014588 if (!isRenderer)
1454114589 {
14542
- if (object.editWindow.copy.doEditClick(ci, 0))
14590
+ //ObjEditor editWindow = object.editWindow;
14591
+ //Object3D copy = editWindow.copy;
14592
+ if (object.doEditClick(ci, 0))
1454314593 {
1454414594 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1454514595 } else
....@@ -15070,9 +15120,9 @@
1507015120 case '_':
1507115121 kompactbit = 5;
1507215122 break;
15073
- case '+':
15074
- kompactbit = 6;
15075
- break;
15123
+// case '+':
15124
+// kompactbit = 6;
15125
+// break;
1507615126 case ' ':
1507715127 ObjEditor.theFrame.ToggleFullScreen();
1507815128 repaint();
....@@ -15121,8 +15171,9 @@
1512115171 case DELETE:
1512215172 ClearSelection();
1512315173 break;
15124
- /*
1512515174 case '+':
15175
+
15176
+ /*
1512615177 //fontsize += 1;
1512715178 bbzoom *= 2;
1512815179 repaint();
....@@ -15373,7 +15424,7 @@
1537315424 }
1537415425 */
1537515426
15376
- object.editWindow.EditSelection();
15427
+ object.editWindow.EditSelection(false);
1537715428 }
1537815429
1537915430 void SelectParent()
....@@ -16385,16 +16436,16 @@
1638516436 cStatic.objectstack[materialdepth++] = checker;
1638616437 //System.out.println("material " + material);
1638716438 //Applet3D.tracein(this, selected);
16388
- vector2buffer = checker.projectedVertices;
16439
+ //vector2buffer = checker.projectedVertices;
1638916440
1639016441 //checker.GetMaterial().Draw(this, false); // true);
16391
- DrawMaterial(checker.GetMaterial(), false); // true);
16442
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1639216443
1639316444 materialdepth -= 1;
1639416445 if (materialdepth > 0)
1639516446 {
16396
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16397
- DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
16447
+ //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16448
+ DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
1639816449 }
1639916450 //checker.GetMaterial().opacity = 1f;
1640016451 ////checker.GetMaterial().ambient = 1f;
....@@ -16618,6 +16669,8 @@
1661816669 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1661916670 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
1662016671
16672
+ CreateSelectedPoint();
16673
+
1662116674 // Will fit the mesh !!!
1662216675 selectedpoint.toParent[0][0] = 0.0001;
1662316676 selectedpoint.toParent[1][1] = 0.0001;
....@@ -16732,6 +16785,11 @@
1673216785 //System.out.println("objects[color] = " + objects[color]);
1673316786 //objects[color].Select();
1673416787 indexcount = 0;
16788
+ ObjEditor window = object.GetWindow();
16789
+ if (window != null && deselect)
16790
+ {
16791
+ window.Select(null, deselect, true);
16792
+ }
1673516793 object.Select(color, deselect);
1673616794 }
1673716795