.. | .. |
---|
261 | 261 | |
---|
262 | 262 | // LA.matConcat(toParent, hip.get(0).toParent, toParent); |
---|
263 | 263 | |
---|
| 264 | + CameraPane.CreateSelectedPoint(); |
---|
| 265 | + |
---|
264 | 266 | CameraPane.debugpointG.toParent[3][0] = poship.x; |
---|
265 | 267 | CameraPane.debugpointG.toParent[3][1] = poship.y; |
---|
266 | 268 | CameraPane.debugpointG.toParent[3][2] = poship.z; |
---|
.. | .. |
---|
484 | 486 | { |
---|
485 | 487 | Object3D hip = get(0); |
---|
486 | 488 | |
---|
| 489 | + if (toParent == null) |
---|
| 490 | + { |
---|
| 491 | + toParent = LA.newMatrix(); |
---|
| 492 | + fromParent = LA.newMatrix(); |
---|
| 493 | + } |
---|
| 494 | + |
---|
487 | 495 | LA.matConcat(toParent, hip.get(0).toParent, matrix); |
---|
488 | 496 | |
---|
489 | 497 | mocaporigin.x = matrix[3][0]; |
---|
.. | .. |
---|
495 | 503 | centroid.z = matrix[3][2]; |
---|
496 | 504 | // this.getCentroid(centroid, true); |
---|
497 | 505 | |
---|
| 506 | + CameraPane.CreateSelectedPoint(); |
---|
498 | 507 | CameraPane.debugpointG.name = ""; |
---|
499 | 508 | CameraPane.debugpointG.toParent[3][0] = mocaporigin.x; |
---|
500 | 509 | CameraPane.debugpointG.toParent[3][1] = mocaporigin.y; |
---|
.. | .. |
---|
638 | 647 | // transient // aout 2013 |
---|
639 | 648 | Object3D skeleton; |
---|
640 | 649 | |
---|
| 650 | + void ExtractBigData(Object3D o) |
---|
| 651 | + { |
---|
| 652 | + super.ExtractBigData(o); |
---|
| 653 | + |
---|
| 654 | + o.savebvh = this.bvh; |
---|
| 655 | + o.saveskeleton = this.skeleton; |
---|
| 656 | + this.bvh = null; |
---|
| 657 | + this.skeleton = null; |
---|
| 658 | + } |
---|
| 659 | + |
---|
| 660 | + void RestoreBigData(Object3D o) |
---|
| 661 | + { |
---|
| 662 | + super.RestoreBigData(o); |
---|
| 663 | + |
---|
| 664 | + this.bvh = o.savebvh; |
---|
| 665 | + this.skeleton = o.saveskeleton; |
---|
| 666 | + } |
---|
| 667 | + |
---|
641 | 668 | boolean smoothed; |
---|
642 | 669 | |
---|
643 | 670 | //boolean touched; |
---|
.. | .. |
---|
664 | 691 | double targetdirx; |
---|
665 | 692 | double targetdirz; |
---|
666 | 693 | |
---|
667 | | - double goalposx = -20; |
---|
668 | | - double goalposz = -10; |
---|
| 694 | + double goalposx = 0; // -20; |
---|
| 695 | + double goalposz = 0; // -10; |
---|
669 | 696 | |
---|
670 | 697 | boolean followpath; |
---|
671 | 698 | |
---|
.. | .. |
---|
921 | 948 | // //GetFileRoot(); |
---|
922 | 949 | |
---|
923 | 950 | // sept 2014: // |
---|
924 | | - GrafreeD.RENDERME = 3; // patch for Merge objects |
---|
| 951 | + Grafreed.RENDERME = 3; // patch for Merge objects |
---|
925 | 952 | float[] thedata = bvh.animation.getBoneData(0); |
---|
926 | 953 | |
---|
927 | 954 | os.x = (float) (path.get(i).toParent[3][0]); // - thedata[frame*6]); |
---|
.. | .. |
---|
971 | 998 | |
---|
972 | 999 | get(0).link2master = path.size() > 1; // hip orientation |
---|
973 | 1000 | |
---|
974 | | - if (get(0).link2master) |
---|
| 1001 | + if (get(0).Link2Support()) |
---|
975 | 1002 | { |
---|
976 | 1003 | rotateonce = 2; |
---|
977 | 1004 | } |
---|
.. | .. |
---|
1400 | 1427 | double w = 0.00015; |
---|
1401 | 1428 | |
---|
1402 | 1429 | //if (!sourcenode.link2master) // strong pin on floor |
---|
1403 | | - if (parent.link2master) // strong pin on floor |
---|
| 1430 | + if (parent.Link2Support()) // strong pin on floor |
---|
1404 | 1431 | { |
---|
1405 | 1432 | w = 0.005; // .001; |
---|
1406 | 1433 | } |
---|
.. | .. |
---|
1519 | 1546 | // mywave = currentwave++; |
---|
1520 | 1547 | // } |
---|
1521 | 1548 | // sound |
---|
1522 | | - cVector eye = CameraPane.theRenderer.eyeCamera.location; |
---|
| 1549 | + cVector eye = Globals.theRenderer.EyeCamera().location; |
---|
1523 | 1550 | |
---|
1524 | 1551 | // if (sourcenode.parent.parent != null) |
---|
1525 | 1552 | // sourcenode.parent.parent.TransformToWorld(floor, tmp); |
---|
.. | .. |
---|
1564 | 1591 | //GraphreeD. |
---|
1565 | 1592 | wav.play(volume * usedvolume); //, mywave); |
---|
1566 | 1593 | |
---|
1567 | | - lastsoundtime = CameraPane.framecount; |
---|
| 1594 | + lastsoundtime = Globals.framecount; |
---|
1568 | 1595 | |
---|
1569 | | - GrafreeD.hassound = true; |
---|
| 1596 | + Grafreed.hassound = true; |
---|
1570 | 1597 | } |
---|
1571 | 1598 | // else |
---|
1572 | 1599 | // System.out.println("skipped"); |
---|
.. | .. |
---|
1614 | 1641 | // sourcenode.parent.toParent[3][1] = ground - floor.y; |
---|
1615 | 1642 | // sourcenode.parent.toParent[3][2] += groundz - floor.z; |
---|
1616 | 1643 | // sourcenode.parent.toParent[3][1] = K * (ground - floor.y) + (1 - K) * oldposy; |
---|
1617 | | - if (footcontact && (sourcenode.parent != null && !sourcenode.parent.link2master)) // strong pin on floor |
---|
| 1644 | + if (footcontact && (sourcenode.parent != null && !sourcenode.parent.Link2Support())) // strong pin on floor |
---|
1618 | 1645 | { |
---|
1619 | 1646 | v0.x = groundx - floor.x; |
---|
1620 | 1647 | v0.y = 0; // groundx - floor.x; |
---|
.. | .. |
---|
1979 | 2006 | // if (sourcenode.link2master) |
---|
1980 | 2007 | // if (goalx != 0 || goalz != 0) |
---|
1981 | 2008 | // K = 0.02; // .0625; |
---|
1982 | | - if (parent.link2master) // strong pin on floor |
---|
| 2009 | + if (parent.Link2Support()) // strong pin on floor |
---|
1983 | 2010 | { |
---|
1984 | 2011 | K = 0.05; // 0.02; |
---|
1985 | 2012 | } |
---|
.. | .. |
---|
2267 | 2294 | } |
---|
2268 | 2295 | |
---|
2269 | 2296 | if (!smoothed) |
---|
2270 | | - for (int i=0; --i>=0;) |
---|
| 2297 | + for (int i=10; --i>=0;) |
---|
2271 | 2298 | SmoothAnimData(); // much reduces shakiness |
---|
2272 | 2299 | |
---|
2273 | 2300 | smoothed = true; |
---|
.. | .. |
---|
2396 | 2423 | // SetBreakPoint(get(0).toParent[0], 0); |
---|
2397 | 2424 | // } |
---|
2398 | 2425 | |
---|
2399 | | - boolean setrotation = get(0).link2master && !firsttimeafterload && frame > 0; |
---|
| 2426 | + boolean setrotation = get(0).Link2Support() && !firsttimeafterload && frame > 0; |
---|
2400 | 2427 | boolean setposition = sourcenode != null && // sourcenode.parent != null && // july 2014 |
---|
2401 | | - sourcenode./*parent.*/link2master && !firsttimeafterload && frame > 0; |
---|
| 2428 | + sourcenode./*parent.*/Link2Support() && !firsttimeafterload && frame > 0; |
---|
2402 | 2429 | |
---|
2403 | 2430 | // cVector centroid = new cVector(); |
---|
2404 | 2431 | // cVector floor = new cVector(); |
---|
.. | .. |
---|
2797 | 2824 | //if (bone._rotationEnabled) |
---|
2798 | 2825 | if (//frame > 0 && |
---|
2799 | 2826 | !bone.skipmocap && |
---|
2800 | | - !bone.name.contains("head") // && |
---|
| 2827 | + !bone.name.contains("head") && |
---|
| 2828 | + !bone.name.contains("Head") // && |
---|
2801 | 2829 | // !bone.name.contains("rFoot") && |
---|
2802 | 2830 | // !bone.name.contains("lFoot") && |
---|
2803 | 2831 | // !bone.name.contains("Pinky") && |
---|
.. | .. |
---|
2830 | 2858 | |
---|
2831 | 2859 | // set translation |
---|
2832 | 2860 | // (currently only possible for root bone! see mocapdata.com data) |
---|
2833 | | - if (bone._isRoot && link2master) // && !GetFileRoot().link2master) |
---|
| 2861 | + if (bone._isRoot && Link2Support()) // && !GetFileRoot().link2master) |
---|
2834 | 2862 | { |
---|
2835 | 2863 | if (hasTranslation) // && _translationEnabled) |
---|
2836 | 2864 | { |
---|
.. | .. |
---|
3233 | 3261 | |
---|
3234 | 3262 | // aout 2013 endframe = 0; // june 2013 |
---|
3235 | 3263 | |
---|
3236 | | - //ResetZero(); |
---|
3237 | | - setPose(frame); |
---|
| 3264 | + ResetZero(); |
---|
| 3265 | + //setPose(frame); |
---|
3238 | 3266 | } |
---|
3239 | 3267 | |
---|
3240 | 3268 | static int mocapsupport = 0; |
---|
.. | .. |
---|
3252 | 3280 | |
---|
3253 | 3281 | int step = 1; |
---|
3254 | 3282 | |
---|
| 3283 | + // patch for running hare |
---|
3255 | 3284 | if (speedup) // fev 2014 |
---|
3256 | 3285 | step *= 2; // 4; |
---|
3257 | 3286 | if (rewind) // mars 2014 |
---|
3258 | 3287 | step *= 4; |
---|
3259 | 3288 | |
---|
3260 | | - if (CameraPane.FAST) // && !CameraPane.HOLD) |
---|
| 3289 | + //if (CameraPane.FAST) // && !CameraPane.HOLD) |
---|
3261 | 3290 | step *= CameraPane.STEP; |
---|
3262 | 3291 | |
---|
3263 | 3292 | //System.err.println("Step Mocap frame # " + frame); |
---|
.. | .. |
---|
3289 | 3318 | "; fullname = " + fullname); |
---|
3290 | 3319 | |
---|
3291 | 3320 | //int delta = frame - baseframe; |
---|
3292 | | - if (CameraPane.CROWD) |
---|
| 3321 | + if (Globals.CROWD) |
---|
3293 | 3322 | { |
---|
3294 | 3323 | baseframe = GetFirstFrame(); // 0 initial point |
---|
3295 | 3324 | } |
---|
.. | .. |
---|
3298 | 3327 | // SetPositionDelta(false, true, false); // ?? false); |
---|
3299 | 3328 | { |
---|
3300 | 3329 | if (support == null) |
---|
3301 | | - ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest); |
---|
| 3330 | + { |
---|
| 3331 | + if (bvh == null && new File(fullname).exists()) |
---|
| 3332 | + ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest); |
---|
| 3333 | + else |
---|
| 3334 | + { |
---|
| 3335 | + SetGlobalTransform(); |
---|
| 3336 | + Rewind(); |
---|
| 3337 | + Fade(); |
---|
| 3338 | + } |
---|
| 3339 | + } |
---|
3302 | 3340 | else |
---|
3303 | 3341 | { |
---|
3304 | | - try |
---|
3305 | | - { |
---|
| 3342 | +// try |
---|
| 3343 | +// { |
---|
3306 | 3344 | bvh = ((Mocap)support.get(mocapsupport++ % support.Size())).bvh; |
---|
3307 | 3345 | |
---|
3308 | 3346 | // SetPositionDelta(false, true, true, true); |
---|
3309 | 3347 | LoadData(); |
---|
3310 | 3348 | Rewind(); |
---|
3311 | 3349 | Fade(); |
---|
3312 | | - } |
---|
3313 | | - catch (Exception e) |
---|
3314 | | - { |
---|
3315 | | - e.printStackTrace(); |
---|
3316 | | - ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest); |
---|
3317 | | - } |
---|
| 3350 | +// } |
---|
| 3351 | +// catch (Exception e) |
---|
| 3352 | +// { |
---|
| 3353 | +// System.err.println("An error occured while loading data. Use fallback by loading the file."); |
---|
| 3354 | +// //e.printStackTrace(); |
---|
| 3355 | +// try |
---|
| 3356 | +// { |
---|
| 3357 | +// ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest); |
---|
| 3358 | +// } |
---|
| 3359 | +// catch (Exception e2) |
---|
| 3360 | +// { |
---|
| 3361 | +// System.err.println("Motion file not found: " + fullname); |
---|
| 3362 | +// } |
---|
| 3363 | +// } |
---|
3318 | 3364 | } |
---|
3319 | 3365 | } |
---|
3320 | 3366 | |
---|
.. | .. |
---|
3496 | 3542 | // filters out bad input data |
---|
3497 | 3543 | void FilterAnimData() |
---|
3498 | 3544 | { |
---|
| 3545 | + new Exception().printStackTrace(); |
---|
3499 | 3546 | System.exit(0); |
---|
3500 | 3547 | |
---|
3501 | 3548 | float[] data; // = bvh.animation.getBoneData(0); |
---|
.. | .. |
---|
3853 | 3900 | |
---|
3854 | 3901 | transient boolean restarted; // CROWD issue? |
---|
3855 | 3902 | |
---|
3856 | | - void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 3903 | + void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
3857 | 3904 | { |
---|
3858 | 3905 | //System.err.println("drawSelf Mocap frame # " + frame); |
---|
3859 | 3906 | //System.err.println("drawSelf Mocap baseframe # " + baseframe); |
---|
.. | .. |
---|
3870 | 3917 | // if (firstframe) |
---|
3871 | 3918 | // return; |
---|
3872 | 3919 | |
---|
3873 | | - if (!restarted && /*display.restartframe &&*/ |
---|
3874 | | - display.isLIVE() && live && display.drawMode == display.SHADOW) // FUCK |
---|
| 3920 | + if (//!restarted && /*display.restartframe &&*/ |
---|
| 3921 | + Globals.isLIVE() && live && (display.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE)) |
---|
3875 | 3922 | { |
---|
3876 | 3923 | //display.restartframe = false; |
---|
3877 | 3924 | restarted = true; |
---|
| 3925 | + //System.err.println("restarted = true"); |
---|
3878 | 3926 | Step(); |
---|
| 3927 | + |
---|
| 3928 | + Globals.lighttouched = true; |
---|
3879 | 3929 | } |
---|
3880 | 3930 | else |
---|
3881 | 3931 | { |
---|
3882 | | - if (display.isLIVE() && live && display.drawMode != display.SHADOW) |
---|
| 3932 | + //System.err.println("restarted"); |
---|
| 3933 | + if (Globals.isLIVE() && live && display.DrawMode() != iCameraPane.SHADOW) |
---|
| 3934 | + { |
---|
3883 | 3935 | restarted = false; |
---|
| 3936 | + //System.err.println("restarted = false"); |
---|
| 3937 | + } |
---|
3884 | 3938 | } |
---|
3885 | 3939 | |
---|
3886 | 3940 | super.drawSelf(display, root, selected, blocked); |
---|
.. | .. |
---|
3940 | 3994 | // GetObject().release(i); |
---|
3941 | 3995 | } |
---|
3942 | 3996 | |
---|
| 3997 | + boolean HasBigData() |
---|
| 3998 | + { |
---|
| 3999 | + return skeleton != null; |
---|
| 4000 | + } |
---|
| 4001 | + |
---|
3943 | 4002 | public Object3D get(int i) |
---|
3944 | 4003 | { |
---|
3945 | 4004 | if (i != 0) |
---|