Normand Briere
2019-08-12 b1d79b74514041a059b454a9f6fc3970773c0cb8
Compact toolbar.
13 files modified
2 files added
278 ■■■■■ changed files
Biparam.java 7 ●●●● patch | view | raw | blame | history
CameraPane.java 1 ●●●● patch | view | raw | blame | history
Cone.java 5 ●●●●● patch | view | raw | blame | history
Globals.java 2 ●●●●● patch | view | raw | blame | history
Grid.java 5 ●●●●● patch | view | raw | blame | history
GroupEditor.java 131 ●●●●● patch | view | raw | blame | history
ObjEditor.java 87 ●●●● patch | view | raw | blame | history
Object3D.java 6 ●●●● patch | view | raw | blame | history
Sphere.java 9 ●●●● patch | view | raw | blame | history
Superellipsoid.java 12 ●●●● patch | view | raw | blame | history
SwitchNode.java 3 ●●●● patch | view | raw | blame | history
Torus.java 8 ●●●●● patch | view | raw | blame | history
cMesh.java 2 ●●● patch | view | raw | blame | history
icons/collapse.png patch | view | raw | blame | history
icons/shadericons/shadow.png patch | view | raw | blame | history
Biparam.java
....@@ -98,6 +98,11 @@
9898 // recalculate();
9999 }
100100
101
+ double uStretch()
102
+ {
103
+ return 1;
104
+ }
105
+
101106 void recalculate()
102107 {
103108 //System.out.println("BREP TRIMMED? 3 " + bRep.trimmed);
....@@ -115,7 +120,7 @@
115120 int p = iu * (vDivs + 1) + iv;
116121 if (touched)
117122 {
118
- vert.s = u;
123
+ vert.s = u * uStretch();
119124 vert.t = v;
120125 }
121126 else
CameraPane.java
....@@ -16667,6 +16667,7 @@
1666716667 private void DrawSkyBox(GL gl, float ratio)
1666816668 {
1666916669 if (//envyoff ||
16670
+ WIREFRAME ||
1667016671 cubemap == null)
1667116672 {
1667216673 gl.glClearColor(BGcolor, BGcolor, BGcolor, 1);
Cone.java
....@@ -193,6 +193,11 @@
193193 return inside;
194194 }
195195
196
+ double uStretch()
197
+ {
198
+ return 6; // Actually 6.28 (I think)
199
+ }
200
+
196201 Vertex biparamFunction(double u, double v)
197202 {
198203 cVector tPos;
Globals.java
....@@ -8,6 +8,8 @@
88
99 private static boolean LIVE = false;
1010
11
+ // Option to set saturation to 1 when choosing a color first
12
+ public static boolean AUTOSATURATE = true;
1113 public static boolean MINSHADER = false;
1214 public static boolean COMPUTESHADOWWHENLIVE = true;
1315 public static boolean RENDERSHADOW = true;
Grid.java
....@@ -62,6 +62,11 @@
6262 */
6363 }
6464
65
+ double uStretch()
66
+ {
67
+ return 1;
68
+ }
69
+
6570 Vertex biparamFunction(double u, double v)
6671 {
6772 Vertex temp = new Vertex((2*v-1)*radius*4, 0 /*-radius,*/, (2*u-1)*radius*4);
GroupEditor.java
....@@ -359,6 +359,16 @@
359359 refreshContents();
360360 }
361361
362
+ public void Show3DView()
363
+ {
364
+ // bug
365
+ //gridPanel.setDividerLocation(1.0);
366
+ //bigPanel.setDividerLocation(0.0);
367
+ bigThree.ClearUI();
368
+ bigThree.add(centralPanel);
369
+ bigThree.FlushUI();
370
+ }
371
+
362372 //ObjEditor objEditor;
363373 public void closeUI2()
364374 {
....@@ -984,11 +994,6 @@
984994 //new Exception().printStackTrace();
985995
986996 oe.radioPanel = new JPanel(new GridBagLayout());
987
- oe.aConstraints.weightx = 1;
988
- oe.aConstraints.weighty = 0;
989
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
990
- oe.aConstraints.gridwidth = 100;
991
- oe.aConstraints.gridheight = 1;
992997 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
993998
994999 oe.buttonGroup = new ButtonGroup();
....@@ -1025,6 +1030,45 @@
10251030 maxButton.setToolTipText("Maximize window");
10261031 maxButton.addActionListener(this);
10271032 }
1033
+
1034
+ cButton gcButton;
1035
+
1036
+ oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
+ gcButton.setToolTipText("Garbage collect");
1038
+ gcButton.addActionListener(new ActionListener()
1039
+ {
1040
+ public void actionPerformed(ActionEvent e)
1041
+ {
1042
+ System.gc();
1043
+ }
1044
+ });
1045
+
1046
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1047
+ collapseButton.setToolTipText("Collapse toolbar");
1048
+ collapseButton.addActionListener(this);
1049
+
1050
+ oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1051
+ maximize3DButton.setToolTipText("Maximize 3D view");
1052
+ maximize3DButton.addActionListener(this);
1053
+
1054
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1055
+ twoButton.setToolTipText("Show 3D view only");
1056
+ twoButton.addActionListener(this);
1057
+ this.fullscreenLayout = twoButton;
1058
+
1059
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1060
+ threeButton.setToolTipText("Show controls and 3D view");
1061
+ threeButton.addActionListener(this);
1062
+ if (Globals.ADVANCED)
1063
+ {
1064
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1065
+ sixButton.setToolTipText("Show 3D view and controls");
1066
+ sixButton.addActionListener(this);
1067
+ }
1068
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1069
+// sevenButton.setToolTipText("3-column layout");
1070
+// sevenButton.addActionListener(this);
1071
+ //
10281072
10291073 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10301074 fullButton.setToolTipText("Full-screen window");
....@@ -1069,14 +1113,14 @@
10691113 nextVersionButton.addActionListener(this);
10701114 nextVersionButton.setEnabled(false);
10711115
1072
- oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1073
- liveCB.setToolTipText("Enable animation");
1074
- liveCB.addItemListener(this);
1075
-
10761116 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10771117 oneStepButton.setToolTipText("Animate one step forward");
10781118 oneStepButton.addActionListener(this);
10791119
1120
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1121
+ liveCB.setToolTipText("Enable animation");
1122
+ liveCB.addItemListener(this);
1123
+
10801124 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
10811125 fastCB.setToolTipText("Fast mode");
10821126 fastCB.addItemListener(this);
....@@ -1103,21 +1147,6 @@
11031147
11041148 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11051149
1106
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1107
- twoButton.setToolTipText("Show 3D view only");
1108
- twoButton.addActionListener(this);
1109
- this.fullscreenLayout = twoButton;
1110
-
1111
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1112
- threeButton.setToolTipText("Show controls and 3D view");
1113
- threeButton.addActionListener(this);
1114
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
- sixButton.setToolTipText("Show 3D view and controls");
1116
- sixButton.addActionListener(this);
1117
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
-// sevenButton.setToolTipText("3-column layout");
1119
-// sevenButton.addActionListener(this);
1120
- //
11211150
11221151 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11231152 rootButton.setToolTipText("Open selection in new tab");
....@@ -1815,7 +1844,12 @@
18151844 TreePath path;
18161845
18171846 public TransferableTreePath(TreePath tp) {
1818
- path = tp;
1847
+ Object[] objs = new Object[tp.getPathCount()];
1848
+ for (int i=0; i<objs.length; i++)
1849
+ {
1850
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1851
+ }
1852
+ path = new TreePath(objs);
18191853 }
18201854
18211855 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2708,6 +2742,18 @@
27082742 if (source == fullButton)
27092743 {
27102744 ToggleFullScreen();
2745
+ } else
2746
+ if (source == collapseButton)
2747
+ {
2748
+ this.expandedLayout = radio.layout;
2749
+ CollapseToolbar();
2750
+ } else
2751
+ if (source == maximize3DButton)
2752
+ {
2753
+ this.expandedLayout = radio.layout;
2754
+ radio.layout = twoButton;
2755
+ Show3DView();
2756
+ CollapseToolbar();
27112757 } else
27122758 if (source == previousVersionButton)
27132759 {
....@@ -3660,38 +3706,7 @@
36603706 if (CameraPane.FULLSCREEN)
36613707 fullscreenLayout = radio.layout;
36623708
3663
- // bug
3664
- //gridPanel.setDividerLocation(1.0);
3665
- //bigPanel.setDividerLocation(0.0);
3666
-// bigThree.remove(scenePanel);
3667
-// bigThree.remove(centralPanel);
3668
-// bigThree.remove(XYZPanel);
3669
-// aWindowConstraints.gridx = 0;
3670
-// aWindowConstraints.gridy = 0;
3671
-// aWindowConstraints.gridwidth = 1;
3672
-// // aConstraints.gridheight = 3;
3673
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3674
-// aWindowConstraints.weightx = 0;
3675
-// aWindowConstraints.weighty = 1;
3676
-// //bigThree.add(jtp, aWindowConstraints);
3677
-// aWindowConstraints.weightx = 1;
3678
-// aWindowConstraints.gridwidth = 3;
3679
-// // aConstraints.gridheight = 3;
3680
-// aWindowConstraints.gridx = 1;
3681
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3682
-// bigThree.add(centralPanel, aWindowConstraints);
3683
-// aWindowConstraints.weightx = 0;
3684
-// aWindowConstraints.gridx = 4;
3685
-// aWindowConstraints.gridwidth = 1;
3686
-// // aConstraints.gridheight = 3;
3687
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3688
-// //bigThree.add(XYZPanel, aWindowConstraints);
3689
-// scenePanel.setVisible(false);
3690
-// centralPanel.setVisible(true);
3691
-// XYZPanel.setVisible(false);
3692
- bigThree.ClearUI();
3693
- bigThree.add(centralPanel);
3694
- bigThree.FlushUI();
3709
+ Show3DView();
36953710
36963711 cameraView.requestFocusInWindow();
36973712
....@@ -5290,7 +5305,7 @@
52905305 Object3D child = (Object3D) group.selection.get(i);
52915306
52925307 objEditor.AddInfo(child, this, true);
5293
- System.err.println("info : " + child.GetPath());
5308
+// System.err.println("info : " + child.GetPath());
52945309 }
52955310
52965311 objEditor.SetText(); // jan 2014
ObjEditor.java
....@@ -754,6 +754,7 @@
754754 boolean maximized;
755755
756756 cButton fullscreenLayout;
757
+ cButton expandedLayout;
757758
758759 void Minimize()
759760 {
....@@ -793,10 +794,12 @@
793794 cButton minButton;
794795 cButton maxButton;
795796 cButton fullButton;
797
+ cButton collapseButton;
798
+ cButton maximize3DButton;
796799
797800 void ToggleFullScreen()
798801 {
799
-GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
802
+ GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
800803
801804 cameraView.ToggleFullScreen();
802805
....@@ -817,13 +820,13 @@
817820 // X frame.getContentPane().remove(/*"Center",*/bigThree);
818821 // X framePanel.add(bigThree);
819822 // X frame.getContentPane().add(/*"Center",*/framePanel);
820
- framePanel.setDividerLocation(46);
823
+// framePanel.setDividerLocation(46); // icons are 24x24
821824
822825 //frame.setVisible(true);
823
- radio.layout = keepButton;
826
+// radio.layout = keepButton;
824827 //theFrame = null;
825828 keepButton = null;
826
- radio.layout.doClick();
829
+// radio.layout.doClick();
827830
828831 } else
829832 {
....@@ -844,10 +847,10 @@
844847 // X frame.getContentPane().remove(/*"Center",*/framePanel);
845848 // X framePanel.remove(bigThree);
846849 // X frame.getContentPane().add(/*"Center",*/bigThree);
847
- framePanel.setDividerLocation(0);
850
+// framePanel.setDividerLocation(0);
848851
849
- radio.layout = fullscreenLayout;
850
- radio.layout.doClick();
852
+// radio.layout = fullscreenLayout;
853
+// radio.layout.doClick();
851854 //frame.setVisible(true);
852855 }
853856 frame.validate();
....@@ -855,23 +858,31 @@
855858 cameraView.requestFocusInWindow();
856859 }
857860
858
- private Object3D CompressCopy()
861
+ void CollapseToolbar()
862
+ {
863
+ framePanel.setDividerLocation(0);
864
+ //frame.validate();
865
+
866
+ cameraView.requestFocusInWindow();
867
+ }
868
+
869
+ private Object3D Duplicate(Object3D object)
859870 {
860871 boolean temp = CameraPane.SWITCH;
861872 CameraPane.SWITCH = false;
862873
863
- copy.ExtractBigData(versiontable);
874
+ object.ExtractBigData(versiontable);
864875 // if (copy == client)
865876
866
- Object3D versions[] = copy.versionlist;
867
- copy.versionlist = null;
877
+ Object3D versions[] = object.versionlist;
878
+ object.versionlist = null;
868879
869880 //byte[] compress = Compress(copy);
870
- Object3D compress = (Object3D)Grafreed.clone(copy);
881
+ Object3D compress = (Object3D)Grafreed.clone(object);
871882
872
- copy.versionlist = versions;
883
+ object.versionlist = versions;
873884
874
- copy.RestoreBigData(versiontable);
885
+ object.RestoreBigData(versiontable);
875886
876887 CameraPane.SWITCH = temp;
877888
....@@ -1702,6 +1713,23 @@
17021713 // aConstraints.gridheight = 1;
17031714
17041715 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1716
+
1717
+ framePanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,
1718
+ new java.beans.PropertyChangeListener()
1719
+ {
1720
+ public void propertyChange(java.beans.PropertyChangeEvent pce)
1721
+ {
1722
+ if ((Integer)pce.getOldValue() == 1)
1723
+ {
1724
+ if (radio.layout != expandedLayout)
1725
+ {
1726
+ radio.layout = expandedLayout;
1727
+ radio.layout.doClick();
1728
+ }
1729
+ }
1730
+ }
1731
+ });
1732
+
17051733 framePanel.setContinuousLayout(false);
17061734 framePanel.setOneTouchExpandable(false);
17071735 //.setDividerLocation(0.8);
....@@ -2120,6 +2148,25 @@
21202148 }
21212149 });
21222150 presetpanel.add(candle);
2151
+
2152
+ cLabel shadowShader = GetLabel("icons/shadericons/shadow.png", !Grafreed.NIMBUSLAF);
2153
+ shadowShader.setToolTipText("Shadow");
2154
+ shadowShader.addMouseListener(new MouseAdapter()
2155
+ {
2156
+ public void mouseClicked(MouseEvent e)
2157
+ {
2158
+ diffuseField.setFloat(0.001);
2159
+ ambientField.setFloat(0.001);
2160
+ cameraField.setFloat(0.001);
2161
+ specularField.setFloat(0.001);
2162
+ fakedepthField.setFloat(0.001);
2163
+ opacityField.setFloat(0.6);
2164
+
2165
+ materialtouched = true;
2166
+ applySelf();
2167
+ }
2168
+ });
2169
+ presetpanel.add(shadowShader);
21232170
21242171 cGridBag panel = new cGridBag().setVertical(true);
21252172
....@@ -4112,11 +4159,11 @@
41124159 public boolean Save(boolean user)
41134160 {
41144161 System.err.println("Save");
4115
- //Replace();
4162
+ Replace();
41164163
41174164 cRadio tab = GetCurrentTab();
41184165
4119
- Object3D compress = CompressCopy(); // Saved version. No need for "Replace"?
4166
+ Object3D compress = Duplicate(copy); // Saved version. No need for "Replace"?
41204167
41214168 boolean thesame = false;
41224169
....@@ -4210,7 +4257,7 @@
42104257
42114258 void CopyChanged()
42124259 {
4213
- Object3D obj = copy.versionlist[copy.versionindex];
4260
+ Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
42144261
42154262 SetUndoStates();
42164263
....@@ -4363,7 +4410,7 @@
43634410 return false;
43644411 }
43654412
4366
- copy.versionlist[copy.versionindex] = CompressCopy();
4413
+ copy.versionlist[copy.versionindex] = Duplicate(copy);
43674414
43684415 return true;
43694416 }
....@@ -4738,7 +4785,7 @@
47384785 //System.out.println("stateChanged = " + this);
47394786 materialtouched = true;
47404787
4741
- if (e.getSource() == colorField && saturationField.getFloat() == 0.001)
4788
+ if (Globals.AUTOSATURATE && e.getSource() == colorField && saturationField.getFloat() == 0.001)
47424789 {
47434790 saturationField.setFloat(1);
47444791 }
....@@ -5882,6 +5929,7 @@
58825929 cNumberSlider anisoField;
58835930 JLabel anisoVLabel;
58845931 cNumberSlider anisoVField;
5932
+
58855933 JLabel cameraLabel;
58865934 cNumberSlider cameraField;
58875935 JLabel selfshadowLabel;
....@@ -5896,6 +5944,7 @@
58965944 cNumberSlider fakedepthField;
58975945 JLabel shadowbiasLabel;
58985946 cNumberSlider shadowbiasField;
5947
+
58995948 JLabel bumpLabel;
59005949 cNumberSlider bumpField;
59015950 JLabel noiseLabel;
Object3D.java
....@@ -2468,7 +2468,11 @@
24682468 else
24692469 {
24702470 //((ObjEditor)editWindow).SetupUI2(null);
2471
- ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2471
+ if (objectUI != null)
2472
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2473
+ else
2474
+ //new Exception().printStackTrace();
2475
+ System.err.println("objectUI is null");
24722476 }
24732477 }
24742478
Sphere.java
....@@ -49,7 +49,7 @@
4949 minUDivs = 3;
5050 minVDivs = 2;
5151 //center = new cVector();
52
- radius = 1;
52
+ radius = 0.5;
5353 if (recalc)
5454 {
5555 retile();
....@@ -121,6 +121,11 @@
121121 buffer.append("}\n");
122122 }
123123
124
+ double uStretch()
125
+ {
126
+ return 2;
127
+ }
128
+
124129 Vertex biparamFunction(double u, double v)
125130 {
126131 double uAng = LA.toRadians(u * 360);
....@@ -137,6 +142,8 @@
137142 LA.vecCopy(temp.norm, temp/*.pos*/);
138143 LA.vecNormalize(temp.norm);
139144
145
+ temp.y += radius;
146
+
140147 return temp;
141148 }
142149
Superellipsoid.java
....@@ -1,6 +1,7 @@
11 class Superellipsoid extends Biparam /*Sphere*/ implements java.io.Serializable
22 {
3
-
3
+ static final long serialVersionUID = -251688182693574378L;
4
+
45 Superellipsoid()
56 {
67 super(); // false);
....@@ -147,6 +148,11 @@
147148 cVector du; // = new cVector();
148149 cVector dv; // = new cVector();
149150
151
+ double uStretch()
152
+ {
153
+ return 2;
154
+ }
155
+
150156 Vertex biparamFunction(double u, double v)
151157 {
152158 //System.out.println("U = " + u + "; V = " + v);
....@@ -177,7 +183,7 @@
177183 double sv = signPower(msv, east);
178184 double z = radius * cv * cu;
179185 double x = radius * cv * su;
180
- double y = radius * sv;
186
+ double y = radius * sv + radius;
181187
182188 double dcu = DsignPower(mcu, north) * -msu;
183189 double dsu = DsignPower(msu, north) * mcu;
....@@ -315,6 +321,6 @@
315321
316322 double east;
317323 double north;
318
- double radius = 1;
324
+ double radius = 0.5;
319325 private cVector inPnt;
320326 }
SwitchNode.java
....@@ -97,7 +97,8 @@
9797
9898 if (bRep == null)
9999 {
100
- bRep = (BoundaryRep) Grafreed.clone(switchobject.get(0).bRep);
100
+ // The switch mesh will be used to interpolate poaes (maybe).
101
+ bRep = (BoundaryRep)Grafreed.clone(switchobject.get(0).bRep);
101102 }
102103
103104 if (CameraPane.SUPPORT && display.DrawMode() == display.SHADOW)
Torus.java
....@@ -56,6 +56,11 @@
5656 buffer.append("}\n");
5757 }
5858
59
+ double uStretch()
60
+ {
61
+ return 6; // Actually 6.28 (I think)
62
+ }
63
+
5964 Vertex biparamFunction(double u, double v)
6065 {
6166 if (u == 1)
....@@ -87,6 +92,9 @@
8792 //temp.pos = tPos; // useless new
8893 temp.norm = tNorm;
8994 LA.vecNormalize(temp.norm);
95
+
96
+ temp.y += minor;
97
+
9098 return temp;
9199 }
92100
cMesh.java
....@@ -49,7 +49,7 @@
4949
5050 cMesh(Object3D bRep)
5151 {
52
- this("Me:" + bRep.name, bRep);
52
+ this("Mesh:" + bRep.name, bRep);
5353 }
5454
5555 cMesh(String name, Object3D bRep)
icons/collapse.png
Binary files differ
icons/shadericons/shadow.png
Binary files differ