| .. | .. | 
|---|
| 464 | 464 |          if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) | 
|---|
| 465 | 465 |          { | 
|---|
| 466 | 466 |              //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 | +                    ;  | 
|---|
| 468 | 470 |              if (!hasnorm) | 
|---|
| 469 | 471 |              { | 
|---|
| 470 |  | -           //     System.out.println("FUCK!!");  | 
|---|
 | 472 | +           //     System.out.println("Mesh normal");  | 
|---|
| 471 | 473 |                  LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0); | 
|---|
| 472 | 474 |                  LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1); | 
|---|
| 473 | 475 |                  LA.vecCross(obj.v0, obj.v1, obj.v2); | 
|---|
| .. | .. | 
|---|
| 1192 | 1194 |                                      gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); | 
|---|
| 1193 | 1195 |                                  } | 
|---|
| 1194 | 1196 |                              } | 
|---|
 | 1197 | +                              | 
|---|
| 1195 | 1198 |                              if (flipV) | 
|---|
| 1196 | 1199 |                                  gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); | 
|---|
| 1197 | 1200 |                              else | 
|---|
| 1198 | 1201 |                                  gl.glTexCoord2f(uv[count2], uv[count2 + 1]); | 
|---|
 | 1202 | +                              | 
|---|
| 1199 | 1203 |                              //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); | 
|---|
| 1200 | 1204 |                              gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); | 
|---|
| 1201 | 1205 |   | 
|---|
| .. | .. | 
|---|
| 1215 | 1219 |                                      gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); | 
|---|
| 1216 | 1220 |                                  } | 
|---|
| 1217 | 1221 |                              } | 
|---|
 | 1222 | +                              | 
|---|
| 1218 | 1223 |                              if (flipV) | 
|---|
| 1219 | 1224 |                                  gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); | 
|---|
| 1220 | 1225 |                              else | 
|---|
| 1221 | 1226 |                                  gl.glTexCoord2f(uv[count2], uv[count2 + 1]); | 
|---|
 | 1227 | +                              | 
|---|
| 1222 | 1228 |                              //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); | 
|---|
| 1223 | 1229 |                              gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); | 
|---|
| 1224 | 1230 |   | 
|---|
| .. | .. | 
|---|
| 1246 | 1252 |                                      gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); | 
|---|
| 1247 | 1253 |                                  else | 
|---|
| 1248 | 1254 |                                      gl.glTexCoord2f(uv[count2], uv[count2 + 1]); | 
|---|
 | 1255 | +                                  | 
|---|
| 1249 | 1256 |                                  //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); | 
|---|
| 1250 | 1257 |                                  gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); | 
|---|
 | 1258 | +                                  | 
|---|
| 1251 | 1259 |                                  count2 += 2; | 
|---|
| 1252 | 1260 |                                  count3 += 3; | 
|---|
| 1253 | 1261 |                              } | 
|---|
 
| .. | .. | 
|---|
| 470 | 470 |  		markleavesItem.addActionListener(this); | 
|---|
| 471 | 471 |  		unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves")); | 
|---|
| 472 | 472 |  		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);  | 
|---|
| 473 | 481 |  		menu.add("-"); | 
|---|
| 474 | 482 |  		flipVItem = menu.add(new MenuItem("Flip V")); | 
|---|
| 475 | 483 |  		flipVItem.addActionListener(this); | 
|---|
| .. | .. | 
|---|
| 2609 | 2617 |                  { | 
|---|
| 2610 | 2618 |  			MarkLeaves(false); | 
|---|
| 2611 | 2619 |  		} 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  | 
|---|
| 2612 | 2636 |  		if (source == flipVItem) | 
|---|
| 2613 | 2637 |                  { | 
|---|
| 2614 | 2638 |  			FlipV(true); | 
|---|
| .. | .. | 
|---|
| 4146 | 4170 |  		refreshContents(); | 
|---|
| 4147 | 4171 |  	} | 
|---|
| 4148 | 4172 |  	 | 
|---|
 | 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 | +	  | 
