From f924d3e00db476c06f55f3d5aaef307e17575340 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Mon, 13 May 2019 07:29:08 -0400 Subject: [PATCH] Transform children --- Mocap.java | 77 +++++++++++++++++++++++++++----------- 1 files changed, 54 insertions(+), 23 deletions(-) diff --git a/Mocap.java b/Mocap.java index 931d1e6..246c834 100644 --- a/Mocap.java +++ b/Mocap.java @@ -484,6 +484,12 @@ { Object3D hip = get(0); + if (toParent == null) + { + toParent = LA.newMatrix(); + fromParent = LA.newMatrix(); + } + LA.matConcat(toParent, hip.get(0).toParent, matrix); mocaporigin.x = matrix[3][0]; @@ -664,8 +670,8 @@ double targetdirx; double targetdirz; - double goalposx = -20; - double goalposz = -10; + double goalposx = 0; // -20; + double goalposz = 0; // -10; boolean followpath; @@ -921,7 +927,7 @@ // //GetFileRoot(); // sept 2014: // - GrafreeD.RENDERME = 3; // patch for Merge objects + Grafreed.RENDERME = 3; // patch for Merge objects float[] thedata = bvh.animation.getBoneData(0); os.x = (float) (path.get(i).toParent[3][0]); // - thedata[frame*6]); @@ -1519,7 +1525,7 @@ // mywave = currentwave++; // } // sound - cVector eye = CameraPane.theRenderer.eyeCamera.location; + cVector eye = Globals.theRenderer.EyeCamera().location; // if (sourcenode.parent.parent != null) // sourcenode.parent.parent.TransformToWorld(floor, tmp); @@ -1566,7 +1572,7 @@ lastsoundtime = Globals.framecount; - GrafreeD.hassound = true; + Grafreed.hassound = true; } // else // System.out.println("skipped"); @@ -2267,7 +2273,7 @@ } if (!smoothed) - for (int i=0; --i>=0;) + for (int i=10; --i>=0;) SmoothAnimData(); // much reduces shakiness smoothed = true; @@ -2797,7 +2803,8 @@ //if (bone._rotationEnabled) if (//frame > 0 && !bone.skipmocap && - !bone.name.contains("head") // && + !bone.name.contains("head") && + !bone.name.contains("Head") // && // !bone.name.contains("rFoot") && // !bone.name.contains("lFoot") && // !bone.name.contains("Pinky") && @@ -3233,8 +3240,8 @@ // aout 2013 endframe = 0; // june 2013 - //ResetZero(); - setPose(frame); + ResetZero(); + //setPose(frame); } static int mocapsupport = 0; @@ -3252,12 +3259,13 @@ int step = 1; + // patch for running hare if (speedup) // fev 2014 step *= 2; // 4; if (rewind) // mars 2014 step *= 4; - if (CameraPane.FAST) // && !CameraPane.HOLD) + //if (CameraPane.FAST) // && !CameraPane.HOLD) step *= CameraPane.STEP; //System.err.println("Step Mocap frame # " + frame); @@ -3298,23 +3306,40 @@ // SetPositionDelta(false, true, false); // ?? false); { if (support == null) - ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest); + { + if (bvh == null && new File(fullname).exists()) + ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest); + else + { + SetGlobalTransform(); + Rewind(); + Fade(); + } + } else { - try - { +// try +// { bvh = ((Mocap)support.get(mocapsupport++ % support.Size())).bvh; // SetPositionDelta(false, true, true, true); LoadData(); Rewind(); Fade(); - } - catch (Exception e) - { - e.printStackTrace(); - ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest); - } +// } +// catch (Exception e) +// { +// System.err.println("An error occured while loading data. Use fallback by loading the file."); +// //e.printStackTrace(); +// try +// { +// ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest); +// } +// catch (Exception e2) +// { +// System.err.println("Motion file not found: " + fullname); +// } +// } } } @@ -3496,6 +3521,7 @@ // filters out bad input data void FilterAnimData() { + new Exception().printStackTrace(); System.exit(0); float[] data; // = bvh.animation.getBoneData(0); @@ -3853,7 +3879,7 @@ transient boolean restarted; // CROWD issue? - void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) + void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) { //System.err.println("drawSelf Mocap frame # " + frame); //System.err.println("drawSelf Mocap baseframe # " + baseframe); @@ -3870,17 +3896,22 @@ // if (firstframe) // return; - if (!restarted && /*display.restartframe &&*/ - Globals.isLIVE() && live && display.DrawMode() == display.SHADOW) // FUCK + if (//!restarted && /*display.restartframe &&*/ + Globals.isLIVE() && live && (display.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW)) { //display.restartframe = false; restarted = true; + //System.err.println("restarted = true"); Step(); } else { - if (Globals.isLIVE() && live && display.DrawMode() != display.SHADOW) + //System.err.println("restarted"); + if (Globals.isLIVE() && live && display.DrawMode() != iCameraPane.SHADOW) + { restarted = false; + //System.err.println("restarted = false"); + } } super.drawSelf(display, root, selected, blocked); -- Gitblit v1.6.2