Normand Briere
2019-10-06 ce660a4b6ba367bd162dd2cff26d02c80a34c912
Mocap.java
....@@ -261,9 +261,11 @@
261261
262262 // LA.matConcat(toParent, hip.get(0).toParent, toParent);
263263
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.CreateSelectedPoint();
265
+
266
+ CameraPane.debugpointG.toParent[3][0] = poship.x;
267
+ CameraPane.debugpointG.toParent[3][1] = poship.y;
268
+ CameraPane.debugpointG.toParent[3][2] = poship.z;
267269
268270 LA.matInvert(toParent, fromParent);
269271
....@@ -283,28 +285,28 @@
283285 poship.x = hip.get(0).toParent[3][0];
284286 poship.y = hip.get(0).toParent[3][1];
285287 poship.z = hip.get(0).toParent[3][2];
288
+
289
+ temp.x = 1;
290
+ temp.y = 0;
291
+ temp.z = 0;
292
+
293
+ LA.xformDir(temp, hip.get(0).toParent, temp);
294
+
295
+ angleYhip = Math.atan2(-temp.z, temp.x);
286296
287
- // AT*AR = A'T*BT*A'R*BR
288
- //
289
- LA.matInvert(hip.get(0).toParent, matrix);
297
+ LA.matIdentity(matrix);
298
+ LA.matYRotate(matrix, angleYhip);
299
+ LA.matTranslate(matrix, poship.x, poship.y, poship.z);
300
+
301
+ //LA.matInvert(hip.get(0).toParent, matrix);
302
+ LA.matInvert(matrix, matrix);
290303
291304 //LA.matIdentity(matrix);
292305 //LA.matTranslate(matrix, -poship.x, -poship.y, -poship.z);
293306
294307 LA.matConcat(toParent, matrix, toParent);
295308
296
-// poship.x = hip.get(0).toParent[3][0];
297
-// poship.y = hip.get(0).toParent[3][1];
298
-// poship.z = hip.get(0).toParent[3][2];
299
-//
300
-// temp.x = 1;
301
-// temp.y = 0;
302
-// temp.z = 0;
303
-//
304
-// LA.xformDir(temp, hip.get(0).toParent, temp);
305
-//
306
-// angleYhip = Math.atan2(-temp.z, temp.x);
307
-
309
+
308310 LA.matConcat(toParent, hip.get(0).toParent, matrix);
309311 pos.x = hip.get(0).toParent[3][0];
310312 pos.y = hip.get(0).toParent[3][1];
....@@ -324,21 +326,21 @@
324326 // LA.matYRotate(toParent, angleY - angleYhip);
325327 // LA.matTranslate(toParent, pos.x - poship.x, pos.y - poship.y, pos.z - poship.z);
326328
327
- CameraPane.debugpoint2.toParent[3][0] = pos.x;
328
- CameraPane.debugpoint2.toParent[3][1] = pos.y;
329
- CameraPane.debugpoint2.toParent[3][2] = pos.z;
329
+ CameraPane.debugpointP.toParent[3][0] = pos.x;
330
+ CameraPane.debugpointP.toParent[3][1] = pos.y;
331
+ CameraPane.debugpointP.toParent[3][2] = pos.z;
330332
331
- CameraPane.debugpoint3.toParent[3][0] = poship.x;
332
- CameraPane.debugpoint3.toParent[3][1] = poship.y;
333
- CameraPane.debugpoint3.toParent[3][2] = poship.z;
333
+ CameraPane.debugpointC.toParent[3][0] = poship.x;
334
+ CameraPane.debugpointC.toParent[3][1] = poship.y;
335
+ CameraPane.debugpointC.toParent[3][2] = poship.z;
334336
335337 poship.x = toParent[3][0];
336338 poship.y = toParent[3][1];
337339 poship.z = toParent[3][2];
338340
339
- CameraPane.debugpoint4.toParent[3][0] = poship.x;
340
- CameraPane.debugpoint4.toParent[3][1] = poship.y;
341
- CameraPane.debugpoint4.toParent[3][2] = poship.z;
341
+ CameraPane.debugpointR.toParent[3][0] = poship.x;
342
+ CameraPane.debugpointR.toParent[3][1] = poship.y;
343
+ CameraPane.debugpointR.toParent[3][2] = poship.z;
342344
343345 LA.matInvert(toParent, fromParent);
344346 }
....@@ -476,6 +478,125 @@
476478 currenthip[i] = data[frame3 + i];
477479 }
478480 }
481
+
482
+ static cVector centroid = new cVector();
483
+ static cVector mocaporigin = new cVector();
484
+
485
+ void SetHipOrientation()
486
+ {
487
+ Object3D hip = get(0);
488
+
489
+ if (toParent == null)
490
+ {
491
+ toParent = LA.newMatrix();
492
+ fromParent = LA.newMatrix();
493
+ }
494
+
495
+ LA.matConcat(toParent, hip.get(0).toParent, matrix);
496
+
497
+ mocaporigin.x = matrix[3][0];
498
+ mocaporigin.y = matrix[3][1];
499
+ mocaporigin.z = matrix[3][2];
500
+
501
+ centroid.x = matrix[3][0];
502
+ centroid.y = matrix[3][1];
503
+ centroid.z = matrix[3][2];
504
+// this.getCentroid(centroid, true);
505
+
506
+ CameraPane.CreateSelectedPoint();
507
+ CameraPane.debugpointG.name = "";
508
+ CameraPane.debugpointG.toParent[3][0] = mocaporigin.x;
509
+ CameraPane.debugpointG.toParent[3][1] = mocaporigin.y;
510
+ CameraPane.debugpointG.toParent[3][2] = mocaporigin.z;
511
+
512
+ CameraPane.debugpointP.name = "";
513
+ CameraPane.debugpointP.toParent[3][0] = centroid.x;
514
+ CameraPane.debugpointP.toParent[3][1] = centroid.y;
515
+ CameraPane.debugpointP.toParent[3][2] = centroid.z;
516
+
517
+ cVector goal = GetGoal(centroid);
518
+ if (goal != null)
519
+ {
520
+ System.err.println("GOAL change (" + this + "): " + goal + " (was " + goalposx + ", " + goalposz + ")");
521
+
522
+ goalposx = goal.x;
523
+ goalposz = goal.z;
524
+ targetdirx = targetdirz = 0;
525
+ }
526
+
527
+ if (goalposx == 0 && goalposz == 0)
528
+ {
529
+ // No target
530
+ if (ScriptNode.speaker != null)
531
+ {
532
+ Object3D sourcenode = GetFileRoot();
533
+ Object3D speakernode = ScriptNode.speaker.GetFileRoot();
534
+
535
+ //System.err.println("speaker is " + speakernode + "; last was " + ScriptNode.lastspeaker);
536
+
537
+ Object3D speaker = ScriptNode.speaker;
538
+
539
+ if (speakernode == sourcenode)
540
+ {
541
+ if (ScriptNode.lastspeaker != null)
542
+ {
543
+ speakernode = ScriptNode.lastspeaker.GetFileRoot();
544
+ speaker = ScriptNode.lastspeaker;
545
+ }
546
+ else
547
+ return;
548
+ }
549
+
550
+ cVector dst = new cVector();
551
+
552
+ boolean success = speakernode.getCentroid(dst); // , true);
553
+
554
+ if (!success)
555
+ new Exception().printStackTrace();
556
+
557
+ //speakernode.parent.TransformToWorld(dst);
558
+ //sourcenode.parent.TransformToLocal(dst);
559
+ this.parent.TransformToLocal(dst);
560
+
561
+ goalposx = dst.x;
562
+ goalposz = dst.z;
563
+ }
564
+ else
565
+ return;
566
+ }
567
+
568
+ cVector temp = new cVector();
569
+
570
+ temp.x = 1;
571
+ temp.y = 0;
572
+ temp.z = 0;
573
+
574
+ LA.xformDir(temp, matrix, temp);
575
+
576
+ double angleYhip = Math.atan2(-temp.z, temp.x);
577
+
578
+ double angleYtarget = Math.atan2(goalposx - centroid.x, goalposz - centroid.z);
579
+
580
+ LA.matIdentity(matrix);
581
+ LA.matTranslate(matrix, -centroid.x, -centroid.y, -centroid.z);
582
+ double angle = CurveAngle(0, angleYtarget - angleYhip, 0.1f);
583
+ LA.matYRotate(matrix, angle);
584
+ LA.matTranslate(matrix, centroid.x, centroid.y, centroid.z);
585
+
586
+ LA.matConcat(matrix, toParent, toParent);
587
+
588
+ LA.matInvert(toParent, fromParent);
589
+
590
+ LA.matConcat(toParent, hip.get(0).toParent, matrix);
591
+
592
+ centroid.x = matrix[3][0];
593
+ centroid.y = matrix[3][1];
594
+ centroid.z = matrix[3][2];
595
+
596
+ double dist = LA.distance(centroid, mocaporigin);
597
+
598
+ CheckForAction(centroid);
599
+ }
479600
480601 void WriteTo(java.io.Writer writer) throws Exception
481602 {
....@@ -526,6 +647,24 @@
526647 // transient // aout 2013
527648 Object3D skeleton;
528649
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
+
529668 boolean smoothed;
530669
531670 //boolean touched;
....@@ -549,11 +688,11 @@
549688 double pinx;
550689 double pinz;
551690
552
- double targetx;
553
- double targetz;
691
+ double targetdirx;
692
+ double targetdirz;
554693
555
- double goalx;
556
- double goalz;
694
+ double goalposx = 0; // -20;
695
+ double goalposz = 0; // -10;
557696
558697 boolean followpath;
559698
....@@ -624,7 +763,7 @@
624763 scriptactions.clear();
625764 }
626765
627
- static double EPSACTION = 0.1; // 0.075; // 0.1;
766
+ static double EPSACTION = 0.1; // 0.075; // 0.1;Came
628767
629768 void AddFromTo(cVector from, cVector to)
630769 {
....@@ -809,7 +948,7 @@
809948 // //GetFileRoot();
810949
811950 // sept 2014: //
812
- GrafreeD.RENDERME = 3; // patch for Merge objects
951
+ Grafreed.RENDERME = 3; // patch for Merge objects
813952 float[] thedata = bvh.animation.getBoneData(0);
814953
815954 os.x = (float) (path.get(i).toParent[3][0]); // - thedata[frame*6]);
....@@ -859,7 +998,7 @@
859998
860999 get(0).link2master = path.size() > 1; // hip orientation
8611000
862
- if (get(0).link2master)
1001
+ if (get(0).Link2Support())
8631002 {
8641003 rotateonce = 2;
8651004 }
....@@ -910,6 +1049,8 @@
9101049 testvect.set(from);
9111050 testvect.sub(fromto.from);
9121051
1052
+ testvect.y = 0; // PATCH
1053
+
9131054 int factor = 1;
9141055
9151056 //if (CameraPane.FAST)
....@@ -951,6 +1092,8 @@
9511092
9521093 testvect.set(from);
9531094 testvect.sub(fromto.from);
1095
+
1096
+ testvect.y = 0; // PATCH
9541097
9551098 int factor = 1;
9561099
....@@ -1186,6 +1329,7 @@
11861329
11871330 void SetPosition(Object3D sourcenode, cVector floor, long floorid, cVector centroid)
11881331 {
1332
+ assert(false);
11891333 //assert(CameraPane.drawMode == CameraPane.SHADOW);
11901334
11911335 Object3D transformnode = new Object3D();
....@@ -1283,7 +1427,7 @@
12831427 double w = 0.00015;
12841428
12851429 //if (!sourcenode.link2master) // strong pin on floor
1286
- if (parent.link2master) // strong pin on floor
1430
+ if (parent.Link2Support()) // strong pin on floor
12871431 {
12881432 w = 0.005; // .001;
12891433 }
....@@ -1389,9 +1533,9 @@
13891533 groundid = floorid;
13901534
13911535 // green
1392
- CameraPane.debugpoint.toParent[3][0] = groundx;
1393
- CameraPane.debugpoint.toParent[3][1] = floor.y;
1394
- CameraPane.debugpoint.toParent[3][2] = groundz;
1536
+ CameraPane.debugpointG.toParent[3][0] = groundx;
1537
+ CameraPane.debugpointG.toParent[3][1] = floor.y;
1538
+ CameraPane.debugpointG.toParent[3][2] = groundz;
13951539
13961540 if (true) // slow && stepout && onein)
13971541 {
....@@ -1402,7 +1546,7 @@
14021546 // mywave = currentwave++;
14031547 // }
14041548 // sound
1405
- cVector eye = CameraPane.theRenderer.eyeCamera.location;
1549
+ cVector eye = Globals.theRenderer.EyeCamera().location;
14061550
14071551 // if (sourcenode.parent.parent != null)
14081552 // sourcenode.parent.parent.TransformToWorld(floor, tmp);
....@@ -1447,9 +1591,9 @@
14471591 //GraphreeD.
14481592 wav.play(volume * usedvolume); //, mywave);
14491593
1450
- lastsoundtime = CameraPane.framecount;
1594
+ lastsoundtime = Globals.framecount;
14511595
1452
- GrafreeD.hassound = true;
1596
+ Grafreed.hassound = true;
14531597 }
14541598 // else
14551599 // System.out.println("skipped");
....@@ -1468,9 +1612,9 @@
14681612
14691613 // System.out.println("Allo " + sourcenode);
14701614 // purple
1471
- CameraPane.debugpoint2.toParent[3][0] = floor.x;// + posx;
1472
- CameraPane.debugpoint2.toParent[3][1] = ground; // floor.y;// + sourcenode.parent.toParent[3][1];
1473
- CameraPane.debugpoint2.toParent[3][2] = floor.z;// + posz;
1615
+ CameraPane.debugpointP.toParent[3][0] = floor.x;// + posx;
1616
+ CameraPane.debugpointP.toParent[3][1] = ground; // floor.y;// + sourcenode.parent.toParent[3][1];
1617
+ CameraPane.debugpointP.toParent[3][2] = floor.z;// + posz;
14741618
14751619
14761620 if (false) // dist2 > 0.1)
....@@ -1497,7 +1641,7 @@
14971641 // sourcenode.parent.toParent[3][1] = ground - floor.y;
14981642 // sourcenode.parent.toParent[3][2] += groundz - floor.z;
14991643 // sourcenode.parent.toParent[3][1] = K * (ground - floor.y) + (1 - K) * oldposy;
1500
- 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
15011645 {
15021646 v0.x = groundx - floor.x;
15031647 v0.y = 0; // groundx - floor.x;
....@@ -1536,9 +1680,9 @@
15361680 this.get(0).TransformToWorld(v0);
15371681
15381682 // cyan
1539
- CameraPane.debugpoint3.toParent[3][0] = v0.x;
1540
- CameraPane.debugpoint3.toParent[3][1] = ground;
1541
- CameraPane.debugpoint3.toParent[3][2] = v0.z;
1683
+ CameraPane.debugpointC.toParent[3][0] = v0.x;
1684
+ CameraPane.debugpointC.toParent[3][1] = ground;
1685
+ CameraPane.debugpointC.toParent[3][2] = v0.z;
15421686
15431687 LA.matConcat(sourcenode.toParent, transformnode.toParent, sourcenode.toParent);
15441688 LA.matInvert(sourcenode.toParent, sourcenode.fromParent);
....@@ -1548,9 +1692,9 @@
15481692 this.get(0).TransformToWorld(v0);
15491693
15501694 // red
1551
- CameraPane.debugpoint4.toParent[3][0] = v0.x;
1552
- CameraPane.debugpoint4.toParent[3][1] = ground;
1553
- CameraPane.debugpoint4.toParent[3][2] = v0.z;
1695
+ CameraPane.debugpointR.toParent[3][0] = v0.x;
1696
+ CameraPane.debugpointR.toParent[3][1] = ground;
1697
+ CameraPane.debugpointR.toParent[3][2] = v0.z;
15541698 }
15551699 }
15561700
....@@ -1590,11 +1734,11 @@
15901734
15911735 if (goal != null)
15921736 {
1593
- System.err.println("GOAL change (" + sourcenode + "): " + goal + " (was " + goalx + ", " + goalz + ")");
1737
+ System.err.println("GOAL change (" + sourcenode + "): " + goal + " (was " + goalposx + ", " + goalposz + ")");
15941738 //sourcenode.parent.parent.Dump();
1595
- goalx = goal.x;
1596
- goalz = goal.z;
1597
- targetx = targetz = 0;
1739
+ goalposx = goal.x;
1740
+ goalposz = goal.z;
1741
+ targetdirx = targetdirz = 0;
15981742
15991743 followpath = true;
16001744 }
....@@ -1645,16 +1789,16 @@
16451789 // }
16461790 if (false) // !uselast)
16471791 {
1648
- CameraPane.debugpoint.toParent[3][0] = dst.x;
1649
- CameraPane.debugpoint.toParent[3][1] = dst.y;
1650
- CameraPane.debugpoint.toParent[3][2] = dst.z;
1792
+ CameraPane.debugpointG.toParent[3][0] = dst.x;
1793
+ CameraPane.debugpointG.toParent[3][1] = dst.y;
1794
+ CameraPane.debugpointG.toParent[3][2] = dst.z;
16511795 }
16521796 }
16531797
1654
- if (goalx != 0 || goalz != 0) // TODO
1798
+ if (goalposx != 0 || goalposz != 0) // TODO
16551799 {
16561800 // overwrite speaker orientation
1657
- dst.set(goalx,0,goalz);
1801
+ dst.set(goalposx,0,goalposz);
16581802 if (sourcenode.parent != null) // july 2014
16591803 sourcenode.parent.
16601804 TransformToLocal(dst);
....@@ -1706,26 +1850,26 @@
17061850 // mars 2014
17071851 if (false) // goalx != 0 || goalz != 0)
17081852 {
1709
- targetx = dst.x - src.x;
1710
- targetz = dst.z - src.z;
1853
+ targetdirx = dst.x - src.x;
1854
+ targetdirz = dst.z - src.z;
17111855
1712
- if (Math.abs(targetx) > 0.1 || Math.abs(targetz) > 0.1)
1856
+ if (Math.abs(targetdirx) > 0.1 || Math.abs(targetdirz) > 0.1)
17131857 {
17141858 // far enough from goal. keep the goal position.
1715
- targetx = 0;
1716
- targetz = 0;
1859
+ targetdirx = 0;
1860
+ targetdirz = 0;
17171861 }
17181862 else
17191863 {
17201864 // too close to goal. switch to target direction instead.
1721
- goalx = 0;
1722
- goalz = 0;
1865
+ goalposx = 0;
1866
+ goalposz = 0;
17231867 }
17241868 }
17251869
17261870 //sourcenode.getCentroid(src, true);
17271871
1728
- if (speakernode == sourcenode && goalx == 0 && goalz == 0)
1872
+ if (speakernode == sourcenode && goalposx == 0 && goalposz == 0)
17291873 {
17301874 if (ScriptNode.lastspeaker != null)
17311875 new Exception().printStackTrace();
....@@ -1734,13 +1878,13 @@
17341878
17351879 // LA.xformPos(src, fromParent, src);
17361880
1737
- if ((ScriptNode.speaker != null && CameraPane.SPEAKERMOCAP || goalx != 0 || goalz != 0) && targetx == 0 && targetz == 0)
1881
+ if ((ScriptNode.speaker != null && CameraPane.SPEAKERMOCAP || goalposx != 0 || goalposz != 0) && targetdirx == 0 && targetdirz == 0)
17381882 dst.sub(src);
17391883 else
17401884 // vector mode
17411885 {
1742
- dst.x = targetx;
1743
- dst.z = targetz;
1886
+ dst.x = targetdirx;
1887
+ dst.z = targetdirz;
17441888
17451889 // TEST TARGET
17461890 // dst.x = CameraPane.selectedpoint.toParent[3][0];
....@@ -1862,7 +2006,7 @@
18622006 // if (sourcenode.link2master)
18632007 // if (goalx != 0 || goalz != 0)
18642008 // K = 0.02; // .0625;
1865
- if (parent.link2master) // strong pin on floor
2009
+ if (parent.Link2Support()) // strong pin on floor
18662010 {
18672011 K = 0.05; // 0.02;
18682012 }
....@@ -2150,7 +2294,7 @@
21502294 }
21512295
21522296 if (!smoothed)
2153
- for (int i=0; --i>=0;)
2297
+ for (int i=10; --i>=0;)
21542298 SmoothAnimData(); // much reduces shakiness
21552299
21562300 smoothed = true;
....@@ -2188,9 +2332,16 @@
21882332 toVector.x = LA.cos(to);
21892333 toVector.y = LA.sin(to);
21902334
2335
+ double fromA = Math.atan2(fromVector.y, fromVector.x);
2336
+ double toA = Math.atan2(toVector.y, toVector.x);
2337
+
21912338 Vector2d currentVector = Slerp(fromVector, toVector, step);
21922339
2193
- return Math.atan2(currentVector.y, currentVector.x);
2340
+ double angle = Math.atan2(currentVector.y, currentVector.x);
2341
+
2342
+ double angle2 = (1-step) * fromA + step * toA;
2343
+
2344
+ return angle;
21942345 }
21952346
21962347 public static Vector2d Slerp(Vector2d from, Vector2d to, double step)
....@@ -2243,6 +2394,8 @@
22432394 e.printStackTrace();
22442395 }
22452396
2397
+ SetHipOrientation();
2398
+
22462399 if (true)
22472400 return;
22482401
....@@ -2270,9 +2423,9 @@
22702423 // SetBreakPoint(get(0).toParent[0], 0);
22712424 // }
22722425
2273
- boolean setrotation = get(0).link2master && !firsttimeafterload && frame > 0;
2426
+ boolean setrotation = get(0).Link2Support() && !firsttimeafterload && frame > 0;
22742427 boolean setposition = sourcenode != null && // sourcenode.parent != null && // july 2014
2275
- sourcenode./*parent.*/link2master && !firsttimeafterload && frame > 0;
2428
+ sourcenode./*parent.*/Link2Support() && !firsttimeafterload && frame > 0;
22762429
22772430 // cVector centroid = new cVector();
22782431 // cVector floor = new cVector();
....@@ -2670,8 +2823,9 @@
26702823 // set rotation
26712824 //if (bone._rotationEnabled)
26722825 if (//frame > 0 &&
2673
- !bone.skipmocap //&&
2674
- //!bone.name.contains("head") &&
2826
+ !bone.skipmocap &&
2827
+ !bone.name.contains("head") &&
2828
+ !bone.name.contains("Head") // &&
26752829 // !bone.name.contains("rFoot") &&
26762830 // !bone.name.contains("lFoot") &&
26772831 // !bone.name.contains("Pinky") &&
....@@ -2704,7 +2858,7 @@
27042858
27052859 // set translation
27062860 // (currently only possible for root bone! see mocapdata.com data)
2707
- if (bone._isRoot && link2master) // && !GetFileRoot().link2master)
2861
+ if (bone._isRoot && Link2Support()) // && !GetFileRoot().link2master)
27082862 {
27092863 if (hasTranslation) // && _translationEnabled)
27102864 {
....@@ -3056,8 +3210,8 @@
30563210
30573211 void Reset()
30583212 {
3059
- if (fullname != null)
3060
- ReadBVH();
3213
+// if (fullname != null)
3214
+// ReadBVH();
30613215
30623216 Object3D hip = get(0);
30633217
....@@ -3096,8 +3250,8 @@
30963250 // LA.matIdentity(rot.fromParent);
30973251
30983252 // july 2014
3099
- goalx = goalz = 0;
3100
- targetx = targetz = 0;
3253
+// goalx = goalz = 0;
3254
+ targetdirx = targetdirz = 0;
31013255
31023256 //SetPositionDelta(true, true, true, false);
31033257 // LoadData();
....@@ -3107,8 +3261,8 @@
31073261
31083262 // aout 2013 endframe = 0; // june 2013
31093263
3110
- //ResetZero();
3111
- setPose(frame);
3264
+ ResetZero();
3265
+ //setPose(frame);
31123266 }
31133267
31143268 static int mocapsupport = 0;
....@@ -3126,12 +3280,13 @@
31263280
31273281 int step = 1;
31283282
3283
+ // patch for running hare
31293284 if (speedup) // fev 2014
31303285 step *= 2; // 4;
31313286 if (rewind) // mars 2014
31323287 step *= 4;
31333288
3134
- if (CameraPane.FAST) // && !CameraPane.HOLD)
3289
+ //if (CameraPane.FAST) // && !CameraPane.HOLD)
31353290 step *= CameraPane.STEP;
31363291
31373292 //System.err.println("Step Mocap frame # " + frame);
....@@ -3163,7 +3318,7 @@
31633318 "; fullname = " + fullname);
31643319
31653320 //int delta = frame - baseframe;
3166
- if (CameraPane.CROWD)
3321
+ if (Globals.CROWD)
31673322 {
31683323 baseframe = GetFirstFrame(); // 0 initial point
31693324 }
....@@ -3172,23 +3327,40 @@
31723327 // SetPositionDelta(false, true, false); // ?? false);
31733328 {
31743329 if (support == null)
3175
- 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
+ }
31763340 else
31773341 {
3178
- try
3179
- {
3342
+// try
3343
+// {
31803344 bvh = ((Mocap)support.get(mocapsupport++ % support.Size())).bvh;
31813345
31823346 // SetPositionDelta(false, true, true, true);
31833347 LoadData();
31843348 Rewind();
31853349 Fade();
3186
- }
3187
- catch (Exception e)
3188
- {
3189
- e.printStackTrace();
3190
- ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest);
3191
- }
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
+// }
31923364 }
31933365 }
31943366
....@@ -3370,6 +3542,7 @@
33703542 // filters out bad input data
33713543 void FilterAnimData()
33723544 {
3545
+ new Exception().printStackTrace();
33733546 System.exit(0);
33743547
33753548 float[] data; // = bvh.animation.getBoneData(0);
....@@ -3727,7 +3900,7 @@
37273900
37283901 transient boolean restarted; // CROWD issue?
37293902
3730
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
3903
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
37313904 {
37323905 //System.err.println("drawSelf Mocap frame # " + frame);
37333906 //System.err.println("drawSelf Mocap baseframe # " + baseframe);
....@@ -3744,17 +3917,24 @@
37443917 // if (firstframe)
37453918 // return;
37463919
3747
- if (!restarted && /*display.restartframe &&*/
3748
- 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))
37493922 {
37503923 //display.restartframe = false;
37513924 restarted = true;
3925
+ //System.err.println("restarted = true");
37523926 Step();
3927
+
3928
+ Globals.lighttouched = true;
37533929 }
37543930 else
37553931 {
3756
- if (display.isLIVE() && live && display.drawMode != display.SHADOW)
3932
+ //System.err.println("restarted");
3933
+ if (Globals.isLIVE() && live && display.DrawMode() != iCameraPane.SHADOW)
3934
+ {
37573935 restarted = false;
3936
+ //System.err.println("restarted = false");
3937
+ }
37583938 }
37593939
37603940 super.drawSelf(display, root, selected, blocked);
....@@ -3814,6 +3994,11 @@
38143994 // GetObject().release(i);
38153995 }
38163996
3997
+ boolean HasBigData()
3998
+ {
3999
+ return skeleton != null;
4000
+ }
4001
+
38174002 public Object3D get(int i)
38184003 {
38194004 if (i != 0)