|---|
| 4149 | 4185 |  	void SetTexRes(int tr) | 
|---|
| 4150 | 4186 |  	{ | 
|---|
| 4151 | 4187 |  		group.selection.SetTexRes(tr); | 
|---|
| .. | .. | 
|---|
| 5283 | 5319 |  	private MenuItem showleavesItem; | 
|---|
| 5284 | 5320 |  	private MenuItem markleavesItem; | 
|---|
| 5285 | 5321 |  	private MenuItem unmarkleavesItem; | 
|---|
 | 5322 | +	private MenuItem rewindleavesItem;  | 
|---|
 | 5323 | +	private MenuItem unrewindleavesItem;  | 
|---|
 | 5324 | +	private MenuItem randomleavesItem;  | 
|---|
 | 5325 | +	private MenuItem unrandomleavesItem;  | 
|---|
| 5286 | 5326 |           | 
|---|
| 5287 | 5327 |  	private MenuItem flipVItem; | 
|---|
| 5288 | 5328 |  	private MenuItem unflipVItem; | 
|---|
 
| .. | .. | 
|---|
| 168 | 168 |  //        objEditor.ctrlPanel.remove(remarkButton); | 
|---|
| 169 | 169 |           | 
|---|
| 170 | 170 |          objEditor.ctrlPanel.remove(setupPanel); | 
|---|
 | 171 | +        objEditor.ctrlPanel.remove(setupPanel2);  | 
|---|
| 171 | 172 |          objEditor.ctrlPanel.remove(commandsPanel); | 
|---|
| 172 | 173 |          objEditor.ctrlPanel.remove(pushPanel); | 
|---|
| 173 | 174 |          //objEditor.ctrlPanel.remove(fillPanel); | 
|---|
| .. | .. | 
|---|
| 747 | 748 |       | 
|---|
| 748 | 749 |      cGridBag namePanel; | 
|---|
| 749 | 750 |      cGridBag setupPanel; | 
|---|
 | 751 | +    cGridBag setupPanel2;  | 
|---|
| 750 | 752 |      cGridBag commandsPanel; | 
|---|
| 751 | 753 |      cGridBag pushPanel; | 
|---|
| 752 | 754 |      cGridBag fillPanel; | 
|---|
| .. | .. | 
|---|
| 939 | 941 |          markCB = AddCheckBox(setupPanel, "Mark", copy.marked); | 
|---|
| 940 | 942 |          markCB.setToolTipText("Set the animation target transform"); | 
|---|
| 941 | 943 |           | 
|---|
| 942 |  | -        rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind);  | 
|---|
 | 944 | +            setupPanel2 = new cGridBag().setVertical(false);  | 
|---|
 | 945 | +              | 
|---|
 | 946 | +        rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);  | 
|---|
| 943 | 947 |          rewindCB.setToolTipText("Rewind animation"); | 
|---|
| 944 | 948 |           | 
|---|
| 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");  | 
|---|
| 947 | 951 |   | 
|---|
| 948 | 952 |          if (Globals.ADVANCED) | 
|---|
| 949 | 953 |          { | 
|---|
| 950 |  | -                link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master);  | 
|---|
 | 954 | +                link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);  | 
|---|
| 951 | 955 |                  link2masterCB.setToolTipText("Attach to support"); | 
|---|
| 952 |  | -                speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup);  | 
|---|
 | 956 | +                speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);  | 
|---|
| 953 | 957 |                  speedupCB.setToolTipText("Option motion capture"); | 
|---|
| 954 | 958 |          } | 
|---|
| 955 | 959 |           | 
|---|
| 956 | 960 |          oe.ctrlPanel.add(setupPanel); | 
|---|
| 957 | 961 |          oe.ctrlPanel.Return(); | 
|---|
 | 962 | +        oe.ctrlPanel.add(setupPanel2);  | 
|---|
 | 963 | +        oe.ctrlPanel.Return();  | 
|---|
| 958 | 964 |           | 
|---|
| 959 | 965 |              commandsPanel = new cGridBag().setVertical(false); | 
|---|
| 960 | 966 |           | 
|---|
 
| .. | .. | 
|---|
| 893 | 893 |               | 
|---|
| 894 | 894 |              boolean changedir = random && Math.random() < 0.01; // && !link2master; | 
|---|
| 895 | 895 |   | 
|---|
| 896 |  | -            if (transformcount*factor > maxcount || (step == 1 && changedir))  | 
|---|
 | 896 | +            if (transformcount*factor >= maxcount && (rewind || random) ||  | 
|---|
 | 897 | +                    (step == 1 && changedir))  | 
