.. | .. |
---|
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(); |
---|
26 | 27 | |
---|
27 | 28 | // TEMPORARY for mocap undo. No need to be transient. |
---|
.. | .. |
---|
29 | 30 | Object3D saveskeleton; |
---|
30 | 31 | // |
---|
31 | 32 | |
---|
32 | | - byte[] versions[]; |
---|
| 33 | + String skyboxname; |
---|
| 34 | + String skyboxext; |
---|
| 35 | + |
---|
| 36 | + Object3D versionlist[]; |
---|
33 | 37 | int versionindex = -1; |
---|
34 | 38 | |
---|
35 | 39 | ScriptNode scriptnode; |
---|
.. | .. |
---|
219 | 223 | // o.bRep.support = null; |
---|
220 | 224 | // } |
---|
221 | 225 | o.selection = this.selection; |
---|
222 | | - o.versions = this.versions; |
---|
| 226 | + o.versionlist = this.versionlist; |
---|
223 | 227 | o.versionindex = this.versionindex; |
---|
224 | 228 | |
---|
225 | 229 | if (this.support != null) |
---|
.. | .. |
---|
242 | 246 | // this.support = null; |
---|
243 | 247 | // this.fileparent = null; |
---|
244 | 248 | } |
---|
| 249 | + |
---|
| 250 | +// Object3D GetObject(java.util.UUID uuid) |
---|
| 251 | +// { |
---|
| 252 | +// if (this.uuid.equals(uuid)) |
---|
| 253 | +// return this; |
---|
| 254 | +// |
---|
| 255 | +// if (blockloop) |
---|
| 256 | +// return null; |
---|
| 257 | +// |
---|
| 258 | +// blockloop = true; |
---|
| 259 | +// |
---|
| 260 | +// for (int i=0; i<Size(); i++) |
---|
| 261 | +// { |
---|
| 262 | +// Object3D o = get(i).GetObject(uuid); |
---|
| 263 | +// |
---|
| 264 | +// if (o != null) |
---|
| 265 | +// return o; |
---|
| 266 | +// } |
---|
| 267 | +// |
---|
| 268 | +// blockloop = false; |
---|
| 269 | +// |
---|
| 270 | +// return null; |
---|
| 271 | +// } |
---|
245 | 272 | |
---|
246 | 273 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
247 | 274 | { |
---|
.. | .. |
---|
277 | 304 | |
---|
278 | 305 | this.selection = o.selection; |
---|
279 | 306 | |
---|
280 | | - this.versions = o.versions; |
---|
| 307 | + this.versionlist = o.versionlist; |
---|
281 | 308 | this.versionindex = o.versionindex; |
---|
282 | 309 | // July 2019 if (this.bRep != null) |
---|
283 | 310 | // this.bRep.support = o.transientrep; |
---|
.. | .. |
---|
1011 | 1038 | |
---|
1012 | 1039 | if (material == null || material.multiply) |
---|
1013 | 1040 | return true; |
---|
| 1041 | + |
---|
| 1042 | + if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1043 | + return false; |
---|
1014 | 1044 | |
---|
1015 | 1045 | // Transparent objects are dynamic because we have to sort the triangles. |
---|
1016 | 1046 | return material.opacity > 0.99; |
---|
.. | .. |
---|
2438 | 2468 | else |
---|
2439 | 2469 | { |
---|
2440 | 2470 | //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2471 | + if (objectUI != null) |
---|
| 2472 | + ((ObjEditor)objectUI).pinButton.setSelected(pinned); |
---|
| 2473 | + else |
---|
| 2474 | + //new Exception().printStackTrace(); |
---|
| 2475 | + System.err.println("objectUI is null"); |
---|
2441 | 2476 | } |
---|
2442 | 2477 | } |
---|
2443 | 2478 | |
---|
.. | .. |
---|
2567 | 2602 | private static final int editSelf = 1; |
---|
2568 | 2603 | private static final int editChild = 2; |
---|
2569 | 2604 | |
---|
2570 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2605 | + void drawEditHandles(//ClickInfo info, |
---|
| 2606 | + int level) |
---|
2571 | 2607 | { |
---|
2572 | 2608 | if (level == 0) |
---|
2573 | 2609 | { |
---|
.. | .. |
---|
2575 | 2611 | return; |
---|
2576 | 2612 | |
---|
2577 | 2613 | Object3D selectee; |
---|
2578 | | - for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1)) |
---|
| 2614 | + for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info, |
---|
| 2615 | + level + 1)) |
---|
2579 | 2616 | { |
---|
2580 | 2617 | selectee = (Object3D) e.nextElement(); |
---|
2581 | 2618 | } |
---|
.. | .. |
---|
2583 | 2620 | } else |
---|
2584 | 2621 | { |
---|
2585 | 2622 | //super. |
---|
2586 | | - drawEditHandles0(info, level + 1); |
---|
| 2623 | + drawEditHandles0(//info, |
---|
| 2624 | + level + 1); |
---|
2587 | 2625 | } |
---|
2588 | 2626 | } |
---|
2589 | 2627 | |
---|
2590 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2628 | + boolean doEditClick(//ClickInfo info, |
---|
| 2629 | + int level) |
---|
2591 | 2630 | { |
---|
2592 | 2631 | doSomething = 0; |
---|
2593 | 2632 | if (level == 0) |
---|
2594 | 2633 | { |
---|
2595 | | - return doParentClick(info); |
---|
| 2634 | + return doParentClick(); //info); |
---|
2596 | 2635 | } |
---|
2597 | 2636 | if (//super. |
---|
2598 | | - doEditClick0(info, level)) |
---|
| 2637 | + doEditClick0(//info, |
---|
| 2638 | + level)) |
---|
2599 | 2639 | { |
---|
2600 | 2640 | doSomething = 1; |
---|
2601 | 2641 | return true; |
---|
.. | .. |
---|
2605 | 2645 | } |
---|
2606 | 2646 | } |
---|
2607 | 2647 | |
---|
2608 | | - boolean doParentClick(ClickInfo info) |
---|
| 2648 | + boolean doParentClick() //ClickInfo info) |
---|
2609 | 2649 | { |
---|
2610 | 2650 | if (selection == null) |
---|
2611 | 2651 | { |
---|
.. | .. |
---|
2618 | 2658 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2619 | 2659 | { |
---|
2620 | 2660 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2621 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2661 | + if (selectee.doEditClick(//info, |
---|
| 2662 | + 1)) |
---|
2622 | 2663 | { |
---|
2623 | 2664 | childToDrag = selectee; |
---|
2624 | 2665 | doSomething = 2; |
---|
.. | .. |
---|
2630 | 2671 | return retval; |
---|
2631 | 2672 | } |
---|
2632 | 2673 | |
---|
2633 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 2674 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2675 | + boolean opposite) |
---|
2634 | 2676 | { |
---|
2635 | 2677 | switch (doSomething) |
---|
2636 | 2678 | { |
---|
2637 | 2679 | case 1: // '\001' |
---|
2638 | 2680 | //super. |
---|
2639 | | - doEditDrag0(info, opposite); |
---|
| 2681 | + doEditDrag0(//clickInfo, |
---|
| 2682 | + opposite); |
---|
2640 | 2683 | break; |
---|
2641 | 2684 | |
---|
2642 | 2685 | case 2: // '\002' |
---|
.. | .. |
---|
2649 | 2692 | { |
---|
2650 | 2693 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2651 | 2694 | //childToDrag.doEditDrag(info); |
---|
2652 | | - sel.doEditDrag(info, opposite); |
---|
| 2695 | + sel.doEditDrag(//clickInfo, |
---|
| 2696 | + opposite); |
---|
2653 | 2697 | } else |
---|
2654 | 2698 | { |
---|
2655 | 2699 | //super. |
---|
2656 | | - doEditDrag0(info, opposite); |
---|
| 2700 | + doEditDrag0(//clickInfo, |
---|
| 2701 | + opposite); |
---|
2657 | 2702 | } |
---|
2658 | 2703 | } |
---|
2659 | 2704 | break; |
---|
.. | .. |
---|
2671 | 2716 | { |
---|
2672 | 2717 | deselectAll(); |
---|
2673 | 2718 | } |
---|
| 2719 | + |
---|
| 2720 | + new Exception().printStackTrace(); |
---|
| 2721 | + |
---|
2674 | 2722 | ClickInfo newInfo = new ClickInfo(); |
---|
2675 | 2723 | newInfo.flags = info.flags; |
---|
2676 | 2724 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
5775 | 5823 | } |
---|
5776 | 5824 | } |
---|
5777 | 5825 | |
---|
5778 | | - void EmbedTextures() |
---|
| 5826 | + void EmbedTextures(boolean embed) |
---|
5779 | 5827 | { |
---|
5780 | 5828 | if (blockloop) |
---|
5781 | 5829 | return; |
---|
5782 | 5830 | |
---|
5783 | | - CameraPane.EmbedTextures(texture); |
---|
| 5831 | + //if (GetTextures() != null) |
---|
| 5832 | + if (embed) |
---|
| 5833 | + CameraPane.EmbedTextures(GetTextures()); |
---|
| 5834 | + else |
---|
| 5835 | + { |
---|
| 5836 | + GetTextures().pigmentdata = null; |
---|
| 5837 | + GetTextures().bumpdata = null; |
---|
| 5838 | + GetTextures().pw = 0; |
---|
| 5839 | + GetTextures().ph = 0; |
---|
| 5840 | + GetTextures().bw = 0; |
---|
| 5841 | + GetTextures().bh = 0; |
---|
| 5842 | + } |
---|
5784 | 5843 | |
---|
5785 | 5844 | int nb = Size(); |
---|
5786 | 5845 | for (int i = 0; i < nb; i++) |
---|
.. | .. |
---|
5791 | 5850 | continue; |
---|
5792 | 5851 | |
---|
5793 | 5852 | blockloop = true; |
---|
5794 | | - child.EmbedTextures(); |
---|
| 5853 | + child.EmbedTextures(embed); |
---|
5795 | 5854 | blockloop = false; |
---|
5796 | 5855 | } |
---|
5797 | 5856 | } |
---|
.. | .. |
---|
5882 | 5941 | if (support != null) |
---|
5883 | 5942 | support = support; |
---|
5884 | 5943 | |
---|
5885 | | - //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5886 | | - boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5944 | + boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5945 | + //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5946 | + |
---|
| 5947 | + //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
5887 | 5948 | |
---|
5888 | 5949 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5889 | 5950 | { |
---|
.. | .. |
---|
5893 | 5954 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5894 | 5955 | // usecalllists = false; |
---|
5895 | 5956 | |
---|
5896 | | - if (GetBRep() != null) |
---|
5897 | | - usecalllists = usecalllists; |
---|
| 5957 | + if (display.DrawMode() == display.SHADOW) |
---|
| 5958 | + //GetBRep() != null) |
---|
| 5959 | + usecalllists = !!usecalllists; |
---|
5898 | 5960 | //System.out.println("draw " + this); |
---|
5899 | 5961 | //new Exception().printStackTrace(); |
---|
5900 | 5962 | |
---|
.. | .. |
---|
5916 | 5978 | if (!(this instanceof Composite)) |
---|
5917 | 5979 | touched = false; |
---|
5918 | 5980 | //if (displaylist == -1 && usecalllists) |
---|
5919 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 5981 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5920 | 5982 | { |
---|
5921 | 5983 | bRep.displaylist = display.GenList(); |
---|
5922 | 5984 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5927 | 5989 | |
---|
5928 | 5990 | //System.out.println("\tnew list " + list); |
---|
5929 | 5991 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5930 | | - if (usecalllists) |
---|
| 5992 | + if (usecalllists && bRep.displaylist > 0) |
---|
5931 | 5993 | { |
---|
5932 | 5994 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5933 | 5995 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5936 | 5998 | CallList(display, root, selected, blocked); |
---|
5937 | 5999 | |
---|
5938 | 6000 | // compiled = true; |
---|
5939 | | - if (usecalllists) |
---|
| 6001 | + if (usecalllists && bRep.displaylist > 0) |
---|
5940 | 6002 | { |
---|
5941 | 6003 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5942 | 6004 | display.EndList(); |
---|
.. | .. |
---|
7287 | 7349 | } |
---|
7288 | 7350 | } |
---|
7289 | 7351 | |
---|
7290 | | - protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec) |
---|
| 7352 | + static ClickInfo clickInfo = new ClickInfo(); |
---|
| 7353 | + |
---|
| 7354 | + protected void calcHotSpot(cVector in, //ClickInfo clickInfo, |
---|
| 7355 | + Point outPt, Rectangle outRec) |
---|
7291 | 7356 | { |
---|
7292 | | - int hc = info.bounds.x + info.bounds.width / 2; |
---|
7293 | | - int vc = info.bounds.y + info.bounds.height / 2; |
---|
7294 | | - double[][] toscreen = info.toScreen; |
---|
| 7357 | + int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2; |
---|
| 7358 | + int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2; |
---|
| 7359 | + double[][] toscreen = clickInfo.toScreen; |
---|
7295 | 7360 | if (toscreen == null) |
---|
7296 | 7361 | { |
---|
7297 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7362 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
7298 | 7363 | } |
---|
7299 | 7364 | cVector vec = in; |
---|
7300 | 7365 | LA.xformPos(in, toscreen, in); |
---|
7301 | 7366 | //System.out.println("Distance = " + info.camera.Distance()); |
---|
7302 | | - vec.x *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
7303 | | - vec.y *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
| 7367 | + vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
| 7368 | + vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
7304 | 7369 | outPt.x = hc + (int) vec.x; |
---|
7305 | 7370 | outPt.y = vc - (int) vec.y; |
---|
7306 | 7371 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
7308 | 7373 | outRec.width = outRec.height = 6; |
---|
7309 | 7374 | } |
---|
7310 | 7375 | |
---|
7311 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7376 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7377 | + ) |
---|
7312 | 7378 | { |
---|
7313 | 7379 | Point pt = new Point(0, 0); |
---|
7314 | 7380 | Rectangle rec = new Rectangle(); |
---|
7315 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7381 | + calcHotSpot(in, //clickInfo, |
---|
| 7382 | + pt, rec); |
---|
7316 | 7383 | return rec; |
---|
7317 | 7384 | } |
---|
7318 | 7385 | |
---|
7319 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7386 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7387 | + int level) |
---|
7320 | 7388 | { |
---|
7321 | 7389 | if (level == 0) |
---|
7322 | 7390 | { |
---|
.. | .. |
---|
7325 | 7393 | { |
---|
7326 | 7394 | cVector origin = new cVector(); |
---|
7327 | 7395 | //LA.xformPos(origin, toParent, origin); |
---|
7328 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7396 | + if (this.clickInfo == null) |
---|
| 7397 | + this.clickInfo = new ClickInfo(); |
---|
| 7398 | + |
---|
| 7399 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
7329 | 7400 | Rectangle boundary = new Rectangle(); |
---|
7330 | 7401 | boundary.x = spot.x - 30; |
---|
7331 | 7402 | boundary.y = spot.y - 30; |
---|
7332 | 7403 | boundary.width = spot.width + 60; |
---|
7333 | 7404 | boundary.height = spot.height + 60; |
---|
7334 | | - info.g.setColor(Color.red); |
---|
| 7405 | + clickInfo.g.setColor(Color.red); |
---|
7335 | 7406 | int spotw = spot.x + spot.width; |
---|
7336 | 7407 | int spoth = spot.y + spot.height; |
---|
7337 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7408 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7338 | 7409 | // if (CameraPane.Xmin > spot.x) |
---|
7339 | 7410 | // { |
---|
7340 | 7411 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7354 | 7425 | spot.translate(32, 32); |
---|
7355 | 7426 | spotw = spot.x + spot.width; |
---|
7356 | 7427 | spoth = spot.y + spot.height; |
---|
7357 | | - info.g.setColor(Color.cyan); |
---|
7358 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7428 | + clickInfo.g.setColor(Color.cyan); |
---|
| 7429 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7359 | 7430 | // if (CameraPane.Xmin > spot.x) |
---|
7360 | 7431 | // { |
---|
7361 | 7432 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7375 | 7446 | // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7376 | 7447 | //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7377 | 7448 | spot.translate(0, -32); |
---|
7378 | | - info.g.setColor(Color.yellow); |
---|
7379 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7380 | | - info.g.setColor(Color.green); |
---|
| 7449 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7450 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7451 | + clickInfo.g.setColor(Color.green); |
---|
7381 | 7452 | // if (CameraPane.Xmin > spot.x) |
---|
7382 | 7453 | // { |
---|
7383 | 7454 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7394 | 7465 | // { |
---|
7395 | 7466 | // CameraPane.Ymax = spoth; |
---|
7396 | 7467 | // } |
---|
7397 | | - info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
7398 | | - (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
| 7468 | + clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
| 7469 | + (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7399 | 7470 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7400 | 7471 | // if (CameraPane.Xmin > boundary.x) |
---|
7401 | 7472 | // { |
---|
.. | .. |
---|
7417 | 7488 | } |
---|
7418 | 7489 | } |
---|
7419 | 7490 | |
---|
7420 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7491 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7492 | + int level) |
---|
7421 | 7493 | { |
---|
7422 | 7494 | if (level == 0) |
---|
7423 | 7495 | { |
---|
.. | .. |
---|
7426 | 7498 | |
---|
7427 | 7499 | boolean retval = false; |
---|
7428 | 7500 | |
---|
7429 | | - startX = info.x; |
---|
7430 | | - startY = info.y; |
---|
| 7501 | + startX = clickInfo.x; |
---|
| 7502 | + startY = clickInfo.y; |
---|
7431 | 7503 | |
---|
7432 | 7504 | hitSomething = -1; |
---|
7433 | 7505 | cVector origin = new cVector(); |
---|
.. | .. |
---|
7437 | 7509 | { |
---|
7438 | 7510 | centerPt = new Point(0, 0); |
---|
7439 | 7511 | } |
---|
7440 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
7441 | | - if (spot.contains(info.x, info.y)) |
---|
| 7512 | + calcHotSpot(origin, //info, |
---|
| 7513 | + centerPt, spot); |
---|
| 7514 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7442 | 7515 | { |
---|
7443 | 7516 | hitSomething = hitCenter; |
---|
7444 | 7517 | retval = true; |
---|
7445 | 7518 | } |
---|
7446 | 7519 | spot.translate(32, 0); |
---|
7447 | | - if (spot.contains(info.x, info.y)) |
---|
| 7520 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7448 | 7521 | { |
---|
7449 | 7522 | hitSomething = hitRotate; |
---|
7450 | 7523 | retval = true; |
---|
7451 | 7524 | } |
---|
7452 | 7525 | spot.translate(0, 32); |
---|
7453 | | - if (spot.contains(info.x, info.y)) |
---|
| 7526 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7454 | 7527 | { |
---|
7455 | 7528 | hitSomething = hitScale; |
---|
| 7529 | + |
---|
| 7530 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
| 7531 | + double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
| 7532 | + double sign = 1; |
---|
| 7533 | + if (hScale < 0) |
---|
| 7534 | + { |
---|
| 7535 | + sign = -1; |
---|
| 7536 | + } |
---|
| 7537 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
| 7538 | + if (hScale < 0.01) |
---|
| 7539 | + { |
---|
| 7540 | + //hScale = 0.01; |
---|
| 7541 | + } |
---|
| 7542 | + |
---|
| 7543 | + double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
| 7544 | + sign = 1; |
---|
| 7545 | + if (vScale < 0) |
---|
| 7546 | + { |
---|
| 7547 | + sign = -1; |
---|
| 7548 | + } |
---|
| 7549 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
| 7550 | + if (vScale < 0.01) |
---|
| 7551 | + { |
---|
| 7552 | + //vScale = 0.01; |
---|
| 7553 | + } |
---|
| 7554 | + |
---|
| 7555 | + clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale); |
---|
| 7556 | + |
---|
7456 | 7557 | retval = true; |
---|
7457 | 7558 | } |
---|
7458 | 7559 | |
---|
.. | .. |
---|
7462 | 7563 | } |
---|
7463 | 7564 | |
---|
7464 | 7565 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7465 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
| 7566 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7466 | 7567 | //System.out.println("modified = " + modified); |
---|
7467 | 7568 | //new Exception().printStackTrace(); |
---|
7468 | 7569 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7490 | 7591 | return true; |
---|
7491 | 7592 | } |
---|
7492 | 7593 | |
---|
7493 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
---|
| 7594 | + void doEditDrag0(//ClickInfo info, |
---|
| 7595 | + boolean opposite) |
---|
7494 | 7596 | { |
---|
7495 | 7597 | if (hitSomething == 0) |
---|
7496 | 7598 | { |
---|
.. | .. |
---|
7504 | 7606 | |
---|
7505 | 7607 | //System.out.println("hitSomething = " + hitSomething); |
---|
7506 | 7608 | |
---|
7507 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7609 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7508 | 7610 | |
---|
7509 | 7611 | cVector xlate = new cVector(); |
---|
7510 | 7612 | //cVector xlate2 = new cVector(); |
---|
.. | .. |
---|
7538 | 7640 | toParent[3][i] = xlate.get(i); |
---|
7539 | 7641 | LA.matInvert(toParent, fromParent); |
---|
7540 | 7642 | */ |
---|
7541 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7542 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7643 | + cVector delta = LA.newVector(0, 0, startY - clickInfo.y); |
---|
| 7644 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7543 | 7645 | |
---|
7544 | 7646 | LA.matCopy(startMat, toParent); |
---|
7545 | 7647 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7548 | 7650 | } else |
---|
7549 | 7651 | { |
---|
7550 | 7652 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7551 | | - cVector up = new cVector(info.camera.up); |
---|
| 7653 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7552 | 7654 | cVector away = new cVector(); |
---|
7553 | 7655 | //cVector right2 = new cVector(); |
---|
7554 | 7656 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7565 | 7667 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7566 | 7668 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7567 | 7669 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7568 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 7670 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7569 | 7671 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7570 | 7672 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7571 | 7673 | //LA.vecCross(up, cVector.Z, right2); |
---|
7572 | 7674 | |
---|
7573 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 7675 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7574 | 7676 | |
---|
7575 | 7677 | //System.out.println("DELTA0 = " + delta); |
---|
7576 | 7678 | //System.out.println("AWAY = " + info.camera.away); |
---|
7577 | 7679 | //System.out.println("UP = " + info.camera.up); |
---|
7578 | 7680 | if (away.z > 0) |
---|
7579 | 7681 | { |
---|
7580 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 7682 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7581 | 7683 | { |
---|
7582 | 7684 | delta.x = -delta.x; |
---|
7583 | 7685 | } else |
---|
.. | .. |
---|
7592 | 7694 | //System.out.println("DELTA1 = " + delta); |
---|
7593 | 7695 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7594 | 7696 | //System.out.println("DELTA2 = " + delta); |
---|
7595 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7697 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7596 | 7698 | LA.matCopy(startMat, toParent); |
---|
7597 | 7699 | //System.out.println("DELTA3 = " + delta); |
---|
7598 | 7700 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7602 | 7704 | break; |
---|
7603 | 7705 | |
---|
7604 | 7706 | case hitRotate: // rotate |
---|
7605 | | - int dx = info.x - centerPt.x; |
---|
7606 | | - int dy = -(info.y - centerPt.y); |
---|
| 7707 | + int dx = clickInfo.x - centerPt.x; |
---|
| 7708 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7607 | 7709 | double angle = (double) Math.atan2(dx, dy); |
---|
7608 | 7710 | angle = -(1.570796 - angle); |
---|
7609 | 7711 | |
---|
.. | .. |
---|
7626 | 7728 | } |
---|
7627 | 7729 | /**/ |
---|
7628 | 7730 | |
---|
7629 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7731 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7630 | 7732 | { |
---|
7631 | 7733 | case 1: // '\001' |
---|
7632 | 7734 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7653 | 7755 | break; |
---|
7654 | 7756 | |
---|
7655 | 7757 | case hitScale: // scale |
---|
7656 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7758 | + double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
7657 | 7759 | double sign = 1; |
---|
7658 | 7760 | if (hScale < 0) |
---|
7659 | 7761 | { |
---|
.. | .. |
---|
7665 | 7767 | //hScale = 0.01; |
---|
7666 | 7768 | } |
---|
7667 | 7769 | |
---|
7668 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 7770 | + double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
7669 | 7771 | sign = 1; |
---|
7670 | 7772 | if (vScale < 0) |
---|
7671 | 7773 | { |
---|
.. | .. |
---|
7676 | 7778 | { |
---|
7677 | 7779 | //vScale = 0.01; |
---|
7678 | 7780 | } |
---|
| 7781 | + |
---|
7679 | 7782 | LA.matCopy(startMat, toParent); |
---|
7680 | 7783 | /**/ |
---|
7681 | 7784 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7685 | 7788 | } |
---|
7686 | 7789 | /**/ |
---|
7687 | 7790 | |
---|
7688 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7791 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
7689 | 7792 | |
---|
7690 | 7793 | if (totalScale < 0.01) |
---|
7691 | 7794 | { |
---|
7692 | 7795 | totalScale = 0.01; |
---|
7693 | 7796 | } |
---|
7694 | 7797 | |
---|
7695 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7798 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7696 | 7799 | { |
---|
7697 | 7800 | case 3: // '\001' |
---|
7698 | 7801 | if (modified || opposite) |
---|
.. | .. |
---|
7759 | 7862 | } // NEW ... |
---|
7760 | 7863 | |
---|
7761 | 7864 | |
---|
7762 | | - info.pane.repaint(); |
---|
| 7865 | + clickInfo.pane.repaint(); |
---|
7763 | 7866 | } |
---|
7764 | 7867 | |
---|
7765 | 7868 | boolean overflow = false; |
---|