Normand Briere
2019-07-07 46dbce888e7c3eff8969f1ddbe22e144410b67f4
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,125 @@
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.CreateSelectedPoint();
505
+ CameraPane.debugpointG.name = "";
506
+ CameraPane.debugpointG.toParent[3][0] = mocaporigin.x;
507
+ CameraPane.debugpointG.toParent[3][1] = mocaporigin.y;
508
+ CameraPane.debugpointG.toParent[3][2] = mocaporigin.z;
509
+
510
+ CameraPane.debugpointP.name = "";
511
+ CameraPane.debugpointP.toParent[3][0] = centroid.x;
512
+ CameraPane.debugpointP.toParent[3][1] = centroid.y;
513
+ CameraPane.debugpointP.toParent[3][2] = centroid.z;
514
+
515
+ cVector goal = GetGoal(centroid);
516
+ if (goal != null)
517
+ {
518
+ System.err.println("GOAL change (" + this + "): " + goal + " (was " + goalposx + ", " + goalposz + ")");
519
+
520
+ goalposx = goal.x;
521
+ goalposz = goal.z;
522
+ targetdirx = targetdirz = 0;
523
+ }
524
+
525
+ if (goalposx == 0 && goalposz == 0)
526
+ {
527
+ // No target
528
+ if (ScriptNode.speaker != null)
529
+ {
530
+ Object3D sourcenode = GetFileRoot();
531
+ Object3D speakernode = ScriptNode.speaker.GetFileRoot();
532
+
533
+ //System.err.println("speaker is " + speakernode + "; last was " + ScriptNode.lastspeaker);
534
+
535
+ Object3D speaker = ScriptNode.speaker;
536
+
537
+ if (speakernode == sourcenode)
538
+ {
539
+ if (ScriptNode.lastspeaker != null)
540
+ {
541
+ speakernode = ScriptNode.lastspeaker.GetFileRoot();
542
+ speaker = ScriptNode.lastspeaker;
543
+ }
544
+ else
545
+ return;
546
+ }
547
+
548
+ cVector dst = new cVector();
549
+
550
+ boolean success = speakernode.getCentroid(dst); // , true);
551
+
552
+ if (!success)
553
+ new Exception().printStackTrace();
554
+
555
+ //speakernode.parent.TransformToWorld(dst);
556
+ //sourcenode.parent.TransformToLocal(dst);
557
+ this.parent.TransformToLocal(dst);
558
+
559
+ goalposx = dst.x;
560
+ goalposz = dst.z;
561
+ }
562
+ else
563
+ return;
564
+ }
565
+
566
+ cVector temp = new cVector();
567
+
568
+ temp.x = 1;
569
+ temp.y = 0;
570
+ temp.z = 0;
571
+
572
+ LA.xformDir(temp, matrix, temp);
573
+
574
+ double angleYhip = Math.atan2(-temp.z, temp.x);
575
+
576
+ double angleYtarget = Math.atan2(goalposx - centroid.x, goalposz - centroid.z);
577
+
578
+ LA.matIdentity(matrix);
579
+ LA.matTranslate(matrix, -centroid.x, -centroid.y, -centroid.z);
580
+ double angle = CurveAngle(0, angleYtarget - angleYhip, 0.1f);
581
+ LA.matYRotate(matrix, angle);
582
+ LA.matTranslate(matrix, centroid.x, centroid.y, centroid.z);
583
+
584
+ LA.matConcat(matrix, toParent, toParent);
585
+
586
+ LA.matInvert(toParent, fromParent);
587
+
588
+ LA.matConcat(toParent, hip.get(0).toParent, matrix);
589
+
590
+ centroid.x = matrix[3][0];
591
+ centroid.y = matrix[3][1];
592
+ centroid.z = matrix[3][2];
593
+
594
+ double dist = LA.distance(centroid, mocaporigin);
595
+
596
+ CheckForAction(centroid);
597
+ }
473598
474599 void WriteTo(java.io.Writer writer) throws Exception
475600 {
....@@ -520,6 +645,24 @@
520645 // transient // aout 2013
521646 Object3D skeleton;
522647
648
+ void ExtractBigData(Object3D o)
649
+ {
650
+ super.ExtractBigData(o);
651
+
652
+ o.bvh = this.bvh;
653
+ o.skeleton = this.skeleton;
654
+ this.bvh = null;
655
+ this.skeleton = null;
656
+ }
657
+
658
+ void RestoreBigData(Object3D o)
659
+ {
660
+ super.RestoreBigData(o);
661
+
662
+ this.bvh = o.bvh;
663
+ this.skeleton = o.skeleton;
664
+ }
665
+
523666 boolean smoothed;
524667
525668 //boolean touched;
....@@ -543,11 +686,11 @@
543686 double pinx;
544687 double pinz;
545688
546
- double targetx;
547
- double targetz;
689
+ double targetdirx;
690
+ double targetdirz;
548691
549
- double goalx;
550
- double goalz;
692
+ double goalposx = 0; // -20;
693
+ double goalposz = 0; // -10;
551694
552695 boolean followpath;
553696
....@@ -618,7 +761,7 @@
618761 scriptactions.clear();
619762 }
620763
621
- static double EPSACTION = 0.1; // 0.075; // 0.1;
764
+ static double EPSACTION = 0.1; // 0.075; // 0.1;Came
622765
623766 void AddFromTo(cVector from, cVector to)
624767 {
....@@ -803,7 +946,7 @@
803946 // //GetFileRoot();
804947
805948 // sept 2014: //
806
- GrafreeD.RENDERME = 3; // patch for Merge objects
949
+ Grafreed.RENDERME = 3; // patch for Merge objects
807950 float[] thedata = bvh.animation.getBoneData(0);
808951
809952 os.x = (float) (path.get(i).toParent[3][0]); // - thedata[frame*6]);
....@@ -904,6 +1047,8 @@
9041047 testvect.set(from);
9051048 testvect.sub(fromto.from);
9061049
1050
+ testvect.y = 0; // PATCH
1051
+
9071052 int factor = 1;
9081053
9091054 //if (CameraPane.FAST)
....@@ -945,6 +1090,8 @@
9451090
9461091 testvect.set(from);
9471092 testvect.sub(fromto.from);
1093
+
1094
+ testvect.y = 0; // PATCH
9481095
9491096 int factor = 1;
9501097
....@@ -1180,6 +1327,7 @@
11801327
11811328 void SetPosition(Object3D sourcenode, cVector floor, long floorid, cVector centroid)
11821329 {
1330
+ assert(false);
11831331 //assert(CameraPane.drawMode == CameraPane.SHADOW);
11841332
11851333 Object3D transformnode = new Object3D();
....@@ -1383,9 +1531,9 @@
13831531 groundid = floorid;
13841532
13851533 // green
1386
- CameraPane.debugpoint.toParent[3][0] = groundx;
1387
- CameraPane.debugpoint.toParent[3][1] = floor.y;
1388
- CameraPane.debugpoint.toParent[3][2] = groundz;
1534
+ CameraPane.debugpointG.toParent[3][0] = groundx;
1535
+ CameraPane.debugpointG.toParent[3][1] = floor.y;
1536
+ CameraPane.debugpointG.toParent[3][2] = groundz;
13891537
13901538 if (true) // slow && stepout && onein)
13911539 {
....@@ -1396,7 +1544,7 @@
13961544 // mywave = currentwave++;
13971545 // }
13981546 // sound
1399
- cVector eye = CameraPane.theRenderer.eyeCamera.location;
1547
+ cVector eye = Globals.theRenderer.EyeCamera().location;
14001548
14011549 // if (sourcenode.parent.parent != null)
14021550 // sourcenode.parent.parent.TransformToWorld(floor, tmp);
....@@ -1441,9 +1589,9 @@
14411589 //GraphreeD.
14421590 wav.play(volume * usedvolume); //, mywave);
14431591
1444
- lastsoundtime = CameraPane.framecount;
1592
+ lastsoundtime = Globals.framecount;
14451593
1446
- GrafreeD.hassound = true;
1594
+ Grafreed.hassound = true;
14471595 }
14481596 // else
14491597 // System.out.println("skipped");
....@@ -1462,9 +1610,9 @@
14621610
14631611 // System.out.println("Allo " + sourcenode);
14641612 // 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;
1613
+ CameraPane.debugpointP.toParent[3][0] = floor.x;// + posx;
1614
+ CameraPane.debugpointP.toParent[3][1] = ground; // floor.y;// + sourcenode.parent.toParent[3][1];
1615
+ CameraPane.debugpointP.toParent[3][2] = floor.z;// + posz;
14681616
14691617
14701618 if (false) // dist2 > 0.1)
....@@ -1530,9 +1678,9 @@
15301678 this.get(0).TransformToWorld(v0);
15311679
15321680 // cyan
1533
- CameraPane.debugpoint3.toParent[3][0] = v0.x;
1534
- CameraPane.debugpoint3.toParent[3][1] = ground;
1535
- CameraPane.debugpoint3.toParent[3][2] = v0.z;
1681
+ CameraPane.debugpointC.toParent[3][0] = v0.x;
1682
+ CameraPane.debugpointC.toParent[3][1] = ground;
1683
+ CameraPane.debugpointC.toParent[3][2] = v0.z;
15361684
15371685 LA.matConcat(sourcenode.toParent, transformnode.toParent, sourcenode.toParent);
15381686 LA.matInvert(sourcenode.toParent, sourcenode.fromParent);
....@@ -1542,9 +1690,9 @@
15421690 this.get(0).TransformToWorld(v0);
15431691
15441692 // red
1545
- CameraPane.debugpoint4.toParent[3][0] = v0.x;
1546
- CameraPane.debugpoint4.toParent[3][1] = ground;
1547
- CameraPane.debugpoint4.toParent[3][2] = v0.z;
1693
+ CameraPane.debugpointR.toParent[3][0] = v0.x;
1694
+ CameraPane.debugpointR.toParent[3][1] = ground;
1695
+ CameraPane.debugpointR.toParent[3][2] = v0.z;
15481696 }
15491697 }
15501698
....@@ -1584,11 +1732,11 @@
15841732
15851733 if (goal != null)
15861734 {
1587
- System.err.println("GOAL change (" + sourcenode + "): " + goal + " (was " + goalx + ", " + goalz + ")");
1735
+ System.err.println("GOAL change (" + sourcenode + "): " + goal + " (was " + goalposx + ", " + goalposz + ")");
15881736 //sourcenode.parent.parent.Dump();
1589
- goalx = goal.x;
1590
- goalz = goal.z;
1591
- targetx = targetz = 0;
1737
+ goalposx = goal.x;
1738
+ goalposz = goal.z;
1739
+ targetdirx = targetdirz = 0;
15921740
15931741 followpath = true;
15941742 }
....@@ -1639,16 +1787,16 @@
16391787 // }
16401788 if (false) // !uselast)
16411789 {
1642
- CameraPane.debugpoint.toParent[3][0] = dst.x;
1643
- CameraPane.debugpoint.toParent[3][1] = dst.y;
1644
- CameraPane.debugpoint.toParent[3][2] = dst.z;
1790
+ CameraPane.debugpointG.toParent[3][0] = dst.x;
1791
+ CameraPane.debugpointG.toParent[3][1] = dst.y;
1792
+ CameraPane.debugpointG.toParent[3][2] = dst.z;
16451793 }
16461794 }
16471795
1648
- if (goalx != 0 || goalz != 0) // TODO
1796
+ if (goalposx != 0 || goalposz != 0) // TODO
16491797 {
16501798 // overwrite speaker orientation
1651
- dst.set(goalx,0,goalz);
1799
+ dst.set(goalposx,0,goalposz);
16521800 if (sourcenode.parent != null) // july 2014
16531801 sourcenode.parent.
16541802 TransformToLocal(dst);
....@@ -1700,26 +1848,26 @@
17001848 // mars 2014
17011849 if (false) // goalx != 0 || goalz != 0)
17021850 {
1703
- targetx = dst.x - src.x;
1704
- targetz = dst.z - src.z;
1851
+ targetdirx = dst.x - src.x;
1852
+ targetdirz = dst.z - src.z;
17051853
1706
- if (Math.abs(targetx) > 0.1 || Math.abs(targetz) > 0.1)
1854
+ if (Math.abs(targetdirx) > 0.1 || Math.abs(targetdirz) > 0.1)
17071855 {
17081856 // far enough from goal. keep the goal position.
1709
- targetx = 0;
1710
- targetz = 0;
1857
+ targetdirx = 0;
1858
+ targetdirz = 0;
17111859 }
17121860 else
17131861 {
17141862 // too close to goal. switch to target direction instead.
1715
- goalx = 0;
1716
- goalz = 0;
1863
+ goalposx = 0;
1864
+ goalposz = 0;
17171865 }
17181866 }
17191867
17201868 //sourcenode.getCentroid(src, true);
17211869
1722
- if (speakernode == sourcenode && goalx == 0 && goalz == 0)
1870
+ if (speakernode == sourcenode && goalposx == 0 && goalposz == 0)
17231871 {
17241872 if (ScriptNode.lastspeaker != null)
17251873 new Exception().printStackTrace();
....@@ -1728,13 +1876,13 @@
17281876
17291877 // LA.xformPos(src, fromParent, src);
17301878
1731
- if ((ScriptNode.speaker != null && CameraPane.SPEAKERMOCAP || goalx != 0 || goalz != 0) && targetx == 0 && targetz == 0)
1879
+ if ((ScriptNode.speaker != null && CameraPane.SPEAKERMOCAP || goalposx != 0 || goalposz != 0) && targetdirx == 0 && targetdirz == 0)
17321880 dst.sub(src);
17331881 else
17341882 // vector mode
17351883 {
1736
- dst.x = targetx;
1737
- dst.z = targetz;
1884
+ dst.x = targetdirx;
1885
+ dst.z = targetdirz;
17381886
17391887 // TEST TARGET
17401888 // dst.x = CameraPane.selectedpoint.toParent[3][0];
....@@ -2144,7 +2292,7 @@
21442292 }
21452293
21462294 if (!smoothed)
2147
- for (int i=0; --i>=0;)
2295
+ for (int i=10; --i>=0;)
21482296 SmoothAnimData(); // much reduces shakiness
21492297
21502298 smoothed = true;
....@@ -2182,9 +2330,16 @@
21822330 toVector.x = LA.cos(to);
21832331 toVector.y = LA.sin(to);
21842332
2333
+ double fromA = Math.atan2(fromVector.y, fromVector.x);
2334
+ double toA = Math.atan2(toVector.y, toVector.x);
2335
+
21852336 Vector2d currentVector = Slerp(fromVector, toVector, step);
21862337
2187
- return Math.atan2(currentVector.y, currentVector.x);
2338
+ double angle = Math.atan2(currentVector.y, currentVector.x);
2339
+
2340
+ double angle2 = (1-step) * fromA + step * toA;
2341
+
2342
+ return angle;
21882343 }
21892344
21902345 public static Vector2d Slerp(Vector2d from, Vector2d to, double step)
....@@ -2236,6 +2391,8 @@
22362391 {
22372392 e.printStackTrace();
22382393 }
2394
+
2395
+ SetHipOrientation();
22392396
22402397 if (true)
22412398 return;
....@@ -2664,8 +2821,9 @@
26642821 // set rotation
26652822 //if (bone._rotationEnabled)
26662823 if (//frame > 0 &&
2667
- !bone.skipmocap //&&
2668
- //!bone.name.contains("head") &&
2824
+ !bone.skipmocap &&
2825
+ !bone.name.contains("head") &&
2826
+ !bone.name.contains("Head") // &&
26692827 // !bone.name.contains("rFoot") &&
26702828 // !bone.name.contains("lFoot") &&
26712829 // !bone.name.contains("Pinky") &&
....@@ -3020,7 +3178,8 @@
30203178 }
30213179 }
30223180
3023
- static int offset = 1; // 5; // 10; // 5; // 100; // skip initial "T"
3181
+ // skip initial "T"
3182
+ static int offset = 1; // 5; // 10; // 5; // 100;
30243183
30253184 void ReadBVH()
30263185 {
....@@ -3049,8 +3208,8 @@
30493208
30503209 void Reset()
30513210 {
3052
- if (fullname != null)
3053
- ReadBVH();
3211
+// if (fullname != null)
3212
+// ReadBVH();
30543213
30553214 Object3D hip = get(0);
30563215
....@@ -3089,8 +3248,8 @@
30893248 // LA.matIdentity(rot.fromParent);
30903249
30913250 // july 2014
3092
- goalx = goalz = 0;
3093
- targetx = targetz = 0;
3251
+// goalx = goalz = 0;
3252
+ targetdirx = targetdirz = 0;
30943253
30953254 //SetPositionDelta(true, true, true, false);
30963255 // LoadData();
....@@ -3100,8 +3259,8 @@
31003259
31013260 // aout 2013 endframe = 0; // june 2013
31023261
3103
- //ResetZero();
3104
- setPose(frame);
3262
+ ResetZero();
3263
+ //setPose(frame);
31053264 }
31063265
31073266 static int mocapsupport = 0;
....@@ -3119,12 +3278,13 @@
31193278
31203279 int step = 1;
31213280
3281
+ // patch for running hare
31223282 if (speedup) // fev 2014
31233283 step *= 2; // 4;
31243284 if (rewind) // mars 2014
31253285 step *= 4;
31263286
3127
- if (CameraPane.FAST) // && !CameraPane.HOLD)
3287
+ //if (CameraPane.FAST) // && !CameraPane.HOLD)
31283288 step *= CameraPane.STEP;
31293289
31303290 //System.err.println("Step Mocap frame # " + frame);
....@@ -3132,7 +3292,7 @@
31323292 baseframe += step;
31333293
31343294 //frame = baseframe;
3135
- frame += step;
3295
+ //frame += step;
31363296
31373297 // if (frame != baseframe)
31383298 // {
....@@ -3156,7 +3316,7 @@
31563316 "; fullname = " + fullname);
31573317
31583318 //int delta = frame - baseframe;
3159
- if (CameraPane.CROWD)
3319
+ if (Globals.CROWD)
31603320 {
31613321 baseframe = GetFirstFrame(); // 0 initial point
31623322 }
....@@ -3165,32 +3325,53 @@
31653325 // SetPositionDelta(false, true, false); // ?? false);
31663326 {
31673327 if (support == null)
3168
- ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest);
3328
+ {
3329
+ if (bvh == null && new File(fullname).exists())
3330
+ ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest);
3331
+ else
3332
+ {
3333
+ SetGlobalTransform();
3334
+ Rewind();
3335
+ Fade();
3336
+ }
3337
+ }
31693338 else
31703339 {
3171
- try
3172
- {
3340
+// try
3341
+// {
31733342 bvh = ((Mocap)support.get(mocapsupport++ % support.Size())).bvh;
31743343
31753344 // SetPositionDelta(false, true, true, true);
31763345 LoadData();
31773346 Rewind();
31783347 Fade();
3179
- }
3180
- catch (Exception e)
3181
- {
3182
- e.printStackTrace();
3183
- ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest);
3184
- }
3348
+// }
3349
+// catch (Exception e)
3350
+// {
3351
+// System.err.println("An error occured while loading data. Use fallback by loading the file.");
3352
+// //e.printStackTrace();
3353
+// try
3354
+// {
3355
+// ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest);
3356
+// }
3357
+// catch (Exception e2)
3358
+// {
3359
+// System.err.println("Motion file not found: " + fullname);
3360
+// }
3361
+// }
31853362 }
31863363 }
3364
+
3365
+ frame = GetFirstFrame();
31873366 }
3367
+ else
3368
+ frame += step;
31883369
31893370 //SetPositionDelta(false);
31903371
3191
- if (frame >= bvh.animation.getNumFrames())
3192
- //baseframe =
3193
- frame = GetFirstFrame(); // 0; // offset; // initial point
3372
+// if (frame >= bvh.animation.getNumFrames())
3373
+// //baseframe =
3374
+// frame = GetFirstFrame(); // 0; // offset; // initial point
31943375
31953376 //System.err.println("frame = " + frame);
31963377 if (lastframe != 0)
....@@ -3359,6 +3540,7 @@
33593540 // filters out bad input data
33603541 void FilterAnimData()
33613542 {
3543
+ new Exception().printStackTrace();
33623544 System.exit(0);
33633545
33643546 float[] data; // = bvh.animation.getBoneData(0);
....@@ -3716,7 +3898,7 @@
37163898
37173899 transient boolean restarted; // CROWD issue?
37183900
3719
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
3901
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
37203902 {
37213903 //System.err.println("drawSelf Mocap frame # " + frame);
37223904 //System.err.println("drawSelf Mocap baseframe # " + baseframe);
....@@ -3733,17 +3915,22 @@
37333915 // if (firstframe)
37343916 // return;
37353917
3736
- if (!restarted && /*display.restartframe &&*/
3737
- display.isLIVE() && live && display.drawMode == display.SHADOW) // FUCK
3918
+ if (//!restarted && /*display.restartframe &&*/
3919
+ Globals.isLIVE() && live && (display.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE))
37383920 {
37393921 //display.restartframe = false;
37403922 restarted = true;
3923
+ //System.err.println("restarted = true");
37413924 Step();
37423925 }
37433926 else
37443927 {
3745
- if (display.isLIVE() && live && display.drawMode != display.SHADOW)
3928
+ //System.err.println("restarted");
3929
+ if (Globals.isLIVE() && live && display.DrawMode() != iCameraPane.SHADOW)
3930
+ {
37463931 restarted = false;
3932
+ //System.err.println("restarted = false");
3933
+ }
37473934 }
37483935
37493936 super.drawSelf(display, root, selected, blocked);