Normand Briere
2019-06-11 4113164b3be1e50251ac40d6fd65660f0a6c2e63
Mocap.java
....@@ -484,6 +484,12 @@
484484 {
485485 Object3D hip = get(0);
486486
487
+ if (toParent == null)
488
+ {
489
+ toParent = LA.newMatrix();
490
+ fromParent = LA.newMatrix();
491
+ }
492
+
487493 LA.matConcat(toParent, hip.get(0).toParent, matrix);
488494
489495 mocaporigin.x = matrix[3][0];
....@@ -664,8 +670,8 @@
664670 double targetdirx;
665671 double targetdirz;
666672
667
- double goalposx = -20;
668
- double goalposz = -10;
673
+ double goalposx = 0; // -20;
674
+ double goalposz = 0; // -10;
669675
670676 boolean followpath;
671677
....@@ -921,7 +927,7 @@
921927 // //GetFileRoot();
922928
923929 // sept 2014: //
924
- GrafreeD.RENDERME = 3; // patch for Merge objects
930
+ Grafreed.RENDERME = 3; // patch for Merge objects
925931 float[] thedata = bvh.animation.getBoneData(0);
926932
927933 os.x = (float) (path.get(i).toParent[3][0]); // - thedata[frame*6]);
....@@ -1519,7 +1525,7 @@
15191525 // mywave = currentwave++;
15201526 // }
15211527 // sound
1522
- cVector eye = CameraPane.theRenderer.EyeCamera().location;
1528
+ cVector eye = Globals.theRenderer.EyeCamera().location;
15231529
15241530 // if (sourcenode.parent.parent != null)
15251531 // sourcenode.parent.parent.TransformToWorld(floor, tmp);
....@@ -1566,7 +1572,7 @@
15661572
15671573 lastsoundtime = Globals.framecount;
15681574
1569
- GrafreeD.hassound = true;
1575
+ Grafreed.hassound = true;
15701576 }
15711577 // else
15721578 // System.out.println("skipped");
....@@ -2267,7 +2273,7 @@
22672273 }
22682274
22692275 if (!smoothed)
2270
- for (int i=0; --i>=0;)
2276
+ for (int i=10; --i>=0;)
22712277 SmoothAnimData(); // much reduces shakiness
22722278
22732279 smoothed = true;
....@@ -2797,7 +2803,8 @@
27972803 //if (bone._rotationEnabled)
27982804 if (//frame > 0 &&
27992805 !bone.skipmocap &&
2800
- !bone.name.contains("head") // &&
2806
+ !bone.name.contains("head") &&
2807
+ !bone.name.contains("Head") // &&
28012808 // !bone.name.contains("rFoot") &&
28022809 // !bone.name.contains("lFoot") &&
28032810 // !bone.name.contains("Pinky") &&
....@@ -3233,8 +3240,8 @@
32333240
32343241 // aout 2013 endframe = 0; // june 2013
32353242
3236
- //ResetZero();
3237
- setPose(frame);
3243
+ ResetZero();
3244
+ //setPose(frame);
32383245 }
32393246
32403247 static int mocapsupport = 0;
....@@ -3252,12 +3259,13 @@
32523259
32533260 int step = 1;
32543261
3262
+ // patch for running hare
32553263 if (speedup) // fev 2014
32563264 step *= 2; // 4;
32573265 if (rewind) // mars 2014
32583266 step *= 4;
32593267
3260
- if (CameraPane.FAST) // && !CameraPane.HOLD)
3268
+ //if (CameraPane.FAST) // && !CameraPane.HOLD)
32613269 step *= CameraPane.STEP;
32623270
32633271 //System.err.println("Step Mocap frame # " + frame);
....@@ -3298,23 +3306,40 @@
32983306 // SetPositionDelta(false, true, false); // ?? false);
32993307 {
33003308 if (support == null)
3301
- 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
+ }
33023319 else
33033320 {
3304
- try
3305
- {
3321
+// try
3322
+// {
33063323 bvh = ((Mocap)support.get(mocapsupport++ % support.Size())).bvh;
33073324
33083325 // SetPositionDelta(false, true, true, true);
33093326 LoadData();
33103327 Rewind();
33113328 Fade();
3312
- }
3313
- catch (Exception e)
3314
- {
3315
- e.printStackTrace();
3316
- ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest);
3317
- }
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
+// }
33183343 }
33193344 }
33203345
....@@ -3496,6 +3521,7 @@
34963521 // filters out bad input data
34973522 void FilterAnimData()
34983523 {
3524
+ new Exception().printStackTrace();
34993525 System.exit(0);
35003526
35013527 float[] data; // = bvh.animation.getBoneData(0);
....@@ -3870,17 +3896,22 @@
38703896 // if (firstframe)
38713897 // return;
38723898
3873
- if (!restarted && /*display.restartframe &&*/
3874
- Globals.isLIVE() && live && display.DrawMode() == display.SHADOW) // FUCK
3899
+ if (//!restarted && /*display.restartframe &&*/
3900
+ Globals.isLIVE() && live && (display.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW))
38753901 {
38763902 //display.restartframe = false;
38773903 restarted = true;
3904
+ //System.err.println("restarted = true");
38783905 Step();
38793906 }
38803907 else
38813908 {
3882
- if (Globals.isLIVE() && live && display.DrawMode() != display.SHADOW)
3909
+ //System.err.println("restarted");
3910
+ if (Globals.isLIVE() && live && display.DrawMode() != iCameraPane.SHADOW)
3911
+ {
38833912 restarted = false;
3913
+ //System.err.println("restarted = false");
3914
+ }
38843915 }
38853916
38863917 super.drawSelf(display, root, selected, blocked);