From cb37a129d1adb403019c96e798e86e2da9667f15 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sun, 17 Nov 2019 17:56:04 -0500 Subject: [PATCH] Maze --- Mocap.java | 76 +++++++++++++++++++++++++++++--------- 1 files changed, 58 insertions(+), 18 deletions(-) diff --git a/Mocap.java b/Mocap.java index fc0ff2e..4656cc7 100644 --- a/Mocap.java +++ b/Mocap.java @@ -261,6 +261,8 @@ // LA.matConcat(toParent, hip.get(0).toParent, toParent); + CameraPane.CreateSelectedPoint(); + CameraPane.debugpointG.toParent[3][0] = poship.x; CameraPane.debugpointG.toParent[3][1] = poship.y; CameraPane.debugpointG.toParent[3][2] = poship.z; @@ -484,6 +486,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]; @@ -495,6 +503,7 @@ centroid.z = matrix[3][2]; // this.getCentroid(centroid, true); + CameraPane.CreateSelectedPoint(); CameraPane.debugpointG.name = ""; CameraPane.debugpointG.toParent[3][0] = mocaporigin.x; CameraPane.debugpointG.toParent[3][1] = mocaporigin.y; @@ -638,6 +647,24 @@ // transient // aout 2013 Object3D skeleton; + void ExtractBigData(Object3D o) + { + super.ExtractBigData(o); + + o.savebvh = this.bvh; + o.saveskeleton = this.skeleton; + this.bvh = null; + this.skeleton = null; + } + + void RestoreBigData(Object3D o) + { + super.RestoreBigData(o); + + this.bvh = o.savebvh; + this.skeleton = o.saveskeleton; + } + boolean smoothed; //boolean touched; @@ -664,8 +691,8 @@ double targetdirx; double targetdirz; - double goalposx = -20; - double goalposz = -10; + double goalposx = 0; // -20; + double goalposz = 0; // -10; boolean followpath; @@ -921,7 +948,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]); @@ -971,7 +998,7 @@ get(0).link2master = path.size() > 1; // hip orientation - if (get(0).link2master) + if (get(0).Link2Support()) { rotateonce = 2; } @@ -1400,7 +1427,7 @@ double w = 0.00015; //if (!sourcenode.link2master) // strong pin on floor - if (parent.link2master) // strong pin on floor + if (parent.Link2Support()) // strong pin on floor { w = 0.005; // .001; } @@ -1566,7 +1593,7 @@ lastsoundtime = Globals.framecount; - GrafreeD.hassound = true; + Grafreed.hassound = true; } // else // System.out.println("skipped"); @@ -1614,7 +1641,7 @@ // sourcenode.parent.toParent[3][1] = ground - floor.y; // sourcenode.parent.toParent[3][2] += groundz - floor.z; // sourcenode.parent.toParent[3][1] = K * (ground - floor.y) + (1 - K) * oldposy; - if (footcontact && (sourcenode.parent != null && !sourcenode.parent.link2master)) // strong pin on floor + if (footcontact && (sourcenode.parent != null && !sourcenode.parent.Link2Support())) // strong pin on floor { v0.x = groundx - floor.x; v0.y = 0; // groundx - floor.x; @@ -1979,7 +2006,7 @@ // if (sourcenode.link2master) // if (goalx != 0 || goalz != 0) // K = 0.02; // .0625; - if (parent.link2master) // strong pin on floor + if (parent.Link2Support()) // strong pin on floor { K = 0.05; // 0.02; } @@ -2396,9 +2423,9 @@ // SetBreakPoint(get(0).toParent[0], 0); // } - boolean setrotation = get(0).link2master && !firsttimeafterload && frame > 0; + boolean setrotation = get(0).Link2Support() && !firsttimeafterload && frame > 0; boolean setposition = sourcenode != null && // sourcenode.parent != null && // july 2014 - sourcenode./*parent.*/link2master && !firsttimeafterload && frame > 0; + sourcenode./*parent.*/Link2Support() && !firsttimeafterload && frame > 0; // cVector centroid = new cVector(); // cVector floor = new cVector(); @@ -2797,7 +2824,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") && @@ -2830,7 +2858,7 @@ // set translation // (currently only possible for root bone! see mocapdata.com data) - if (bone._isRoot && link2master) // && !GetFileRoot().link2master) + if (bone._isRoot && Link2Support()) // && !GetFileRoot().link2master) { if (hasTranslation) // && _translationEnabled) { @@ -3233,8 +3261,8 @@ // aout 2013 endframe = 0; // june 2013 - //ResetZero(); - setPose(frame); + ResetZero(); + //setPose(frame); } static int mocapsupport = 0; @@ -3300,7 +3328,7 @@ { if (support == null) { - if (new File(fullname).exists()) + if (bvh == null && new File(fullname).exists()) ObjEditor.LoadBVHFile(fullname, this, false, beginframe, lastframetest); else { @@ -3889,17 +3917,24 @@ // 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 || !Globals.COMPUTESHADOWWHENLIVE)) { //display.restartframe = false; restarted = true; + //System.err.println("restarted = true"); Step(); + + Globals.lighttouched = true; } 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); @@ -3959,6 +3994,11 @@ // GetObject().release(i); } + boolean HasBigData() + { + return skeleton != null; + } + public Object3D get(int i) { if (i != 0) -- Gitblit v1.6.2