Normand Briere
2019-08-16 64e20f390e4b8e58bd0006dde8fa10fba1dac1d5
Fix box and VR keys.
9 files modified
8 files added
162 ■■■■ changed files
BoundaryRep.java 2 ●●● patch | view | raw | blame | history
Box.java 4 ●●●● patch | view | raw | blame | history
Camera.java 2 ●●● patch | view | raw | blame | history
CameraPane.java 66 ●●●● patch | view | raw | blame | history
Grafreed.java 3 ●●●● patch | view | raw | blame | history
Grid.java 2 ●●● patch | view | raw | blame | history
GroupEditor.java 29 ●●●●● patch | view | raw | blame | history
ObjEditor.java 31 ●●●● patch | view | raw | blame | history
Object3D.java 23 ●●●●● patch | view | raw | blame | history
cubemaps/default-skyboxes/rgb2/negx.jpg patch | view | raw | blame | history
cubemaps/default-skyboxes/rgb2/negy.jpg patch | view | raw | blame | history
cubemaps/default-skyboxes/rgb2/negz.jpg patch | view | raw | blame | history
cubemaps/default-skyboxes/rgb2/posx.jpg patch | view | raw | blame | history
cubemaps/default-skyboxes/rgb2/posy.jpg patch | view | raw | blame | history
cubemaps/default-skyboxes/rgb2/posz.jpg patch | view | raw | blame | history
cubemaps/default-skyboxes/rgb2/preview.jpg patch | view | raw | blame | history
icons/empty.png patch | view | raw | blame | history
BoundaryRep.java
....@@ -2000,7 +2000,7 @@
20002000 // Warning: faster but dangerous
20012001 if (v.weights != null && v.weights[j]
20022002 // == 0)
2003
- < 0.001 * v.totalweight)
2003
+ < 0.0001 * v.totalweight)
20042004 {
20052005 //testweight += v.weights[j-1];
20062006 continue;
Box.java
....@@ -106,10 +106,10 @@
106106 cVector minima;
107107 cVector maxima;
108108 static float umap[] = {
109
- 0, 1, 0, 1, 1, 0, 1, 0
109
+ 0, 1, 0, 1, 1, 0, 1, 0,
110110 };
111111 static float vmap[] = {
112
- 0, 0, 1, 1, 1, 1, 0, 0
112
+ 1, 1, 0, 0, 1, 1, 0, 0,
113113 };
114114 static int faces[][] = {
115115 {
Camera.java
....@@ -319,7 +319,7 @@
319319 location.set(lookAt);
320320 lookAt.set(cStatic.point1);
321321
322
- computeTransform();
322
+ //computeTransform();
323323 }
324324
325325 //synchronized // june 2014
CameraPane.java
....@@ -11088,7 +11088,7 @@
1108811088 {
1108911089 if (cubemaprgb == null)
1109011090 {
11091
- cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb" + "/", "jpg", false);
11091
+ cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb2" + "/", "jpg", false);
1109211092 }
1109311093
1109411094 cubemap = cubemaprgb;
....@@ -13419,8 +13419,12 @@
1341913419 program = programmin;
1342013420 }
1342113421
13422
- System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
13423
- System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
13422
+ if (Globals.DEBUG)
13423
+ {
13424
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
13425
+ System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
13426
+ }
13427
+
1342413428 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1342513429
1342613430 //gl.glNewList(displayListID, GL.GL_COMPILE);
....@@ -13467,7 +13471,8 @@
1346713471 "\n" +
1346813472 "END\n";
1346913473
13470
- System.out.println("Program shadow #" + 0 + "; length = " + program.length());
13474
+ if (Globals.DEBUG)
13475
+ System.out.println("Program shadow #" + 0 + "; length = " + program.length());
1347113476 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1347213477
1347313478 //gl.glNewList(displayListID, GL.GL_COMPILE);
....@@ -14666,11 +14671,17 @@
1466614671 void GoDown(int mod)
1466714672 {
1466814673 MODIFIERS |= COMMAND;
14674
+ boolean isVR = (mouseMode&VR)!=0;
1466914675 /**/
1467014676 if((mod&SHIFT) == SHIFT)
14671
- manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14677
+ {
14678
+ if (isVR)
14679
+ manipCamera.RotateInterest(0, -speed);
14680
+ else
14681
+ manipCamera.RotatePosition(0, -speed);
14682
+ }
1467214683 else
14673
- manipCamera.RotatePosition(0, -speed);
14684
+ manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth());
1467414685 /**/
1467514686 if ((mod & SHIFT) == SHIFT)
1467614687 {
....@@ -14680,6 +14691,8 @@
1468014691 mouseMode |= BACKFORTH;
1468114692 }
1468214693
14694
+ targetLookAt.set(manipCamera.lookAt);
14695
+
1468314696 //prevX = X = anchorX;
1468414697 prevY = Y = anchorY - (int) (renderCamera.Distance());
1468514698 }
....@@ -14688,10 +14701,17 @@
1468814701 {
1468914702 MODIFIERS |= COMMAND;
1469014703 /**/
14704
+ boolean isVR = (mouseMode&VR)!=0;
14705
+
1469114706 if((mod&SHIFT) == SHIFT)
14692
- manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14707
+ {
14708
+ if (isVR)
14709
+ manipCamera.RotateInterest(0, speed);
14710
+ else
14711
+ manipCamera.RotatePosition(0, speed);
14712
+ }
1469314713 else
14694
- manipCamera.RotatePosition(0, speed);
14714
+ manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth());
1469514715 /**/
1469614716 if ((mod & SHIFT) == SHIFT)
1469714717 {
....@@ -14701,6 +14721,8 @@
1470114721 mouseMode |= BACKFORTH;
1470214722 }
1470314723
14724
+ targetLookAt.set(manipCamera.lookAt);
14725
+
1470414726 //prevX = X = anchorX;
1470514727 prevY = Y = anchorY + (int) (renderCamera.Distance());
1470614728 }
....@@ -14710,9 +14732,14 @@
1471014732 MODIFIERS |= COMMAND;
1471114733 /**/
1471214734 if((mod&SHIFT) == SHIFT)
14713
- manipCamera.Translate(speed*delta, 0, getWidth());
14735
+ manipCamera.Translate(speed*delta, 0, getWidth());
1471414736 else
14715
- manipCamera.RotatePosition(speed, 0);
14737
+ {
14738
+ if ((mouseMode&VR)!=0)
14739
+ manipCamera.RotateInterest(-speed, 0);
14740
+ else
14741
+ manipCamera.RotatePosition(speed, 0);
14742
+ }
1471614743 /**/
1471714744 if ((mod & SHIFT) == SHIFT)
1471814745 {
....@@ -14722,6 +14749,8 @@
1472214749 mouseMode |= ROTATE;
1472314750 } // TRANSLATE;
1472414751
14752
+ targetLookAt.set(manipCamera.lookAt);
14753
+
1472514754 prevX = X = anchorX - 10; // (int)(10*renderCamera.Distance());
1472614755 prevY = Y = anchorY;
1472714756 }
....@@ -14731,9 +14760,15 @@
1473114760 MODIFIERS |= COMMAND;
1473214761 /**/
1473314762 if((mod&SHIFT) == SHIFT)
14734
- manipCamera.Translate(-speed*delta, 0, getWidth());
14763
+ manipCamera.Translate(-speed*delta, 0, getWidth());
1473514764 else
14736
- manipCamera.RotatePosition(-speed, 0);
14765
+ {
14766
+ if ((mouseMode&VR)!=0)
14767
+ manipCamera.RotateInterest(speed, 0);
14768
+ else
14769
+ manipCamera.RotatePosition(-speed, 0);
14770
+ }
14771
+
1473714772 /**/
1473814773 if ((mod & SHIFT) == SHIFT)
1473914774 {
....@@ -14743,6 +14778,8 @@
1474314778 mouseMode |= ROTATE;
1474414779 } // TRANSLATE;
1474514780
14781
+ targetLookAt.set(manipCamera.lookAt);
14782
+
1474614783 prevX = X = anchorX + 10; // (int)(10*renderCamera.Distance());
1474714784 prevY = Y = anchorY;
1474814785 }
....@@ -16127,7 +16164,7 @@
1612716164 {
1612816165 switch (hitSomething)
1612916166 {
16130
- case Object3D.hitCenter: gr.setColor(Color.pink);
16167
+ case Object3D.hitCenter: gr.setColor(Color.white);
1613116168 gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
1613216169 break;
1613316170 case Object3D.hitRotate: gr.setColor(Color.yellow);
....@@ -16153,7 +16190,7 @@
1615316190 if (hasMarquee)
1615416191 {
1615516192 gr.setXORMode(Color.white);
16156
- gr.setColor(Color.red);
16193
+ gr.setColor(Color.white);
1615716194 if (!firstime)
1615816195 {
1615916196 gr.drawRect(prevmarqX, prevmarqY, prevmarqW, prevmarqH);
....@@ -17329,6 +17366,7 @@
1732917366
1733017367 public void init(GLAutoDrawable drawable)
1733117368 {
17369
+ if (Globals.DEBUG)
1733217370 System.out.println("shadow buffer init");
1733317371
1733417372 GL gl = drawable.getGL();
Grafreed.java
....@@ -676,7 +676,8 @@
676676
677677 public static void main(String argv[])
678678 {
679
- String osArch = System.getProperty("os.arch");
679
+ String osArch = System.getProperty("os.arch");
680
+ if (Globals.DEBUG)
680681 System.out.println("os.arch = " + osArch);
681682
682683 if (argv.length == 0)
Grid.java
....@@ -69,7 +69,7 @@
6969
7070 double vFlip(double v)
7171 {
72
- return v;
72
+ return 1-v;
7373 }
7474
7575 Vertex biparamFunction(double u, double v)
GroupEditor.java
....@@ -570,9 +570,6 @@
570570 //menu.add("-");
571571 oe.jTree.popup.addSeparator();
572572
573
- deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
574
- deleteItem.addActionListener(this);
575
-
576573 if (Globals.ADVANCED)
577574 {
578575 // Deletes the cameras...
....@@ -706,15 +703,17 @@
706703 setMasterItem.addActionListener(this);
707704 }
708705
709
- oe.menuBar.add(menu = new Menu("Group"));
710
-// grabItem = menu.add(new MenuItem("Grab"));
711
-// grabItem.addActionListener(this);
706
+ oe.menuBar.add(menu = new Menu("Order"));
707
+
712708 backItem = menu.add(new MenuItem("Back"));
713709 backItem.addActionListener(this);
714710 frontItem = menu.add(new MenuItem("Front"));
715711 frontItem.addActionListener(this);
716712 // compositeItem = menu.add(new MenuItem("Composite"));
717713 // compositeItem.addActionListener(this);
714
+
715
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
716
+ grabItem.addActionListener(this);
718717
719718 if (Globals.ADVANCED)
720719 {
....@@ -723,6 +722,11 @@
723722 }
724723 ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
725724 ungroupItem.addActionListener(this);
725
+
726
+ oe.jTree.popup.addSeparator();
727
+
728
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
729
+ deleteItem.addActionListener(this);
726730
727731 // menu.add("-");
728732 //
....@@ -1065,7 +1069,7 @@
10651069 collapseButton.setToolTipText("Collapse toolbar");
10661070 collapseButton.addActionListener(this);
10671071
1068
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/empty.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10691073 maximize3DButton.setToolTipText("Maximize 3D view");
10701074 maximize3DButton.addActionListener(this);
10711075
....@@ -1504,6 +1508,7 @@
15041508
15051509 oe.SetupViews();
15061510
1511
+ if (Globals.DEBUG)
15071512 System.out.println("SetupViews");
15081513 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
15091514 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -4114,7 +4119,10 @@
41144119 copy.versionlist = new Object3D[100];
41154120 copy.versionindex = -1;
41164121
4117
- Save(true);
4122
+ // Cannot work with loops
4123
+ // To fix this issue, first mark all nodes above the root,
4124
+ // and check if any of these nodes are reachable below the root.
4125
+ //Save(true);
41184126 }
41194127
41204128 SetVersionStates();
....@@ -5359,7 +5367,8 @@
53595367 if (group.selection != null)
53605368 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53615369 {
5362
- if (!(e.nextElement() instanceof Composite))
5370
+ Object next = e.nextElement();
5371
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53635372 {
53645373 allComposites = false;
53655374 break;
....@@ -6350,7 +6359,7 @@
63506359 private MenuItem transformGeometryItem;
63516360 private MenuItem transformChildrenItem;
63526361 private MenuItem hideItem;
6353
- private MenuItem grabItem;
6362
+ private JMenuItem grabItem;
63546363 private MenuItem backItem;
63556364 private MenuItem frontItem;
63566365 private MenuItem cameraItem;
ObjEditor.java
....@@ -388,7 +388,8 @@
388388 //parent = p;
389389
390390 GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
391
- System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
391
+ if (Globals.DEBUG)
392
+ System.out.println("getFullScreenWindow? " + gd.getFullScreenWindow());
392393 //gd.setFullScreenWindow(this);
393394 //setResizable(false);
394395 //if (!isDisplayable())
....@@ -1323,14 +1324,14 @@
13231324
13241325 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
13251326 liveCB.setToolTipText("Animate object");
1327
+ markCB = AddCheckBox(setupPanel, "Anim", copy.marked);
1328
+ markCB.setToolTipText("Set target transform");
13261329 selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
13271330 selectableCB.setToolTipText("Make object selectable");
13281331 // Return();
13291332
13301333 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
13311334 hideCB.setToolTipText("Hide object");
1332
- markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1333
- markCB.setToolTipText("As animation target transform");
13341335
13351336 ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
13361337
....@@ -1532,6 +1533,7 @@
15321533
15331534 if (cam == null || !(copy.get(0) instanceof cGroup))
15341535 {
1536
+ if (Globals.DEBUG)
15351537 System.out.println("CREATE CAMERAS");
15361538 cams = new cTemplate();
15371539 cams.name = "Cameras";
....@@ -2196,7 +2198,7 @@
21962198 public void mouseClicked(MouseEvent e)
21972199 {
21982200 borderfadeField.setFloat(0.5);
2199
- opacityField.setFloat(0.6);
2201
+ opacityField.setFloat(0.75);
22002202
22012203 materialtouched = true;
22022204 applySelf();
....@@ -2311,9 +2313,20 @@
23112313
23122314 cGridBag huepanel = new cGridBag();
23132315 cGridBag huelabel = new cGridBag();
2314
- skin = GetLabel("icons/hue.png", false);
2315
- skin.fit = true;
2316
- huelabel.add(skin);
2316
+ cLabel hue = GetLabel("icons/hue.png", false);
2317
+ hue.fit = true;
2318
+
2319
+ hue.addMouseListener(new MouseAdapter()
2320
+ {
2321
+ public void mousePressed(MouseEvent e)
2322
+ {
2323
+ int x = e.getX();
2324
+
2325
+ colorField.setFloat((double)x / ((cLabel)e.getSource()).getWidth());
2326
+ }
2327
+ });
2328
+
2329
+ huelabel.add(hue);
23172330 huelabel.preferredWidth = 20;
23182331 huepanel.add(new cGridBag()); // Label
23192332 huepanel.add(huelabel); // Field/slider
....@@ -5178,6 +5191,8 @@
51785191
51795192 if (previousVersionButton != null && copy.versionlist != null)
51805193 SetVersionStates();
5194
+
5195
+ cameraView.requestFocusInWindow();
51815196 }
51825197
51835198 static TweenManager tweenManager = new TweenManager();
....@@ -5209,7 +5224,7 @@
52095224 // group = (Composite) group.get(0);
52105225 // }
52115226
5212
- System.out.println("makeSomething of " + thing);
5227
+ //System.out.println("makeSomething of " + thing);
52135228
52145229 /*
52155230 if (deselect && jList != null)
Object3D.java
....@@ -7417,7 +7417,7 @@
74177417 boundary.y = spot.y - 30;
74187418 boundary.width = spot.width + 60;
74197419 boundary.height = spot.height + 60;
7420
- clickInfo.g.setColor(Color.red);
7420
+ clickInfo.g.setColor(Color.white);
74217421 int spotw = spot.x + spot.width;
74227422 int spoth = spot.y + spot.height;
74237423 clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -7818,21 +7818,27 @@
78187818 case 3: // '\001'
78197819 if (modified || opposite)
78207820 {
7821
+ if (modified && opposite)
7822
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7823
+ else
78217824 //LA.matScale(toParent, 1, hScale, vScale);
7822
- LA.matScale(toParent, totalScale, 1, 1);
7825
+ LA.matScale(toParent, totalScale, 1, 1);
78237826 } // vScale, 1);
78247827 else
78257828 {
78267829 // EXCEPTION!
7827
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7830
+ LA.matScale(toParent, 1, totalScale, totalScale);
78287831 } // vScale, 1);
78297832 break;
78307833
78317834 case 2: // '\002'
78327835 if (modified || opposite)
78337836 {
7834
- //LA.matScale(toParent, hScale, 1, vScale);
7835
- LA.matScale(toParent, 1, totalScale, 1);
7837
+ if (modified && opposite)
7838
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7839
+ else
7840
+ //LA.matScale(toParent, hScale, 1, vScale);
7841
+ LA.matScale(toParent, 1, totalScale, 1);
78367842 } else
78377843 {
78387844 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7842,8 +7848,11 @@
78427848 case 1: // '\003'
78437849 if (modified || opposite)
78447850 {
7845
- //LA.matScale(toParent, hScale, vScale, 1);
7846
- LA.matScale(toParent, 1, 1, totalScale);
7851
+ if (modified && opposite)
7852
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7853
+ else
7854
+ //LA.matScale(toParent, hScale, vScale, 1);
7855
+ LA.matScale(toParent, 1, 1, totalScale);
78477856 } else
78487857 {
78497858 LA.matScale(toParent, totalScale, totalScale, 1);
cubemaps/default-skyboxes/rgb2/negx.jpg
Binary files differ
cubemaps/default-skyboxes/rgb2/negy.jpg
Binary files differ
cubemaps/default-skyboxes/rgb2/negz.jpg
Binary files differ
cubemaps/default-skyboxes/rgb2/posx.jpg
Binary files differ
cubemaps/default-skyboxes/rgb2/posy.jpg
Binary files differ
cubemaps/default-skyboxes/rgb2/posz.jpg
Binary files differ
cubemaps/default-skyboxes/rgb2/preview.jpg
Binary files differ
icons/empty.png
Binary files differ