.. | .. |
---|
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 | |
---|
| 33 | + String skyboxname; |
---|
| 34 | + String skyboxext; |
---|
| 35 | + |
---|
| 36 | + Object3D versionlist[]; |
---|
| 37 | + int versionindex = -1; |
---|
| 38 | + |
---|
32 | 39 | ScriptNode scriptnode; |
---|
33 | 40 | |
---|
34 | 41 | void InitOthers() |
---|
.. | .. |
---|
215 | 222 | // o.transientrep = this.bRep.support; |
---|
216 | 223 | // o.bRep.support = null; |
---|
217 | 224 | // } |
---|
| 225 | + o.selection = this.selection; |
---|
| 226 | + o.versionlist = this.versionlist; |
---|
| 227 | + o.versionindex = this.versionindex; |
---|
218 | 228 | |
---|
219 | 229 | if (this.support != null) |
---|
220 | 230 | { |
---|
.. | .. |
---|
236 | 246 | // this.support = null; |
---|
237 | 247 | // this.fileparent = null; |
---|
238 | 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 | +// } |
---|
239 | 272 | |
---|
240 | 273 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
241 | 274 | { |
---|
.. | .. |
---|
268 | 301 | { |
---|
269 | 302 | this.support.bRep = o.transientrep; |
---|
270 | 303 | } |
---|
| 304 | + |
---|
| 305 | + this.selection = o.selection; |
---|
| 306 | + |
---|
| 307 | + this.versionlist = o.versionlist; |
---|
| 308 | + this.versionindex = o.versionindex; |
---|
271 | 309 | // July 2019 if (this.bRep != null) |
---|
272 | 310 | // this.bRep.support = o.transientrep; |
---|
273 | 311 | // this.support = o.support; |
---|
.. | .. |
---|
415 | 453 | } |
---|
416 | 454 | |
---|
417 | 455 | boolean live = false; |
---|
| 456 | + transient boolean keepdontselect; |
---|
418 | 457 | boolean dontselect = false; |
---|
419 | 458 | boolean hide = false; |
---|
420 | 459 | boolean link2master = false; // performs reset support/master at each frame |
---|
.. | .. |
---|
999 | 1038 | |
---|
1000 | 1039 | if (material == null || material.multiply) |
---|
1001 | 1040 | return true; |
---|
| 1041 | + |
---|
| 1042 | + if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1043 | + return false; |
---|
1002 | 1044 | |
---|
1003 | 1045 | // Transparent objects are dynamic because we have to sort the triangles. |
---|
1004 | 1046 | return material.opacity > 0.99; |
---|
.. | .. |
---|
2426 | 2468 | else |
---|
2427 | 2469 | { |
---|
2428 | 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"); |
---|
2429 | 2476 | } |
---|
2430 | 2477 | } |
---|
2431 | 2478 | |
---|
.. | .. |
---|
2555 | 2602 | private static final int editSelf = 1; |
---|
2556 | 2603 | private static final int editChild = 2; |
---|
2557 | 2604 | |
---|
2558 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2605 | + void drawEditHandles(//ClickInfo info, |
---|
| 2606 | + int level) |
---|
2559 | 2607 | { |
---|
2560 | 2608 | if (level == 0) |
---|
2561 | 2609 | { |
---|
.. | .. |
---|
2563 | 2611 | return; |
---|
2564 | 2612 | |
---|
2565 | 2613 | Object3D selectee; |
---|
2566 | | - 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)) |
---|
2567 | 2616 | { |
---|
2568 | 2617 | selectee = (Object3D) e.nextElement(); |
---|
2569 | 2618 | } |
---|
.. | .. |
---|
2571 | 2620 | } else |
---|
2572 | 2621 | { |
---|
2573 | 2622 | //super. |
---|
2574 | | - drawEditHandles0(info, level + 1); |
---|
| 2623 | + drawEditHandles0(//info, |
---|
| 2624 | + level + 1); |
---|
2575 | 2625 | } |
---|
2576 | 2626 | } |
---|
2577 | 2627 | |
---|
2578 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2628 | + boolean doEditClick(//ClickInfo info, |
---|
| 2629 | + int level) |
---|
2579 | 2630 | { |
---|
2580 | 2631 | doSomething = 0; |
---|
2581 | 2632 | if (level == 0) |
---|
2582 | 2633 | { |
---|
2583 | | - return doParentClick(info); |
---|
| 2634 | + return doParentClick(); //info); |
---|
2584 | 2635 | } |
---|
2585 | 2636 | if (//super. |
---|
2586 | | - doEditClick0(info, level)) |
---|
| 2637 | + doEditClick0(//info, |
---|
| 2638 | + level)) |
---|
2587 | 2639 | { |
---|
2588 | 2640 | doSomething = 1; |
---|
2589 | 2641 | return true; |
---|
.. | .. |
---|
2593 | 2645 | } |
---|
2594 | 2646 | } |
---|
2595 | 2647 | |
---|
2596 | | - boolean doParentClick(ClickInfo info) |
---|
| 2648 | + boolean doParentClick() //ClickInfo info) |
---|
2597 | 2649 | { |
---|
2598 | 2650 | if (selection == null) |
---|
2599 | 2651 | { |
---|
.. | .. |
---|
2606 | 2658 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2607 | 2659 | { |
---|
2608 | 2660 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2609 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2661 | + if (selectee.doEditClick(//info, |
---|
| 2662 | + 1)) |
---|
2610 | 2663 | { |
---|
2611 | 2664 | childToDrag = selectee; |
---|
2612 | 2665 | doSomething = 2; |
---|
.. | .. |
---|
2618 | 2671 | return retval; |
---|
2619 | 2672 | } |
---|
2620 | 2673 | |
---|
2621 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 2674 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2675 | + boolean opposite) |
---|
2622 | 2676 | { |
---|
2623 | 2677 | switch (doSomething) |
---|
2624 | 2678 | { |
---|
2625 | 2679 | case 1: // '\001' |
---|
2626 | 2680 | //super. |
---|
2627 | | - doEditDrag0(info, opposite); |
---|
| 2681 | + doEditDrag0(//clickInfo, |
---|
| 2682 | + opposite); |
---|
2628 | 2683 | break; |
---|
2629 | 2684 | |
---|
2630 | 2685 | case 2: // '\002' |
---|
.. | .. |
---|
2637 | 2692 | { |
---|
2638 | 2693 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2639 | 2694 | //childToDrag.doEditDrag(info); |
---|
2640 | | - sel.doEditDrag(info, opposite); |
---|
| 2695 | + sel.doEditDrag(//clickInfo, |
---|
| 2696 | + opposite); |
---|
2641 | 2697 | } else |
---|
2642 | 2698 | { |
---|
2643 | 2699 | //super. |
---|
2644 | | - doEditDrag0(info, opposite); |
---|
| 2700 | + doEditDrag0(//clickInfo, |
---|
| 2701 | + opposite); |
---|
2645 | 2702 | } |
---|
2646 | 2703 | } |
---|
2647 | 2704 | break; |
---|
.. | .. |
---|
2659 | 2716 | { |
---|
2660 | 2717 | deselectAll(); |
---|
2661 | 2718 | } |
---|
| 2719 | + |
---|
| 2720 | + new Exception().printStackTrace(); |
---|
| 2721 | + |
---|
2662 | 2722 | ClickInfo newInfo = new ClickInfo(); |
---|
2663 | 2723 | newInfo.flags = info.flags; |
---|
2664 | 2724 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
3106 | 3166 | { |
---|
3107 | 3167 | if (bRep != null) |
---|
3108 | 3168 | { |
---|
3109 | | - bRep.GenerateNormalsMINE(); |
---|
| 3169 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
3110 | 3170 | Touch(); |
---|
3111 | 3171 | } |
---|
3112 | 3172 | } |
---|
.. | .. |
---|
5409 | 5469 | blockloop = false; |
---|
5410 | 5470 | } |
---|
5411 | 5471 | |
---|
| 5472 | + void ResetSelectable() |
---|
| 5473 | + { |
---|
| 5474 | + if (blockloop) |
---|
| 5475 | + return; |
---|
| 5476 | + |
---|
| 5477 | + blockloop = true; |
---|
| 5478 | + |
---|
| 5479 | + keepdontselect = dontselect; |
---|
| 5480 | + dontselect = true; |
---|
| 5481 | + |
---|
| 5482 | + Object3D child; |
---|
| 5483 | + int nb = Size(); |
---|
| 5484 | + for (int i = 0; i < nb; i++) |
---|
| 5485 | + { |
---|
| 5486 | + child = (Object3D) get(i); |
---|
| 5487 | + if (child == null) |
---|
| 5488 | + continue; |
---|
| 5489 | + child.ResetSelectable(); |
---|
| 5490 | + } |
---|
| 5491 | + |
---|
| 5492 | + blockloop = false; |
---|
| 5493 | + } |
---|
| 5494 | + |
---|
| 5495 | + void RestoreSelectable() |
---|
| 5496 | + { |
---|
| 5497 | + if (blockloop) |
---|
| 5498 | + return; |
---|
| 5499 | + |
---|
| 5500 | + blockloop = true; |
---|
| 5501 | + |
---|
| 5502 | + dontselect = keepdontselect; |
---|
| 5503 | + |
---|
| 5504 | + Object3D child; |
---|
| 5505 | + int nb = Size(); |
---|
| 5506 | + for (int i = 0; i < nb; i++) |
---|
| 5507 | + { |
---|
| 5508 | + child = (Object3D) get(i); |
---|
| 5509 | + if (child == null) |
---|
| 5510 | + continue; |
---|
| 5511 | + child.RestoreSelectable(); |
---|
| 5512 | + } |
---|
| 5513 | + |
---|
| 5514 | + blockloop = false; |
---|
| 5515 | + } |
---|
| 5516 | + |
---|
5412 | 5517 | boolean IsSelected() |
---|
5413 | 5518 | { |
---|
5414 | 5519 | if (parent == null) |
---|
.. | .. |
---|
5718 | 5823 | } |
---|
5719 | 5824 | } |
---|
5720 | 5825 | |
---|
| 5826 | + void EmbedTextures(boolean embed) |
---|
| 5827 | + { |
---|
| 5828 | + if (blockloop) |
---|
| 5829 | + return; |
---|
| 5830 | + |
---|
| 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 | + } |
---|
| 5843 | + |
---|
| 5844 | + int nb = Size(); |
---|
| 5845 | + for (int i = 0; i < nb; i++) |
---|
| 5846 | + { |
---|
| 5847 | + Object3D child = (Object3D) get(i); |
---|
| 5848 | + |
---|
| 5849 | + if (child == null) |
---|
| 5850 | + continue; |
---|
| 5851 | + |
---|
| 5852 | + blockloop = true; |
---|
| 5853 | + child.EmbedTextures(embed); |
---|
| 5854 | + blockloop = false; |
---|
| 5855 | + } |
---|
| 5856 | + } |
---|
| 5857 | + |
---|
5721 | 5858 | void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5722 | 5859 | { |
---|
5723 | 5860 | Draw(display, root, selected, blocked); |
---|
.. | .. |
---|
5804 | 5941 | if (support != null) |
---|
5805 | 5942 | support = support; |
---|
5806 | 5943 | |
---|
5807 | | - //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5808 | | - 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. |
---|
5809 | 5948 | |
---|
5810 | 5949 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5811 | 5950 | { |
---|
.. | .. |
---|
5815 | 5954 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5816 | 5955 | // usecalllists = false; |
---|
5817 | 5956 | |
---|
5818 | | - if (GetBRep() != null) |
---|
5819 | | - usecalllists = usecalllists; |
---|
| 5957 | + if (display.DrawMode() == display.SHADOW) |
---|
| 5958 | + //GetBRep() != null) |
---|
| 5959 | + usecalllists = !!usecalllists; |
---|
5820 | 5960 | //System.out.println("draw " + this); |
---|
5821 | 5961 | //new Exception().printStackTrace(); |
---|
5822 | 5962 | |
---|
.. | .. |
---|
5838 | 5978 | if (!(this instanceof Composite)) |
---|
5839 | 5979 | touched = false; |
---|
5840 | 5980 | //if (displaylist == -1 && usecalllists) |
---|
5841 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 5981 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5842 | 5982 | { |
---|
5843 | 5983 | bRep.displaylist = display.GenList(); |
---|
5844 | 5984 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5849 | 5989 | |
---|
5850 | 5990 | //System.out.println("\tnew list " + list); |
---|
5851 | 5991 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5852 | | - if (usecalllists) |
---|
| 5992 | + if (usecalllists && bRep.displaylist > 0) |
---|
5853 | 5993 | { |
---|
5854 | 5994 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5855 | 5995 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5858 | 5998 | CallList(display, root, selected, blocked); |
---|
5859 | 5999 | |
---|
5860 | 6000 | // compiled = true; |
---|
5861 | | - if (usecalllists) |
---|
| 6001 | + if (usecalllists && bRep.displaylist > 0) |
---|
5862 | 6002 | { |
---|
5863 | 6003 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5864 | 6004 | display.EndList(); |
---|
.. | .. |
---|
7209 | 7349 | } |
---|
7210 | 7350 | } |
---|
7211 | 7351 | |
---|
7212 | | - 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) |
---|
7213 | 7356 | { |
---|
7214 | | - int hc = info.bounds.x + info.bounds.width / 2; |
---|
7215 | | - int vc = info.bounds.y + info.bounds.height / 2; |
---|
7216 | | - 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; |
---|
7217 | 7360 | if (toscreen == null) |
---|
7218 | 7361 | { |
---|
7219 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7362 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
7220 | 7363 | } |
---|
7221 | 7364 | cVector vec = in; |
---|
7222 | 7365 | LA.xformPos(in, toscreen, in); |
---|
7223 | 7366 | //System.out.println("Distance = " + info.camera.Distance()); |
---|
7224 | | - vec.x *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
7225 | | - 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(); |
---|
7226 | 7369 | outPt.x = hc + (int) vec.x; |
---|
7227 | 7370 | outPt.y = vc - (int) vec.y; |
---|
7228 | 7371 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
7230 | 7373 | outRec.width = outRec.height = 6; |
---|
7231 | 7374 | } |
---|
7232 | 7375 | |
---|
7233 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7376 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7377 | + ) |
---|
7234 | 7378 | { |
---|
7235 | 7379 | Point pt = new Point(0, 0); |
---|
7236 | 7380 | Rectangle rec = new Rectangle(); |
---|
7237 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7381 | + calcHotSpot(in, //clickInfo, |
---|
| 7382 | + pt, rec); |
---|
7238 | 7383 | return rec; |
---|
7239 | 7384 | } |
---|
7240 | 7385 | |
---|
7241 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7386 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7387 | + int level) |
---|
7242 | 7388 | { |
---|
7243 | 7389 | if (level == 0) |
---|
7244 | 7390 | { |
---|
.. | .. |
---|
7247 | 7393 | { |
---|
7248 | 7394 | cVector origin = new cVector(); |
---|
7249 | 7395 | //LA.xformPos(origin, toParent, origin); |
---|
7250 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7396 | + if (this.clickInfo == null) |
---|
| 7397 | + this.clickInfo = new ClickInfo(); |
---|
| 7398 | + |
---|
| 7399 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
7251 | 7400 | Rectangle boundary = new Rectangle(); |
---|
7252 | 7401 | boundary.x = spot.x - 30; |
---|
7253 | 7402 | boundary.y = spot.y - 30; |
---|
7254 | 7403 | boundary.width = spot.width + 60; |
---|
7255 | 7404 | boundary.height = spot.height + 60; |
---|
7256 | | - info.g.setColor(Color.red); |
---|
| 7405 | + clickInfo.g.setColor(Color.red); |
---|
7257 | 7406 | int spotw = spot.x + spot.width; |
---|
7258 | 7407 | int spoth = spot.y + spot.height; |
---|
7259 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7408 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7260 | 7409 | // if (CameraPane.Xmin > spot.x) |
---|
7261 | 7410 | // { |
---|
7262 | 7411 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7276 | 7425 | spot.translate(32, 32); |
---|
7277 | 7426 | spotw = spot.x + spot.width; |
---|
7278 | 7427 | spoth = spot.y + spot.height; |
---|
7279 | | - info.g.setColor(Color.cyan); |
---|
7280 | | - 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); |
---|
7281 | 7430 | // if (CameraPane.Xmin > spot.x) |
---|
7282 | 7431 | // { |
---|
7283 | 7432 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7297 | 7446 | // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7298 | 7447 | //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7299 | 7448 | spot.translate(0, -32); |
---|
7300 | | - info.g.setColor(Color.yellow); |
---|
7301 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7302 | | - 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); |
---|
7303 | 7452 | // if (CameraPane.Xmin > spot.x) |
---|
7304 | 7453 | // { |
---|
7305 | 7454 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7316 | 7465 | // { |
---|
7317 | 7466 | // CameraPane.Ymax = spoth; |
---|
7318 | 7467 | // } |
---|
7319 | | - info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
7320 | | - (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); |
---|
7321 | 7470 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7322 | 7471 | // if (CameraPane.Xmin > boundary.x) |
---|
7323 | 7472 | // { |
---|
.. | .. |
---|
7339 | 7488 | } |
---|
7340 | 7489 | } |
---|
7341 | 7490 | |
---|
7342 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7491 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7492 | + int level) |
---|
7343 | 7493 | { |
---|
7344 | 7494 | if (level == 0) |
---|
7345 | 7495 | { |
---|
.. | .. |
---|
7348 | 7498 | |
---|
7349 | 7499 | boolean retval = false; |
---|
7350 | 7500 | |
---|
7351 | | - startX = info.x; |
---|
7352 | | - startY = info.y; |
---|
| 7501 | + startX = clickInfo.x; |
---|
| 7502 | + startY = clickInfo.y; |
---|
7353 | 7503 | |
---|
7354 | 7504 | hitSomething = -1; |
---|
7355 | 7505 | cVector origin = new cVector(); |
---|
.. | .. |
---|
7359 | 7509 | { |
---|
7360 | 7510 | centerPt = new Point(0, 0); |
---|
7361 | 7511 | } |
---|
7362 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
7363 | | - if (spot.contains(info.x, info.y)) |
---|
| 7512 | + calcHotSpot(origin, //info, |
---|
| 7513 | + centerPt, spot); |
---|
| 7514 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7364 | 7515 | { |
---|
7365 | 7516 | hitSomething = hitCenter; |
---|
7366 | 7517 | retval = true; |
---|
7367 | 7518 | } |
---|
7368 | 7519 | spot.translate(32, 0); |
---|
7369 | | - if (spot.contains(info.x, info.y)) |
---|
| 7520 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7370 | 7521 | { |
---|
7371 | 7522 | hitSomething = hitRotate; |
---|
7372 | 7523 | retval = true; |
---|
7373 | 7524 | } |
---|
7374 | 7525 | spot.translate(0, 32); |
---|
7375 | | - if (spot.contains(info.x, info.y)) |
---|
| 7526 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7376 | 7527 | { |
---|
7377 | 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 | + |
---|
7378 | 7557 | retval = true; |
---|
7379 | 7558 | } |
---|
7380 | 7559 | |
---|
.. | .. |
---|
7384 | 7563 | } |
---|
7385 | 7564 | |
---|
7386 | 7565 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7387 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
| 7566 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7388 | 7567 | //System.out.println("modified = " + modified); |
---|
7389 | 7568 | //new Exception().printStackTrace(); |
---|
7390 | 7569 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7412 | 7591 | return true; |
---|
7413 | 7592 | } |
---|
7414 | 7593 | |
---|
7415 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
---|
| 7594 | + void doEditDrag0(//ClickInfo info, |
---|
| 7595 | + boolean opposite) |
---|
7416 | 7596 | { |
---|
7417 | 7597 | if (hitSomething == 0) |
---|
7418 | 7598 | { |
---|
.. | .. |
---|
7426 | 7606 | |
---|
7427 | 7607 | //System.out.println("hitSomething = " + hitSomething); |
---|
7428 | 7608 | |
---|
7429 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7609 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7430 | 7610 | |
---|
7431 | 7611 | cVector xlate = new cVector(); |
---|
7432 | 7612 | //cVector xlate2 = new cVector(); |
---|
.. | .. |
---|
7460 | 7640 | toParent[3][i] = xlate.get(i); |
---|
7461 | 7641 | LA.matInvert(toParent, fromParent); |
---|
7462 | 7642 | */ |
---|
7463 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7464 | | - 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); |
---|
7465 | 7645 | |
---|
7466 | 7646 | LA.matCopy(startMat, toParent); |
---|
7467 | 7647 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7470 | 7650 | } else |
---|
7471 | 7651 | { |
---|
7472 | 7652 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7473 | | - cVector up = new cVector(info.camera.up); |
---|
| 7653 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7474 | 7654 | cVector away = new cVector(); |
---|
7475 | 7655 | //cVector right2 = new cVector(); |
---|
7476 | 7656 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7487 | 7667 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7488 | 7668 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7489 | 7669 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7490 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 7670 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7491 | 7671 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7492 | 7672 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7493 | 7673 | //LA.vecCross(up, cVector.Z, right2); |
---|
7494 | 7674 | |
---|
7495 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 7675 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7496 | 7676 | |
---|
7497 | 7677 | //System.out.println("DELTA0 = " + delta); |
---|
7498 | 7678 | //System.out.println("AWAY = " + info.camera.away); |
---|
7499 | 7679 | //System.out.println("UP = " + info.camera.up); |
---|
7500 | 7680 | if (away.z > 0) |
---|
7501 | 7681 | { |
---|
7502 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 7682 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7503 | 7683 | { |
---|
7504 | 7684 | delta.x = -delta.x; |
---|
7505 | 7685 | } else |
---|
.. | .. |
---|
7514 | 7694 | //System.out.println("DELTA1 = " + delta); |
---|
7515 | 7695 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7516 | 7696 | //System.out.println("DELTA2 = " + delta); |
---|
7517 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7697 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7518 | 7698 | LA.matCopy(startMat, toParent); |
---|
7519 | 7699 | //System.out.println("DELTA3 = " + delta); |
---|
7520 | 7700 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7524 | 7704 | break; |
---|
7525 | 7705 | |
---|
7526 | 7706 | case hitRotate: // rotate |
---|
7527 | | - int dx = info.x - centerPt.x; |
---|
7528 | | - int dy = -(info.y - centerPt.y); |
---|
| 7707 | + int dx = clickInfo.x - centerPt.x; |
---|
| 7708 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7529 | 7709 | double angle = (double) Math.atan2(dx, dy); |
---|
7530 | 7710 | angle = -(1.570796 - angle); |
---|
7531 | 7711 | |
---|
.. | .. |
---|
7548 | 7728 | } |
---|
7549 | 7729 | /**/ |
---|
7550 | 7730 | |
---|
7551 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7731 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7552 | 7732 | { |
---|
7553 | 7733 | case 1: // '\001' |
---|
7554 | 7734 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7575 | 7755 | break; |
---|
7576 | 7756 | |
---|
7577 | 7757 | case hitScale: // scale |
---|
7578 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7758 | + double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
7579 | 7759 | double sign = 1; |
---|
7580 | 7760 | if (hScale < 0) |
---|
7581 | 7761 | { |
---|
.. | .. |
---|
7587 | 7767 | //hScale = 0.01; |
---|
7588 | 7768 | } |
---|
7589 | 7769 | |
---|
7590 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 7770 | + double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
7591 | 7771 | sign = 1; |
---|
7592 | 7772 | if (vScale < 0) |
---|
7593 | 7773 | { |
---|
.. | .. |
---|
7598 | 7778 | { |
---|
7599 | 7779 | //vScale = 0.01; |
---|
7600 | 7780 | } |
---|
| 7781 | + |
---|
7601 | 7782 | LA.matCopy(startMat, toParent); |
---|
7602 | 7783 | /**/ |
---|
7603 | 7784 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7607 | 7788 | } |
---|
7608 | 7789 | /**/ |
---|
7609 | 7790 | |
---|
7610 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7791 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
7611 | 7792 | |
---|
7612 | 7793 | if (totalScale < 0.01) |
---|
7613 | 7794 | { |
---|
7614 | 7795 | totalScale = 0.01; |
---|
7615 | 7796 | } |
---|
7616 | 7797 | |
---|
7617 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7798 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7618 | 7799 | { |
---|
7619 | 7800 | case 3: // '\001' |
---|
7620 | 7801 | if (modified || opposite) |
---|
.. | .. |
---|
7681 | 7862 | } // NEW ... |
---|
7682 | 7863 | |
---|
7683 | 7864 | |
---|
7684 | | - info.pane.repaint(); |
---|
| 7865 | + clickInfo.pane.repaint(); |
---|
7685 | 7866 | } |
---|
7686 | 7867 | |
---|
7687 | 7868 | boolean overflow = false; |
---|