Normand Briere
2019-06-21 15123b19e7bc8da2869429b07f0fbaa0598e945e
Rewind all.
5 files modified
126 ■■■■ changed files
CameraPane.java 12 ●●●● patch | view | raw | blame | history
GroupEditor.java 40 ●●●●● patch | view | raw | blame | history
ObjEditor.java 16 ●●●●● patch | view | raw | blame | history
Object3D.java 54 ●●●●● patch | view | raw | blame | history
matrix/Matrix.java 4 ●●●● patch | view | raw | blame | history
CameraPane.java
....@@ -464,10 +464,12 @@
464464 if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
465465 {
466466 //gl.glBegin(gl.GL_TRIANGLES);
467
- boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
467
+ boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0)
468
+ // TEST LIVE NORMALS && !obj.dontselect
469
+ ;
468470 if (!hasnorm)
469471 {
470
- // System.out.println("FUCK!!");
472
+ // System.out.println("Mesh normal");
471473 LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0);
472474 LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1);
473475 LA.vecCross(obj.v0, obj.v1, obj.v2);
....@@ -1192,10 +1194,12 @@
11921194 gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
11931195 }
11941196 }
1197
+
11951198 if (flipV)
11961199 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
11971200 else
11981201 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1202
+
11991203 //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
12001204 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
12011205
....@@ -1215,10 +1219,12 @@
12151219 gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
12161220 }
12171221 }
1222
+
12181223 if (flipV)
12191224 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
12201225 else
12211226 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1227
+
12221228 //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
12231229 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
12241230
....@@ -1246,8 +1252,10 @@
12461252 gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
12471253 else
12481254 gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1255
+
12491256 //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
12501257 gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
1258
+
12511259 count2 += 2;
12521260 count3 += 3;
12531261 }
GroupEditor.java
....@@ -470,6 +470,14 @@
470470 markleavesItem.addActionListener(this);
471471 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
472472 unmarkleavesItem.addActionListener(this);
473
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
474
+ rewindleavesItem.addActionListener(this);
475
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
476
+ unrewindleavesItem.addActionListener(this);
477
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
478
+ randomleavesItem.addActionListener(this);
479
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
480
+ unrandomleavesItem.addActionListener(this);
473481 menu.add("-");
474482 flipVItem = menu.add(new MenuItem("Flip V"));
475483 flipVItem.addActionListener(this);
....@@ -2609,6 +2617,22 @@
26092617 {
26102618 MarkLeaves(false);
26112619 } else
2620
+ if (source == rewindleavesItem)
2621
+ {
2622
+ RewindLeaves(true);
2623
+ } else
2624
+ if (source == unrewindleavesItem)
2625
+ {
2626
+ RewindLeaves(false);
2627
+ } else
2628
+ if (source == randomleavesItem)
2629
+ {
2630
+ RandomLeaves(true);
2631
+ } else
2632
+ if (source == unrandomleavesItem)
2633
+ {
2634
+ RandomLeaves(false);
2635
+ } else
26122636 if (source == flipVItem)
26132637 {
26142638 FlipV(true);
....@@ -4146,6 +4170,18 @@
41464170 refreshContents();
41474171 }
41484172
4173
+ void RewindLeaves(boolean hide)
4174
+ {
4175
+ group.selection.RewindLeaves(hide);
4176
+ refreshContents();
4177
+ }
4178
+
4179
+ void RandomLeaves(boolean hide)
4180
+ {
4181
+ group.selection.RandomLeaves(hide);
4182
+ refreshContents();
4183
+ }
4184
+
41494185 void SetTexRes(int tr)
41504186 {
41514187 group.selection.SetTexRes(tr);
....@@ -5283,6 +5319,10 @@
52835319 private MenuItem showleavesItem;
52845320 private MenuItem markleavesItem;
52855321 private MenuItem unmarkleavesItem;
5322
+ private MenuItem rewindleavesItem;
5323
+ private MenuItem unrewindleavesItem;
5324
+ private MenuItem randomleavesItem;
5325
+ private MenuItem unrandomleavesItem;
52865326
52875327 private MenuItem flipVItem;
52885328 private MenuItem unflipVItem;
ObjEditor.java
....@@ -168,6 +168,7 @@
168168 // objEditor.ctrlPanel.remove(remarkButton);
169169
170170 objEditor.ctrlPanel.remove(setupPanel);
171
+ objEditor.ctrlPanel.remove(setupPanel2);
171172 objEditor.ctrlPanel.remove(commandsPanel);
172173 objEditor.ctrlPanel.remove(pushPanel);
173174 //objEditor.ctrlPanel.remove(fillPanel);
....@@ -747,6 +748,7 @@
747748
748749 cGridBag namePanel;
749750 cGridBag setupPanel;
751
+ cGridBag setupPanel2;
750752 cGridBag commandsPanel;
751753 cGridBag pushPanel;
752754 cGridBag fillPanel;
....@@ -939,22 +941,26 @@
939941 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
940942 markCB.setToolTipText("Set the animation target transform");
941943
942
- rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind);
944
+ setupPanel2 = new cGridBag().setVertical(false);
945
+
946
+ rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
943947 rewindCB.setToolTipText("Rewind animation");
944948
945
- randomCB = AddCheckBox(setupPanel, "Random", copy.random);
946
- randomCB.setToolTipText("Option for switch node");
949
+ randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
950
+ randomCB.setToolTipText("Rewind or Go back and forth randomly");
947951
948952 if (Globals.ADVANCED)
949953 {
950
- link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master);
954
+ link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
951955 link2masterCB.setToolTipText("Attach to support");
952
- speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup);
956
+ speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
953957 speedupCB.setToolTipText("Option motion capture");
954958 }
955959
956960 oe.ctrlPanel.add(setupPanel);
957961 oe.ctrlPanel.Return();
962
+ oe.ctrlPanel.add(setupPanel2);
963
+ oe.ctrlPanel.Return();
958964
959965 commandsPanel = new cGridBag().setVertical(false);
960966
Object3D.java
....@@ -893,7 +893,8 @@
893893
894894 boolean changedir = random && Math.random() < 0.01; // && !link2master;
895895
896
- if (transformcount*factor > maxcount || (step == 1 && changedir))
896
+ if (transformcount*factor >= maxcount && (rewind || random) ||
897
+ (step == 1 && changedir))
897898 {
898899 countdown = 1;
899900 delay = speedup?8:1;
....@@ -3503,7 +3504,8 @@
35033504 if (blockloop)
35043505 return;
35053506
3506
- if (marked || (bRep != null && material != null)) // borderline...
3507
+ if (//marked || // does not make sense
3508
+ (bRep != null || material != null)) // borderline...
35073509 live = h;
35083510
35093511 for (int i = 0; i < Size(); i++)
....@@ -3524,7 +3526,8 @@
35243526 return;
35253527
35263528 //if (bRep != null)
3527
- if (marked || (bRep != null && material != null)) // borderline...
3529
+ if (//marked || // does not make sense
3530
+ (bRep != null || material != null)) // borderline...
35283531 link2master = h;
35293532
35303533 for (int i = 0; i < Size(); i++)
....@@ -3544,7 +3547,8 @@
35443547 if (blockloop)
35453548 return;
35463549
3547
- if (marked || (bRep != null && material != null)) // borderline...
3550
+ if (//marked || // does not make sense
3551
+ (bRep != null || material != null)) // borderline...
35483552 hide = h;
35493553
35503554 for (int i = 0; i < Size(); i++)
....@@ -3564,7 +3568,7 @@
35643568 if (blockloop)
35653569 return;
35663570
3567
- if (bRep != null && material != null) // borderline...
3571
+ if (bRep != null || material != null) // borderline...
35683572 marked = h;
35693573
35703574 for (int i = 0; i < Size(); i++)
....@@ -3579,6 +3583,46 @@
35793583 }
35803584 }
35813585
3586
+ void RewindLeaves(boolean h)
3587
+ {
3588
+ if (blockloop)
3589
+ return;
3590
+
3591
+ if (bRep != null || material != null) // borderline...
3592
+ rewind = h;
3593
+
3594
+ for (int i = 0; i < Size(); i++)
3595
+ {
3596
+ Object3D child = (Object3D) get(i); // reserve(i);
3597
+ if (child == null)
3598
+ continue;
3599
+ blockloop = true;
3600
+ child.RewindLeaves(h);
3601
+ blockloop = false;
3602
+ // release(i);
3603
+ }
3604
+ }
3605
+
3606
+ void RandomLeaves(boolean h)
3607
+ {
3608
+ if (blockloop)
3609
+ return;
3610
+
3611
+ if (bRep != null || material != null) // borderline...
3612
+ random = h;
3613
+
3614
+ for (int i = 0; i < Size(); i++)
3615
+ {
3616
+ Object3D child = (Object3D) get(i); // reserve(i);
3617
+ if (child == null)
3618
+ continue;
3619
+ blockloop = true;
3620
+ child.RandomLeaves(h);
3621
+ blockloop = false;
3622
+ // release(i);
3623
+ }
3624
+ }
3625
+
35823626 void SetTexRes(int tr)
35833627 {
35843628 texres = tr;
matrix/Matrix.java
....@@ -678,14 +678,14 @@
678678 {
679679 for (int j = 0; j < nr; j++)
680680 {
681
- boolean zero = Math.abs(A[i][j]) < 1E-8;
681
+ boolean zero = Math.abs(A[i][j]) < 1E-12;
682682
683683 if (!zero)
684684 {
685685 if (i != j)
686686 return false;
687687
688
- boolean un = Math.abs(A[i][j] - 1) < 1E-8;
688
+ boolean un = Math.abs(A[i][j] - 1) < 1E-12;
689689
690690 if (!un)
691691 return false;