Normand Briere
2019-06-03 e24558ddeacfc945b9e9ba0a32b552d04e2ed4dd
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 {
....@@ -543,11 +667,11 @@
543667 double pinx;
544668 double pinz;
545669
546
- double targetx;
547
- double targetz;
670
+ double targetdirx;
671
+ double targetdirz;
548672
549
- double goalx;
550
- double goalz;
673
+ double goalposx = 0; // -20;
674
+ double goalposz = 0; // -10;
551675
552676 boolean followpath;
553677
....@@ -618,7 +742,7 @@
618742 scriptactions.clear();
619743 }
620744
621
- static double EPSACTION = 0.1; // 0.075; // 0.1;
745
+ static double EPSACTION = 0.1; // 0.075; // 0.1;Came
622746
623747 void AddFromTo(cVector from, cVector to)
624748 {
....@@ -803,7 +927,7 @@
803927 // //GetFileRoot();
804928
805929 // sept 2014: //
806
- GrafreeD.RENDERME = 3; // patch for Merge objects
930
+ Grafreed.RENDERME = 3; // patch for Merge objects
807931 float[] thedata = bvh.animation.getBoneData(0);
808932
809933 os.x = (float) (path.get(i).toParent[3][0]); // - thedata[frame*6]);
....@@ -904,6 +1028,8 @@
9041028 testvect.set(from);
9051029 testvect.sub(fromto.from);
9061030
1031
+ testvect.y = 0; // PATCH
1032
+
9071033 int factor = 1;
9081034
9091035 //if (CameraPane.FAST)
....@@ -945,6 +1071,8 @@
9451071
9461072 testvect.set(from);
9471073 testvect.sub(fromto.from);
1074
+
1075
+ testvect.y = 0; // PATCH
9481076
9491077 int factor = 1;
9501078
....@@ -1180,6 +1308,7 @@
11801308
11811309 void SetPosition(Object3D sourcenode, cVector floor, long floorid, cVector centroid)
11821310 {
1311
+ assert(false);
11831312 //assert(CameraPane.drawMode == CameraPane.SHADOW);
11841313
11851314 Object3D transformnode = new Object3D();
....@@ -1383,9 +1512,9 @@
13831512 groundid = floorid;
13841513
13851514 // green
1386
- CameraPane.debugpoint.toParent[3][0] = groundx;
1387
- CameraPane.debugpoint.toParent[3][1] = floor.y;
1388
- 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;
13891518
13901519 if (true) // slow && stepout && onein)
13911520 {
....@@ -1396,7 +1525,7 @@
13961525 // mywave = currentwave++;
13971526 // }
13981527 // sound
1399
- cVector eye = CameraPane.theRenderer.eyeCamera.location;
1528
+ cVector eye = Globals.theRenderer.EyeCamera().location;
14001529
14011530 // if (sourcenode.parent.parent != null)
14021531 // sourcenode.parent.parent.TransformToWorld(floor, tmp);
....@@ -1441,9 +1570,9 @@
14411570 //GraphreeD.
14421571 wav.play(volume * usedvolume); //, mywave);
14431572
1444
- lastsoundtime = CameraPane.framecount;
1573
+ lastsoundtime = Globals.framecount;
14451574
1446
- GrafreeD.hassound = true;
1575
+ Grafreed.hassound = true;
14471576 }
14481577 // else
14491578 // System.out.println("skipped");
....@@ -1462,9 +1591,9 @@
14621591
14631592 // System.out.println("Allo " + sourcenode);
14641593 // 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;
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;
14681597
14691598
14701599 if (false) // dist2 > 0.1)
....@@ -1530,9 +1659,9 @@
15301659 this.get(0).TransformToWorld(v0);
15311660
15321661 // cyan
1533
- CameraPane.debugpoint3.toParent[3][0] = v0.x;
1534
- CameraPane.debugpoint3.toParent[3][1] = ground;
1535
- 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;
15361665
15371666 LA.matConcat(sourcenode.toParent, transformnode.toParent, sourcenode.toParent);
15381667 LA.matInvert(sourcenode.toParent, sourcenode.fromParent);
....@@ -1542,9 +1671,9 @@
15421671 this.get(0).TransformToWorld(v0);
15431672
15441673 // red
1545
- CameraPane.debugpoint4.toParent[3][0] = v0.x;
1546
- CameraPane.debugpoint4.toParent[3][1] = ground;
1547
- 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;
15481677 }
15491678 }
15501679
....@@ -1584,11 +1713,11 @@
15841713
15851714 if (goal != null)
15861715 {
1587
- System.err.println("GOAL change (" + sourcenode + "): " + goal + " (was " + goalx + ", " + goalz + ")");
1716
+ System.err.println("GOAL change (" + sourcenode + "): " + goal + " (was " + goalposx + ", " + goalposz + ")");
15881717 //sourcenode.parent.parent.Dump();
1589
- goalx = goal.x;
1590
- goalz = goal.z;
1591
- targetx = targetz = 0;
1718
+ goalposx = goal.x;
1719
+ goalposz = goal.z;
1720
+ targetdirx = targetdirz = 0;
15921721
15931722 followpath = true;
15941723 }
....@@ -1639,16 +1768,16 @@
16391768 // }
16401769 if (false) // !uselast)
16411770 {
1642
- CameraPane.debugpoint.toParent[3][0] = dst.x;
1643
- CameraPane.debugpoint.toParent[3][1] = dst.y;
1644
- 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;
16451774 }
16461775 }
16471776
1648
- if (goalx != 0 || goalz != 0) // TODO
1777
+ if (goalposx != 0 || goalposz != 0) // TODO
16491778 {
16501779 // overwrite speaker orientation
1651
- dst.set(goalx,0,goalz);
1780
+ dst.set(goalposx,0,goalposz);
16521781 if (sourcenode.parent != null) // july 2014
16531782 sourcenode.parent.
16541783 TransformToLocal(dst);
....@@ -1700,26 +1829,26 @@
17001829 // mars 2014
17011830 if (false) // goalx != 0 || goalz != 0)
17021831 {
1703
- targetx = dst.x - src.x;
1704
- targetz = dst.z - src.z;
1832
+ targetdirx = dst.x - src.x;
1833
+ targetdirz = dst.z - src.z;
17051834
1706
- if (Math.abs(targetx) > 0.1 || Math.abs(targetz) > 0.1)
1835
+ if (Math.abs(targetdirx) > 0.1 || Math.abs(targetdirz) > 0.1)
17071836 {
17081837 // far enough from goal. keep the goal position.
1709
- targetx = 0;
1710
- targetz = 0;
1838
+ targetdirx = 0;
1839
+ targetdirz = 0;
17111840 }
17121841 else
17131842 {
17141843 // too close to goal. switch to target direction instead.
1715
- goalx = 0;
1716
- goalz = 0;
1844
+ goalposx = 0;
1845
+ goalposz = 0;
17171846 }
17181847 }
17191848
17201849 //sourcenode.getCentroid(src, true);
17211850
1722
- if (speakernode == sourcenode && goalx == 0 && goalz == 0)
1851
+ if (speakernode == sourcenode && goalposx == 0 && goalposz == 0)
17231852 {
17241853 if (ScriptNode.lastspeaker != null)
17251854 new Exception().printStackTrace();
....@@ -1728,13 +1857,13 @@
17281857
17291858 // LA.xformPos(src, fromParent, src);
17301859
1731
- 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)
17321861 dst.sub(src);
17331862 else
17341863 // vector mode
17351864 {
1736
- dst.x = targetx;
1737
- dst.z = targetz;
1865
+ dst.x = targetdirx;
1866
+ dst.z = targetdirz;
17381867
17391868 // TEST TARGET
17401869 // dst.x = CameraPane.selectedpoint.toParent[3][0];
....@@ -2144,7 +2273,7 @@
21442273 }
21452274
21462275 if (!smoothed)
2147
- for (int i=0; --i>=0;)
2276
+ for (int i=10; --i>=0;)
21482277 SmoothAnimData(); // much reduces shakiness
21492278
21502279 smoothed = true;
....@@ -2182,9 +2311,16 @@
21822311 toVector.x = LA.cos(to);
21832312 toVector.y = LA.sin(to);
21842313
2314
+ double fromA = Math.atan2(fromVector.y, fromVector.x);
2315
+ double toA = Math.atan2(toVector.y, toVector.x);
2316
+
21852317 Vector2d currentVector = Slerp(fromVector, toVector, step);
21862318
2187
- 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;
21882324 }
21892325
21902326 public static Vector2d Slerp(Vector2d from, Vector2d to, double step)
....@@ -2236,6 +2372,8 @@
22362372 {
22372373 e.printStackTrace();
22382374 }
2375
+
2376
+ SetHipOrientation();
22392377
22402378 if (true)
22412379 return;
....@@ -2664,8 +2802,9 @@
26642802 // set rotation
26652803 //if (bone._rotationEnabled)
26662804 if (//frame > 0 &&
2667
- !bone.skipmocap //&&
2668
- //!bone.name.contains("head") &&
2805
+ !bone.skipmocap &&
2806
+ !bone.name.contains("head") &&
2807
+ !bone.name.contains("Head") // &&
26692808 // !bone.name.contains("rFoot") &&
26702809 // !bone.name.contains("lFoot") &&
26712810 // !bone.name.contains("Pinky") &&
....@@ -3020,7 +3159,8 @@
30203159 }
30213160 }
30223161
3023
- static int offset = 1; // 5; // 10; // 5; // 100; // skip initial "T"
3162
+ // skip initial "T"
3163
+ static int offset = 1; // 5; // 10; // 5; // 100;
30243164
30253165 void ReadBVH()
30263166 {
....@@ -3049,8 +3189,8 @@
30493189
30503190 void Reset()
30513191 {
3052
- if (fullname != null)
3053
- ReadBVH();
3192
+// if (fullname != null)
3193
+// ReadBVH();
30543194
30553195 Object3D hip = get(0);
30563196
....@@ -3089,8 +3229,8 @@
30893229 // LA.matIdentity(rot.fromParent);
30903230
30913231 // july 2014
3092
- goalx = goalz = 0;
3093
- targetx = targetz = 0;
3232
+// goalx = goalz = 0;
3233
+ targetdirx = targetdirz = 0;
30943234
30953235 //SetPositionDelta(true, true, true, false);
30963236 // LoadData();
....@@ -3100,8 +3240,8 @@
31003240
31013241 // aout 2013 endframe = 0; // june 2013
31023242
3103
- //ResetZero();
3104
- setPose(frame);
3243
+ ResetZero();
3244
+ //setPose(frame);
31053245 }
31063246
31073247 static int mocapsupport = 0;
....@@ -3119,12 +3259,13 @@
31193259
31203260 int step = 1;
31213261
3262
+ // patch for running hare
31223263 if (speedup) // fev 2014
31233264 step *= 2; // 4;
31243265 if (rewind) // mars 2014
31253266 step *= 4;
31263267
3127
- if (CameraPane.FAST) // && !CameraPane.HOLD)
3268
+ //if (CameraPane.FAST) // && !CameraPane.HOLD)
31283269 step *= CameraPane.STEP;
31293270
31303271 //System.err.println("Step Mocap frame # " + frame);
....@@ -3132,7 +3273,7 @@
31323273 baseframe += step;
31333274
31343275 //frame = baseframe;
3135
- frame += step;
3276
+ //frame += step;
31363277
31373278 // if (frame != baseframe)
31383279 // {
....@@ -3156,7 +3297,7 @@
31563297 "; fullname = " + fullname);
31573298
31583299 //int delta = frame - baseframe;
3159
- if (CameraPane.CROWD)
3300
+ if (Globals.CROWD)
31603301 {
31613302 baseframe = GetFirstFrame(); // 0 initial point
31623303 }
....@@ -3165,32 +3306,53 @@
31653306 // SetPositionDelta(false, true, false); // ?? false);
31663307 {
31673308 if (support == null)
3168
- 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
+ }
31693319 else
31703320 {
3171
- try
3172
- {
3321
+// try
3322
+// {
31733323 bvh = ((Mocap)support.get(mocapsupport++ % support.Size())).bvh;
31743324
31753325 // SetPositionDelta(false, true, true, true);
31763326 LoadData();
31773327 Rewind();
31783328 Fade();
3179
- }
3180
- catch (Exception e)
3181
- {
3182
- e.printStackTrace();
3183
- ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest);
3184
- }
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
+// }
31853343 }
31863344 }
3345
+
3346
+ frame = GetFirstFrame();
31873347 }
3348
+ else
3349
+ frame += step;
31883350
31893351 //SetPositionDelta(false);
31903352
3191
- if (frame >= bvh.animation.getNumFrames())
3192
- //baseframe =
3193
- frame = GetFirstFrame(); // 0; // offset; // initial point
3353
+// if (frame >= bvh.animation.getNumFrames())
3354
+// //baseframe =
3355
+// frame = GetFirstFrame(); // 0; // offset; // initial point
31943356
31953357 //System.err.println("frame = " + frame);
31963358 if (lastframe != 0)
....@@ -3359,6 +3521,7 @@
33593521 // filters out bad input data
33603522 void FilterAnimData()
33613523 {
3524
+ new Exception().printStackTrace();
33623525 System.exit(0);
33633526
33643527 float[] data; // = bvh.animation.getBoneData(0);
....@@ -3716,7 +3879,7 @@
37163879
37173880 transient boolean restarted; // CROWD issue?
37183881
3719
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
3882
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
37203883 {
37213884 //System.err.println("drawSelf Mocap frame # " + frame);
37223885 //System.err.println("drawSelf Mocap baseframe # " + baseframe);
....@@ -3733,17 +3896,22 @@
37333896 // if (firstframe)
37343897 // return;
37353898
3736
- if (!restarted && /*display.restartframe &&*/
3737
- display.isLIVE() && live && display.drawMode == display.SHADOW) // FUCK
3899
+ if (//!restarted && /*display.restartframe &&*/
3900
+ Globals.isLIVE() && live && (display.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW))
37383901 {
37393902 //display.restartframe = false;
37403903 restarted = true;
3904
+ //System.err.println("restarted = true");
37413905 Step();
37423906 }
37433907 else
37443908 {
3745
- if (display.isLIVE() && live && display.drawMode != display.SHADOW)
3909
+ //System.err.println("restarted");
3910
+ if (Globals.isLIVE() && live && display.DrawMode() != iCameraPane.SHADOW)
3911
+ {
37463912 restarted = false;
3913
+ //System.err.println("restarted = false");
3914
+ }
37473915 }
37483916
37493917 super.drawSelf(display, root, selected, blocked);