.. | .. |
---|
24 | 24 | |
---|
25 | 25 | private UUID uuid = UUID.randomUUID(); |
---|
26 | 26 | |
---|
| 27 | + // TEMPORARY for mocap undo |
---|
| 28 | + mocap.reader.BVHReader.BVHResult bvh; |
---|
| 29 | + Object3D skeleton; |
---|
| 30 | + // |
---|
| 31 | + |
---|
27 | 32 | ScriptNode scriptnode; |
---|
28 | 33 | |
---|
29 | 34 | void InitOthers() |
---|
.. | .. |
---|
104 | 109 | |
---|
105 | 110 | // transient boolean reduced; // for morph reduction |
---|
106 | 111 | |
---|
107 | | -transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
108 | | -transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
| 112 | + transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
| 113 | + transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
109 | 114 | |
---|
110 | | -transient Object3D transientsupport; // for cloning |
---|
111 | | -transient boolean transientlink2master; |
---|
| 115 | + transient Object3D transientsupport; // for cloning |
---|
| 116 | + transient boolean transientlink2master; |
---|
112 | 117 | |
---|
113 | | -void SaveSupports() |
---|
114 | | -{ |
---|
115 | | - if (blockloop) |
---|
116 | | - return; |
---|
117 | | - |
---|
118 | | - transientsupport = support; |
---|
119 | | - transientlink2master = link2master; |
---|
120 | | - |
---|
121 | | - support = null; |
---|
122 | | - link2master = false; |
---|
123 | | - |
---|
124 | | - if (bRep != null) |
---|
| 118 | + void SaveSupports() |
---|
125 | 119 | { |
---|
126 | | - bRep.SaveSupports(); |
---|
127 | | - } |
---|
128 | | - |
---|
129 | | - for (int i = 0; i < Size(); i++) |
---|
130 | | - { |
---|
131 | | - Object3D child = (Object3D) get(i); |
---|
132 | | - if (child == null) |
---|
133 | | - continue; |
---|
134 | | - blockloop = true; |
---|
135 | | - child.SaveSupports(); |
---|
136 | | - blockloop = false; |
---|
137 | | - } |
---|
138 | | -} |
---|
| 120 | + if (blockloop) |
---|
| 121 | + return; |
---|
139 | 122 | |
---|
140 | | -void RestoreSupports() |
---|
141 | | -{ |
---|
142 | | - if (blockloop) |
---|
143 | | - return; |
---|
| 123 | + transientsupport = support; |
---|
| 124 | + transientlink2master = link2master; |
---|
144 | 125 | |
---|
145 | | - support = transientsupport; |
---|
146 | | - link2master = transientlink2master; |
---|
147 | | - transientsupport = null; |
---|
148 | | - transientlink2master = false; |
---|
149 | | - |
---|
150 | | - if (bRep != null) |
---|
151 | | - { |
---|
152 | | - bRep.RestoreSupports(); |
---|
| 126 | + support = null; |
---|
| 127 | + link2master = false; |
---|
| 128 | + |
---|
| 129 | + if (bRep != null) |
---|
| 130 | + { |
---|
| 131 | + bRep.SaveSupports(); |
---|
| 132 | + } |
---|
| 133 | + |
---|
| 134 | + for (int i = 0; i < Size(); i++) |
---|
| 135 | + { |
---|
| 136 | + Object3D child = (Object3D) get(i); |
---|
| 137 | + if (child == null) |
---|
| 138 | + continue; |
---|
| 139 | + blockloop = true; |
---|
| 140 | + child.SaveSupports(); |
---|
| 141 | + blockloop = false; |
---|
| 142 | + } |
---|
153 | 143 | } |
---|
154 | | - |
---|
155 | | - for (int i = 0; i < Size(); i++) |
---|
| 144 | + |
---|
| 145 | + void RestoreSupports() |
---|
156 | 146 | { |
---|
157 | | - Object3D child = (Object3D) get(i); |
---|
158 | | - if (child == null) |
---|
159 | | - continue; |
---|
160 | | - blockloop = true; |
---|
161 | | - child.RestoreSupports(); |
---|
162 | | - blockloop = false; |
---|
| 147 | + if (blockloop) |
---|
| 148 | + return; |
---|
| 149 | + |
---|
| 150 | + support = transientsupport; |
---|
| 151 | + link2master = transientlink2master; |
---|
| 152 | + transientsupport = null; |
---|
| 153 | + transientlink2master = false; |
---|
| 154 | + |
---|
| 155 | + if (bRep != null) |
---|
| 156 | + { |
---|
| 157 | + bRep.RestoreSupports(); |
---|
| 158 | + } |
---|
| 159 | + |
---|
| 160 | + for (int i = 0; i < Size(); i++) |
---|
| 161 | + { |
---|
| 162 | + Object3D child = (Object3D) get(i); |
---|
| 163 | + if (child == null) |
---|
| 164 | + continue; |
---|
| 165 | + blockloop = true; |
---|
| 166 | + child.RestoreSupports(); |
---|
| 167 | + blockloop = false; |
---|
| 168 | + } |
---|
163 | 169 | } |
---|
164 | | -} |
---|
| 170 | + |
---|
| 171 | + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 172 | + { |
---|
| 173 | + if (hashtable.containsKey(GetUUID())) |
---|
| 174 | + { |
---|
| 175 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 176 | + |
---|
| 177 | + Grafreed.Assert(this.bRep == o.bRep); |
---|
| 178 | + if (this.bRep != null) |
---|
| 179 | + assert(this.bRep.support == o.transientrep); |
---|
| 180 | + |
---|
| 181 | + return; |
---|
| 182 | + } |
---|
| 183 | + |
---|
| 184 | + Object3D o = new Object3D(); |
---|
| 185 | + |
---|
| 186 | + hashtable.put(GetUUID(), o); |
---|
| 187 | + |
---|
| 188 | + for (int i=0; i<Size(); i++) |
---|
| 189 | + { |
---|
| 190 | + get(i).ExtractBigData(hashtable); |
---|
| 191 | + } |
---|
| 192 | + |
---|
| 193 | + ExtractBigData(o); |
---|
| 194 | + } |
---|
| 195 | + |
---|
| 196 | + void ExtractBigData(Object3D o) |
---|
| 197 | + { |
---|
| 198 | + o.bRep = this.bRep; |
---|
| 199 | + if (this.bRep != null) |
---|
| 200 | + { |
---|
| 201 | + o.transientrep = this.bRep.support; |
---|
| 202 | + o.bRep.support = null; |
---|
| 203 | + } |
---|
| 204 | + |
---|
| 205 | + // o.support = this.support; |
---|
| 206 | + // o.fileparent = this.fileparent; |
---|
| 207 | + // if (this.bRep != null) |
---|
| 208 | + // o.bRep = this.bRep.support; |
---|
| 209 | + |
---|
| 210 | + this.bRep = null; |
---|
| 211 | + // if (this.bRep != null) |
---|
| 212 | + // this.bRep.support = null; |
---|
| 213 | + // this.support = null; |
---|
| 214 | + // this.fileparent = null; |
---|
| 215 | + } |
---|
| 216 | + |
---|
| 217 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 218 | + { |
---|
| 219 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 220 | + return; |
---|
| 221 | + |
---|
| 222 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 223 | + |
---|
| 224 | + RestoreBigData(o); |
---|
| 225 | + |
---|
| 226 | + hashtable.remove(GetUUID()); |
---|
| 227 | + |
---|
| 228 | + for (int i=0; i<Size(); i++) |
---|
| 229 | + { |
---|
| 230 | + get(i).RestoreBigData(hashtable); |
---|
| 231 | + } |
---|
| 232 | + } |
---|
| 233 | + |
---|
| 234 | + void RestoreBigData(Object3D o) |
---|
| 235 | + { |
---|
| 236 | + this.bRep = o.bRep; |
---|
| 237 | + if (this.bRep != null) |
---|
| 238 | + this.bRep.support = o.transientrep; |
---|
| 239 | + // this.support = o.support; |
---|
| 240 | + // this.fileparent = o.fileparent; |
---|
| 241 | + } |
---|
165 | 242 | |
---|
166 | 243 | // MOCAP SUPPORT |
---|
167 | 244 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
486 | 563 | toParent = LA.newMatrix(); |
---|
487 | 564 | fromParent = LA.newMatrix(); |
---|
488 | 565 | } |
---|
| 566 | + |
---|
489 | 567 | if (toParentMarked == null) |
---|
490 | 568 | { |
---|
491 | 569 | if (maxcount != 1) |
---|
492 | 570 | { |
---|
493 | 571 | new Exception().printStackTrace(); |
---|
494 | 572 | } |
---|
| 573 | + |
---|
495 | 574 | toParentMarked = LA.newMatrix(); |
---|
496 | 575 | fromParentMarked = LA.newMatrix(); |
---|
497 | 576 | } |
---|
.. | .. |
---|
2632 | 2711 | //Touch(); |
---|
2633 | 2712 | } |
---|
2634 | 2713 | |
---|
| 2714 | + void GenNormalsMeshS() |
---|
| 2715 | + { |
---|
| 2716 | + selection.GenNormalsMesh(); |
---|
| 2717 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2718 | +// { |
---|
| 2719 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2720 | +// selectee.GenNormals(crease); |
---|
| 2721 | +// } |
---|
| 2722 | + |
---|
| 2723 | + //Touch(); |
---|
| 2724 | + } |
---|
| 2725 | + |
---|
2635 | 2726 | void ClearColorsS() |
---|
2636 | 2727 | { |
---|
2637 | 2728 | selection.ClearColors(); |
---|
.. | .. |
---|
2763 | 2854 | if (child == null) |
---|
2764 | 2855 | continue; |
---|
2765 | 2856 | child.GenNormals(crease); |
---|
| 2857 | +// Children().release(i); |
---|
| 2858 | + } |
---|
| 2859 | + blockloop = false; |
---|
| 2860 | + } |
---|
| 2861 | + |
---|
| 2862 | + void GenNormalsMesh() |
---|
| 2863 | + { |
---|
| 2864 | + if (blockloop) |
---|
| 2865 | + return; |
---|
| 2866 | + |
---|
| 2867 | + blockloop = true; |
---|
| 2868 | + GenNormalsMesh0(); |
---|
| 2869 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2870 | + { |
---|
| 2871 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2872 | + if (child == null) |
---|
| 2873 | + continue; |
---|
| 2874 | + child.GenNormalsMesh(); |
---|
2766 | 2875 | // Children().release(i); |
---|
2767 | 2876 | } |
---|
2768 | 2877 | blockloop = false; |
---|
.. | .. |
---|
2931 | 3040 | if (bRep != null) |
---|
2932 | 3041 | { |
---|
2933 | 3042 | bRep.GenerateNormals(crease); |
---|
| 3043 | + Touch(); |
---|
| 3044 | + } |
---|
| 3045 | + } |
---|
| 3046 | + |
---|
| 3047 | + void GenNormalsMesh0() |
---|
| 3048 | + { |
---|
| 3049 | + if (bRep != null) |
---|
| 3050 | + { |
---|
| 3051 | + bRep.GenerateNormalsMesh(); |
---|
2934 | 3052 | Touch(); |
---|
2935 | 3053 | } |
---|
2936 | 3054 | } |
---|
.. | .. |
---|
4233 | 4351 | } |
---|
4234 | 4352 | } |
---|
4235 | 4353 | |
---|
| 4354 | + void RepairSOV() |
---|
| 4355 | + { |
---|
| 4356 | + if (blockloop) |
---|
| 4357 | + return; |
---|
| 4358 | + |
---|
| 4359 | + String texname = this.GetPigmentTexture(); |
---|
| 4360 | + |
---|
| 4361 | + if (texname.startsWith("sov")) |
---|
| 4362 | + { |
---|
| 4363 | + String[] s = texname.split("/"); |
---|
| 4364 | + |
---|
| 4365 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4366 | + |
---|
| 4367 | + texname = sname[0]; |
---|
| 4368 | + |
---|
| 4369 | + if (sname.length > 1) |
---|
| 4370 | + { |
---|
| 4371 | + texname += "Color.jpg"; |
---|
| 4372 | + } |
---|
| 4373 | + |
---|
| 4374 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4375 | + } |
---|
| 4376 | + |
---|
| 4377 | + texname = this.GetBumpTexture(); |
---|
| 4378 | + |
---|
| 4379 | + if (texname.startsWith("sov")) |
---|
| 4380 | + { |
---|
| 4381 | + String[] s = texname.split("/"); |
---|
| 4382 | + |
---|
| 4383 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4384 | + |
---|
| 4385 | + texname = sname[0]; |
---|
| 4386 | + |
---|
| 4387 | + if (sname.length > 1) |
---|
| 4388 | + { |
---|
| 4389 | + texname += "Bump.jpg"; |
---|
| 4390 | + } |
---|
| 4391 | + |
---|
| 4392 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4393 | + } |
---|
| 4394 | + |
---|
| 4395 | + for (int i=0; i<Size(); i++) |
---|
| 4396 | + { |
---|
| 4397 | + blockloop = true; |
---|
| 4398 | + get(i).RepairSOV(); |
---|
| 4399 | + blockloop = false; |
---|
| 4400 | + } |
---|
| 4401 | + } |
---|
| 4402 | + |
---|
4236 | 4403 | void RepairTexture() |
---|
4237 | 4404 | { |
---|
4238 | 4405 | if (this instanceof FileObject || blockloop) |
---|
.. | .. |
---|
5456 | 5623 | boolean NeedSupport() |
---|
5457 | 5624 | { |
---|
5458 | 5625 | return |
---|
5459 | | - CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
| 5626 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5460 | 5627 | // PROBLEM with CROWD!! |
---|
5461 | 5628 | && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5462 | 5629 | } |
---|
5463 | 5630 | |
---|
5464 | 5631 | static boolean DEBUG_SELECTION = false; |
---|
| 5632 | + |
---|
| 5633 | + boolean IsLive() |
---|
| 5634 | + { |
---|
| 5635 | + if (live) |
---|
| 5636 | + return true; |
---|
| 5637 | + |
---|
| 5638 | + if (parent == null) |
---|
| 5639 | + return false; |
---|
| 5640 | + |
---|
| 5641 | + return parent.IsLive(); |
---|
| 5642 | + } |
---|
5465 | 5643 | |
---|
5466 | 5644 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5467 | 5645 | { |
---|
.. | .. |
---|
5524 | 5702 | support = support; |
---|
5525 | 5703 | |
---|
5526 | 5704 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5527 | | - boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5705 | + boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5528 | 5706 | |
---|
5529 | 5707 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5530 | 5708 | { |
---|
.. | .. |
---|
5544 | 5722 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5545 | 5723 | |
---|
5546 | 5724 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5547 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5725 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5726 | + (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
5548 | 5727 | { |
---|
5549 | 5728 | Globals.lighttouched = true; |
---|
5550 | 5729 | } // all panes... |
---|
| 5730 | + |
---|
5551 | 5731 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5552 | 5732 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5553 | 5733 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5715 | 5895 | tex = GetTextures(); |
---|
5716 | 5896 | } |
---|
5717 | 5897 | |
---|
5718 | | - boolean failed = false; |
---|
| 5898 | + boolean failedPigment = false; |
---|
| 5899 | + boolean failedBump = false; |
---|
5719 | 5900 | |
---|
5720 | 5901 | try |
---|
5721 | 5902 | { |
---|
5722 | | - display.BindTextures(tex, texres); |
---|
| 5903 | + display.BindPigmentTexture(tex, texres); |
---|
5723 | 5904 | } |
---|
5724 | 5905 | catch (Exception e) |
---|
5725 | 5906 | { |
---|
5726 | 5907 | System.err.println("FAILED: " + this); |
---|
5727 | | - failed = true; |
---|
| 5908 | + failedPigment = true; |
---|
| 5909 | + } |
---|
| 5910 | + |
---|
| 5911 | + try |
---|
| 5912 | + { |
---|
| 5913 | + display.BindBumpTexture(tex, texres); |
---|
| 5914 | + } |
---|
| 5915 | + catch (Exception e) |
---|
| 5916 | + { |
---|
| 5917 | + //System.err.println("FAILED: " + this); |
---|
| 5918 | + failedBump = true; |
---|
5728 | 5919 | } |
---|
5729 | 5920 | |
---|
5730 | 5921 | if (!compiled) |
---|
.. | .. |
---|
5747 | 5938 | } |
---|
5748 | 5939 | } |
---|
5749 | 5940 | |
---|
5750 | | - if (!failed) |
---|
5751 | | - display.ReleaseTextures(tex); |
---|
| 5941 | + if (!failedBump) |
---|
| 5942 | + display.ReleaseBumpTexture(tex); |
---|
| 5943 | + |
---|
| 5944 | + if (!failedPigment) |
---|
| 5945 | + display.ReleasePigmentTexture(tex); |
---|
5752 | 5946 | |
---|
5753 | 5947 | display.PopMaterial(this, selected); |
---|
5754 | 5948 | } |
---|
.. | .. |
---|
6973 | 7167 | spot.translate(32, 32); |
---|
6974 | 7168 | spotw = spot.x + spot.width; |
---|
6975 | 7169 | spoth = spot.y + spot.height; |
---|
6976 | | - info.g.setColor(Color.blue); |
---|
| 7170 | + info.g.setColor(Color.cyan); |
---|
6977 | 7171 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6978 | 7172 | // if (CameraPane.Xmin > spot.x) |
---|
6979 | 7173 | // { |
---|
.. | .. |
---|
6991 | 7185 | // { |
---|
6992 | 7186 | // CameraPane.Ymax = spoth; |
---|
6993 | 7187 | // } |
---|
6994 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6995 | | - //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7188 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7189 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
6996 | 7190 | spot.translate(0, -32); |
---|
6997 | | - info.g.setColor(Color.green); |
---|
| 7191 | + info.g.setColor(Color.yellow); |
---|
6998 | 7192 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7193 | + info.g.setColor(Color.green); |
---|
6999 | 7194 | // if (CameraPane.Xmin > spot.x) |
---|
7000 | 7195 | // { |
---|
7001 | 7196 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7313 | 7508 | switch (info.pane.RenderCamera().viewCode) |
---|
7314 | 7509 | { |
---|
7315 | 7510 | case 3: // '\001' |
---|
7316 | | - if (modified) |
---|
| 7511 | + if (modified || opposite) |
---|
7317 | 7512 | { |
---|
7318 | 7513 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7319 | 7514 | LA.matScale(toParent, totalScale, 1, 1); |
---|
7320 | 7515 | } // vScale, 1); |
---|
7321 | 7516 | else |
---|
7322 | 7517 | { |
---|
| 7518 | + // EXCEPTION! |
---|
7323 | 7519 | LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7324 | 7520 | } // vScale, 1); |
---|
7325 | 7521 | break; |
---|
7326 | 7522 | |
---|
7327 | 7523 | case 2: // '\002' |
---|
7328 | | - if (modified) |
---|
| 7524 | + if (modified || opposite) |
---|
7329 | 7525 | { |
---|
7330 | 7526 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7331 | 7527 | LA.matScale(toParent, 1, totalScale, 1); |
---|
.. | .. |
---|
7336 | 7532 | break; |
---|
7337 | 7533 | |
---|
7338 | 7534 | case 1: // '\003' |
---|
7339 | | - if (modified) |
---|
| 7535 | + if (modified || opposite) |
---|
7340 | 7536 | { |
---|
7341 | 7537 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7342 | 7538 | LA.matScale(toParent, 1, 1, totalScale); |
---|
.. | .. |
---|
7567 | 7763 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7568 | 7764 | |
---|
7569 | 7765 | Object3D /*Composite*/ parent; |
---|
7570 | | - Object3D /*Composite*/ fileparent; |
---|
| 7766 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7571 | 7767 | |
---|
7572 | 7768 | double[][] toParent; // dynamic matrix |
---|
7573 | 7769 | double[][] fromParent; |
---|