.. | .. |
---|
29 | 29 | Object3D saveskeleton; |
---|
30 | 30 | // |
---|
31 | 31 | |
---|
32 | | - byte[] versions[] = new byte[100][]; |
---|
| 32 | + String skyboxname; |
---|
| 33 | + String skyboxext; |
---|
| 34 | + |
---|
| 35 | + Object3D versions[]; |
---|
33 | 36 | int versionindex = -1; |
---|
34 | 37 | |
---|
35 | 38 | ScriptNode scriptnode; |
---|
.. | .. |
---|
219 | 222 | // o.bRep.support = null; |
---|
220 | 223 | // } |
---|
221 | 224 | o.selection = this.selection; |
---|
| 225 | + o.versions = this.versions; |
---|
| 226 | + o.versionindex = this.versionindex; |
---|
222 | 227 | |
---|
223 | 228 | if (this.support != null) |
---|
224 | 229 | { |
---|
.. | .. |
---|
274 | 279 | } |
---|
275 | 280 | |
---|
276 | 281 | this.selection = o.selection; |
---|
| 282 | + |
---|
| 283 | + this.versions = o.versions; |
---|
| 284 | + this.versionindex = o.versionindex; |
---|
277 | 285 | // July 2019 if (this.bRep != null) |
---|
278 | 286 | // this.bRep.support = o.transientrep; |
---|
279 | 287 | // this.support = o.support; |
---|
.. | .. |
---|
421 | 429 | } |
---|
422 | 430 | |
---|
423 | 431 | boolean live = false; |
---|
| 432 | + transient boolean keepdontselect; |
---|
424 | 433 | boolean dontselect = false; |
---|
425 | 434 | boolean hide = false; |
---|
426 | 435 | boolean link2master = false; // performs reset support/master at each frame |
---|
.. | .. |
---|
1005 | 1014 | |
---|
1006 | 1015 | if (material == null || material.multiply) |
---|
1007 | 1016 | return true; |
---|
| 1017 | + |
---|
| 1018 | + if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1019 | + return false; |
---|
1008 | 1020 | |
---|
1009 | 1021 | // Transparent objects are dynamic because we have to sort the triangles. |
---|
1010 | 1022 | return material.opacity > 0.99; |
---|
.. | .. |
---|
2561 | 2573 | private static final int editSelf = 1; |
---|
2562 | 2574 | private static final int editChild = 2; |
---|
2563 | 2575 | |
---|
2564 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2576 | + void drawEditHandles(//ClickInfo info, |
---|
| 2577 | + int level) |
---|
2565 | 2578 | { |
---|
2566 | 2579 | if (level == 0) |
---|
2567 | 2580 | { |
---|
.. | .. |
---|
2569 | 2582 | return; |
---|
2570 | 2583 | |
---|
2571 | 2584 | Object3D selectee; |
---|
2572 | | - for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1)) |
---|
| 2585 | + for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info, |
---|
| 2586 | + level + 1)) |
---|
2573 | 2587 | { |
---|
2574 | 2588 | selectee = (Object3D) e.nextElement(); |
---|
2575 | 2589 | } |
---|
.. | .. |
---|
2577 | 2591 | } else |
---|
2578 | 2592 | { |
---|
2579 | 2593 | //super. |
---|
2580 | | - drawEditHandles0(info, level + 1); |
---|
| 2594 | + drawEditHandles0(//info, |
---|
| 2595 | + level + 1); |
---|
2581 | 2596 | } |
---|
2582 | 2597 | } |
---|
2583 | 2598 | |
---|
2584 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2599 | + boolean doEditClick(//ClickInfo info, |
---|
| 2600 | + int level) |
---|
2585 | 2601 | { |
---|
2586 | 2602 | doSomething = 0; |
---|
2587 | 2603 | if (level == 0) |
---|
2588 | 2604 | { |
---|
2589 | | - return doParentClick(info); |
---|
| 2605 | + return doParentClick(); //info); |
---|
2590 | 2606 | } |
---|
2591 | 2607 | if (//super. |
---|
2592 | | - doEditClick0(info, level)) |
---|
| 2608 | + doEditClick0(//info, |
---|
| 2609 | + level)) |
---|
2593 | 2610 | { |
---|
2594 | 2611 | doSomething = 1; |
---|
2595 | 2612 | return true; |
---|
.. | .. |
---|
2599 | 2616 | } |
---|
2600 | 2617 | } |
---|
2601 | 2618 | |
---|
2602 | | - boolean doParentClick(ClickInfo info) |
---|
| 2619 | + boolean doParentClick() //ClickInfo info) |
---|
2603 | 2620 | { |
---|
2604 | 2621 | if (selection == null) |
---|
2605 | 2622 | { |
---|
.. | .. |
---|
2612 | 2629 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2613 | 2630 | { |
---|
2614 | 2631 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2615 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2632 | + if (selectee.doEditClick(//info, |
---|
| 2633 | + 1)) |
---|
2616 | 2634 | { |
---|
2617 | 2635 | childToDrag = selectee; |
---|
2618 | 2636 | doSomething = 2; |
---|
.. | .. |
---|
2624 | 2642 | return retval; |
---|
2625 | 2643 | } |
---|
2626 | 2644 | |
---|
2627 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 2645 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2646 | + boolean opposite) |
---|
2628 | 2647 | { |
---|
2629 | 2648 | switch (doSomething) |
---|
2630 | 2649 | { |
---|
2631 | 2650 | case 1: // '\001' |
---|
2632 | 2651 | //super. |
---|
2633 | | - doEditDrag0(info, opposite); |
---|
| 2652 | + doEditDrag0(//clickInfo, |
---|
| 2653 | + opposite); |
---|
2634 | 2654 | break; |
---|
2635 | 2655 | |
---|
2636 | 2656 | case 2: // '\002' |
---|
.. | .. |
---|
2643 | 2663 | { |
---|
2644 | 2664 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2645 | 2665 | //childToDrag.doEditDrag(info); |
---|
2646 | | - sel.doEditDrag(info, opposite); |
---|
| 2666 | + sel.doEditDrag(//clickInfo, |
---|
| 2667 | + opposite); |
---|
2647 | 2668 | } else |
---|
2648 | 2669 | { |
---|
2649 | 2670 | //super. |
---|
2650 | | - doEditDrag0(info, opposite); |
---|
| 2671 | + doEditDrag0(//clickInfo, |
---|
| 2672 | + opposite); |
---|
2651 | 2673 | } |
---|
2652 | 2674 | } |
---|
2653 | 2675 | break; |
---|
.. | .. |
---|
2665 | 2687 | { |
---|
2666 | 2688 | deselectAll(); |
---|
2667 | 2689 | } |
---|
| 2690 | + |
---|
| 2691 | + new Exception().printStackTrace(); |
---|
| 2692 | + |
---|
2668 | 2693 | ClickInfo newInfo = new ClickInfo(); |
---|
2669 | 2694 | newInfo.flags = info.flags; |
---|
2670 | 2695 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
3112 | 3137 | { |
---|
3113 | 3138 | if (bRep != null) |
---|
3114 | 3139 | { |
---|
3115 | | - bRep.GenerateNormalsMINE(); |
---|
| 3140 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
3116 | 3141 | Touch(); |
---|
3117 | 3142 | } |
---|
3118 | 3143 | } |
---|
.. | .. |
---|
5415 | 5440 | blockloop = false; |
---|
5416 | 5441 | } |
---|
5417 | 5442 | |
---|
| 5443 | + void ResetSelectable() |
---|
| 5444 | + { |
---|
| 5445 | + if (blockloop) |
---|
| 5446 | + return; |
---|
| 5447 | + |
---|
| 5448 | + blockloop = true; |
---|
| 5449 | + |
---|
| 5450 | + keepdontselect = dontselect; |
---|
| 5451 | + dontselect = true; |
---|
| 5452 | + |
---|
| 5453 | + Object3D child; |
---|
| 5454 | + int nb = Size(); |
---|
| 5455 | + for (int i = 0; i < nb; i++) |
---|
| 5456 | + { |
---|
| 5457 | + child = (Object3D) get(i); |
---|
| 5458 | + if (child == null) |
---|
| 5459 | + continue; |
---|
| 5460 | + child.ResetSelectable(); |
---|
| 5461 | + } |
---|
| 5462 | + |
---|
| 5463 | + blockloop = false; |
---|
| 5464 | + } |
---|
| 5465 | + |
---|
| 5466 | + void RestoreSelectable() |
---|
| 5467 | + { |
---|
| 5468 | + if (blockloop) |
---|
| 5469 | + return; |
---|
| 5470 | + |
---|
| 5471 | + blockloop = true; |
---|
| 5472 | + |
---|
| 5473 | + dontselect = keepdontselect; |
---|
| 5474 | + |
---|
| 5475 | + Object3D child; |
---|
| 5476 | + int nb = Size(); |
---|
| 5477 | + for (int i = 0; i < nb; i++) |
---|
| 5478 | + { |
---|
| 5479 | + child = (Object3D) get(i); |
---|
| 5480 | + if (child == null) |
---|
| 5481 | + continue; |
---|
| 5482 | + child.RestoreSelectable(); |
---|
| 5483 | + } |
---|
| 5484 | + |
---|
| 5485 | + blockloop = false; |
---|
| 5486 | + } |
---|
| 5487 | + |
---|
5418 | 5488 | boolean IsSelected() |
---|
5419 | 5489 | { |
---|
5420 | 5490 | if (parent == null) |
---|
.. | .. |
---|
5724 | 5794 | } |
---|
5725 | 5795 | } |
---|
5726 | 5796 | |
---|
| 5797 | + void EmbedTextures(boolean embed) |
---|
| 5798 | + { |
---|
| 5799 | + if (blockloop) |
---|
| 5800 | + return; |
---|
| 5801 | + |
---|
| 5802 | + //if (GetTextures() != null) |
---|
| 5803 | + if (embed) |
---|
| 5804 | + CameraPane.EmbedTextures(GetTextures()); |
---|
| 5805 | + else |
---|
| 5806 | + { |
---|
| 5807 | + GetTextures().pigmentdata = null; |
---|
| 5808 | + GetTextures().bumpdata = null; |
---|
| 5809 | + GetTextures().pw = 0; |
---|
| 5810 | + GetTextures().ph = 0; |
---|
| 5811 | + GetTextures().bw = 0; |
---|
| 5812 | + GetTextures().bh = 0; |
---|
| 5813 | + } |
---|
| 5814 | + |
---|
| 5815 | + int nb = Size(); |
---|
| 5816 | + for (int i = 0; i < nb; i++) |
---|
| 5817 | + { |
---|
| 5818 | + Object3D child = (Object3D) get(i); |
---|
| 5819 | + |
---|
| 5820 | + if (child == null) |
---|
| 5821 | + continue; |
---|
| 5822 | + |
---|
| 5823 | + blockloop = true; |
---|
| 5824 | + child.EmbedTextures(embed); |
---|
| 5825 | + blockloop = false; |
---|
| 5826 | + } |
---|
| 5827 | + } |
---|
| 5828 | + |
---|
5727 | 5829 | void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5728 | 5830 | { |
---|
5729 | 5831 | Draw(display, root, selected, blocked); |
---|
.. | .. |
---|
5810 | 5912 | if (support != null) |
---|
5811 | 5913 | support = support; |
---|
5812 | 5914 | |
---|
5813 | | - //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5814 | | - boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5915 | + boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5916 | + //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5917 | + |
---|
| 5918 | + //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
5815 | 5919 | |
---|
5816 | 5920 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5817 | 5921 | { |
---|
.. | .. |
---|
5821 | 5925 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5822 | 5926 | // usecalllists = false; |
---|
5823 | 5927 | |
---|
5824 | | - if (GetBRep() != null) |
---|
5825 | | - usecalllists = usecalllists; |
---|
| 5928 | + if (display.DrawMode() == display.SHADOW) |
---|
| 5929 | + //GetBRep() != null) |
---|
| 5930 | + usecalllists = !!usecalllists; |
---|
5826 | 5931 | //System.out.println("draw " + this); |
---|
5827 | 5932 | //new Exception().printStackTrace(); |
---|
5828 | 5933 | |
---|
.. | .. |
---|
5844 | 5949 | if (!(this instanceof Composite)) |
---|
5845 | 5950 | touched = false; |
---|
5846 | 5951 | //if (displaylist == -1 && usecalllists) |
---|
5847 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 5952 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5848 | 5953 | { |
---|
5849 | 5954 | bRep.displaylist = display.GenList(); |
---|
5850 | 5955 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5855 | 5960 | |
---|
5856 | 5961 | //System.out.println("\tnew list " + list); |
---|
5857 | 5962 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5858 | | - if (usecalllists) |
---|
| 5963 | + if (usecalllists && bRep.displaylist > 0) |
---|
5859 | 5964 | { |
---|
5860 | 5965 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5861 | 5966 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5864 | 5969 | CallList(display, root, selected, blocked); |
---|
5865 | 5970 | |
---|
5866 | 5971 | // compiled = true; |
---|
5867 | | - if (usecalllists) |
---|
| 5972 | + if (usecalllists && bRep.displaylist > 0) |
---|
5868 | 5973 | { |
---|
5869 | 5974 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5870 | 5975 | display.EndList(); |
---|
.. | .. |
---|
7215 | 7320 | } |
---|
7216 | 7321 | } |
---|
7217 | 7322 | |
---|
7218 | | - protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec) |
---|
| 7323 | + static ClickInfo clickInfo = new ClickInfo(); |
---|
| 7324 | + |
---|
| 7325 | + protected void calcHotSpot(cVector in, //ClickInfo clickInfo, |
---|
| 7326 | + Point outPt, Rectangle outRec) |
---|
7219 | 7327 | { |
---|
7220 | | - int hc = info.bounds.x + info.bounds.width / 2; |
---|
7221 | | - int vc = info.bounds.y + info.bounds.height / 2; |
---|
7222 | | - double[][] toscreen = info.toScreen; |
---|
| 7328 | + int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2; |
---|
| 7329 | + int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2; |
---|
| 7330 | + double[][] toscreen = clickInfo.toScreen; |
---|
7223 | 7331 | if (toscreen == null) |
---|
7224 | 7332 | { |
---|
7225 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7333 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
7226 | 7334 | } |
---|
7227 | 7335 | cVector vec = in; |
---|
7228 | 7336 | LA.xformPos(in, toscreen, in); |
---|
7229 | 7337 | //System.out.println("Distance = " + info.camera.Distance()); |
---|
7230 | | - vec.x *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
7231 | | - vec.y *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
| 7338 | + vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
| 7339 | + vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
7232 | 7340 | outPt.x = hc + (int) vec.x; |
---|
7233 | 7341 | outPt.y = vc - (int) vec.y; |
---|
7234 | 7342 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
7236 | 7344 | outRec.width = outRec.height = 6; |
---|
7237 | 7345 | } |
---|
7238 | 7346 | |
---|
7239 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7347 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7348 | + ) |
---|
7240 | 7349 | { |
---|
7241 | 7350 | Point pt = new Point(0, 0); |
---|
7242 | 7351 | Rectangle rec = new Rectangle(); |
---|
7243 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7352 | + calcHotSpot(in, //clickInfo, |
---|
| 7353 | + pt, rec); |
---|
7244 | 7354 | return rec; |
---|
7245 | 7355 | } |
---|
7246 | 7356 | |
---|
7247 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7357 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7358 | + int level) |
---|
7248 | 7359 | { |
---|
7249 | 7360 | if (level == 0) |
---|
7250 | 7361 | { |
---|
.. | .. |
---|
7253 | 7364 | { |
---|
7254 | 7365 | cVector origin = new cVector(); |
---|
7255 | 7366 | //LA.xformPos(origin, toParent, origin); |
---|
7256 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7367 | + if (this.clickInfo == null) |
---|
| 7368 | + this.clickInfo = new ClickInfo(); |
---|
| 7369 | + |
---|
| 7370 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
7257 | 7371 | Rectangle boundary = new Rectangle(); |
---|
7258 | 7372 | boundary.x = spot.x - 30; |
---|
7259 | 7373 | boundary.y = spot.y - 30; |
---|
7260 | 7374 | boundary.width = spot.width + 60; |
---|
7261 | 7375 | boundary.height = spot.height + 60; |
---|
7262 | | - info.g.setColor(Color.red); |
---|
| 7376 | + clickInfo.g.setColor(Color.red); |
---|
7263 | 7377 | int spotw = spot.x + spot.width; |
---|
7264 | 7378 | int spoth = spot.y + spot.height; |
---|
7265 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7379 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7266 | 7380 | // if (CameraPane.Xmin > spot.x) |
---|
7267 | 7381 | // { |
---|
7268 | 7382 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7282 | 7396 | spot.translate(32, 32); |
---|
7283 | 7397 | spotw = spot.x + spot.width; |
---|
7284 | 7398 | spoth = spot.y + spot.height; |
---|
7285 | | - info.g.setColor(Color.cyan); |
---|
7286 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7399 | + clickInfo.g.setColor(Color.cyan); |
---|
| 7400 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7287 | 7401 | // if (CameraPane.Xmin > spot.x) |
---|
7288 | 7402 | // { |
---|
7289 | 7403 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7303 | 7417 | // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7304 | 7418 | //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7305 | 7419 | spot.translate(0, -32); |
---|
7306 | | - info.g.setColor(Color.yellow); |
---|
7307 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7308 | | - info.g.setColor(Color.green); |
---|
| 7420 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7421 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7422 | + clickInfo.g.setColor(Color.green); |
---|
7309 | 7423 | // if (CameraPane.Xmin > spot.x) |
---|
7310 | 7424 | // { |
---|
7311 | 7425 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7322 | 7436 | // { |
---|
7323 | 7437 | // CameraPane.Ymax = spoth; |
---|
7324 | 7438 | // } |
---|
7325 | | - info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
7326 | | - (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
| 7439 | + clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
| 7440 | + (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7327 | 7441 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7328 | 7442 | // if (CameraPane.Xmin > boundary.x) |
---|
7329 | 7443 | // { |
---|
.. | .. |
---|
7345 | 7459 | } |
---|
7346 | 7460 | } |
---|
7347 | 7461 | |
---|
7348 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7462 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7463 | + int level) |
---|
7349 | 7464 | { |
---|
7350 | 7465 | if (level == 0) |
---|
7351 | 7466 | { |
---|
.. | .. |
---|
7354 | 7469 | |
---|
7355 | 7470 | boolean retval = false; |
---|
7356 | 7471 | |
---|
7357 | | - startX = info.x; |
---|
7358 | | - startY = info.y; |
---|
| 7472 | + startX = clickInfo.x; |
---|
| 7473 | + startY = clickInfo.y; |
---|
7359 | 7474 | |
---|
7360 | 7475 | hitSomething = -1; |
---|
7361 | 7476 | cVector origin = new cVector(); |
---|
.. | .. |
---|
7365 | 7480 | { |
---|
7366 | 7481 | centerPt = new Point(0, 0); |
---|
7367 | 7482 | } |
---|
7368 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
7369 | | - if (spot.contains(info.x, info.y)) |
---|
| 7483 | + calcHotSpot(origin, //info, |
---|
| 7484 | + centerPt, spot); |
---|
| 7485 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7370 | 7486 | { |
---|
7371 | 7487 | hitSomething = hitCenter; |
---|
7372 | 7488 | retval = true; |
---|
7373 | 7489 | } |
---|
7374 | 7490 | spot.translate(32, 0); |
---|
7375 | | - if (spot.contains(info.x, info.y)) |
---|
| 7491 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7376 | 7492 | { |
---|
7377 | 7493 | hitSomething = hitRotate; |
---|
7378 | 7494 | retval = true; |
---|
7379 | 7495 | } |
---|
7380 | 7496 | spot.translate(0, 32); |
---|
7381 | | - if (spot.contains(info.x, info.y)) |
---|
| 7497 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7382 | 7498 | { |
---|
7383 | 7499 | hitSomething = hitScale; |
---|
| 7500 | + |
---|
| 7501 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
| 7502 | + double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
| 7503 | + double sign = 1; |
---|
| 7504 | + if (hScale < 0) |
---|
| 7505 | + { |
---|
| 7506 | + sign = -1; |
---|
| 7507 | + } |
---|
| 7508 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
| 7509 | + if (hScale < 0.01) |
---|
| 7510 | + { |
---|
| 7511 | + //hScale = 0.01; |
---|
| 7512 | + } |
---|
| 7513 | + |
---|
| 7514 | + double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
| 7515 | + sign = 1; |
---|
| 7516 | + if (vScale < 0) |
---|
| 7517 | + { |
---|
| 7518 | + sign = -1; |
---|
| 7519 | + } |
---|
| 7520 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
| 7521 | + if (vScale < 0.01) |
---|
| 7522 | + { |
---|
| 7523 | + //vScale = 0.01; |
---|
| 7524 | + } |
---|
| 7525 | + |
---|
| 7526 | + clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale); |
---|
| 7527 | + |
---|
7384 | 7528 | retval = true; |
---|
7385 | 7529 | } |
---|
7386 | 7530 | |
---|
.. | .. |
---|
7390 | 7534 | } |
---|
7391 | 7535 | |
---|
7392 | 7536 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7393 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
| 7537 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7394 | 7538 | //System.out.println("modified = " + modified); |
---|
7395 | 7539 | //new Exception().printStackTrace(); |
---|
7396 | 7540 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7418 | 7562 | return true; |
---|
7419 | 7563 | } |
---|
7420 | 7564 | |
---|
7421 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
---|
| 7565 | + void doEditDrag0(//ClickInfo info, |
---|
| 7566 | + boolean opposite) |
---|
7422 | 7567 | { |
---|
7423 | 7568 | if (hitSomething == 0) |
---|
7424 | 7569 | { |
---|
.. | .. |
---|
7432 | 7577 | |
---|
7433 | 7578 | //System.out.println("hitSomething = " + hitSomething); |
---|
7434 | 7579 | |
---|
7435 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7580 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7436 | 7581 | |
---|
7437 | 7582 | cVector xlate = new cVector(); |
---|
7438 | 7583 | //cVector xlate2 = new cVector(); |
---|
.. | .. |
---|
7466 | 7611 | toParent[3][i] = xlate.get(i); |
---|
7467 | 7612 | LA.matInvert(toParent, fromParent); |
---|
7468 | 7613 | */ |
---|
7469 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7470 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7614 | + cVector delta = LA.newVector(0, 0, startY - clickInfo.y); |
---|
| 7615 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7471 | 7616 | |
---|
7472 | 7617 | LA.matCopy(startMat, toParent); |
---|
7473 | 7618 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7476 | 7621 | } else |
---|
7477 | 7622 | { |
---|
7478 | 7623 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7479 | | - cVector up = new cVector(info.camera.up); |
---|
| 7624 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7480 | 7625 | cVector away = new cVector(); |
---|
7481 | 7626 | //cVector right2 = new cVector(); |
---|
7482 | 7627 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7493 | 7638 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7494 | 7639 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7495 | 7640 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7496 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 7641 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7497 | 7642 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7498 | 7643 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7499 | 7644 | //LA.vecCross(up, cVector.Z, right2); |
---|
7500 | 7645 | |
---|
7501 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 7646 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7502 | 7647 | |
---|
7503 | 7648 | //System.out.println("DELTA0 = " + delta); |
---|
7504 | 7649 | //System.out.println("AWAY = " + info.camera.away); |
---|
7505 | 7650 | //System.out.println("UP = " + info.camera.up); |
---|
7506 | 7651 | if (away.z > 0) |
---|
7507 | 7652 | { |
---|
7508 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 7653 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7509 | 7654 | { |
---|
7510 | 7655 | delta.x = -delta.x; |
---|
7511 | 7656 | } else |
---|
.. | .. |
---|
7520 | 7665 | //System.out.println("DELTA1 = " + delta); |
---|
7521 | 7666 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7522 | 7667 | //System.out.println("DELTA2 = " + delta); |
---|
7523 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7668 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7524 | 7669 | LA.matCopy(startMat, toParent); |
---|
7525 | 7670 | //System.out.println("DELTA3 = " + delta); |
---|
7526 | 7671 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7530 | 7675 | break; |
---|
7531 | 7676 | |
---|
7532 | 7677 | case hitRotate: // rotate |
---|
7533 | | - int dx = info.x - centerPt.x; |
---|
7534 | | - int dy = -(info.y - centerPt.y); |
---|
| 7678 | + int dx = clickInfo.x - centerPt.x; |
---|
| 7679 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7535 | 7680 | double angle = (double) Math.atan2(dx, dy); |
---|
7536 | 7681 | angle = -(1.570796 - angle); |
---|
7537 | 7682 | |
---|
.. | .. |
---|
7554 | 7699 | } |
---|
7555 | 7700 | /**/ |
---|
7556 | 7701 | |
---|
7557 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7702 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7558 | 7703 | { |
---|
7559 | 7704 | case 1: // '\001' |
---|
7560 | 7705 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7581 | 7726 | break; |
---|
7582 | 7727 | |
---|
7583 | 7728 | case hitScale: // scale |
---|
7584 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7729 | + double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
7585 | 7730 | double sign = 1; |
---|
7586 | 7731 | if (hScale < 0) |
---|
7587 | 7732 | { |
---|
.. | .. |
---|
7593 | 7738 | //hScale = 0.01; |
---|
7594 | 7739 | } |
---|
7595 | 7740 | |
---|
7596 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 7741 | + double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
7597 | 7742 | sign = 1; |
---|
7598 | 7743 | if (vScale < 0) |
---|
7599 | 7744 | { |
---|
.. | .. |
---|
7604 | 7749 | { |
---|
7605 | 7750 | //vScale = 0.01; |
---|
7606 | 7751 | } |
---|
| 7752 | + |
---|
7607 | 7753 | LA.matCopy(startMat, toParent); |
---|
7608 | 7754 | /**/ |
---|
7609 | 7755 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7613 | 7759 | } |
---|
7614 | 7760 | /**/ |
---|
7615 | 7761 | |
---|
7616 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7762 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
7617 | 7763 | |
---|
7618 | 7764 | if (totalScale < 0.01) |
---|
7619 | 7765 | { |
---|
7620 | 7766 | totalScale = 0.01; |
---|
7621 | 7767 | } |
---|
7622 | 7768 | |
---|
7623 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7769 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7624 | 7770 | { |
---|
7625 | 7771 | case 3: // '\001' |
---|
7626 | 7772 | if (modified || opposite) |
---|
.. | .. |
---|
7687 | 7833 | } // NEW ... |
---|
7688 | 7834 | |
---|
7689 | 7835 | |
---|
7690 | | - info.pane.repaint(); |
---|
| 7836 | + clickInfo.pane.repaint(); |
---|
7691 | 7837 | } |
---|
7692 | 7838 | |
---|
7693 | 7839 | boolean overflow = false; |
---|