Normand Briere
2019-06-16 b33ef80d78f01a6a61f4248b1bb7deaade42d503
Mocap.java
....@@ -29,7 +29,7 @@
2929
3030 void Fade()
3131 {
32
- if (true) // currentbones == null || CameraPane.fullreset)
32
+ if (currentbones == null || CameraPane.fullreset)
3333 return;
3434
3535 cVector temp = new cVector();
....@@ -107,7 +107,7 @@
107107 //data[f3 + i] += pos[i] - data[frame3 + i];
108108 // data[f3 + i] = k*data[f3+i] + (1-k)*
109109 // currentbones[boneframe3 + i-end];
110
- data[f3 + i] = (float)CurveAngle(data[f3+i], currenthip[i], 1-k);
110
+// data[f3 + i] = (float)CurveAngle(data[f3+i], currenthip[i], 1-k);
111111 }
112112
113113 // TODO: translation
....@@ -225,7 +225,7 @@
225225 // before resetting the mocap data.
226226 void SetGlobalTransform()
227227 {
228
- SetCurrentBones(frame);
228
+ //SetCurrentBones(frame);
229229
230230 cVector temp = new cVector();
231231 cVector pos = new cVector();
....@@ -235,6 +235,12 @@
235235 double angleYhip = 0;
236236
237237 Object3D hip = get(0);
238
+
239
+ if (hip.get(0).toParent == null)
240
+ {
241
+ hip.get(0).toParent = LA.newMatrix();
242
+ hip.get(0).fromParent = LA.newMatrix();
243
+ }
238244
239245 LA.matConcat(toParent, hip.get(0).toParent, matrix);
240246 poship.x = matrix[3][0];
....@@ -255,9 +261,9 @@
255261
256262 // LA.matConcat(toParent, hip.get(0).toParent, toParent);
257263
258
- CameraPane.debugpoint.toParent[3][0] = poship.x;
259
- CameraPane.debugpoint.toParent[3][1] = poship.y;
260
- 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;
261267
262268 LA.matInvert(toParent, fromParent);
263269
....@@ -277,28 +283,28 @@
277283 poship.x = hip.get(0).toParent[3][0];
278284 poship.y = hip.get(0).toParent[3][1];
279285 poship.z = hip.get(0).toParent[3][2];
286
+
287
+ temp.x = 1;
288
+ temp.y = 0;
289
+ temp.z = 0;
290
+
291
+ LA.xformDir(temp, hip.get(0).toParent, temp);
292
+
293
+ angleYhip = Math.atan2(-temp.z, temp.x);
280294
281
- // AT*AR = A'T*BT*A'R*BR
282
- //
283
- LA.matInvert(hip.get(0).toParent, matrix);
295
+ LA.matIdentity(matrix);
296
+ LA.matYRotate(matrix, angleYhip);
297
+ LA.matTranslate(matrix, poship.x, poship.y, poship.z);
298
+
299
+ //LA.matInvert(hip.get(0).toParent, matrix);
300
+ LA.matInvert(matrix, matrix);
284301
285302 //LA.matIdentity(matrix);
286303 //LA.matTranslate(matrix, -poship.x, -poship.y, -poship.z);
287304
288305 LA.matConcat(toParent, matrix, toParent);
289306
290
-// poship.x = hip.get(0).toParent[3][0];
291
-// poship.y = hip.get(0).toParent[3][1];
292
-// poship.z = hip.get(0).toParent[3][2];
293
-//
294
-// temp.x = 1;
295
-// temp.y = 0;
296
-// temp.z = 0;
297
-//
298
-// LA.xformDir(temp, hip.get(0).toParent, temp);
299
-//
300
-// angleYhip = Math.atan2(-temp.z, temp.x);
301
-
307
+
302308 LA.matConcat(toParent, hip.get(0).toParent, matrix);
303309 pos.x = hip.get(0).toParent[3][0];
304310 pos.y = hip.get(0).toParent[3][1];
....@@ -318,21 +324,21 @@
318324 // LA.matYRotate(toParent, angleY - angleYhip);
319325 // LA.matTranslate(toParent, pos.x - poship.x, pos.y - poship.y, pos.z - poship.z);
320326
321
- CameraPane.debugpoint2.toParent[3][0] = pos.x;
322
- CameraPane.debugpoint2.toParent[3][1] = pos.y;
323
- 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;
324330
325
- CameraPane.debugpoint3.toParent[3][0] = poship.x;
326
- CameraPane.debugpoint3.toParent[3][1] = poship.y;
327
- 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;
328334
329335 poship.x = toParent[3][0];
330336 poship.y = toParent[3][1];
331337 poship.z = toParent[3][2];
332338
333
- CameraPane.debugpoint4.toParent[3][0] = poship.x;
334
- CameraPane.debugpoint4.toParent[3][1] = poship.y;
335
- 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;
336342
337343 LA.matInvert(toParent, fromParent);
338344 }
....@@ -470,6 +476,124 @@
470476 currenthip[i] = data[frame3 + i];
471477 }
472478 }
479
+
480
+ static cVector centroid = new cVector();
481
+ static cVector mocaporigin = new cVector();
482
+
483
+ void SetHipOrientation()
484
+ {
485
+ Object3D hip = get(0);
486
+
487
+ if (toParent == null)
488
+ {
489
+ toParent = LA.newMatrix();
490
+ fromParent = LA.newMatrix();
491
+ }
492
+
493
+ LA.matConcat(toParent, hip.get(0).toParent, matrix);
494
+
495
+ mocaporigin.x = matrix[3][0];
496
+ mocaporigin.y = matrix[3][1];
497
+ mocaporigin.z = matrix[3][2];
498
+
499
+ centroid.x = matrix[3][0];
500
+ centroid.y = matrix[3][1];
501
+ centroid.z = matrix[3][2];
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;
513
+
514
+ cVector goal = GetGoal(centroid);
515
+ if (goal != null)
516
+ {
517
+ System.err.println("GOAL change (" + this + "): " + goal + " (was " + goalposx + ", " + goalposz + ")");
518
+
519
+ goalposx = goal.x;
520
+ goalposz = goal.z;
521
+ targetdirx = targetdirz = 0;
522
+ }
523
+
524
+ if (goalposx == 0 && goalposz == 0)
525
+ {
526
+ // No target
527
+ if (ScriptNode.speaker != null)
528
+ {
529
+ Object3D sourcenode = GetFileRoot();
530
+ Object3D speakernode = ScriptNode.speaker.GetFileRoot();
531
+
532
+ //System.err.println("speaker is " + speakernode + "; last was " + ScriptNode.lastspeaker);
533
+
534
+ Object3D speaker = ScriptNode.speaker;
535
+
536
+ if (speakernode == sourcenode)
537
+ {
538
+ if (ScriptNode.lastspeaker != null)
539
+ {
540
+ speakernode = ScriptNode.lastspeaker.GetFileRoot();
541
+ speaker = ScriptNode.lastspeaker;
542
+ }
543
+ else
544
+ return;
545
+ }
546
+
547
+ cVector dst = new cVector();
548
+
549
+ boolean success = speakernode.getCentroid(dst); // , true);
550
+
551
+ if (!success)
552
+ new Exception().printStackTrace();
553
+
554
+ //speakernode.parent.TransformToWorld(dst);
555
+ //sourcenode.parent.TransformToLocal(dst);
556
+ this.parent.TransformToLocal(dst);
557
+
558
+ goalposx = dst.x;
559
+ goalposz = dst.z;
560
+ }
561
+ else
562
+ return;
563
+ }
564
+
565
+ cVector temp = new cVector();
566
+
567
+ temp.x = 1;
568
+ temp.y = 0;
569
+ temp.z = 0;
570
+
571
+ LA.xformDir(temp, matrix, temp);
572
+
573
+ double angleYhip = Math.atan2(-temp.z, temp.x);
574
+
575
+ double angleYtarget = Math.atan2(goalposx - centroid.x, goalposz - centroid.z);
576
+
577
+ LA.matIdentity(matrix);
578
+ LA.matTranslate(matrix, -centroid.x, -centroid.y, -centroid.z);
579
+ double angle = CurveAngle(0, angleYtarget - angleYhip, 0.1f);
580
+ LA.matYRotate(matrix, angle);
581
+ LA.matTranslate(matrix, centroid.x, centroid.y, centroid.z);
582
+
583
+ LA.matConcat(matrix, toParent, toParent);
584
+
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);
594
+
595
+ CheckForAction(centroid);
596
+ }
473597
474598 void WriteTo(java.io.Writer writer) throws Exception
475599 {
....@@ -520,6 +644,24 @@
520644 // transient // aout 2013
521645 Object3D skeleton;
522646
647
+ void ExtractBigData(Object3D o)
648
+ {
649
+ super.ExtractBigData(o);
650
+
651
+ o.bvh = this.bvh;
652
+ o.skeleton = this.skeleton;
653
+ this.bvh = null;
654
+ this.skeleton = null;
655
+ }
656
+
657
+ void RestoreBigData(Object3D o)
658
+ {
659
+ super.RestoreBigData(o);
660
+
661
+ this.bvh = o.bvh;
662
+ this.skeleton = o.skeleton;
663
+ }
664
+
523665 boolean smoothed;
524666
525667 //boolean touched;
....@@ -543,11 +685,11 @@
543685 double pinx;
544686 double pinz;
545687
546
- double targetx;
547
- double targetz;
688
+ double targetdirx;
689
+ double targetdirz;
548690
549
- double goalx;
550
- double goalz;
691
+ double goalposx = 0; // -20;
692
+ double goalposz = 0; // -10;
551693
552694 boolean followpath;
553695
....@@ -618,7 +760,7 @@
618760 scriptactions.clear();
619761 }
620762
621
- static double EPSACTION = 0.1; // 0.075; // 0.1;
763
+ static double EPSACTION = 0.1; // 0.075; // 0.1;Came
622764
623765 void AddFromTo(cVector from, cVector to)
624766 {
....@@ -803,7 +945,7 @@
803945 // //GetFileRoot();
804946
805947 // sept 2014: //
806
- GrafreeD.RENDERME = 3; // patch for Merge objects
948
+ Grafreed.RENDERME = 3; // patch for Merge objects
807949 float[] thedata = bvh.animation.getBoneData(0);
808950
809951 os.x = (float) (path.get(i).toParent[3][0]); // - thedata[frame*6]);
....@@ -904,6 +1046,8 @@
9041046 testvect.set(from);
9051047 testvect.sub(fromto.from);
9061048
1049
+ testvect.y = 0; // PATCH
1050
+
9071051 int factor = 1;
9081052
9091053 //if (CameraPane.FAST)
....@@ -945,6 +1089,8 @@
9451089
9461090 testvect.set(from);
9471091 testvect.sub(fromto.from);
1092
+
1093
+ testvect.y = 0; // PATCH
9481094
9491095 int factor = 1;
9501096
....@@ -1180,6 +1326,7 @@
11801326
11811327 void SetPosition(Object3D sourcenode, cVector floor, long floorid, cVector centroid)
11821328 {
1329
+ assert(false);
11831330 //assert(CameraPane.drawMode == CameraPane.SHADOW);
11841331
11851332 Object3D transformnode = new Object3D();
....@@ -1383,9 +1530,9 @@
13831530 groundid = floorid;
13841531
13851532 // green
1386
- CameraPane.debugpoint.toParent[3][0] = groundx;
1387
- CameraPane.debugpoint.toParent[3][1] = floor.y;
1388
- CameraPane.debugpoint.toParent[3][2] = groundz;
1533
+ CameraPane.debugpointG.toParent[3][0] = groundx;
1534
+ CameraPane.debugpointG.toParent[3][1] = floor.y;
1535
+ CameraPane.debugpointG.toParent[3][2] = groundz;
13891536
13901537 if (true) // slow && stepout && onein)
13911538 {
....@@ -1396,7 +1543,7 @@
13961543 // mywave = currentwave++;
13971544 // }
13981545 // sound
1399
- cVector eye = CameraPane.theRenderer.eyeCamera.location;
1546
+ cVector eye = Globals.theRenderer.EyeCamera().location;
14001547
14011548 // if (sourcenode.parent.parent != null)
14021549 // sourcenode.parent.parent.TransformToWorld(floor, tmp);
....@@ -1441,9 +1588,9 @@
14411588 //GraphreeD.
14421589 wav.play(volume * usedvolume); //, mywave);
14431590
1444
- lastsoundtime = CameraPane.framecount;
1591
+ lastsoundtime = Globals.framecount;
14451592
1446
- GrafreeD.hassound = true;
1593
+ Grafreed.hassound = true;
14471594 }
14481595 // else
14491596 // System.out.println("skipped");
....@@ -1462,9 +1609,9 @@
14621609
14631610 // System.out.println("Allo " + sourcenode);
14641611 // purple
1465
- CameraPane.debugpoint2.toParent[3][0] = floor.x;// + posx;
1466
- CameraPane.debugpoint2.toParent[3][1] = ground; // floor.y;// + sourcenode.parent.toParent[3][1];
1467
- CameraPane.debugpoint2.toParent[3][2] = floor.z;// + posz;
1612
+ CameraPane.debugpointP.toParent[3][0] = floor.x;// + posx;
1613
+ CameraPane.debugpointP.toParent[3][1] = ground; // floor.y;// + sourcenode.parent.toParent[3][1];
1614
+ CameraPane.debugpointP.toParent[3][2] = floor.z;// + posz;
14681615
14691616
14701617 if (false) // dist2 > 0.1)
....@@ -1530,9 +1677,9 @@
15301677 this.get(0).TransformToWorld(v0);
15311678
15321679 // cyan
1533
- CameraPane.debugpoint3.toParent[3][0] = v0.x;
1534
- CameraPane.debugpoint3.toParent[3][1] = ground;
1535
- CameraPane.debugpoint3.toParent[3][2] = v0.z;
1680
+ CameraPane.debugpointC.toParent[3][0] = v0.x;
1681
+ CameraPane.debugpointC.toParent[3][1] = ground;
1682
+ CameraPane.debugpointC.toParent[3][2] = v0.z;
15361683
15371684 LA.matConcat(sourcenode.toParent, transformnode.toParent, sourcenode.toParent);
15381685 LA.matInvert(sourcenode.toParent, sourcenode.fromParent);
....@@ -1542,9 +1689,9 @@
15421689 this.get(0).TransformToWorld(v0);
15431690
15441691 // red
1545
- CameraPane.debugpoint4.toParent[3][0] = v0.x;
1546
- CameraPane.debugpoint4.toParent[3][1] = ground;
1547
- CameraPane.debugpoint4.toParent[3][2] = v0.z;
1692
+ CameraPane.debugpointR.toParent[3][0] = v0.x;
1693
+ CameraPane.debugpointR.toParent[3][1] = ground;
1694
+ CameraPane.debugpointR.toParent[3][2] = v0.z;
15481695 }
15491696 }
15501697
....@@ -1584,11 +1731,11 @@
15841731
15851732 if (goal != null)
15861733 {
1587
- System.err.println("GOAL change (" + sourcenode + "): " + goal + " (was " + goalx + ", " + goalz + ")");
1734
+ System.err.println("GOAL change (" + sourcenode + "): " + goal + " (was " + goalposx + ", " + goalposz + ")");
15881735 //sourcenode.parent.parent.Dump();
1589
- goalx = goal.x;
1590
- goalz = goal.z;
1591
- targetx = targetz = 0;
1736
+ goalposx = goal.x;
1737
+ goalposz = goal.z;
1738
+ targetdirx = targetdirz = 0;
15921739
15931740 followpath = true;
15941741 }
....@@ -1639,16 +1786,16 @@
16391786 // }
16401787 if (false) // !uselast)
16411788 {
1642
- CameraPane.debugpoint.toParent[3][0] = dst.x;
1643
- CameraPane.debugpoint.toParent[3][1] = dst.y;
1644
- CameraPane.debugpoint.toParent[3][2] = dst.z;
1789
+ CameraPane.debugpointG.toParent[3][0] = dst.x;
1790
+ CameraPane.debugpointG.toParent[3][1] = dst.y;
1791
+ CameraPane.debugpointG.toParent[3][2] = dst.z;
16451792 }
16461793 }
16471794
1648
- if (goalx != 0 || goalz != 0) // TODO
1795
+ if (goalposx != 0 || goalposz != 0) // TODO
16491796 {
16501797 // overwrite speaker orientation
1651
- dst.set(goalx,0,goalz);
1798
+ dst.set(goalposx,0,goalposz);
16521799 if (sourcenode.parent != null) // july 2014
16531800 sourcenode.parent.
16541801 TransformToLocal(dst);
....@@ -1700,26 +1847,26 @@
17001847 // mars 2014
17011848 if (false) // goalx != 0 || goalz != 0)
17021849 {
1703
- targetx = dst.x - src.x;
1704
- targetz = dst.z - src.z;
1850
+ targetdirx = dst.x - src.x;
1851
+ targetdirz = dst.z - src.z;
17051852
1706
- if (Math.abs(targetx) > 0.1 || Math.abs(targetz) > 0.1)
1853
+ if (Math.abs(targetdirx) > 0.1 || Math.abs(targetdirz) > 0.1)
17071854 {
17081855 // far enough from goal. keep the goal position.
1709
- targetx = 0;
1710
- targetz = 0;
1856
+ targetdirx = 0;
1857
+ targetdirz = 0;
17111858 }
17121859 else
17131860 {
17141861 // too close to goal. switch to target direction instead.
1715
- goalx = 0;
1716
- goalz = 0;
1862
+ goalposx = 0;
1863
+ goalposz = 0;
17171864 }
17181865 }
17191866
17201867 //sourcenode.getCentroid(src, true);
17211868
1722
- if (speakernode == sourcenode && goalx == 0 && goalz == 0)
1869
+ if (speakernode == sourcenode && goalposx == 0 && goalposz == 0)
17231870 {
17241871 if (ScriptNode.lastspeaker != null)
17251872 new Exception().printStackTrace();
....@@ -1728,13 +1875,13 @@
17281875
17291876 // LA.xformPos(src, fromParent, src);
17301877
1731
- if ((ScriptNode.speaker != null && CameraPane.SPEAKERMOCAP || goalx != 0 || goalz != 0) && targetx == 0 && targetz == 0)
1878
+ if ((ScriptNode.speaker != null && CameraPane.SPEAKERMOCAP || goalposx != 0 || goalposz != 0) && targetdirx == 0 && targetdirz == 0)
17321879 dst.sub(src);
17331880 else
17341881 // vector mode
17351882 {
1736
- dst.x = targetx;
1737
- dst.z = targetz;
1883
+ dst.x = targetdirx;
1884
+ dst.z = targetdirz;
17381885
17391886 // TEST TARGET
17401887 // dst.x = CameraPane.selectedpoint.toParent[3][0];
....@@ -2144,7 +2291,7 @@
21442291 }
21452292
21462293 if (!smoothed)
2147
- for (int i=0; --i>=0;)
2294
+ for (int i=10; --i>=0;)
21482295 SmoothAnimData(); // much reduces shakiness
21492296
21502297 smoothed = true;
....@@ -2182,9 +2329,16 @@
21822329 toVector.x = LA.cos(to);
21832330 toVector.y = LA.sin(to);
21842331
2332
+ double fromA = Math.atan2(fromVector.y, fromVector.x);
2333
+ double toA = Math.atan2(toVector.y, toVector.x);
2334
+
21852335 Vector2d currentVector = Slerp(fromVector, toVector, step);
21862336
2187
- return Math.atan2(currentVector.y, currentVector.x);
2337
+ double angle = Math.atan2(currentVector.y, currentVector.x);
2338
+
2339
+ double angle2 = (1-step) * fromA + step * toA;
2340
+
2341
+ return angle;
21882342 }
21892343
21902344 public static Vector2d Slerp(Vector2d from, Vector2d to, double step)
....@@ -2236,6 +2390,8 @@
22362390 {
22372391 e.printStackTrace();
22382392 }
2393
+
2394
+ SetHipOrientation();
22392395
22402396 if (true)
22412397 return;
....@@ -2664,8 +2820,9 @@
26642820 // set rotation
26652821 //if (bone._rotationEnabled)
26662822 if (//frame > 0 &&
2667
- !bone.skipmocap //&&
2668
- //!bone.name.contains("head") &&
2823
+ !bone.skipmocap &&
2824
+ !bone.name.contains("head") &&
2825
+ !bone.name.contains("Head") // &&
26692826 // !bone.name.contains("rFoot") &&
26702827 // !bone.name.contains("lFoot") &&
26712828 // !bone.name.contains("Pinky") &&
....@@ -3020,7 +3177,8 @@
30203177 }
30213178 }
30223179
3023
- static int offset = 1; // 5; // 10; // 5; // 100; // skip initial "T"
3180
+ // skip initial "T"
3181
+ static int offset = 1; // 5; // 10; // 5; // 100;
30243182
30253183 void ReadBVH()
30263184 {
....@@ -3049,8 +3207,8 @@
30493207
30503208 void Reset()
30513209 {
3052
- if (fullname != null)
3053
- ReadBVH();
3210
+// if (fullname != null)
3211
+// ReadBVH();
30543212
30553213 Object3D hip = get(0);
30563214
....@@ -3089,8 +3247,8 @@
30893247 // LA.matIdentity(rot.fromParent);
30903248
30913249 // july 2014
3092
- goalx = goalz = 0;
3093
- targetx = targetz = 0;
3250
+// goalx = goalz = 0;
3251
+ targetdirx = targetdirz = 0;
30943252
30953253 //SetPositionDelta(true, true, true, false);
30963254 // LoadData();
....@@ -3100,8 +3258,8 @@
31003258
31013259 // aout 2013 endframe = 0; // june 2013
31023260
3103
- //ResetZero();
3104
- setPose(frame);
3261
+ ResetZero();
3262
+ //setPose(frame);
31053263 }
31063264
31073265 static int mocapsupport = 0;
....@@ -3119,12 +3277,13 @@
31193277
31203278 int step = 1;
31213279
3280
+ // patch for running hare
31223281 if (speedup) // fev 2014
31233282 step *= 2; // 4;
31243283 if (rewind) // mars 2014
31253284 step *= 4;
31263285
3127
- if (CameraPane.FAST) // && !CameraPane.HOLD)
3286
+ //if (CameraPane.FAST) // && !CameraPane.HOLD)
31283287 step *= CameraPane.STEP;
31293288
31303289 //System.err.println("Step Mocap frame # " + frame);
....@@ -3132,7 +3291,7 @@
31323291 baseframe += step;
31333292
31343293 //frame = baseframe;
3135
- frame += step;
3294
+ //frame += step;
31363295
31373296 // if (frame != baseframe)
31383297 // {
....@@ -3156,7 +3315,7 @@
31563315 "; fullname = " + fullname);
31573316
31583317 //int delta = frame - baseframe;
3159
- if (CameraPane.CROWD)
3318
+ if (Globals.CROWD)
31603319 {
31613320 baseframe = GetFirstFrame(); // 0 initial point
31623321 }
....@@ -3165,32 +3324,53 @@
31653324 // SetPositionDelta(false, true, false); // ?? false);
31663325 {
31673326 if (support == null)
3168
- ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest);
3327
+ {
3328
+ if (bvh == null && new File(fullname).exists())
3329
+ ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest);
3330
+ else
3331
+ {
3332
+ SetGlobalTransform();
3333
+ Rewind();
3334
+ Fade();
3335
+ }
3336
+ }
31693337 else
31703338 {
3171
- try
3172
- {
3339
+// try
3340
+// {
31733341 bvh = ((Mocap)support.get(mocapsupport++ % support.Size())).bvh;
31743342
31753343 // SetPositionDelta(false, true, true, true);
31763344 LoadData();
31773345 Rewind();
31783346 Fade();
3179
- }
3180
- catch (Exception e)
3181
- {
3182
- e.printStackTrace();
3183
- ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest);
3184
- }
3347
+// }
3348
+// catch (Exception e)
3349
+// {
3350
+// System.err.println("An error occured while loading data. Use fallback by loading the file.");
3351
+// //e.printStackTrace();
3352
+// try
3353
+// {
3354
+// ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest);
3355
+// }
3356
+// catch (Exception e2)
3357
+// {
3358
+// System.err.println("Motion file not found: " + fullname);
3359
+// }
3360
+// }
31853361 }
31863362 }
3363
+
3364
+ frame = GetFirstFrame();
31873365 }
3366
+ else
3367
+ frame += step;
31883368
31893369 //SetPositionDelta(false);
31903370
3191
- if (frame >= bvh.animation.getNumFrames())
3192
- //baseframe =
3193
- frame = GetFirstFrame(); // 0; // offset; // initial point
3371
+// if (frame >= bvh.animation.getNumFrames())
3372
+// //baseframe =
3373
+// frame = GetFirstFrame(); // 0; // offset; // initial point
31943374
31953375 //System.err.println("frame = " + frame);
31963376 if (lastframe != 0)
....@@ -3359,6 +3539,7 @@
33593539 // filters out bad input data
33603540 void FilterAnimData()
33613541 {
3542
+ new Exception().printStackTrace();
33623543 System.exit(0);
33633544
33643545 float[] data; // = bvh.animation.getBoneData(0);
....@@ -3716,7 +3897,7 @@
37163897
37173898 transient boolean restarted; // CROWD issue?
37183899
3719
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
3900
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
37203901 {
37213902 //System.err.println("drawSelf Mocap frame # " + frame);
37223903 //System.err.println("drawSelf Mocap baseframe # " + baseframe);
....@@ -3733,17 +3914,22 @@
37333914 // if (firstframe)
37343915 // return;
37353916
3736
- if (!restarted && /*display.restartframe &&*/
3737
- display.isLIVE() && live && display.drawMode == display.SHADOW) // FUCK
3917
+ if (//!restarted && /*display.restartframe &&*/
3918
+ Globals.isLIVE() && live && (display.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW))
37383919 {
37393920 //display.restartframe = false;
37403921 restarted = true;
3922
+ //System.err.println("restarted = true");
37413923 Step();
37423924 }
37433925 else
37443926 {
3745
- if (display.isLIVE() && live && display.drawMode != display.SHADOW)
3927
+ //System.err.println("restarted");
3928
+ if (Globals.isLIVE() && live && display.DrawMode() != iCameraPane.SHADOW)
3929
+ {
37463930 restarted = false;
3931
+ //System.err.println("restarted = false");
3932
+ }
37473933 }
37483934
37493935 super.drawSelf(display, root, selected, blocked);