Normand Briere
2019-06-26 89b25e7cc97f6fe221dfd41c4d463500f8a31bc1
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];
....@@ -495,6 +501,7 @@
495501 centroid.z = matrix[3][2];
496502 // this.getCentroid(centroid, true);
497503
504
+ CameraPane.CreateSelectedPoint();
498505 CameraPane.debugpointG.name = "";
499506 CameraPane.debugpointG.toParent[3][0] = mocaporigin.x;
500507 CameraPane.debugpointG.toParent[3][1] = mocaporigin.y;
....@@ -638,6 +645,24 @@
638645 // transient // aout 2013
639646 Object3D skeleton;
640647
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
+
641666 boolean smoothed;
642667
643668 //boolean touched;
....@@ -664,8 +689,8 @@
664689 double targetdirx;
665690 double targetdirz;
666691
667
- double goalposx = -20;
668
- double goalposz = -10;
692
+ double goalposx = 0; // -20;
693
+ double goalposz = 0; // -10;
669694
670695 boolean followpath;
671696
....@@ -921,7 +946,7 @@
921946 // //GetFileRoot();
922947
923948 // sept 2014: //
924
- GrafreeD.RENDERME = 3; // patch for Merge objects
949
+ Grafreed.RENDERME = 3; // patch for Merge objects
925950 float[] thedata = bvh.animation.getBoneData(0);
926951
927952 os.x = (float) (path.get(i).toParent[3][0]); // - thedata[frame*6]);
....@@ -1519,7 +1544,7 @@
15191544 // mywave = currentwave++;
15201545 // }
15211546 // sound
1522
- cVector eye = CameraPane.theRenderer.eyeCamera.location;
1547
+ cVector eye = Globals.theRenderer.EyeCamera().location;
15231548
15241549 // if (sourcenode.parent.parent != null)
15251550 // sourcenode.parent.parent.TransformToWorld(floor, tmp);
....@@ -1566,7 +1591,7 @@
15661591
15671592 lastsoundtime = Globals.framecount;
15681593
1569
- GrafreeD.hassound = true;
1594
+ Grafreed.hassound = true;
15701595 }
15711596 // else
15721597 // System.out.println("skipped");
....@@ -2267,7 +2292,7 @@
22672292 }
22682293
22692294 if (!smoothed)
2270
- for (int i=0; --i>=0;)
2295
+ for (int i=10; --i>=0;)
22712296 SmoothAnimData(); // much reduces shakiness
22722297
22732298 smoothed = true;
....@@ -2797,7 +2822,8 @@
27972822 //if (bone._rotationEnabled)
27982823 if (//frame > 0 &&
27992824 !bone.skipmocap &&
2800
- !bone.name.contains("head") // &&
2825
+ !bone.name.contains("head") &&
2826
+ !bone.name.contains("Head") // &&
28012827 // !bone.name.contains("rFoot") &&
28022828 // !bone.name.contains("lFoot") &&
28032829 // !bone.name.contains("Pinky") &&
....@@ -3233,8 +3259,8 @@
32333259
32343260 // aout 2013 endframe = 0; // june 2013
32353261
3236
- //ResetZero();
3237
- setPose(frame);
3262
+ ResetZero();
3263
+ //setPose(frame);
32383264 }
32393265
32403266 static int mocapsupport = 0;
....@@ -3252,12 +3278,13 @@
32523278
32533279 int step = 1;
32543280
3281
+ // patch for running hare
32553282 if (speedup) // fev 2014
32563283 step *= 2; // 4;
32573284 if (rewind) // mars 2014
32583285 step *= 4;
32593286
3260
- if (CameraPane.FAST) // && !CameraPane.HOLD)
3287
+ //if (CameraPane.FAST) // && !CameraPane.HOLD)
32613288 step *= CameraPane.STEP;
32623289
32633290 //System.err.println("Step Mocap frame # " + frame);
....@@ -3298,23 +3325,40 @@
32983325 // SetPositionDelta(false, true, false); // ?? false);
32993326 {
33003327 if (support == null)
3301
- 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
+ }
33023338 else
33033339 {
3304
- try
3305
- {
3340
+// try
3341
+// {
33063342 bvh = ((Mocap)support.get(mocapsupport++ % support.Size())).bvh;
33073343
33083344 // SetPositionDelta(false, true, true, true);
33093345 LoadData();
33103346 Rewind();
33113347 Fade();
3312
- }
3313
- catch (Exception e)
3314
- {
3315
- e.printStackTrace();
3316
- ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest);
3317
- }
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
+// }
33183362 }
33193363 }
33203364
....@@ -3496,6 +3540,7 @@
34963540 // filters out bad input data
34973541 void FilterAnimData()
34983542 {
3543
+ new Exception().printStackTrace();
34993544 System.exit(0);
35003545
35013546 float[] data; // = bvh.animation.getBoneData(0);
....@@ -3853,7 +3898,7 @@
38533898
38543899 transient boolean restarted; // CROWD issue?
38553900
3856
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
3901
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
38573902 {
38583903 //System.err.println("drawSelf Mocap frame # " + frame);
38593904 //System.err.println("drawSelf Mocap baseframe # " + baseframe);
....@@ -3870,17 +3915,22 @@
38703915 // if (firstframe)
38713916 // return;
38723917
3873
- if (!restarted && /*display.restartframe &&*/
3874
- Globals.isLIVE() && live && display.DrawMode() == display.SHADOW) // FUCK
3918
+ if (//!restarted && /*display.restartframe &&*/
3919
+ Globals.isLIVE() && live && (display.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE))
38753920 {
38763921 //display.restartframe = false;
38773922 restarted = true;
3923
+ //System.err.println("restarted = true");
38783924 Step();
38793925 }
38803926 else
38813927 {
3882
- if (Globals.isLIVE() && live && display.DrawMode() != display.SHADOW)
3928
+ //System.err.println("restarted");
3929
+ if (Globals.isLIVE() && live && display.DrawMode() != iCameraPane.SHADOW)
3930
+ {
38833931 restarted = false;
3932
+ //System.err.println("restarted = false");
3933
+ }
38843934 }
38853935
38863936 super.drawSelf(display, root, selected, blocked);