.. | .. |
---|
261 | 261 | |
---|
262 | 262 | // LA.matConcat(toParent, hip.get(0).toParent, toParent); |
---|
263 | 263 | |
---|
264 | | - CameraPane.debugpoint.toParent[3][0] = poship.x; |
---|
265 | | - CameraPane.debugpoint.toParent[3][1] = poship.y; |
---|
266 | | - CameraPane.debugpoint.toParent[3][2] = poship.z; |
---|
| 264 | + CameraPane.debugpointG.toParent[3][0] = poship.x; |
---|
| 265 | + CameraPane.debugpointG.toParent[3][1] = poship.y; |
---|
| 266 | + CameraPane.debugpointG.toParent[3][2] = poship.z; |
---|
267 | 267 | |
---|
268 | 268 | LA.matInvert(toParent, fromParent); |
---|
269 | 269 | |
---|
.. | .. |
---|
324 | 324 | // LA.matYRotate(toParent, angleY - angleYhip); |
---|
325 | 325 | // LA.matTranslate(toParent, pos.x - poship.x, pos.y - poship.y, pos.z - poship.z); |
---|
326 | 326 | |
---|
327 | | - CameraPane.debugpoint2.toParent[3][0] = pos.x; |
---|
328 | | - CameraPane.debugpoint2.toParent[3][1] = pos.y; |
---|
329 | | - CameraPane.debugpoint2.toParent[3][2] = pos.z; |
---|
| 327 | + CameraPane.debugpointP.toParent[3][0] = pos.x; |
---|
| 328 | + CameraPane.debugpointP.toParent[3][1] = pos.y; |
---|
| 329 | + CameraPane.debugpointP.toParent[3][2] = pos.z; |
---|
330 | 330 | |
---|
331 | | - CameraPane.debugpoint3.toParent[3][0] = poship.x; |
---|
332 | | - CameraPane.debugpoint3.toParent[3][1] = poship.y; |
---|
333 | | - CameraPane.debugpoint3.toParent[3][2] = poship.z; |
---|
| 331 | + CameraPane.debugpointC.toParent[3][0] = poship.x; |
---|
| 332 | + CameraPane.debugpointC.toParent[3][1] = poship.y; |
---|
| 333 | + CameraPane.debugpointC.toParent[3][2] = poship.z; |
---|
334 | 334 | |
---|
335 | 335 | poship.x = toParent[3][0]; |
---|
336 | 336 | poship.y = toParent[3][1]; |
---|
337 | 337 | poship.z = toParent[3][2]; |
---|
338 | 338 | |
---|
339 | | - CameraPane.debugpoint4.toParent[3][0] = poship.x; |
---|
340 | | - CameraPane.debugpoint4.toParent[3][1] = poship.y; |
---|
341 | | - CameraPane.debugpoint4.toParent[3][2] = poship.z; |
---|
| 339 | + CameraPane.debugpointR.toParent[3][0] = poship.x; |
---|
| 340 | + CameraPane.debugpointR.toParent[3][1] = poship.y; |
---|
| 341 | + CameraPane.debugpointR.toParent[3][2] = poship.z; |
---|
342 | 342 | |
---|
343 | 343 | LA.matInvert(toParent, fromParent); |
---|
344 | 344 | } |
---|
.. | .. |
---|
477 | 477 | } |
---|
478 | 478 | } |
---|
479 | 479 | |
---|
| 480 | + static cVector centroid = new cVector(); |
---|
| 481 | + static cVector mocaporigin = new cVector(); |
---|
| 482 | + |
---|
480 | 483 | void SetHipOrientation() |
---|
481 | 484 | { |
---|
482 | 485 | Object3D hip = get(0); |
---|
483 | 486 | |
---|
| 487 | + if (toParent == null) |
---|
| 488 | + { |
---|
| 489 | + toParent = LA.newMatrix(); |
---|
| 490 | + fromParent = LA.newMatrix(); |
---|
| 491 | + } |
---|
| 492 | + |
---|
484 | 493 | LA.matConcat(toParent, hip.get(0).toParent, matrix); |
---|
485 | 494 | |
---|
486 | | - cVector centroid = new cVector(); |
---|
| 495 | + mocaporigin.x = matrix[3][0]; |
---|
| 496 | + mocaporigin.y = matrix[3][1]; |
---|
| 497 | + mocaporigin.z = matrix[3][2]; |
---|
| 498 | + |
---|
487 | 499 | centroid.x = matrix[3][0]; |
---|
488 | 500 | centroid.y = matrix[3][1]; |
---|
489 | 501 | centroid.z = matrix[3][2]; |
---|
490 | | - this.getCentroid(centroid, true); |
---|
| 502 | +// this.getCentroid(centroid, true); |
---|
| 503 | + |
---|
| 504 | + CameraPane.debugpointG.name = ""; |
---|
| 505 | + CameraPane.debugpointG.toParent[3][0] = mocaporigin.x; |
---|
| 506 | + CameraPane.debugpointG.toParent[3][1] = mocaporigin.y; |
---|
| 507 | + CameraPane.debugpointG.toParent[3][2] = mocaporigin.z; |
---|
| 508 | + |
---|
| 509 | + CameraPane.debugpointP.name = ""; |
---|
| 510 | + CameraPane.debugpointP.toParent[3][0] = centroid.x; |
---|
| 511 | + CameraPane.debugpointP.toParent[3][1] = centroid.y; |
---|
| 512 | + CameraPane.debugpointP.toParent[3][2] = centroid.z; |
---|
491 | 513 | |
---|
492 | 514 | cVector goal = GetGoal(centroid); |
---|
493 | 515 | if (goal != null) |
---|
494 | 516 | { |
---|
495 | | - System.err.println("GOAL change (" + this + "): " + goal + " (was " + goalx + ", " + goalz + ")"); |
---|
| 517 | + System.err.println("GOAL change (" + this + "): " + goal + " (was " + goalposx + ", " + goalposz + ")"); |
---|
496 | 518 | |
---|
497 | | - goalx = goal.x; |
---|
498 | | - goalz = goal.z; |
---|
499 | | - targetx = targetz = 0; |
---|
| 519 | + goalposx = goal.x; |
---|
| 520 | + goalposz = goal.z; |
---|
| 521 | + targetdirx = targetdirz = 0; |
---|
500 | 522 | } |
---|
501 | 523 | |
---|
502 | | - if (goalx == 0 && goalz == 0) |
---|
| 524 | + if (goalposx == 0 && goalposz == 0) |
---|
503 | 525 | { |
---|
504 | 526 | // No target |
---|
505 | 527 | if (ScriptNode.speaker != null) |
---|
.. | .. |
---|
533 | 555 | //sourcenode.parent.TransformToLocal(dst); |
---|
534 | 556 | this.parent.TransformToLocal(dst); |
---|
535 | 557 | |
---|
536 | | - goalx = dst.x; |
---|
537 | | - goalz = dst.z; |
---|
| 558 | + goalposx = dst.x; |
---|
| 559 | + goalposz = dst.z; |
---|
538 | 560 | } |
---|
539 | 561 | else |
---|
540 | 562 | return; |
---|
.. | .. |
---|
550 | 572 | |
---|
551 | 573 | double angleYhip = Math.atan2(-temp.z, temp.x); |
---|
552 | 574 | |
---|
553 | | - double angleYtarget = Math.atan2(goalx - centroid.x, goalz - centroid.z); |
---|
| 575 | + double angleYtarget = Math.atan2(goalposx - centroid.x, goalposz - centroid.z); |
---|
554 | 576 | |
---|
555 | 577 | LA.matIdentity(matrix); |
---|
556 | 578 | LA.matTranslate(matrix, -centroid.x, -centroid.y, -centroid.z); |
---|
557 | | - double angle = CurveAngle(0, angleYtarget - angleYhip, 1); // 0.1f); |
---|
| 579 | + double angle = CurveAngle(0, angleYtarget - angleYhip, 0.1f); |
---|
558 | 580 | LA.matYRotate(matrix, angle); |
---|
559 | 581 | LA.matTranslate(matrix, centroid.x, centroid.y, centroid.z); |
---|
560 | 582 | |
---|
561 | 583 | LA.matConcat(matrix, toParent, toParent); |
---|
562 | 584 | |
---|
563 | 585 | LA.matInvert(toParent, fromParent); |
---|
| 586 | + |
---|
| 587 | + LA.matConcat(toParent, hip.get(0).toParent, matrix); |
---|
| 588 | + |
---|
| 589 | + centroid.x = matrix[3][0]; |
---|
| 590 | + centroid.y = matrix[3][1]; |
---|
| 591 | + centroid.z = matrix[3][2]; |
---|
| 592 | + |
---|
| 593 | + double dist = LA.distance(centroid, mocaporigin); |
---|
564 | 594 | |
---|
565 | 595 | CheckForAction(centroid); |
---|
566 | 596 | } |
---|
.. | .. |
---|
637 | 667 | double pinx; |
---|
638 | 668 | double pinz; |
---|
639 | 669 | |
---|
640 | | - double targetx; |
---|
641 | | - double targetz; |
---|
| 670 | + double targetdirx; |
---|
| 671 | + double targetdirz; |
---|
642 | 672 | |
---|
643 | | - double goalx = -20; |
---|
644 | | - double goalz = -10; |
---|
| 673 | + double goalposx = 0; // -20; |
---|
| 674 | + double goalposz = 0; // -10; |
---|
645 | 675 | |
---|
646 | 676 | boolean followpath; |
---|
647 | 677 | |
---|
.. | .. |
---|
712 | 742 | scriptactions.clear(); |
---|
713 | 743 | } |
---|
714 | 744 | |
---|
715 | | - static double EPSACTION = 0.1; // 0.075; // 0.1; |
---|
| 745 | + static double EPSACTION = 0.1; // 0.075; // 0.1;Came |
---|
716 | 746 | |
---|
717 | 747 | void AddFromTo(cVector from, cVector to) |
---|
718 | 748 | { |
---|
.. | .. |
---|
897 | 927 | // //GetFileRoot(); |
---|
898 | 928 | |
---|
899 | 929 | // sept 2014: // |
---|
900 | | - GrafreeD.RENDERME = 3; // patch for Merge objects |
---|
| 930 | + Grafreed.RENDERME = 3; // patch for Merge objects |
---|
901 | 931 | float[] thedata = bvh.animation.getBoneData(0); |
---|
902 | 932 | |
---|
903 | 933 | os.x = (float) (path.get(i).toParent[3][0]); // - thedata[frame*6]); |
---|
.. | .. |
---|
1278 | 1308 | |
---|
1279 | 1309 | void SetPosition(Object3D sourcenode, cVector floor, long floorid, cVector centroid) |
---|
1280 | 1310 | { |
---|
| 1311 | + assert(false); |
---|
1281 | 1312 | //assert(CameraPane.drawMode == CameraPane.SHADOW); |
---|
1282 | 1313 | |
---|
1283 | 1314 | Object3D transformnode = new Object3D(); |
---|
.. | .. |
---|
1481 | 1512 | groundid = floorid; |
---|
1482 | 1513 | |
---|
1483 | 1514 | // green |
---|
1484 | | - CameraPane.debugpoint.toParent[3][0] = groundx; |
---|
1485 | | - CameraPane.debugpoint.toParent[3][1] = floor.y; |
---|
1486 | | - CameraPane.debugpoint.toParent[3][2] = groundz; |
---|
| 1515 | + CameraPane.debugpointG.toParent[3][0] = groundx; |
---|
| 1516 | + CameraPane.debugpointG.toParent[3][1] = floor.y; |
---|
| 1517 | + CameraPane.debugpointG.toParent[3][2] = groundz; |
---|
1487 | 1518 | |
---|
1488 | 1519 | if (true) // slow && stepout && onein) |
---|
1489 | 1520 | { |
---|
.. | .. |
---|
1494 | 1525 | // mywave = currentwave++; |
---|
1495 | 1526 | // } |
---|
1496 | 1527 | // sound |
---|
1497 | | - cVector eye = CameraPane.theRenderer.eyeCamera.location; |
---|
| 1528 | + cVector eye = Globals.theRenderer.EyeCamera().location; |
---|
1498 | 1529 | |
---|
1499 | 1530 | // if (sourcenode.parent.parent != null) |
---|
1500 | 1531 | // sourcenode.parent.parent.TransformToWorld(floor, tmp); |
---|
.. | .. |
---|
1539 | 1570 | //GraphreeD. |
---|
1540 | 1571 | wav.play(volume * usedvolume); //, mywave); |
---|
1541 | 1572 | |
---|
1542 | | - lastsoundtime = CameraPane.framecount; |
---|
| 1573 | + lastsoundtime = Globals.framecount; |
---|
1543 | 1574 | |
---|
1544 | | - GrafreeD.hassound = true; |
---|
| 1575 | + Grafreed.hassound = true; |
---|
1545 | 1576 | } |
---|
1546 | 1577 | // else |
---|
1547 | 1578 | // System.out.println("skipped"); |
---|
.. | .. |
---|
1560 | 1591 | |
---|
1561 | 1592 | // System.out.println("Allo " + sourcenode); |
---|
1562 | 1593 | // purple |
---|
1563 | | - CameraPane.debugpoint2.toParent[3][0] = floor.x;// + posx; |
---|
1564 | | - CameraPane.debugpoint2.toParent[3][1] = ground; // floor.y;// + sourcenode.parent.toParent[3][1]; |
---|
1565 | | - CameraPane.debugpoint2.toParent[3][2] = floor.z;// + posz; |
---|
| 1594 | + CameraPane.debugpointP.toParent[3][0] = floor.x;// + posx; |
---|
| 1595 | + CameraPane.debugpointP.toParent[3][1] = ground; // floor.y;// + sourcenode.parent.toParent[3][1]; |
---|
| 1596 | + CameraPane.debugpointP.toParent[3][2] = floor.z;// + posz; |
---|
1566 | 1597 | |
---|
1567 | 1598 | |
---|
1568 | 1599 | if (false) // dist2 > 0.1) |
---|
.. | .. |
---|
1628 | 1659 | this.get(0).TransformToWorld(v0); |
---|
1629 | 1660 | |
---|
1630 | 1661 | // cyan |
---|
1631 | | - CameraPane.debugpoint3.toParent[3][0] = v0.x; |
---|
1632 | | - CameraPane.debugpoint3.toParent[3][1] = ground; |
---|
1633 | | - CameraPane.debugpoint3.toParent[3][2] = v0.z; |
---|
| 1662 | + CameraPane.debugpointC.toParent[3][0] = v0.x; |
---|
| 1663 | + CameraPane.debugpointC.toParent[3][1] = ground; |
---|
| 1664 | + CameraPane.debugpointC.toParent[3][2] = v0.z; |
---|
1634 | 1665 | |
---|
1635 | 1666 | LA.matConcat(sourcenode.toParent, transformnode.toParent, sourcenode.toParent); |
---|
1636 | 1667 | LA.matInvert(sourcenode.toParent, sourcenode.fromParent); |
---|
.. | .. |
---|
1640 | 1671 | this.get(0).TransformToWorld(v0); |
---|
1641 | 1672 | |
---|
1642 | 1673 | // red |
---|
1643 | | - CameraPane.debugpoint4.toParent[3][0] = v0.x; |
---|
1644 | | - CameraPane.debugpoint4.toParent[3][1] = ground; |
---|
1645 | | - CameraPane.debugpoint4.toParent[3][2] = v0.z; |
---|
| 1674 | + CameraPane.debugpointR.toParent[3][0] = v0.x; |
---|
| 1675 | + CameraPane.debugpointR.toParent[3][1] = ground; |
---|
| 1676 | + CameraPane.debugpointR.toParent[3][2] = v0.z; |
---|
1646 | 1677 | } |
---|
1647 | 1678 | } |
---|
1648 | 1679 | |
---|
.. | .. |
---|
1682 | 1713 | |
---|
1683 | 1714 | if (goal != null) |
---|
1684 | 1715 | { |
---|
1685 | | - System.err.println("GOAL change (" + sourcenode + "): " + goal + " (was " + goalx + ", " + goalz + ")"); |
---|
| 1716 | + System.err.println("GOAL change (" + sourcenode + "): " + goal + " (was " + goalposx + ", " + goalposz + ")"); |
---|
1686 | 1717 | //sourcenode.parent.parent.Dump(); |
---|
1687 | | - goalx = goal.x; |
---|
1688 | | - goalz = goal.z; |
---|
1689 | | - targetx = targetz = 0; |
---|
| 1718 | + goalposx = goal.x; |
---|
| 1719 | + goalposz = goal.z; |
---|
| 1720 | + targetdirx = targetdirz = 0; |
---|
1690 | 1721 | |
---|
1691 | 1722 | followpath = true; |
---|
1692 | 1723 | } |
---|
.. | .. |
---|
1737 | 1768 | // } |
---|
1738 | 1769 | if (false) // !uselast) |
---|
1739 | 1770 | { |
---|
1740 | | - CameraPane.debugpoint.toParent[3][0] = dst.x; |
---|
1741 | | - CameraPane.debugpoint.toParent[3][1] = dst.y; |
---|
1742 | | - CameraPane.debugpoint.toParent[3][2] = dst.z; |
---|
| 1771 | + CameraPane.debugpointG.toParent[3][0] = dst.x; |
---|
| 1772 | + CameraPane.debugpointG.toParent[3][1] = dst.y; |
---|
| 1773 | + CameraPane.debugpointG.toParent[3][2] = dst.z; |
---|
1743 | 1774 | } |
---|
1744 | 1775 | } |
---|
1745 | 1776 | |
---|
1746 | | - if (goalx != 0 || goalz != 0) // TODO |
---|
| 1777 | + if (goalposx != 0 || goalposz != 0) // TODO |
---|
1747 | 1778 | { |
---|
1748 | 1779 | // overwrite speaker orientation |
---|
1749 | | - dst.set(goalx,0,goalz); |
---|
| 1780 | + dst.set(goalposx,0,goalposz); |
---|
1750 | 1781 | if (sourcenode.parent != null) // july 2014 |
---|
1751 | 1782 | sourcenode.parent. |
---|
1752 | 1783 | TransformToLocal(dst); |
---|
.. | .. |
---|
1798 | 1829 | // mars 2014 |
---|
1799 | 1830 | if (false) // goalx != 0 || goalz != 0) |
---|
1800 | 1831 | { |
---|
1801 | | - targetx = dst.x - src.x; |
---|
1802 | | - targetz = dst.z - src.z; |
---|
| 1832 | + targetdirx = dst.x - src.x; |
---|
| 1833 | + targetdirz = dst.z - src.z; |
---|
1803 | 1834 | |
---|
1804 | | - if (Math.abs(targetx) > 0.1 || Math.abs(targetz) > 0.1) |
---|
| 1835 | + if (Math.abs(targetdirx) > 0.1 || Math.abs(targetdirz) > 0.1) |
---|
1805 | 1836 | { |
---|
1806 | 1837 | // far enough from goal. keep the goal position. |
---|
1807 | | - targetx = 0; |
---|
1808 | | - targetz = 0; |
---|
| 1838 | + targetdirx = 0; |
---|
| 1839 | + targetdirz = 0; |
---|
1809 | 1840 | } |
---|
1810 | 1841 | else |
---|
1811 | 1842 | { |
---|
1812 | 1843 | // too close to goal. switch to target direction instead. |
---|
1813 | | - goalx = 0; |
---|
1814 | | - goalz = 0; |
---|
| 1844 | + goalposx = 0; |
---|
| 1845 | + goalposz = 0; |
---|
1815 | 1846 | } |
---|
1816 | 1847 | } |
---|
1817 | 1848 | |
---|
1818 | 1849 | //sourcenode.getCentroid(src, true); |
---|
1819 | 1850 | |
---|
1820 | | - if (speakernode == sourcenode && goalx == 0 && goalz == 0) |
---|
| 1851 | + if (speakernode == sourcenode && goalposx == 0 && goalposz == 0) |
---|
1821 | 1852 | { |
---|
1822 | 1853 | if (ScriptNode.lastspeaker != null) |
---|
1823 | 1854 | new Exception().printStackTrace(); |
---|
.. | .. |
---|
1826 | 1857 | |
---|
1827 | 1858 | // LA.xformPos(src, fromParent, src); |
---|
1828 | 1859 | |
---|
1829 | | - if ((ScriptNode.speaker != null && CameraPane.SPEAKERMOCAP || goalx != 0 || goalz != 0) && targetx == 0 && targetz == 0) |
---|
| 1860 | + if ((ScriptNode.speaker != null && CameraPane.SPEAKERMOCAP || goalposx != 0 || goalposz != 0) && targetdirx == 0 && targetdirz == 0) |
---|
1830 | 1861 | dst.sub(src); |
---|
1831 | 1862 | else |
---|
1832 | 1863 | // vector mode |
---|
1833 | 1864 | { |
---|
1834 | | - dst.x = targetx; |
---|
1835 | | - dst.z = targetz; |
---|
| 1865 | + dst.x = targetdirx; |
---|
| 1866 | + dst.z = targetdirz; |
---|
1836 | 1867 | |
---|
1837 | 1868 | // TEST TARGET |
---|
1838 | 1869 | // dst.x = CameraPane.selectedpoint.toParent[3][0]; |
---|
.. | .. |
---|
2242 | 2273 | } |
---|
2243 | 2274 | |
---|
2244 | 2275 | if (!smoothed) |
---|
2245 | | - for (int i=0; --i>=0;) |
---|
| 2276 | + for (int i=10; --i>=0;) |
---|
2246 | 2277 | SmoothAnimData(); // much reduces shakiness |
---|
2247 | 2278 | |
---|
2248 | 2279 | smoothed = true; |
---|
.. | .. |
---|
2280 | 2311 | toVector.x = LA.cos(to); |
---|
2281 | 2312 | toVector.y = LA.sin(to); |
---|
2282 | 2313 | |
---|
| 2314 | + double fromA = Math.atan2(fromVector.y, fromVector.x); |
---|
| 2315 | + double toA = Math.atan2(toVector.y, toVector.x); |
---|
| 2316 | + |
---|
2283 | 2317 | Vector2d currentVector = Slerp(fromVector, toVector, step); |
---|
2284 | 2318 | |
---|
2285 | | - return Math.atan2(currentVector.y, currentVector.x); |
---|
| 2319 | + double angle = Math.atan2(currentVector.y, currentVector.x); |
---|
| 2320 | + |
---|
| 2321 | + double angle2 = (1-step) * fromA + step * toA; |
---|
| 2322 | + |
---|
| 2323 | + return angle; |
---|
2286 | 2324 | } |
---|
2287 | 2325 | |
---|
2288 | 2326 | public static Vector2d Slerp(Vector2d from, Vector2d to, double step) |
---|
.. | .. |
---|
2765 | 2803 | //if (bone._rotationEnabled) |
---|
2766 | 2804 | if (//frame > 0 && |
---|
2767 | 2805 | !bone.skipmocap && |
---|
2768 | | - !bone.name.contains("head") // && |
---|
| 2806 | + !bone.name.contains("head") && |
---|
| 2807 | + !bone.name.contains("Head") // && |
---|
2769 | 2808 | // !bone.name.contains("rFoot") && |
---|
2770 | 2809 | // !bone.name.contains("lFoot") && |
---|
2771 | 2810 | // !bone.name.contains("Pinky") && |
---|
.. | .. |
---|
3191 | 3230 | |
---|
3192 | 3231 | // july 2014 |
---|
3193 | 3232 | // goalx = goalz = 0; |
---|
3194 | | - targetx = targetz = 0; |
---|
| 3233 | + targetdirx = targetdirz = 0; |
---|
3195 | 3234 | |
---|
3196 | 3235 | //SetPositionDelta(true, true, true, false); |
---|
3197 | 3236 | // LoadData(); |
---|
.. | .. |
---|
3201 | 3240 | |
---|
3202 | 3241 | // aout 2013 endframe = 0; // june 2013 |
---|
3203 | 3242 | |
---|
3204 | | - //ResetZero(); |
---|
3205 | | - setPose(frame); |
---|
| 3243 | + ResetZero(); |
---|
| 3244 | + //setPose(frame); |
---|
3206 | 3245 | } |
---|
3207 | 3246 | |
---|
3208 | 3247 | static int mocapsupport = 0; |
---|
.. | .. |
---|
3220 | 3259 | |
---|
3221 | 3260 | int step = 1; |
---|
3222 | 3261 | |
---|
| 3262 | + // patch for running hare |
---|
3223 | 3263 | if (speedup) // fev 2014 |
---|
3224 | 3264 | step *= 2; // 4; |
---|
3225 | 3265 | if (rewind) // mars 2014 |
---|
3226 | 3266 | step *= 4; |
---|
3227 | 3267 | |
---|
3228 | | - if (CameraPane.FAST) // && !CameraPane.HOLD) |
---|
| 3268 | + //if (CameraPane.FAST) // && !CameraPane.HOLD) |
---|
3229 | 3269 | step *= CameraPane.STEP; |
---|
3230 | 3270 | |
---|
3231 | 3271 | //System.err.println("Step Mocap frame # " + frame); |
---|
.. | .. |
---|
3257 | 3297 | "; fullname = " + fullname); |
---|
3258 | 3298 | |
---|
3259 | 3299 | //int delta = frame - baseframe; |
---|
3260 | | - if (CameraPane.CROWD) |
---|
| 3300 | + if (Globals.CROWD) |
---|
3261 | 3301 | { |
---|
3262 | 3302 | baseframe = GetFirstFrame(); // 0 initial point |
---|
3263 | 3303 | } |
---|
.. | .. |
---|
3266 | 3306 | // SetPositionDelta(false, true, false); // ?? false); |
---|
3267 | 3307 | { |
---|
3268 | 3308 | if (support == null) |
---|
3269 | | - ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest); |
---|
| 3309 | + { |
---|
| 3310 | + if (bvh == null && new File(fullname).exists()) |
---|
| 3311 | + ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest); |
---|
| 3312 | + else |
---|
| 3313 | + { |
---|
| 3314 | + SetGlobalTransform(); |
---|
| 3315 | + Rewind(); |
---|
| 3316 | + Fade(); |
---|
| 3317 | + } |
---|
| 3318 | + } |
---|
3270 | 3319 | else |
---|
3271 | 3320 | { |
---|
3272 | | - try |
---|
3273 | | - { |
---|
| 3321 | +// try |
---|
| 3322 | +// { |
---|
3274 | 3323 | bvh = ((Mocap)support.get(mocapsupport++ % support.Size())).bvh; |
---|
3275 | 3324 | |
---|
3276 | 3325 | // SetPositionDelta(false, true, true, true); |
---|
3277 | 3326 | LoadData(); |
---|
3278 | 3327 | Rewind(); |
---|
3279 | 3328 | Fade(); |
---|
3280 | | - } |
---|
3281 | | - catch (Exception e) |
---|
3282 | | - { |
---|
3283 | | - e.printStackTrace(); |
---|
3284 | | - ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest); |
---|
3285 | | - } |
---|
| 3329 | +// } |
---|
| 3330 | +// catch (Exception e) |
---|
| 3331 | +// { |
---|
| 3332 | +// System.err.println("An error occured while loading data. Use fallback by loading the file."); |
---|
| 3333 | +// //e.printStackTrace(); |
---|
| 3334 | +// try |
---|
| 3335 | +// { |
---|
| 3336 | +// ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest); |
---|
| 3337 | +// } |
---|
| 3338 | +// catch (Exception e2) |
---|
| 3339 | +// { |
---|
| 3340 | +// System.err.println("Motion file not found: " + fullname); |
---|
| 3341 | +// } |
---|
| 3342 | +// } |
---|
3286 | 3343 | } |
---|
3287 | 3344 | } |
---|
3288 | 3345 | |
---|
.. | .. |
---|
3464 | 3521 | // filters out bad input data |
---|
3465 | 3522 | void FilterAnimData() |
---|
3466 | 3523 | { |
---|
| 3524 | + new Exception().printStackTrace(); |
---|
3467 | 3525 | System.exit(0); |
---|
3468 | 3526 | |
---|
3469 | 3527 | float[] data; // = bvh.animation.getBoneData(0); |
---|
.. | .. |
---|
3821 | 3879 | |
---|
3822 | 3880 | transient boolean restarted; // CROWD issue? |
---|
3823 | 3881 | |
---|
3824 | | - void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 3882 | + void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
3825 | 3883 | { |
---|
3826 | 3884 | //System.err.println("drawSelf Mocap frame # " + frame); |
---|
3827 | 3885 | //System.err.println("drawSelf Mocap baseframe # " + baseframe); |
---|
.. | .. |
---|
3838 | 3896 | // if (firstframe) |
---|
3839 | 3897 | // return; |
---|
3840 | 3898 | |
---|
3841 | | - if (!restarted && /*display.restartframe &&*/ |
---|
3842 | | - display.isLIVE() && live && display.drawMode == display.SHADOW) // FUCK |
---|
| 3899 | + if (//!restarted && /*display.restartframe &&*/ |
---|
| 3900 | + Globals.isLIVE() && live && (display.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW)) |
---|
3843 | 3901 | { |
---|
3844 | 3902 | //display.restartframe = false; |
---|
3845 | 3903 | restarted = true; |
---|
| 3904 | + //System.err.println("restarted = true"); |
---|
3846 | 3905 | Step(); |
---|
3847 | 3906 | } |
---|
3848 | 3907 | else |
---|
3849 | 3908 | { |
---|
3850 | | - if (display.isLIVE() && live && display.drawMode != display.SHADOW) |
---|
| 3909 | + //System.err.println("restarted"); |
---|
| 3910 | + if (Globals.isLIVE() && live && display.DrawMode() != iCameraPane.SHADOW) |
---|
| 3911 | + { |
---|
3851 | 3912 | restarted = false; |
---|
| 3913 | + //System.err.println("restarted = false"); |
---|
| 3914 | + } |
---|
3852 | 3915 | } |
---|
3853 | 3916 | |
---|
3854 | 3917 | super.drawSelf(display, root, selected, blocked); |
---|