|---|
| 897 | 898 |              { | 
|---|
| 898 | 899 |                  countdown = 1; | 
|---|
| 899 | 900 |                  delay = speedup?8:1; | 
|---|
| .. | .. | 
|---|
| 3503 | 3504 |          if (blockloop) | 
|---|
| 3504 | 3505 |              return; | 
|---|
| 3505 | 3506 |           | 
|---|
| 3506 |  | -        if (marked || (bRep != null && material != null)) // borderline...  | 
|---|
 | 3507 | +        if (//marked || // does not make sense  | 
|---|
 | 3508 | +                (bRep != null || material != null)) // borderline...  | 
|---|
| 3507 | 3509 |              live = h; | 
|---|
| 3508 | 3510 |           | 
|---|
| 3509 | 3511 |          for (int i = 0; i < Size(); i++) | 
|---|
| .. | .. | 
|---|
| 3524 | 3526 |              return; | 
|---|
| 3525 | 3527 |           | 
|---|
| 3526 | 3528 |          //if (bRep != null) | 
|---|
| 3527 |  | -        if (marked || (bRep != null && material != null)) // borderline...  | 
|---|
 | 3529 | +        if (//marked || // does not make sense  | 
|---|
 | 3530 | +                (bRep != null || material != null)) // borderline...  | 
|---|
| 3528 | 3531 |              link2master = h; | 
|---|
| 3529 | 3532 |           | 
|---|
| 3530 | 3533 |          for (int i = 0; i < Size(); i++) | 
|---|
| .. | .. | 
|---|
| 3544 | 3547 |          if (blockloop) | 
|---|
| 3545 | 3548 |              return; | 
|---|
| 3546 | 3549 |           | 
|---|
| 3547 |  | -        if (marked || (bRep != null && material != null)) // borderline...  | 
|---|
 | 3550 | +        if (//marked || // does not make sense  | 
|---|
 | 3551 | +                (bRep != null || material != null)) // borderline...  | 
|---|
| 3548 | 3552 |              hide = h; | 
|---|
| 3549 | 3553 |           | 
|---|
| 3550 | 3554 |          for (int i = 0; i < Size(); i++) | 
|---|
| .. | .. | 
|---|
| 3564 | 3568 |          if (blockloop) | 
|---|
| 3565 | 3569 |              return; | 
|---|
| 3566 | 3570 |           | 
|---|
| 3567 |  | -        if (bRep != null && material != null) // borderline...  | 
|---|
 | 3571 | +        if (bRep != null || material != null) // borderline...  | 
|---|
| 3568 | 3572 |              marked = h; | 
|---|
| 3569 | 3573 |           | 
|---|
| 3570 | 3574 |          for (int i = 0; i < Size(); i++) | 
|---|
| .. | .. | 
|---|
| 3579 | 3583 |          } | 
|---|
| 3580 | 3584 |      } | 
|---|
| 3581 | 3585 |       | 
|---|
 | 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 | +      | 
|---|
| 3582 | 3626 |      void SetTexRes(int tr) | 
|---|
| 3583 | 3627 |      { | 
|---|
| 3584 | 3628 |          texres = tr; | 
|---|
 
| .. | .. | 
|---|
| 678 | 678 |          { | 
|---|
| 679 | 679 |              for (int j = 0; j < nr; j++) | 
|---|
| 680 | 680 |              { | 
|---|
| 681 |  | -                boolean zero = Math.abs(A[i][j]) < 1E-8;  | 
|---|
 | 681 | +                boolean zero = Math.abs(A[i][j]) < 1E-12;  | 
|---|
| 682 | 682 |   | 
|---|
| 683 | 683 |                  if (!zero) | 
|---|
| 684 | 684 |                  { | 
|---|
| 685 | 685 |                      if (i != j) | 
|---|
| 686 | 686 |                          return false; | 
|---|
| 687 | 687 |                       | 
|---|
| 688 |  | -                    boolean un = Math.abs(A[i][j] - 1) < 1E-8;  | 
|---|
 | 688 | +                    boolean un = Math.abs(A[i][j] - 1) < 1E-12;  | 
|---|
| 689 | 689 |                       | 
|---|
| 690 | 690 |                      if (!un) | 
|---|
| 691 | 691 |                          return false; | 
|---|