.. | .. |
---|
22 | 22 | //static final long serialVersionUID = -607422624994562685L; |
---|
23 | 23 | static final long serialVersionUID = 5022536242724664900L; |
---|
24 | 24 | |
---|
| 25 | + // Use GetUUID for backward compatibility with null. |
---|
25 | 26 | private UUID uuid = UUID.randomUUID(); |
---|
| 27 | + |
---|
| 28 | + // TEMPORARY for mocap undo. No need to be transient. |
---|
| 29 | + mocap.reader.BVHReader.BVHResult savebvh; |
---|
| 30 | + Object3D saveskeleton; |
---|
| 31 | + // |
---|
| 32 | + |
---|
| 33 | + String skyboxname; |
---|
| 34 | + String skyboxext; |
---|
| 35 | + |
---|
| 36 | + Object3D versionlist[]; |
---|
| 37 | + int versionindex = -1; |
---|
| 38 | + |
---|
| 39 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
26 | 40 | |
---|
27 | 41 | ScriptNode scriptnode; |
---|
28 | 42 | |
---|
| 43 | + int VersionCount() |
---|
| 44 | + { |
---|
| 45 | + int count = 0; |
---|
| 46 | + |
---|
| 47 | + for (int i = versionlist.length; --i >= 0;) |
---|
| 48 | + { |
---|
| 49 | + if (versionlist[i] != null) |
---|
| 50 | + count++; |
---|
| 51 | + } |
---|
| 52 | + |
---|
| 53 | + return count; |
---|
| 54 | + } |
---|
| 55 | + |
---|
29 | 56 | void InitOthers() |
---|
30 | 57 | { |
---|
31 | 58 | if (projectedVertices == null || projectedVertices.length <= 2) |
---|
.. | .. |
---|
104 | 131 | |
---|
105 | 132 | // transient boolean reduced; // for morph reduction |
---|
106 | 133 | |
---|
107 | | -transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
108 | | -transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
| 134 | + transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
| 135 | + transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
109 | 136 | |
---|
110 | | -transient Object3D transientsupport; // for cloning |
---|
111 | | -transient boolean transientlink2master; |
---|
| 137 | + transient Object3D transientsupport; // for cloning |
---|
| 138 | + transient boolean transientlink2master; |
---|
112 | 139 | |
---|
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) |
---|
| 140 | + void SaveSupports() |
---|
125 | 141 | { |
---|
126 | | - bRep.SaveSupports(); |
---|
| 142 | + if (blockloop) |
---|
| 143 | + return; |
---|
| 144 | + |
---|
| 145 | + transientsupport = support; |
---|
| 146 | + transientlink2master = link2master; |
---|
| 147 | + |
---|
| 148 | + support = null; |
---|
| 149 | + link2master = false; |
---|
| 150 | + |
---|
| 151 | + if (bRep != null) |
---|
| 152 | + { |
---|
| 153 | + bRep.SaveSupports(); |
---|
| 154 | + } |
---|
| 155 | + |
---|
| 156 | + for (int i = 0; i < Size(); i++) |
---|
| 157 | + { |
---|
| 158 | + Object3D child = (Object3D) get(i); |
---|
| 159 | + if (child == null) |
---|
| 160 | + continue; |
---|
| 161 | + blockloop = true; |
---|
| 162 | + child.SaveSupports(); |
---|
| 163 | + blockloop = false; |
---|
| 164 | + } |
---|
127 | 165 | } |
---|
128 | | - |
---|
129 | | - for (int i = 0; i < Size(); i++) |
---|
| 166 | + |
---|
| 167 | + void RestoreSupports() |
---|
130 | 168 | { |
---|
131 | | - Object3D child = (Object3D) get(i); |
---|
132 | | - if (child == null) |
---|
133 | | - continue; |
---|
| 169 | + if (blockloop) |
---|
| 170 | + return; |
---|
| 171 | + |
---|
| 172 | + support = transientsupport; |
---|
| 173 | + link2master = transientlink2master; |
---|
| 174 | + transientsupport = null; |
---|
| 175 | + transientlink2master = false; |
---|
| 176 | + |
---|
| 177 | + if (bRep != null) |
---|
| 178 | + { |
---|
| 179 | + bRep.RestoreSupports(); |
---|
| 180 | + } |
---|
| 181 | + |
---|
| 182 | + for (int i = 0; i < Size(); i++) |
---|
| 183 | + { |
---|
| 184 | + Object3D child = (Object3D) get(i); |
---|
| 185 | + if (child == null) |
---|
| 186 | + continue; |
---|
| 187 | + blockloop = true; |
---|
| 188 | + child.RestoreSupports(); |
---|
| 189 | + blockloop = false; |
---|
| 190 | + } |
---|
| 191 | + } |
---|
| 192 | + |
---|
| 193 | + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 194 | + { |
---|
| 195 | + Object3D o; |
---|
| 196 | + |
---|
| 197 | + if (hashtable.containsKey(GetUUID())) |
---|
| 198 | + { |
---|
| 199 | + o = hashtable.get(GetUUID()); |
---|
| 200 | + |
---|
| 201 | + Grafreed.Assert(this.bRep == o.bRep); |
---|
| 202 | + //if (this.bRep != null) |
---|
| 203 | + // assert(this.bRep.support == o.transientrep); |
---|
| 204 | + if (this.support != null) |
---|
| 205 | + assert(this.support.bRep == o.transientrep); |
---|
| 206 | + } |
---|
| 207 | + else |
---|
| 208 | + { |
---|
| 209 | + o = new Object3D("copy of " + this.name); |
---|
| 210 | + |
---|
| 211 | + hashtable.put(GetUUID(), o); |
---|
| 212 | + } |
---|
| 213 | + |
---|
| 214 | + if (!blockloop) |
---|
| 215 | + { |
---|
| 216 | + blockloop = true; |
---|
| 217 | + |
---|
| 218 | + for (int i=0; i<Size(); i++) |
---|
| 219 | + { |
---|
| 220 | + get(i).ExtractBigData(hashtable); |
---|
| 221 | + } |
---|
| 222 | + |
---|
| 223 | + blockloop = false; |
---|
| 224 | + } |
---|
| 225 | + |
---|
| 226 | + ExtractBigData(o); |
---|
| 227 | + } |
---|
| 228 | + |
---|
| 229 | + void ExtractBigData(Object3D o) |
---|
| 230 | + { |
---|
| 231 | + if (o.bRep != null) |
---|
| 232 | + Grafreed.Assert(o.bRep == this.bRep); |
---|
| 233 | + |
---|
| 234 | + o.bRep = this.bRep; |
---|
| 235 | +// July 2019 if (this.bRep != null) |
---|
| 236 | +// { |
---|
| 237 | +// o.transientrep = this.bRep.support; |
---|
| 238 | +// o.bRep.support = null; |
---|
| 239 | +// } |
---|
| 240 | + o.selection = this.selection; |
---|
| 241 | + o.versionlist = this.versionlist; |
---|
| 242 | + o.versionindex = this.versionindex; |
---|
| 243 | + |
---|
| 244 | + if (this.support != null) |
---|
| 245 | + { |
---|
| 246 | + if (o.transientrep != null) |
---|
| 247 | + Grafreed.Assert(o.transientrep == this.support.bRep); |
---|
| 248 | + |
---|
| 249 | + o.transientrep = this.support.bRep; |
---|
| 250 | + this.support.bRep = null; |
---|
| 251 | + } |
---|
| 252 | + |
---|
| 253 | + // o.support = this.support; |
---|
| 254 | + // o.fileparent = this.fileparent; |
---|
| 255 | + // if (this.bRep != null) |
---|
| 256 | + // o.bRep = this.bRep.support; |
---|
| 257 | + |
---|
| 258 | + this.bRep = null; |
---|
| 259 | + // if (this.bRep != null) |
---|
| 260 | + // this.bRep.support = null; |
---|
| 261 | + // this.support = null; |
---|
| 262 | + // this.fileparent = null; |
---|
| 263 | + } |
---|
| 264 | + |
---|
| 265 | +// Object3D GetObject(java.util.UUID uuid) |
---|
| 266 | +// { |
---|
| 267 | +// if (this.uuid.equals(uuid)) |
---|
| 268 | +// return this; |
---|
| 269 | +// |
---|
| 270 | +// if (blockloop) |
---|
| 271 | +// return null; |
---|
| 272 | +// |
---|
| 273 | +// blockloop = true; |
---|
| 274 | +// |
---|
| 275 | +// for (int i=0; i<Size(); i++) |
---|
| 276 | +// { |
---|
| 277 | +// Object3D o = get(i).GetObject(uuid); |
---|
| 278 | +// |
---|
| 279 | +// if (o != null) |
---|
| 280 | +// return o; |
---|
| 281 | +// } |
---|
| 282 | +// |
---|
| 283 | +// blockloop = false; |
---|
| 284 | +// |
---|
| 285 | +// return null; |
---|
| 286 | +// } |
---|
| 287 | + |
---|
| 288 | + transient boolean tag; |
---|
| 289 | + |
---|
| 290 | + void TagObjects(Object3D o, boolean tag) |
---|
| 291 | + { |
---|
| 292 | + if (blockloop) |
---|
| 293 | + return; |
---|
| 294 | + |
---|
| 295 | + o.tag = tag; |
---|
| 296 | + |
---|
| 297 | + if (o == this) |
---|
| 298 | + return; |
---|
| 299 | + |
---|
134 | 300 | blockloop = true; |
---|
135 | | - child.SaveSupports(); |
---|
| 301 | + |
---|
| 302 | + for (int i=0; i<Size(); i++) |
---|
| 303 | + { |
---|
| 304 | + get(i).TagObjects(o, tag); |
---|
| 305 | + } |
---|
| 306 | + |
---|
136 | 307 | blockloop = false; |
---|
137 | 308 | } |
---|
138 | | -} |
---|
139 | 309 | |
---|
140 | | -void RestoreSupports() |
---|
141 | | -{ |
---|
142 | | - if (blockloop) |
---|
143 | | - return; |
---|
| 310 | + boolean HasTags() |
---|
| 311 | + { |
---|
| 312 | + if (blockloop) |
---|
| 313 | + return false; |
---|
144 | 314 | |
---|
145 | | - support = transientsupport; |
---|
146 | | - link2master = transientlink2master; |
---|
147 | | - transientsupport = null; |
---|
148 | | - transientlink2master = false; |
---|
149 | | - |
---|
150 | | - if (bRep != null) |
---|
151 | | - { |
---|
152 | | - bRep.RestoreSupports(); |
---|
153 | | - } |
---|
154 | | - |
---|
155 | | - for (int i = 0; i < Size(); i++) |
---|
156 | | - { |
---|
157 | | - Object3D child = (Object3D) get(i); |
---|
158 | | - if (child == null) |
---|
159 | | - continue; |
---|
160 | 315 | blockloop = true; |
---|
161 | | - child.RestoreSupports(); |
---|
| 316 | + |
---|
| 317 | + boolean hasTags = false; |
---|
| 318 | + |
---|
| 319 | + for (int i=0; i<Size(); i++) |
---|
| 320 | + { |
---|
| 321 | + hasTags |= get(i).tag || get(i).HasTags(); |
---|
| 322 | + |
---|
| 323 | + if (hasTags) |
---|
| 324 | + break; |
---|
| 325 | + } |
---|
| 326 | + |
---|
| 327 | + blockloop = false; |
---|
| 328 | + |
---|
| 329 | + return hasTags; |
---|
| 330 | + } |
---|
| 331 | + |
---|
| 332 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 333 | + { |
---|
| 334 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 335 | + return; |
---|
| 336 | + |
---|
| 337 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 338 | + |
---|
| 339 | + RestoreBigData(o); |
---|
| 340 | + |
---|
| 341 | + if (blockloop) |
---|
| 342 | + return; |
---|
| 343 | + |
---|
| 344 | + blockloop = true; |
---|
| 345 | + |
---|
| 346 | + //hashtable.remove(GetUUID()); |
---|
| 347 | + |
---|
| 348 | + for (int i=0; i<Size(); i++) |
---|
| 349 | + { |
---|
| 350 | + get(i).RestoreBigData(hashtable); |
---|
| 351 | + } |
---|
| 352 | + |
---|
162 | 353 | blockloop = false; |
---|
163 | 354 | } |
---|
164 | | -} |
---|
| 355 | + |
---|
| 356 | + void RestoreBigData(Object3D o) |
---|
| 357 | + { |
---|
| 358 | + this.bRep = o.bRep; |
---|
| 359 | + if (this.support != null && o.transientrep != null) |
---|
| 360 | + { |
---|
| 361 | + this.support.bRep = o.transientrep; |
---|
| 362 | + } |
---|
| 363 | + |
---|
| 364 | + this.selection = o.selection; |
---|
| 365 | + |
---|
| 366 | + this.versionlist = o.versionlist; |
---|
| 367 | + this.versionindex = o.versionindex; |
---|
| 368 | +// July 2019 if (this.bRep != null) |
---|
| 369 | +// this.bRep.support = o.transientrep; |
---|
| 370 | + // this.support = o.support; |
---|
| 371 | + // this.fileparent = o.fileparent; |
---|
| 372 | + } |
---|
165 | 373 | |
---|
166 | 374 | // MOCAP SUPPORT |
---|
167 | 375 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
304 | 512 | } |
---|
305 | 513 | |
---|
306 | 514 | boolean live = false; |
---|
| 515 | + transient boolean keepdontselect; |
---|
307 | 516 | boolean dontselect = false; |
---|
308 | 517 | boolean hide = false; |
---|
309 | 518 | boolean link2master = false; // performs reset support/master at each frame |
---|
.. | .. |
---|
372 | 581 | } |
---|
373 | 582 | } |
---|
374 | 583 | |
---|
375 | | - int memorysize; |
---|
| 584 | + transient int memorysize; // needs to be transient, dunno why |
---|
376 | 585 | |
---|
377 | 586 | int MemorySize() |
---|
378 | 587 | { |
---|
379 | | - if (true) // memorysize == 0) |
---|
| 588 | + if (memorysize == 0) |
---|
380 | 589 | { |
---|
381 | 590 | try |
---|
382 | 591 | { |
---|
.. | .. |
---|
486 | 695 | toParent = LA.newMatrix(); |
---|
487 | 696 | fromParent = LA.newMatrix(); |
---|
488 | 697 | } |
---|
| 698 | + |
---|
489 | 699 | if (toParentMarked == null) |
---|
490 | 700 | { |
---|
491 | 701 | if (maxcount != 1) |
---|
492 | 702 | { |
---|
493 | | - new Exception().printStackTrace(); |
---|
| 703 | + //new Exception().printStackTrace(); |
---|
494 | 704 | } |
---|
| 705 | + |
---|
495 | 706 | toParentMarked = LA.newMatrix(); |
---|
496 | 707 | fromParentMarked = LA.newMatrix(); |
---|
497 | 708 | } |
---|
.. | .. |
---|
802 | 1013 | |
---|
803 | 1014 | if (marked && Globals.isLIVE() && live && |
---|
804 | 1015 | //TEMP21aug2018 |
---|
805 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 1016 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
806 | 1017 | currentframe != Globals.framecount) |
---|
807 | 1018 | { |
---|
808 | 1019 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
814 | 1025 | |
---|
815 | 1026 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
816 | 1027 | |
---|
817 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 1028 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 1029 | + (step == 1 && changedir)) |
---|
818 | 1030 | { |
---|
819 | 1031 | countdown = 1; |
---|
820 | 1032 | delay = speedup?8:1; |
---|
.. | .. |
---|
886 | 1098 | if (material == null || material.multiply) |
---|
887 | 1099 | return true; |
---|
888 | 1100 | |
---|
| 1101 | + if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1102 | + return false; |
---|
| 1103 | + |
---|
| 1104 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
889 | 1105 | return material.opacity > 0.99; |
---|
890 | 1106 | } |
---|
891 | 1107 | |
---|
.. | .. |
---|
1286 | 1502 | toParent = LA.newMatrix(); |
---|
1287 | 1503 | fromParent = LA.newMatrix(); |
---|
1288 | 1504 | } |
---|
| 1505 | + |
---|
1289 | 1506 | LA.matCopy(other.toParent, toParent); |
---|
1290 | 1507 | LA.matCopy(other.fromParent, fromParent); |
---|
1291 | 1508 | |
---|
.. | .. |
---|
2165 | 2382 | |
---|
2166 | 2383 | InitOthers(); |
---|
2167 | 2384 | |
---|
2168 | | - if (this instanceof Camera) |
---|
2169 | | - { |
---|
2170 | | - material.shift = 90; |
---|
2171 | | - } |
---|
2172 | | - |
---|
2173 | 2385 | material.multiply = multiply; |
---|
2174 | 2386 | |
---|
2175 | 2387 | if (multiply) |
---|
.. | .. |
---|
2307 | 2519 | } |
---|
2308 | 2520 | */ |
---|
2309 | 2521 | } |
---|
| 2522 | + else |
---|
| 2523 | + { |
---|
| 2524 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2525 | + if (objectUI != null) |
---|
| 2526 | + ((ObjEditor)objectUI).pinButton.setSelected(pinned); |
---|
| 2527 | + else |
---|
| 2528 | + //new Exception().printStackTrace(); |
---|
| 2529 | + System.err.println("objectUI is null"); |
---|
| 2530 | + } |
---|
2310 | 2531 | } |
---|
2311 | 2532 | |
---|
2312 | 2533 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2348 | 2569 | { |
---|
2349 | 2570 | editWindow.refreshContents(); |
---|
2350 | 2571 | } |
---|
| 2572 | + else |
---|
| 2573 | + { |
---|
| 2574 | + if (manipWindow != null) |
---|
| 2575 | + { |
---|
| 2576 | + manipWindow.refreshContents(); |
---|
| 2577 | + } |
---|
| 2578 | + } |
---|
| 2579 | + |
---|
2351 | 2580 | //if (parent != null) |
---|
2352 | 2581 | //parent.refreshEditWindow(); |
---|
2353 | 2582 | } |
---|
.. | .. |
---|
2427 | 2656 | private static final int editSelf = 1; |
---|
2428 | 2657 | private static final int editChild = 2; |
---|
2429 | 2658 | |
---|
2430 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2659 | + void drawEditHandles(//ClickInfo info, |
---|
| 2660 | + int level) |
---|
2431 | 2661 | { |
---|
2432 | 2662 | if (level == 0) |
---|
2433 | 2663 | { |
---|
.. | .. |
---|
2435 | 2665 | return; |
---|
2436 | 2666 | |
---|
2437 | 2667 | Object3D selectee; |
---|
2438 | | - for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1)) |
---|
| 2668 | + for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info, |
---|
| 2669 | + level + 1)) |
---|
2439 | 2670 | { |
---|
2440 | 2671 | selectee = (Object3D) e.nextElement(); |
---|
2441 | 2672 | } |
---|
.. | .. |
---|
2443 | 2674 | } else |
---|
2444 | 2675 | { |
---|
2445 | 2676 | //super. |
---|
2446 | | - drawEditHandles0(info, level + 1); |
---|
| 2677 | + drawEditHandles0(//info, |
---|
| 2678 | + level + 1); |
---|
2447 | 2679 | } |
---|
2448 | 2680 | } |
---|
2449 | 2681 | |
---|
2450 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2682 | + boolean doEditClick(//ClickInfo info, |
---|
| 2683 | + int level) |
---|
2451 | 2684 | { |
---|
2452 | 2685 | doSomething = 0; |
---|
2453 | 2686 | if (level == 0) |
---|
2454 | 2687 | { |
---|
2455 | | - return doParentClick(info); |
---|
| 2688 | + return doParentClick(); //info); |
---|
2456 | 2689 | } |
---|
2457 | 2690 | if (//super. |
---|
2458 | | - doEditClick0(info, level)) |
---|
| 2691 | + doEditClick0(//info, |
---|
| 2692 | + level)) |
---|
2459 | 2693 | { |
---|
2460 | 2694 | doSomething = 1; |
---|
2461 | 2695 | return true; |
---|
.. | .. |
---|
2465 | 2699 | } |
---|
2466 | 2700 | } |
---|
2467 | 2701 | |
---|
2468 | | - boolean doParentClick(ClickInfo info) |
---|
| 2702 | + boolean doParentClick() //ClickInfo info) |
---|
2469 | 2703 | { |
---|
2470 | 2704 | if (selection == null) |
---|
2471 | 2705 | { |
---|
.. | .. |
---|
2478 | 2712 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2479 | 2713 | { |
---|
2480 | 2714 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2481 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2715 | + if (selectee.doEditClick(//info, |
---|
| 2716 | + 1)) |
---|
2482 | 2717 | { |
---|
2483 | 2718 | childToDrag = selectee; |
---|
2484 | 2719 | doSomething = 2; |
---|
.. | .. |
---|
2490 | 2725 | return retval; |
---|
2491 | 2726 | } |
---|
2492 | 2727 | |
---|
2493 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 2728 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2729 | + boolean opposite) |
---|
2494 | 2730 | { |
---|
2495 | 2731 | switch (doSomething) |
---|
2496 | 2732 | { |
---|
2497 | 2733 | case 1: // '\001' |
---|
2498 | 2734 | //super. |
---|
2499 | | - doEditDrag0(info, opposite); |
---|
| 2735 | + doEditDrag0(//clickInfo, |
---|
| 2736 | + opposite); |
---|
2500 | 2737 | break; |
---|
2501 | 2738 | |
---|
2502 | 2739 | case 2: // '\002' |
---|
.. | .. |
---|
2509 | 2746 | { |
---|
2510 | 2747 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2511 | 2748 | //childToDrag.doEditDrag(info); |
---|
2512 | | - sel.doEditDrag(info, opposite); |
---|
| 2749 | + sel.doEditDrag(//clickInfo, |
---|
| 2750 | + opposite); |
---|
2513 | 2751 | } else |
---|
2514 | 2752 | { |
---|
2515 | 2753 | //super. |
---|
2516 | | - doEditDrag0(info, opposite); |
---|
| 2754 | + doEditDrag0(//clickInfo, |
---|
| 2755 | + opposite); |
---|
2517 | 2756 | } |
---|
2518 | 2757 | } |
---|
2519 | 2758 | break; |
---|
.. | .. |
---|
2531 | 2770 | { |
---|
2532 | 2771 | deselectAll(); |
---|
2533 | 2772 | } |
---|
| 2773 | + |
---|
| 2774 | + new Exception().printStackTrace(); |
---|
| 2775 | + |
---|
2534 | 2776 | ClickInfo newInfo = new ClickInfo(); |
---|
2535 | 2777 | newInfo.flags = info.flags; |
---|
2536 | 2778 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
2623 | 2865 | void GenNormalsS(boolean crease) |
---|
2624 | 2866 | { |
---|
2625 | 2867 | selection.GenNormals(crease); |
---|
| 2868 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2869 | +// { |
---|
| 2870 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2871 | +// selectee.GenNormals(crease); |
---|
| 2872 | +// } |
---|
| 2873 | + |
---|
| 2874 | + //Touch(); |
---|
| 2875 | + } |
---|
| 2876 | + |
---|
| 2877 | + void GenNormalsMeshS() |
---|
| 2878 | + { |
---|
| 2879 | + selection.GenNormalsMesh(); |
---|
2626 | 2880 | // for (int i=0; i<selection.size(); i++) |
---|
2627 | 2881 | // { |
---|
2628 | 2882 | // Object3D selectee = (Object3D) selection.elementAt(i); |
---|
.. | .. |
---|
2763 | 3017 | if (child == null) |
---|
2764 | 3018 | continue; |
---|
2765 | 3019 | child.GenNormals(crease); |
---|
| 3020 | +// Children().release(i); |
---|
| 3021 | + } |
---|
| 3022 | + blockloop = false; |
---|
| 3023 | + } |
---|
| 3024 | + |
---|
| 3025 | + void GenNormalsMesh() |
---|
| 3026 | + { |
---|
| 3027 | + if (blockloop) |
---|
| 3028 | + return; |
---|
| 3029 | + |
---|
| 3030 | + blockloop = true; |
---|
| 3031 | + GenNormalsMesh0(); |
---|
| 3032 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 3033 | + { |
---|
| 3034 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 3035 | + if (child == null) |
---|
| 3036 | + continue; |
---|
| 3037 | + child.GenNormalsMesh(); |
---|
2766 | 3038 | // Children().release(i); |
---|
2767 | 3039 | } |
---|
2768 | 3040 | blockloop = false; |
---|
.. | .. |
---|
2935 | 3207 | } |
---|
2936 | 3208 | } |
---|
2937 | 3209 | |
---|
| 3210 | + void GenNormalsMesh0() |
---|
| 3211 | + { |
---|
| 3212 | + if (bRep != null) |
---|
| 3213 | + { |
---|
| 3214 | + bRep.GenerateNormalsMesh(); |
---|
| 3215 | + Touch(); |
---|
| 3216 | + } |
---|
| 3217 | + } |
---|
| 3218 | + |
---|
2938 | 3219 | void GenNormalsMINE0() |
---|
2939 | 3220 | { |
---|
2940 | 3221 | if (bRep != null) |
---|
2941 | 3222 | { |
---|
2942 | | - bRep.GenerateNormalsMINE(); |
---|
| 3223 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
2943 | 3224 | Touch(); |
---|
2944 | 3225 | } |
---|
2945 | 3226 | } |
---|
.. | .. |
---|
2996 | 3277 | blockloop = false; |
---|
2997 | 3278 | } |
---|
2998 | 3279 | |
---|
| 3280 | + public void ResetTransform(int mask) |
---|
| 3281 | + { |
---|
| 3282 | + Object3D obj = this; |
---|
| 3283 | + |
---|
| 3284 | + if (mask == -1) |
---|
| 3285 | + { |
---|
| 3286 | + if (obj instanceof Camera) // jan 2014 |
---|
| 3287 | + { |
---|
| 3288 | + LA.matIdentity(obj.toParent); |
---|
| 3289 | + LA.matIdentity(obj.fromParent); |
---|
| 3290 | + } |
---|
| 3291 | + else |
---|
| 3292 | + { |
---|
| 3293 | + obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent); |
---|
| 3294 | + obj.fromParent = null; // LA.matIdentity(obj.fromParent); |
---|
| 3295 | + } |
---|
| 3296 | + return; |
---|
| 3297 | + } |
---|
| 3298 | + |
---|
| 3299 | + if ((mask&2) != 0) // Scale/rotation |
---|
| 3300 | + { |
---|
| 3301 | + obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1; |
---|
| 3302 | + obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0; |
---|
| 3303 | + obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0; |
---|
| 3304 | + obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1; |
---|
| 3305 | + obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0; |
---|
| 3306 | + obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0; |
---|
| 3307 | + } |
---|
| 3308 | + if ((mask&1) != 0) // Translation |
---|
| 3309 | + { |
---|
| 3310 | + if (obj.toParent != null) |
---|
| 3311 | + { |
---|
| 3312 | + obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0; |
---|
| 3313 | + obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0; |
---|
| 3314 | + } |
---|
| 3315 | + } |
---|
| 3316 | + } |
---|
| 3317 | + |
---|
| 3318 | + public void TextureRatioTransform(int axis) |
---|
| 3319 | + { |
---|
| 3320 | + cTexture tex = GetTextures(); |
---|
| 3321 | + |
---|
| 3322 | + com.sun.opengl.util.texture.TextureData texturedata = null; |
---|
| 3323 | + |
---|
| 3324 | + try |
---|
| 3325 | + { |
---|
| 3326 | + texturedata = Globals.theRenderer.GetTextureData(tex, false, texres); |
---|
| 3327 | + } |
---|
| 3328 | + catch (Exception e) |
---|
| 3329 | + { |
---|
| 3330 | + System.err.println("FAIL TextureRatio: " + this); |
---|
| 3331 | + } |
---|
| 3332 | + |
---|
| 3333 | + LA.matIdentity(Object3D.mat); |
---|
| 3334 | + Object3D.mat[axis][axis] = (double)texturedata.getWidth() / texturedata.getHeight(); |
---|
| 3335 | + |
---|
| 3336 | + if (toParent == null) |
---|
| 3337 | + { |
---|
| 3338 | + toParent = LA.newMatrix(); |
---|
| 3339 | + fromParent = LA.newMatrix(); |
---|
| 3340 | + } |
---|
| 3341 | + |
---|
| 3342 | + ResetTransform(2); |
---|
| 3343 | + |
---|
| 3344 | + LA.matConcat(Object3D.mat, fromParent, fromParent); |
---|
| 3345 | + LA.matInvert(fromParent, toParent); |
---|
| 3346 | + } |
---|
| 3347 | + |
---|
| 3348 | + void TextureRatio(int axis) |
---|
| 3349 | + { |
---|
| 3350 | + if (blockloop) |
---|
| 3351 | + return; |
---|
| 3352 | + |
---|
| 3353 | + blockloop = true; |
---|
| 3354 | + |
---|
| 3355 | + TextureRatioTransform(axis); |
---|
| 3356 | + |
---|
| 3357 | + for (int i=Size(); --i>=0;) |
---|
| 3358 | + { |
---|
| 3359 | + Object3D v = get(i); |
---|
| 3360 | + |
---|
| 3361 | + v.TextureRatio(axis); |
---|
| 3362 | + } |
---|
| 3363 | + |
---|
| 3364 | + blockloop = false; |
---|
| 3365 | + } |
---|
| 3366 | + |
---|
2999 | 3367 | void TransformChildren() |
---|
3000 | 3368 | { |
---|
3001 | 3369 | if (toParent != null) |
---|
.. | .. |
---|
3349 | 3717 | |
---|
3350 | 3718 | void ClearMaterials() |
---|
3351 | 3719 | { |
---|
| 3720 | + if (blockloop) |
---|
| 3721 | + return; |
---|
| 3722 | + |
---|
| 3723 | + blockloop = true; |
---|
| 3724 | + |
---|
3352 | 3725 | ClearMaterial(); |
---|
3353 | | - for (int i = 0; i < size(); i++) |
---|
| 3726 | + for (int i = 0; i < Size(); i++) |
---|
3354 | 3727 | { |
---|
3355 | | - Object3D child = (Object3D) reserve(i); |
---|
| 3728 | + Object3D child = (Object3D) get(i); |
---|
3356 | 3729 | if (child == null) |
---|
3357 | 3730 | continue; |
---|
3358 | 3731 | child.ClearMaterials(); |
---|
3359 | | - release(i); |
---|
3360 | 3732 | } |
---|
| 3733 | + |
---|
| 3734 | + blockloop = false; |
---|
| 3735 | + } |
---|
| 3736 | + |
---|
| 3737 | + void ClearVersionList() |
---|
| 3738 | + { |
---|
| 3739 | + this.versionlist = null; |
---|
| 3740 | + this.versionindex = -1; |
---|
| 3741 | + this.versiontable = null; |
---|
| 3742 | + } |
---|
| 3743 | + |
---|
| 3744 | + void ClearVersions() |
---|
| 3745 | + { |
---|
| 3746 | + if (blockloop) |
---|
| 3747 | + return; |
---|
| 3748 | + |
---|
| 3749 | + blockloop = true; |
---|
| 3750 | + |
---|
| 3751 | + ClearVersionList(); |
---|
| 3752 | + for (int i = 0; i < Size(); i++) |
---|
| 3753 | + { |
---|
| 3754 | + Object3D child = (Object3D) get(i); |
---|
| 3755 | + if (child == null) |
---|
| 3756 | + continue; |
---|
| 3757 | + child.ClearVersions(); |
---|
| 3758 | + } |
---|
| 3759 | + |
---|
| 3760 | + blockloop = false; |
---|
3361 | 3761 | } |
---|
3362 | 3762 | |
---|
3363 | 3763 | void FlipV(boolean flip) |
---|
.. | .. |
---|
3385 | 3785 | if (blockloop) |
---|
3386 | 3786 | return; |
---|
3387 | 3787 | |
---|
3388 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3788 | + if (//marked || // does not make sense |
---|
| 3789 | + (bRep != null || material != null)) // borderline... |
---|
3389 | 3790 | live = h; |
---|
3390 | 3791 | |
---|
3391 | 3792 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3406 | 3807 | return; |
---|
3407 | 3808 | |
---|
3408 | 3809 | //if (bRep != null) |
---|
3409 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3810 | + if (//marked || // does not make sense |
---|
| 3811 | + (bRep != null || material != null)) // borderline... |
---|
3410 | 3812 | link2master = h; |
---|
3411 | 3813 | |
---|
3412 | 3814 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3426 | 3828 | if (blockloop) |
---|
3427 | 3829 | return; |
---|
3428 | 3830 | |
---|
3429 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3831 | + if (//marked || // does not make sense |
---|
| 3832 | + (bRep != null || material != null)) // borderline... |
---|
3430 | 3833 | hide = h; |
---|
3431 | 3834 | |
---|
3432 | 3835 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3446 | 3849 | if (blockloop) |
---|
3447 | 3850 | return; |
---|
3448 | 3851 | |
---|
3449 | | - if (bRep != null && material != null) // borderline... |
---|
| 3852 | + if (bRep != null || material != null) // borderline... |
---|
3450 | 3853 | marked = h; |
---|
3451 | 3854 | |
---|
3452 | 3855 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3456 | 3859 | continue; |
---|
3457 | 3860 | blockloop = true; |
---|
3458 | 3861 | child.MarkLeaves(h); |
---|
| 3862 | + blockloop = false; |
---|
| 3863 | + // release(i); |
---|
| 3864 | + } |
---|
| 3865 | + } |
---|
| 3866 | + |
---|
| 3867 | + void RewindLeaves(boolean h) |
---|
| 3868 | + { |
---|
| 3869 | + if (blockloop) |
---|
| 3870 | + return; |
---|
| 3871 | + |
---|
| 3872 | + if (bRep != null || material != null) // borderline... |
---|
| 3873 | + rewind = h; |
---|
| 3874 | + |
---|
| 3875 | + for (int i = 0; i < Size(); i++) |
---|
| 3876 | + { |
---|
| 3877 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3878 | + if (child == null) |
---|
| 3879 | + continue; |
---|
| 3880 | + blockloop = true; |
---|
| 3881 | + child.RewindLeaves(h); |
---|
| 3882 | + blockloop = false; |
---|
| 3883 | + // release(i); |
---|
| 3884 | + } |
---|
| 3885 | + } |
---|
| 3886 | + |
---|
| 3887 | + void RandomLeaves(boolean h) |
---|
| 3888 | + { |
---|
| 3889 | + if (blockloop) |
---|
| 3890 | + return; |
---|
| 3891 | + |
---|
| 3892 | + if (bRep != null || material != null) // borderline... |
---|
| 3893 | + random = h; |
---|
| 3894 | + |
---|
| 3895 | + for (int i = 0; i < Size(); i++) |
---|
| 3896 | + { |
---|
| 3897 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3898 | + if (child == null) |
---|
| 3899 | + continue; |
---|
| 3900 | + blockloop = true; |
---|
| 3901 | + child.RandomLeaves(h); |
---|
3459 | 3902 | blockloop = false; |
---|
3460 | 3903 | // release(i); |
---|
3461 | 3904 | } |
---|
.. | .. |
---|
4233 | 4676 | } |
---|
4234 | 4677 | } |
---|
4235 | 4678 | |
---|
| 4679 | + void RepairSOV() |
---|
| 4680 | + { |
---|
| 4681 | + if (blockloop) |
---|
| 4682 | + return; |
---|
| 4683 | + |
---|
| 4684 | + String texname = this.GetPigmentTexture(); |
---|
| 4685 | + |
---|
| 4686 | + if (texname.startsWith("sov")) |
---|
| 4687 | + { |
---|
| 4688 | + String[] s = texname.split("/"); |
---|
| 4689 | + |
---|
| 4690 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4691 | + |
---|
| 4692 | + texname = sname[0]; |
---|
| 4693 | + |
---|
| 4694 | + if (sname.length > 1) |
---|
| 4695 | + { |
---|
| 4696 | + texname += "Color.jpg"; |
---|
| 4697 | + } |
---|
| 4698 | + |
---|
| 4699 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4700 | + } |
---|
| 4701 | + |
---|
| 4702 | + texname = this.GetBumpTexture(); |
---|
| 4703 | + |
---|
| 4704 | + if (texname.startsWith("sov")) |
---|
| 4705 | + { |
---|
| 4706 | + String[] s = texname.split("/"); |
---|
| 4707 | + |
---|
| 4708 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4709 | + |
---|
| 4710 | + texname = sname[0]; |
---|
| 4711 | + |
---|
| 4712 | + if (sname.length > 1) |
---|
| 4713 | + { |
---|
| 4714 | + texname += "Bump.jpg"; |
---|
| 4715 | + } |
---|
| 4716 | + |
---|
| 4717 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4718 | + } |
---|
| 4719 | + |
---|
| 4720 | + for (int i=0; i<Size(); i++) |
---|
| 4721 | + { |
---|
| 4722 | + blockloop = true; |
---|
| 4723 | + get(i).RepairSOV(); |
---|
| 4724 | + blockloop = false; |
---|
| 4725 | + } |
---|
| 4726 | + } |
---|
| 4727 | + |
---|
4236 | 4728 | void RepairTexture() |
---|
4237 | 4729 | { |
---|
4238 | 4730 | if (this instanceof FileObject || blockloop) |
---|
.. | .. |
---|
4747 | 5239 | } |
---|
4748 | 5240 | } |
---|
4749 | 5241 | |
---|
| 5242 | + ObjEditor GetWindow() |
---|
| 5243 | + { |
---|
| 5244 | + if (editWindow != null) |
---|
| 5245 | + return editWindow; |
---|
| 5246 | + |
---|
| 5247 | + return manipWindow; |
---|
| 5248 | + } |
---|
| 5249 | + |
---|
4750 | 5250 | cTreePath Select(int indexcount, boolean deselect) |
---|
4751 | 5251 | { |
---|
4752 | 5252 | if (hide || dontselect) |
---|
.. | .. |
---|
4783 | 5283 | if (leaf != null) |
---|
4784 | 5284 | { |
---|
4785 | 5285 | cTreePath tp = new cTreePath(this, leaf); |
---|
4786 | | - if (editWindow != null) |
---|
| 5286 | + ObjEditor window = GetWindow(); |
---|
| 5287 | + if (window != null) |
---|
4787 | 5288 | { |
---|
4788 | 5289 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4789 | | - editWindow.Select(tp, deselect, true); |
---|
| 5290 | + window.Select(tp, deselect, true); |
---|
4790 | 5291 | } |
---|
4791 | 5292 | |
---|
4792 | 5293 | return tp; |
---|
.. | .. |
---|
4803 | 5304 | |
---|
4804 | 5305 | if (child == null) |
---|
4805 | 5306 | continue; |
---|
| 5307 | + |
---|
4806 | 5308 | if (child.HasTransparency() && child.size() != 0) |
---|
4807 | 5309 | { |
---|
4808 | 5310 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4812 | 5314 | if (leaf != null) |
---|
4813 | 5315 | { |
---|
4814 | 5316 | cTreePath tp = new cTreePath(this, leaf); |
---|
4815 | | - if (editWindow != null) |
---|
| 5317 | + ObjEditor window = GetWindow(); |
---|
| 5318 | + if (window != null) |
---|
4816 | 5319 | { |
---|
4817 | | - editWindow.Select(tp, deselect, true); |
---|
| 5320 | + window.Select(tp, deselect, true); |
---|
4818 | 5321 | } |
---|
4819 | 5322 | |
---|
4820 | 5323 | return tp; |
---|
.. | .. |
---|
5139 | 5642 | blockloop = false; |
---|
5140 | 5643 | } |
---|
5141 | 5644 | |
---|
| 5645 | + void ResetSelectable() |
---|
| 5646 | + { |
---|
| 5647 | + if (blockloop) |
---|
| 5648 | + return; |
---|
| 5649 | + |
---|
| 5650 | + blockloop = true; |
---|
| 5651 | + |
---|
| 5652 | + keepdontselect = dontselect; |
---|
| 5653 | + dontselect = true; |
---|
| 5654 | + |
---|
| 5655 | + Object3D child; |
---|
| 5656 | + int nb = Size(); |
---|
| 5657 | + for (int i = 0; i < nb; i++) |
---|
| 5658 | + { |
---|
| 5659 | + child = (Object3D) get(i); |
---|
| 5660 | + if (child == null) |
---|
| 5661 | + continue; |
---|
| 5662 | + child.ResetSelectable(); |
---|
| 5663 | + } |
---|
| 5664 | + |
---|
| 5665 | + blockloop = false; |
---|
| 5666 | + } |
---|
| 5667 | + |
---|
| 5668 | + void RestoreSelectable() |
---|
| 5669 | + { |
---|
| 5670 | + if (blockloop) |
---|
| 5671 | + return; |
---|
| 5672 | + |
---|
| 5673 | + blockloop = true; |
---|
| 5674 | + |
---|
| 5675 | + dontselect = keepdontselect; |
---|
| 5676 | + |
---|
| 5677 | + Object3D child; |
---|
| 5678 | + int nb = Size(); |
---|
| 5679 | + for (int i = 0; i < nb; i++) |
---|
| 5680 | + { |
---|
| 5681 | + child = (Object3D) get(i); |
---|
| 5682 | + if (child == null) |
---|
| 5683 | + continue; |
---|
| 5684 | + child.RestoreSelectable(); |
---|
| 5685 | + } |
---|
| 5686 | + |
---|
| 5687 | + blockloop = false; |
---|
| 5688 | + } |
---|
| 5689 | + |
---|
5142 | 5690 | boolean IsSelected() |
---|
5143 | 5691 | { |
---|
5144 | 5692 | if (parent == null) |
---|
.. | .. |
---|
5199 | 5747 | if (fullname == null) |
---|
5200 | 5748 | return ""; |
---|
5201 | 5749 | |
---|
| 5750 | + if (fullname.pigment != null) |
---|
| 5751 | + { |
---|
| 5752 | + return fullname.pigment; |
---|
| 5753 | + } |
---|
| 5754 | + |
---|
5202 | 5755 | // System.out.println("Fullname = " + fullname); |
---|
5203 | 5756 | |
---|
5204 | 5757 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5211 | 5764 | |
---|
5212 | 5765 | if (split.length == 0) |
---|
5213 | 5766 | { |
---|
5214 | | - return ""; |
---|
| 5767 | + return fullname.pigment = ""; |
---|
5215 | 5768 | } |
---|
5216 | 5769 | |
---|
5217 | 5770 | if (split.length <= 2) |
---|
.. | .. |
---|
5219 | 5772 | if (fullname.name.endsWith(":")) |
---|
5220 | 5773 | { |
---|
5221 | 5774 | // Windows |
---|
5222 | | - return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5775 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
5223 | 5776 | } |
---|
5224 | 5777 | |
---|
5225 | | - return split[0]; |
---|
| 5778 | + return fullname.pigment = split[0]; |
---|
5226 | 5779 | } |
---|
5227 | 5780 | |
---|
5228 | 5781 | // Windows |
---|
5229 | 5782 | assert(split.length == 4); |
---|
5230 | 5783 | |
---|
5231 | | - return split[0] + ":" + split[1]; |
---|
| 5784 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5232 | 5785 | } |
---|
5233 | 5786 | |
---|
5234 | 5787 | static String GetBump(cTexture fullname) |
---|
5235 | 5788 | { |
---|
5236 | 5789 | if (fullname == null) |
---|
5237 | 5790 | return ""; |
---|
| 5791 | + |
---|
| 5792 | + if (fullname.bump != null) |
---|
| 5793 | + { |
---|
| 5794 | + return fullname.bump; |
---|
| 5795 | + } |
---|
5238 | 5796 | |
---|
5239 | 5797 | // System.out.println("Fullname = " + fullname); |
---|
5240 | 5798 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5246 | 5804 | |
---|
5247 | 5805 | if (split.length == 0) |
---|
5248 | 5806 | { |
---|
5249 | | - return ""; |
---|
| 5807 | + return fullname.bump = ""; |
---|
5250 | 5808 | } |
---|
5251 | 5809 | |
---|
5252 | 5810 | if (split.length == 1) |
---|
5253 | 5811 | { |
---|
5254 | | - return ""; |
---|
| 5812 | + return fullname.bump = ""; |
---|
5255 | 5813 | } |
---|
5256 | 5814 | |
---|
5257 | 5815 | if (split.length == 2) |
---|
.. | .. |
---|
5259 | 5817 | if (fullname.name.endsWith(":")) |
---|
5260 | 5818 | { |
---|
5261 | 5819 | // Windows |
---|
5262 | | - return ""; |
---|
| 5820 | + return fullname.bump = ""; |
---|
5263 | 5821 | } |
---|
5264 | 5822 | |
---|
5265 | | - return split[1]; |
---|
| 5823 | + return fullname.bump = split[1]; |
---|
5266 | 5824 | } |
---|
5267 | 5825 | |
---|
5268 | 5826 | // Windows |
---|
5269 | 5827 | assert(split.length == 4); |
---|
5270 | 5828 | |
---|
5271 | | - return split[2] + ":" + split[3]; |
---|
| 5829 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5272 | 5830 | } |
---|
5273 | 5831 | |
---|
5274 | 5832 | String GetPigmentTexture() |
---|
.. | .. |
---|
5351 | 5909 | texname = ""; |
---|
5352 | 5910 | |
---|
5353 | 5911 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 5912 | + |
---|
| 5913 | + GetTextures().pigment = null; |
---|
| 5914 | + |
---|
5354 | 5915 | Touch(); |
---|
5355 | 5916 | } |
---|
5356 | 5917 | |
---|
.. | .. |
---|
5424 | 5985 | |
---|
5425 | 5986 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
5426 | 5987 | |
---|
| 5988 | + GetTextures().bump = null; |
---|
| 5989 | + |
---|
5427 | 5990 | Touch(); |
---|
5428 | 5991 | } |
---|
5429 | 5992 | |
---|
.. | .. |
---|
5448 | 6011 | } |
---|
5449 | 6012 | } |
---|
5450 | 6013 | |
---|
| 6014 | + void EmbedTextures(boolean embed) |
---|
| 6015 | + { |
---|
| 6016 | + if (blockloop) |
---|
| 6017 | + return; |
---|
| 6018 | + |
---|
| 6019 | + //if (GetTextures() != null) |
---|
| 6020 | + if (embed) |
---|
| 6021 | + CameraPane.EmbedTextures(GetTextures()); |
---|
| 6022 | + else |
---|
| 6023 | + { |
---|
| 6024 | + GetTextures().pigmentdata = null; |
---|
| 6025 | + GetTextures().bumpdata = null; |
---|
| 6026 | + GetTextures().pw = 0; |
---|
| 6027 | + GetTextures().ph = 0; |
---|
| 6028 | + GetTextures().bw = 0; |
---|
| 6029 | + GetTextures().bh = 0; |
---|
| 6030 | + } |
---|
| 6031 | + |
---|
| 6032 | + int nb = Size(); |
---|
| 6033 | + for (int i = 0; i < nb; i++) |
---|
| 6034 | + { |
---|
| 6035 | + Object3D child = (Object3D) get(i); |
---|
| 6036 | + |
---|
| 6037 | + if (child == null) |
---|
| 6038 | + continue; |
---|
| 6039 | + |
---|
| 6040 | + blockloop = true; |
---|
| 6041 | + child.EmbedTextures(embed); |
---|
| 6042 | + blockloop = false; |
---|
| 6043 | + } |
---|
| 6044 | + } |
---|
| 6045 | + |
---|
5451 | 6046 | void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5452 | 6047 | { |
---|
5453 | 6048 | Draw(display, root, selected, blocked); |
---|
.. | .. |
---|
5456 | 6051 | boolean NeedSupport() |
---|
5457 | 6052 | { |
---|
5458 | 6053 | return |
---|
5459 | | - CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
| 6054 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5460 | 6055 | // PROBLEM with CROWD!! |
---|
5461 | 6056 | && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5462 | 6057 | } |
---|
5463 | 6058 | |
---|
5464 | 6059 | static boolean DEBUG_SELECTION = false; |
---|
| 6060 | + |
---|
| 6061 | + boolean IsLive() |
---|
| 6062 | + { |
---|
| 6063 | + if (live) |
---|
| 6064 | + return true; |
---|
| 6065 | + |
---|
| 6066 | + if (parent == null) |
---|
| 6067 | + return false; |
---|
| 6068 | + |
---|
| 6069 | + return parent.IsLive(); |
---|
| 6070 | + } |
---|
| 6071 | + |
---|
| 6072 | + boolean IsDynamic() |
---|
| 6073 | + { |
---|
| 6074 | + return live && bRep != null; |
---|
| 6075 | + } |
---|
5465 | 6076 | |
---|
5466 | 6077 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5467 | 6078 | { |
---|
.. | .. |
---|
5523 | 6134 | if (support != null) |
---|
5524 | 6135 | support = support; |
---|
5525 | 6136 | |
---|
5526 | | - //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); |
---|
| 6137 | + boolean usecalllists = !IsDynamic() && |
---|
| 6138 | + IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6139 | + //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6140 | + |
---|
| 6141 | + //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
5528 | 6142 | |
---|
5529 | 6143 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5530 | 6144 | { |
---|
.. | .. |
---|
5534 | 6148 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5535 | 6149 | // usecalllists = false; |
---|
5536 | 6150 | |
---|
5537 | | - if (GetBRep() != null) |
---|
5538 | | - usecalllists = usecalllists; |
---|
| 6151 | + if (display.DrawMode() == display.SHADOW) |
---|
| 6152 | + //GetBRep() != null) |
---|
| 6153 | + usecalllists = !!usecalllists; |
---|
5539 | 6154 | //System.out.println("draw " + this); |
---|
5540 | 6155 | //new Exception().printStackTrace(); |
---|
5541 | 6156 | |
---|
.. | .. |
---|
5544 | 6159 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5545 | 6160 | |
---|
5546 | 6161 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5547 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 6162 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 6163 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5548 | 6164 | { |
---|
5549 | 6165 | Globals.lighttouched = true; |
---|
5550 | 6166 | } // all panes... |
---|
| 6167 | + |
---|
5551 | 6168 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5552 | 6169 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5553 | 6170 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5555 | 6172 | if (!(this instanceof Composite)) |
---|
5556 | 6173 | touched = false; |
---|
5557 | 6174 | //if (displaylist == -1 && usecalllists) |
---|
5558 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 6175 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5559 | 6176 | { |
---|
5560 | 6177 | bRep.displaylist = display.GenList(); |
---|
5561 | 6178 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5566 | 6183 | |
---|
5567 | 6184 | //System.out.println("\tnew list " + list); |
---|
5568 | 6185 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5569 | | - if (usecalllists) |
---|
| 6186 | + if (usecalllists && bRep.displaylist > 0) |
---|
5570 | 6187 | { |
---|
5571 | 6188 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5572 | 6189 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5575 | 6192 | CallList(display, root, selected, blocked); |
---|
5576 | 6193 | |
---|
5577 | 6194 | // compiled = true; |
---|
5578 | | - if (usecalllists) |
---|
| 6195 | + if (usecalllists && bRep.displaylist > 0) |
---|
5579 | 6196 | { |
---|
5580 | 6197 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5581 | 6198 | display.EndList(); |
---|
.. | .. |
---|
5675 | 6292 | if (GetBRep() != null) |
---|
5676 | 6293 | { |
---|
5677 | 6294 | display.NextIndex(); |
---|
| 6295 | + |
---|
5678 | 6296 | // vertex color conflict : gl.glCallList(list); |
---|
5679 | 6297 | DrawNode(display, root, selected); |
---|
5680 | 6298 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5715 | 6333 | tex = GetTextures(); |
---|
5716 | 6334 | } |
---|
5717 | 6335 | |
---|
5718 | | - boolean failed = false; |
---|
| 6336 | + boolean failedPigment = false; |
---|
| 6337 | + boolean failedBump = false; |
---|
5719 | 6338 | |
---|
5720 | 6339 | try |
---|
5721 | 6340 | { |
---|
5722 | | - display.BindTextures(tex, texres); |
---|
| 6341 | + display.BindPigmentTexture(tex, texres); |
---|
5723 | 6342 | } |
---|
5724 | 6343 | catch (Exception e) |
---|
5725 | 6344 | { |
---|
5726 | 6345 | System.err.println("FAILED: " + this); |
---|
5727 | | - failed = true; |
---|
| 6346 | + failedPigment = true; |
---|
| 6347 | + } |
---|
| 6348 | + |
---|
| 6349 | + try |
---|
| 6350 | + { |
---|
| 6351 | + display.BindBumpTexture(tex, texres); |
---|
| 6352 | + } |
---|
| 6353 | + catch (Exception e) |
---|
| 6354 | + { |
---|
| 6355 | + //System.err.println("FAILED: " + this); |
---|
| 6356 | + failedBump = true; |
---|
5728 | 6357 | } |
---|
5729 | 6358 | |
---|
5730 | 6359 | if (!compiled) |
---|
.. | .. |
---|
5747 | 6376 | } |
---|
5748 | 6377 | } |
---|
5749 | 6378 | |
---|
5750 | | - if (!failed) |
---|
5751 | | - display.ReleaseTextures(tex); |
---|
| 6379 | + if (!failedBump) |
---|
| 6380 | + display.ReleaseBumpTexture(tex); |
---|
| 6381 | + |
---|
| 6382 | + if (!failedPigment) |
---|
| 6383 | + display.ReleasePigmentTexture(tex); |
---|
5752 | 6384 | |
---|
5753 | 6385 | display.PopMaterial(this, selected); |
---|
5754 | 6386 | } |
---|
.. | .. |
---|
6121 | 6753 | // dec 2012 |
---|
6122 | 6754 | new Exception().printStackTrace(); |
---|
6123 | 6755 | return; |
---|
| 6756 | + } |
---|
| 6757 | + |
---|
| 6758 | + if (dontselect) |
---|
| 6759 | + { |
---|
| 6760 | + //bRep.GenerateNormalsMINE(); |
---|
6124 | 6761 | } |
---|
6125 | 6762 | |
---|
6126 | 6763 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
6906 | 7543 | } |
---|
6907 | 7544 | } |
---|
6908 | 7545 | |
---|
6909 | | - protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec) |
---|
| 7546 | + static ClickInfo clickInfo = new ClickInfo(); |
---|
| 7547 | + |
---|
| 7548 | + protected void calcHotSpot(cVector in, //ClickInfo clickInfo, |
---|
| 7549 | + Point outPt, Rectangle outRec) |
---|
6910 | 7550 | { |
---|
6911 | | - int hc = info.bounds.x + info.bounds.width / 2; |
---|
6912 | | - int vc = info.bounds.y + info.bounds.height / 2; |
---|
6913 | | - double[][] toscreen = info.toScreen; |
---|
| 7551 | + int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2; |
---|
| 7552 | + int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2; |
---|
| 7553 | + double[][] toscreen = clickInfo.toScreen; |
---|
6914 | 7554 | if (toscreen == null) |
---|
6915 | 7555 | { |
---|
6916 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7556 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
6917 | 7557 | } |
---|
6918 | 7558 | cVector vec = in; |
---|
6919 | 7559 | LA.xformPos(in, toscreen, in); |
---|
6920 | 7560 | //System.out.println("Distance = " + info.camera.Distance()); |
---|
6921 | | - vec.x *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
6922 | | - vec.y *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
| 7561 | + vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
| 7562 | + vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
6923 | 7563 | outPt.x = hc + (int) vec.x; |
---|
6924 | 7564 | outPt.y = vc - (int) vec.y; |
---|
6925 | 7565 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
6927 | 7567 | outRec.width = outRec.height = 6; |
---|
6928 | 7568 | } |
---|
6929 | 7569 | |
---|
6930 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7570 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7571 | + ) |
---|
6931 | 7572 | { |
---|
6932 | 7573 | Point pt = new Point(0, 0); |
---|
6933 | 7574 | Rectangle rec = new Rectangle(); |
---|
6934 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7575 | + calcHotSpot(in, //clickInfo, |
---|
| 7576 | + pt, rec); |
---|
6935 | 7577 | return rec; |
---|
6936 | 7578 | } |
---|
6937 | 7579 | |
---|
6938 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7580 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7581 | + int level) |
---|
6939 | 7582 | { |
---|
6940 | 7583 | if (level == 0) |
---|
6941 | 7584 | { |
---|
.. | .. |
---|
6944 | 7587 | { |
---|
6945 | 7588 | cVector origin = new cVector(); |
---|
6946 | 7589 | //LA.xformPos(origin, toParent, origin); |
---|
6947 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7590 | + if (this.clickInfo == null) |
---|
| 7591 | + this.clickInfo = new ClickInfo(); |
---|
| 7592 | + |
---|
| 7593 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
6948 | 7594 | Rectangle boundary = new Rectangle(); |
---|
6949 | 7595 | boundary.x = spot.x - 30; |
---|
6950 | 7596 | boundary.y = spot.y - 30; |
---|
6951 | 7597 | boundary.width = spot.width + 60; |
---|
6952 | 7598 | boundary.height = spot.height + 60; |
---|
6953 | | - info.g.setColor(Color.red); |
---|
| 7599 | + clickInfo.g.setColor(Color.white); |
---|
6954 | 7600 | int spotw = spot.x + spot.width; |
---|
6955 | 7601 | int spoth = spot.y + spot.height; |
---|
6956 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7602 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6957 | 7603 | // if (CameraPane.Xmin > spot.x) |
---|
6958 | 7604 | // { |
---|
6959 | 7605 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
6970 | 7616 | // { |
---|
6971 | 7617 | // CameraPane.Ymax = spoth; |
---|
6972 | 7618 | // } |
---|
6973 | | - spot.translate(32, 32); |
---|
| 7619 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7620 | +// { |
---|
| 7621 | +// CameraPane.Xmin = spot.x; |
---|
| 7622 | +// } |
---|
| 7623 | +// if (CameraPane.Xmax < spotw) |
---|
| 7624 | +// { |
---|
| 7625 | +// CameraPane.Xmax = spotw; |
---|
| 7626 | +// } |
---|
| 7627 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7628 | +// { |
---|
| 7629 | +// CameraPane.Ymin = spot.y; |
---|
| 7630 | +// } |
---|
| 7631 | +// if (CameraPane.Ymax < spoth) |
---|
| 7632 | +// { |
---|
| 7633 | +// CameraPane.Ymax = spoth; |
---|
| 7634 | +// } |
---|
| 7635 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7636 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
| 7637 | + spot.translate(32, 0); |
---|
| 7638 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7639 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7640 | + |
---|
| 7641 | + spot.translate(32, 64); |
---|
6974 | 7642 | spotw = spot.x + spot.width; |
---|
6975 | 7643 | spoth = spot.y + spot.height; |
---|
6976 | | - info.g.setColor(Color.blue); |
---|
6977 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7644 | + clickInfo.g.setColor(Color.cyan); |
---|
| 7645 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6978 | 7646 | // if (CameraPane.Xmin > spot.x) |
---|
6979 | 7647 | // { |
---|
6980 | 7648 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
6991 | 7659 | // { |
---|
6992 | 7660 | // CameraPane.Ymax = spoth; |
---|
6993 | 7661 | // } |
---|
6994 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6995 | | - //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
6996 | | - spot.translate(0, -32); |
---|
6997 | | - info.g.setColor(Color.green); |
---|
6998 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6999 | | -// if (CameraPane.Xmin > spot.x) |
---|
7000 | | -// { |
---|
7001 | | -// CameraPane.Xmin = spot.x; |
---|
7002 | | -// } |
---|
7003 | | -// if (CameraPane.Xmax < spotw) |
---|
7004 | | -// { |
---|
7005 | | -// CameraPane.Xmax = spotw; |
---|
7006 | | -// } |
---|
7007 | | -// if (CameraPane.Ymin > spot.y) |
---|
7008 | | -// { |
---|
7009 | | -// CameraPane.Ymin = spot.y; |
---|
7010 | | -// } |
---|
7011 | | -// if (CameraPane.Ymax < spoth) |
---|
7012 | | -// { |
---|
7013 | | -// CameraPane.Ymax = spoth; |
---|
7014 | | -// } |
---|
7015 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
7016 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7662 | + clickInfo.g.setColor(Color.green); |
---|
| 7663 | + clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
| 7664 | + (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7017 | 7665 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7018 | 7666 | // if (CameraPane.Xmin > boundary.x) |
---|
7019 | 7667 | // { |
---|
.. | .. |
---|
7035 | 7683 | } |
---|
7036 | 7684 | } |
---|
7037 | 7685 | |
---|
7038 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7686 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7687 | + int level) |
---|
7039 | 7688 | { |
---|
7040 | 7689 | if (level == 0) |
---|
7041 | 7690 | { |
---|
.. | .. |
---|
7044 | 7693 | |
---|
7045 | 7694 | boolean retval = false; |
---|
7046 | 7695 | |
---|
7047 | | - startX = info.x; |
---|
7048 | | - startY = info.y; |
---|
| 7696 | + startX = clickInfo.x; |
---|
| 7697 | + startY = clickInfo.y; |
---|
7049 | 7698 | |
---|
7050 | 7699 | hitSomething = -1; |
---|
7051 | 7700 | cVector origin = new cVector(); |
---|
.. | .. |
---|
7055 | 7704 | { |
---|
7056 | 7705 | centerPt = new Point(0, 0); |
---|
7057 | 7706 | } |
---|
7058 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
7059 | | - if (spot.contains(info.x, info.y)) |
---|
| 7707 | + calcHotSpot(origin, //info, |
---|
| 7708 | + centerPt, spot); |
---|
| 7709 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7060 | 7710 | { |
---|
7061 | 7711 | hitSomething = hitCenter; |
---|
7062 | 7712 | retval = true; |
---|
7063 | 7713 | } |
---|
7064 | 7714 | spot.translate(32, 0); |
---|
7065 | | - if (spot.contains(info.x, info.y)) |
---|
| 7715 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7066 | 7716 | { |
---|
7067 | 7717 | hitSomething = hitRotate; |
---|
7068 | 7718 | retval = true; |
---|
7069 | 7719 | } |
---|
7070 | 7720 | spot.translate(0, 32); |
---|
7071 | | - if (spot.contains(info.x, info.y)) |
---|
| 7721 | + spot.translate(32, 0); |
---|
| 7722 | + spot.translate(0, 32); |
---|
| 7723 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7072 | 7724 | { |
---|
7073 | 7725 | hitSomething = hitScale; |
---|
| 7726 | + |
---|
| 7727 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
| 7728 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
| 7729 | + double sign = 1; |
---|
| 7730 | + if (hScale < 0) |
---|
| 7731 | + { |
---|
| 7732 | + sign = -1; |
---|
| 7733 | + } |
---|
| 7734 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
| 7735 | + if (hScale < 0.01) |
---|
| 7736 | + { |
---|
| 7737 | + //hScale = 0.01; |
---|
| 7738 | + } |
---|
| 7739 | + |
---|
| 7740 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
| 7741 | + sign = 1; |
---|
| 7742 | + if (vScale < 0) |
---|
| 7743 | + { |
---|
| 7744 | + sign = -1; |
---|
| 7745 | + } |
---|
| 7746 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
| 7747 | + if (vScale < 0.01) |
---|
| 7748 | + { |
---|
| 7749 | + //vScale = 0.01; |
---|
| 7750 | + } |
---|
| 7751 | + |
---|
| 7752 | + clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale); |
---|
| 7753 | + |
---|
7074 | 7754 | retval = true; |
---|
7075 | 7755 | } |
---|
7076 | 7756 | |
---|
.. | .. |
---|
7080 | 7760 | } |
---|
7081 | 7761 | |
---|
7082 | 7762 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7083 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
| 7763 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7084 | 7764 | //System.out.println("modified = " + modified); |
---|
7085 | 7765 | //new Exception().printStackTrace(); |
---|
7086 | 7766 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7108 | 7788 | return true; |
---|
7109 | 7789 | } |
---|
7110 | 7790 | |
---|
7111 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
---|
| 7791 | + void doEditDrag0(//ClickInfo info, |
---|
| 7792 | + boolean opposite) |
---|
7112 | 7793 | { |
---|
7113 | 7794 | if (hitSomething == 0) |
---|
7114 | 7795 | { |
---|
.. | .. |
---|
7122 | 7803 | |
---|
7123 | 7804 | //System.out.println("hitSomething = " + hitSomething); |
---|
7124 | 7805 | |
---|
7125 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7806 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7126 | 7807 | |
---|
7127 | 7808 | cVector xlate = new cVector(); |
---|
7128 | 7809 | //cVector xlate2 = new cVector(); |
---|
.. | .. |
---|
7136 | 7817 | |
---|
7137 | 7818 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7138 | 7819 | |
---|
7139 | | - if (modified || opposite) |
---|
| 7820 | + // Modified could snap |
---|
| 7821 | + if (//modified || |
---|
| 7822 | + opposite) |
---|
7140 | 7823 | { |
---|
7141 | 7824 | //assert(false); |
---|
7142 | 7825 | /* |
---|
.. | .. |
---|
7156 | 7839 | toParent[3][i] = xlate.get(i); |
---|
7157 | 7840 | LA.matInvert(toParent, fromParent); |
---|
7158 | 7841 | */ |
---|
7159 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7160 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7842 | + cVector delta = LA.newVector(0, 0, startY - clickInfo.y); |
---|
| 7843 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7161 | 7844 | |
---|
7162 | 7845 | LA.matCopy(startMat, toParent); |
---|
7163 | 7846 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7166 | 7849 | } else |
---|
7167 | 7850 | { |
---|
7168 | 7851 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7169 | | - cVector up = new cVector(info.camera.up); |
---|
| 7852 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7170 | 7853 | cVector away = new cVector(); |
---|
7171 | 7854 | //cVector right2 = new cVector(); |
---|
7172 | 7855 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7183 | 7866 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7184 | 7867 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7185 | 7868 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7186 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 7869 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7187 | 7870 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7188 | 7871 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7189 | 7872 | //LA.vecCross(up, cVector.Z, right2); |
---|
7190 | 7873 | |
---|
7191 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 7874 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7192 | 7875 | |
---|
7193 | 7876 | //System.out.println("DELTA0 = " + delta); |
---|
7194 | 7877 | //System.out.println("AWAY = " + info.camera.away); |
---|
7195 | 7878 | //System.out.println("UP = " + info.camera.up); |
---|
7196 | 7879 | if (away.z > 0) |
---|
7197 | 7880 | { |
---|
7198 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 7881 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7199 | 7882 | { |
---|
7200 | 7883 | delta.x = -delta.x; |
---|
7201 | 7884 | } else |
---|
.. | .. |
---|
7210 | 7893 | //System.out.println("DELTA1 = " + delta); |
---|
7211 | 7894 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7212 | 7895 | //System.out.println("DELTA2 = " + delta); |
---|
7213 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7896 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7214 | 7897 | LA.matCopy(startMat, toParent); |
---|
7215 | 7898 | //System.out.println("DELTA3 = " + delta); |
---|
7216 | 7899 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7220 | 7903 | break; |
---|
7221 | 7904 | |
---|
7222 | 7905 | case hitRotate: // rotate |
---|
7223 | | - int dx = info.x - centerPt.x; |
---|
7224 | | - int dy = -(info.y - centerPt.y); |
---|
| 7906 | + int dx = clickInfo.x - centerPt.x; |
---|
| 7907 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7225 | 7908 | double angle = (double) Math.atan2(dx, dy); |
---|
7226 | 7909 | angle = -(1.570796 - angle); |
---|
7227 | 7910 | |
---|
.. | .. |
---|
7230 | 7913 | |
---|
7231 | 7914 | if (modified) |
---|
7232 | 7915 | { |
---|
7233 | | - // Rotate 90 degrees |
---|
| 7916 | + // Rotate 45 degrees |
---|
7234 | 7917 | angle /= (Math.PI / 4); |
---|
7235 | 7918 | angle = Math.floor(angle + 0.5); |
---|
7236 | 7919 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7244 | 7927 | } |
---|
7245 | 7928 | /**/ |
---|
7246 | 7929 | |
---|
7247 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7930 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7248 | 7931 | { |
---|
7249 | 7932 | case 1: // '\001' |
---|
7250 | 7933 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7271 | 7954 | break; |
---|
7272 | 7955 | |
---|
7273 | 7956 | case hitScale: // scale |
---|
7274 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7957 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7275 | 7958 | double sign = 1; |
---|
7276 | 7959 | if (hScale < 0) |
---|
7277 | 7960 | { |
---|
.. | .. |
---|
7283 | 7966 | //hScale = 0.01; |
---|
7284 | 7967 | } |
---|
7285 | 7968 | |
---|
7286 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 7969 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7287 | 7970 | sign = 1; |
---|
7288 | 7971 | if (vScale < 0) |
---|
7289 | 7972 | { |
---|
.. | .. |
---|
7294 | 7977 | { |
---|
7295 | 7978 | //vScale = 0.01; |
---|
7296 | 7979 | } |
---|
| 7980 | + |
---|
7297 | 7981 | LA.matCopy(startMat, toParent); |
---|
7298 | 7982 | /**/ |
---|
7299 | 7983 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7303 | 7987 | } |
---|
7304 | 7988 | /**/ |
---|
7305 | 7989 | |
---|
7306 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7990 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
7307 | 7991 | |
---|
7308 | 7992 | if (totalScale < 0.01) |
---|
7309 | 7993 | { |
---|
7310 | 7994 | totalScale = 0.01; |
---|
7311 | 7995 | } |
---|
7312 | 7996 | |
---|
7313 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7997 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7314 | 7998 | { |
---|
7315 | 7999 | case 3: // '\001' |
---|
7316 | | - if (modified) |
---|
| 8000 | + if (modified || opposite) |
---|
7317 | 8001 | { |
---|
| 8002 | + if (modified) // && opposite) |
---|
| 8003 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8004 | + else |
---|
7318 | 8005 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7319 | | - LA.matScale(toParent, totalScale, 1, 1); |
---|
| 8006 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7320 | 8007 | } // vScale, 1); |
---|
7321 | 8008 | else |
---|
7322 | 8009 | { |
---|
7323 | | - LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8010 | + // EXCEPTION! |
---|
| 8011 | + LA.matScale(toParent, 1, totalScale, totalScale); |
---|
7324 | 8012 | } // vScale, 1); |
---|
7325 | 8013 | break; |
---|
7326 | 8014 | |
---|
7327 | 8015 | case 2: // '\002' |
---|
7328 | | - if (modified) |
---|
| 8016 | + if (modified || opposite) |
---|
7329 | 8017 | { |
---|
7330 | | - //LA.matScale(toParent, hScale, 1, vScale); |
---|
7331 | | - LA.matScale(toParent, 1, totalScale, 1); |
---|
| 8018 | + if (modified) // && opposite) |
---|
| 8019 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8020 | + else |
---|
| 8021 | + //LA.matScale(toParent, hScale, 1, vScale); |
---|
| 8022 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7332 | 8023 | } else |
---|
7333 | 8024 | { |
---|
7334 | 8025 | LA.matScale(toParent, totalScale, 1, totalScale); |
---|
.. | .. |
---|
7336 | 8027 | break; |
---|
7337 | 8028 | |
---|
7338 | 8029 | case 1: // '\003' |
---|
7339 | | - if (modified) |
---|
| 8030 | + if (modified || opposite) |
---|
7340 | 8031 | { |
---|
7341 | | - //LA.matScale(toParent, hScale, vScale, 1); |
---|
7342 | | - LA.matScale(toParent, 1, 1, totalScale); |
---|
| 8032 | + if (modified) // && opposite) |
---|
| 8033 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8034 | + else |
---|
| 8035 | + //LA.matScale(toParent, hScale, vScale, 1); |
---|
| 8036 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7343 | 8037 | } else |
---|
7344 | 8038 | { |
---|
7345 | 8039 | LA.matScale(toParent, totalScale, totalScale, 1); |
---|
.. | .. |
---|
7376 | 8070 | } // NEW ... |
---|
7377 | 8071 | |
---|
7378 | 8072 | |
---|
7379 | | - info.pane.repaint(); |
---|
| 8073 | + clickInfo.pane.repaint(); |
---|
7380 | 8074 | } |
---|
7381 | 8075 | |
---|
7382 | 8076 | boolean overflow = false; |
---|
.. | .. |
---|
7487 | 8181 | } // + super.toString(); |
---|
7488 | 8182 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
7489 | 8183 | |
---|
7490 | | - if (!Globals.ADVANCED) |
---|
7491 | | - return objname; |
---|
| 8184 | +// if (!Globals.ADVANCED) |
---|
| 8185 | +// return objname; |
---|
7492 | 8186 | |
---|
7493 | | - return objname + " " + System.identityHashCode(this); |
---|
| 8187 | + return objname + " " + System.identityHashCode(this); // + GetUUID() |
---|
7494 | 8188 | } |
---|
7495 | 8189 | |
---|
7496 | 8190 | public int hashCode() |
---|
.. | .. |
---|
7556 | 8250 | editWindow = null; |
---|
7557 | 8251 | } // ? |
---|
7558 | 8252 | } |
---|
| 8253 | + else |
---|
| 8254 | + { |
---|
| 8255 | + //editWindow.closeUI(); |
---|
| 8256 | + } |
---|
7559 | 8257 | } |
---|
7560 | 8258 | |
---|
7561 | 8259 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7567 | 8265 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7568 | 8266 | |
---|
7569 | 8267 | Object3D /*Composite*/ parent; |
---|
7570 | | - Object3D /*Composite*/ fileparent; |
---|
| 8268 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7571 | 8269 | |
---|
7572 | 8270 | double[][] toParent; // dynamic matrix |
---|
7573 | 8271 | double[][] fromParent; |
---|
.. | .. |
---|
7713 | 8411 | } |
---|
7714 | 8412 | |
---|
7715 | 8413 | transient ObjEditor editWindow; |
---|
| 8414 | + transient ObjEditor manipWindow; |
---|
| 8415 | + |
---|
| 8416 | + transient boolean pinned; |
---|
| 8417 | + |
---|
7716 | 8418 | transient ObjectUI objectUI; |
---|
7717 | 8419 | public static int povDepth = 0; |
---|
7718 | 8420 | private static cVector tbMin = new cVector(); |
---|