From 4629090fafbef256abd0686a85ee12042d658868 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Wed, 12 Jun 2019 22:37:48 -0400 Subject: [PATCH] Mocap big data --- Object3D.java | 265 ++++++++++++++++++++++++++++++++-------------------- 1 files changed, 164 insertions(+), 101 deletions(-) diff --git a/Object3D.java b/Object3D.java index af581bd..d7a346f 100644 --- a/Object3D.java +++ b/Object3D.java @@ -24,6 +24,11 @@ private UUID uuid = UUID.randomUUID(); + // TEMPORARY for mocap undo + mocap.reader.BVHReader.BVHResult bvh; + Object3D skeleton; + // + ScriptNode scriptnode; void InitOthers() @@ -104,117 +109,136 @@ // transient boolean reduced; // for morph reduction -transient com.bulletphysics.linearmath.Transform cache; // for fast merge -transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge + transient com.bulletphysics.linearmath.Transform cache; // for fast merge + transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge -transient Object3D transientsupport; // for cloning -transient boolean transientlink2master; + transient Object3D transientsupport; // for cloning + transient boolean transientlink2master; -void SaveSupports() -{ - if (blockloop) - return; + void SaveSupports() + { + if (blockloop) + return; - transientsupport = support; - transientlink2master = link2master; - - support = null; - link2master = false; - - if (bRep != null) - { - bRep.SaveSupports(); - } - - for (int i = 0; i < Size(); i++) - { - Object3D child = (Object3D) get(i); - if (child == null) - continue; - blockloop = true; - child.SaveSupports(); - blockloop = false; - } -} + transientsupport = support; + transientlink2master = link2master; -void RestoreSupports() -{ - if (blockloop) - return; + support = null; + link2master = false; - support = transientsupport; - link2master = transientlink2master; - transientsupport = null; - transientlink2master = false; - - if (bRep != null) - { - bRep.RestoreSupports(); - } - - for (int i = 0; i < Size(); i++) - { - Object3D child = (Object3D) get(i); - if (child == null) - continue; - blockloop = true; - child.RestoreSupports(); - blockloop = false; - } -} + if (bRep != null) + { + bRep.SaveSupports(); + } -void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) -{ - if (hashtable.containsKey(GetUUID())) - return; - - Object3D o = new Object3D(); - o.bRep = this.bRep; - if (this.bRep != null) - { - o.transientrep = this.bRep.support; - o.bRep.support = null; + for (int i = 0; i < Size(); i++) + { + Object3D child = (Object3D) get(i); + if (child == null) + continue; + blockloop = true; + child.SaveSupports(); + blockloop = false; + } } - -// o.support = this.support; -// o.fileparent = this.fileparent; -// if (this.bRep != null) -// o.bRep = this.bRep.support; - - hashtable.put(GetUUID(), o); - - this.bRep = null; -// if (this.bRep != null) -// this.bRep.support = null; -// this.support = null; -// this.fileparent = null; - - for (int i=0; i<Size(); i++) - { - get(i).ExtractBigData(hashtable); - } -} -void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) -{ - if (!hashtable.containsKey(GetUUID())) - return; - - Object3D o = hashtable.get(GetUUID()); - - this.bRep = o.bRep; - if (this.bRep != null) - this.bRep.support = o.transientrep; -// this.support = o.support; -// this.fileparent = o.fileparent; - - hashtable.remove(GetUUID()); - - for (int i=0; i<Size(); i++) + void RestoreSupports() { - get(i).RestoreBigData(hashtable); + if (blockloop) + return; + + support = transientsupport; + link2master = transientlink2master; + transientsupport = null; + transientlink2master = false; + + if (bRep != null) + { + bRep.RestoreSupports(); + } + + for (int i = 0; i < Size(); i++) + { + Object3D child = (Object3D) get(i); + if (child == null) + continue; + blockloop = true; + child.RestoreSupports(); + blockloop = false; + } } -} + + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) + { + if (hashtable.containsKey(GetUUID())) + { + Object3D o = hashtable.get(GetUUID()); + + assert(this.bRep == o.bRep); + if (this.bRep != null) + assert(this.bRep.support == o.transientrep); + + return; + } + + Object3D o = new Object3D(); + + hashtable.put(GetUUID(), o); + + for (int i=0; i<Size(); i++) + { + get(i).ExtractBigData(hashtable); + } + + ExtractBigData(o); + } + + void ExtractBigData(Object3D o) + { + o.bRep = this.bRep; + if (this.bRep != null) + { + o.transientrep = this.bRep.support; + o.bRep.support = null; + } + + // o.support = this.support; + // o.fileparent = this.fileparent; + // if (this.bRep != null) + // o.bRep = this.bRep.support; + + this.bRep = null; + // if (this.bRep != null) + // this.bRep.support = null; + // this.support = null; + // this.fileparent = null; + } + + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) + { + if (!hashtable.containsKey(GetUUID())) + return; + + Object3D o = hashtable.get(GetUUID()); + + RestoreBigData(o); + + hashtable.remove(GetUUID()); + + for (int i=0; i<Size(); i++) + { + get(i).RestoreBigData(hashtable); + } + } + + void RestoreBigData(Object3D o) + { + this.bRep = o.bRep; + if (this.bRep != null) + this.bRep.support = o.transientrep; + // this.support = o.support; + // this.fileparent = o.fileparent; + } // MOCAP SUPPORT double tx,ty,tz,rx,ry,rz; @@ -2685,6 +2709,18 @@ //Touch(); } + void GenNormalsMeshS() + { + selection.GenNormalsMesh(); +// for (int i=0; i<selection.size(); i++) +// { +// Object3D selectee = (Object3D) selection.elementAt(i); +// selectee.GenNormals(crease); +// } + + //Touch(); + } + void ClearColorsS() { selection.ClearColors(); @@ -2816,6 +2852,24 @@ if (child == null) continue; child.GenNormals(crease); +// Children().release(i); + } + blockloop = false; + } + + void GenNormalsMesh() + { + if (blockloop) + return; + + blockloop = true; + GenNormalsMesh0(); + for (int i = 0; i < Children().Size(); i++) + { + Object3D child = (Object3D) Children().get(i); // reserve(i); + if (child == null) + continue; + child.GenNormalsMesh(); // Children().release(i); } blockloop = false; @@ -2988,6 +3042,15 @@ } } + void GenNormalsMesh0() + { + if (bRep != null) + { + bRep.GenerateNormalsMesh(); + Touch(); + } + } + void GenNormalsMINE0() { if (bRep != null) -- Gitblit v1.6.2