.. | .. |
---|
29 | 29 | Object3D saveskeleton; |
---|
30 | 30 | // |
---|
31 | 31 | |
---|
| 32 | + byte[] versions[]; |
---|
| 33 | + int versionindex = -1; |
---|
| 34 | + |
---|
32 | 35 | ScriptNode scriptnode; |
---|
33 | 36 | |
---|
34 | 37 | void InitOthers() |
---|
.. | .. |
---|
215 | 218 | // o.transientrep = this.bRep.support; |
---|
216 | 219 | // o.bRep.support = null; |
---|
217 | 220 | // } |
---|
| 221 | + o.selection = this.selection; |
---|
| 222 | + o.versions = this.versions; |
---|
| 223 | + o.versionindex = this.versionindex; |
---|
218 | 224 | |
---|
219 | 225 | if (this.support != null) |
---|
220 | 226 | { |
---|
.. | .. |
---|
268 | 274 | { |
---|
269 | 275 | this.support.bRep = o.transientrep; |
---|
270 | 276 | } |
---|
| 277 | + |
---|
| 278 | + this.selection = o.selection; |
---|
| 279 | + |
---|
| 280 | + this.versions = o.versions; |
---|
| 281 | + this.versionindex = o.versionindex; |
---|
271 | 282 | // July 2019 if (this.bRep != null) |
---|
272 | 283 | // this.bRep.support = o.transientrep; |
---|
273 | 284 | // this.support = o.support; |
---|
.. | .. |
---|
415 | 426 | } |
---|
416 | 427 | |
---|
417 | 428 | boolean live = false; |
---|
| 429 | + transient boolean keepdontselect; |
---|
418 | 430 | boolean dontselect = false; |
---|
419 | 431 | boolean hide = false; |
---|
420 | 432 | boolean link2master = false; // performs reset support/master at each frame |
---|
.. | .. |
---|
2555 | 2567 | private static final int editSelf = 1; |
---|
2556 | 2568 | private static final int editChild = 2; |
---|
2557 | 2569 | |
---|
2558 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2570 | + void drawEditHandles(//ClickInfo info, |
---|
| 2571 | + int level) |
---|
2559 | 2572 | { |
---|
2560 | 2573 | if (level == 0) |
---|
2561 | 2574 | { |
---|
.. | .. |
---|
2563 | 2576 | return; |
---|
2564 | 2577 | |
---|
2565 | 2578 | Object3D selectee; |
---|
2566 | | - for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1)) |
---|
| 2579 | + for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info, |
---|
| 2580 | + level + 1)) |
---|
2567 | 2581 | { |
---|
2568 | 2582 | selectee = (Object3D) e.nextElement(); |
---|
2569 | 2583 | } |
---|
.. | .. |
---|
2571 | 2585 | } else |
---|
2572 | 2586 | { |
---|
2573 | 2587 | //super. |
---|
2574 | | - drawEditHandles0(info, level + 1); |
---|
| 2588 | + drawEditHandles0(//info, |
---|
| 2589 | + level + 1); |
---|
2575 | 2590 | } |
---|
2576 | 2591 | } |
---|
2577 | 2592 | |
---|
2578 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2593 | + boolean doEditClick(//ClickInfo info, |
---|
| 2594 | + int level) |
---|
2579 | 2595 | { |
---|
2580 | 2596 | doSomething = 0; |
---|
2581 | 2597 | if (level == 0) |
---|
2582 | 2598 | { |
---|
2583 | | - return doParentClick(info); |
---|
| 2599 | + return doParentClick(); //info); |
---|
2584 | 2600 | } |
---|
2585 | 2601 | if (//super. |
---|
2586 | | - doEditClick0(info, level)) |
---|
| 2602 | + doEditClick0(//info, |
---|
| 2603 | + level)) |
---|
2587 | 2604 | { |
---|
2588 | 2605 | doSomething = 1; |
---|
2589 | 2606 | return true; |
---|
.. | .. |
---|
2593 | 2610 | } |
---|
2594 | 2611 | } |
---|
2595 | 2612 | |
---|
2596 | | - boolean doParentClick(ClickInfo info) |
---|
| 2613 | + boolean doParentClick() //ClickInfo info) |
---|
2597 | 2614 | { |
---|
2598 | 2615 | if (selection == null) |
---|
2599 | 2616 | { |
---|
.. | .. |
---|
2606 | 2623 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2607 | 2624 | { |
---|
2608 | 2625 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2609 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2626 | + if (selectee.doEditClick(//info, |
---|
| 2627 | + 1)) |
---|
2610 | 2628 | { |
---|
2611 | 2629 | childToDrag = selectee; |
---|
2612 | 2630 | doSomething = 2; |
---|
.. | .. |
---|
2618 | 2636 | return retval; |
---|
2619 | 2637 | } |
---|
2620 | 2638 | |
---|
2621 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 2639 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2640 | + boolean opposite) |
---|
2622 | 2641 | { |
---|
2623 | 2642 | switch (doSomething) |
---|
2624 | 2643 | { |
---|
2625 | 2644 | case 1: // '\001' |
---|
2626 | 2645 | //super. |
---|
2627 | | - doEditDrag0(info, opposite); |
---|
| 2646 | + doEditDrag0(//clickInfo, |
---|
| 2647 | + opposite); |
---|
2628 | 2648 | break; |
---|
2629 | 2649 | |
---|
2630 | 2650 | case 2: // '\002' |
---|
.. | .. |
---|
2637 | 2657 | { |
---|
2638 | 2658 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2639 | 2659 | //childToDrag.doEditDrag(info); |
---|
2640 | | - sel.doEditDrag(info, opposite); |
---|
| 2660 | + sel.doEditDrag(//clickInfo, |
---|
| 2661 | + opposite); |
---|
2641 | 2662 | } else |
---|
2642 | 2663 | { |
---|
2643 | 2664 | //super. |
---|
2644 | | - doEditDrag0(info, opposite); |
---|
| 2665 | + doEditDrag0(//clickInfo, |
---|
| 2666 | + opposite); |
---|
2645 | 2667 | } |
---|
2646 | 2668 | } |
---|
2647 | 2669 | break; |
---|
.. | .. |
---|
2659 | 2681 | { |
---|
2660 | 2682 | deselectAll(); |
---|
2661 | 2683 | } |
---|
| 2684 | + |
---|
| 2685 | + new Exception().printStackTrace(); |
---|
| 2686 | + |
---|
2662 | 2687 | ClickInfo newInfo = new ClickInfo(); |
---|
2663 | 2688 | newInfo.flags = info.flags; |
---|
2664 | 2689 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
3106 | 3131 | { |
---|
3107 | 3132 | if (bRep != null) |
---|
3108 | 3133 | { |
---|
3109 | | - bRep.GenerateNormalsMINE(); |
---|
| 3134 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
3110 | 3135 | Touch(); |
---|
3111 | 3136 | } |
---|
3112 | 3137 | } |
---|
.. | .. |
---|
5409 | 5434 | blockloop = false; |
---|
5410 | 5435 | } |
---|
5411 | 5436 | |
---|
| 5437 | + void ResetSelectable() |
---|
| 5438 | + { |
---|
| 5439 | + if (blockloop) |
---|
| 5440 | + return; |
---|
| 5441 | + |
---|
| 5442 | + blockloop = true; |
---|
| 5443 | + |
---|
| 5444 | + keepdontselect = dontselect; |
---|
| 5445 | + dontselect = true; |
---|
| 5446 | + |
---|
| 5447 | + Object3D child; |
---|
| 5448 | + int nb = Size(); |
---|
| 5449 | + for (int i = 0; i < nb; i++) |
---|
| 5450 | + { |
---|
| 5451 | + child = (Object3D) get(i); |
---|
| 5452 | + if (child == null) |
---|
| 5453 | + continue; |
---|
| 5454 | + child.ResetSelectable(); |
---|
| 5455 | + } |
---|
| 5456 | + |
---|
| 5457 | + blockloop = false; |
---|
| 5458 | + } |
---|
| 5459 | + |
---|
| 5460 | + void RestoreSelectable() |
---|
| 5461 | + { |
---|
| 5462 | + if (blockloop) |
---|
| 5463 | + return; |
---|
| 5464 | + |
---|
| 5465 | + blockloop = true; |
---|
| 5466 | + |
---|
| 5467 | + dontselect = keepdontselect; |
---|
| 5468 | + |
---|
| 5469 | + Object3D child; |
---|
| 5470 | + int nb = Size(); |
---|
| 5471 | + for (int i = 0; i < nb; i++) |
---|
| 5472 | + { |
---|
| 5473 | + child = (Object3D) get(i); |
---|
| 5474 | + if (child == null) |
---|
| 5475 | + continue; |
---|
| 5476 | + child.RestoreSelectable(); |
---|
| 5477 | + } |
---|
| 5478 | + |
---|
| 5479 | + blockloop = false; |
---|
| 5480 | + } |
---|
| 5481 | + |
---|
5412 | 5482 | boolean IsSelected() |
---|
5413 | 5483 | { |
---|
5414 | 5484 | if (parent == null) |
---|
.. | .. |
---|
5718 | 5788 | } |
---|
5719 | 5789 | } |
---|
5720 | 5790 | |
---|
| 5791 | + void EmbedTextures(boolean embed) |
---|
| 5792 | + { |
---|
| 5793 | + if (blockloop) |
---|
| 5794 | + return; |
---|
| 5795 | + |
---|
| 5796 | + //if (GetTextures() != null) |
---|
| 5797 | + if (embed) |
---|
| 5798 | + CameraPane.EmbedTextures(GetTextures()); |
---|
| 5799 | + else |
---|
| 5800 | + { |
---|
| 5801 | + GetTextures().pigmentdata = null; |
---|
| 5802 | + GetTextures().bumpdata = null; |
---|
| 5803 | + GetTextures().pw = 0; |
---|
| 5804 | + GetTextures().ph = 0; |
---|
| 5805 | + GetTextures().bw = 0; |
---|
| 5806 | + GetTextures().bh = 0; |
---|
| 5807 | + } |
---|
| 5808 | + |
---|
| 5809 | + int nb = Size(); |
---|
| 5810 | + for (int i = 0; i < nb; i++) |
---|
| 5811 | + { |
---|
| 5812 | + Object3D child = (Object3D) get(i); |
---|
| 5813 | + |
---|
| 5814 | + if (child == null) |
---|
| 5815 | + continue; |
---|
| 5816 | + |
---|
| 5817 | + blockloop = true; |
---|
| 5818 | + child.EmbedTextures(embed); |
---|
| 5819 | + blockloop = false; |
---|
| 5820 | + } |
---|
| 5821 | + } |
---|
| 5822 | + |
---|
5721 | 5823 | void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5722 | 5824 | { |
---|
5723 | 5825 | Draw(display, root, selected, blocked); |
---|
.. | .. |
---|
5805 | 5907 | support = support; |
---|
5806 | 5908 | |
---|
5807 | 5909 | //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); |
---|
| 5910 | + boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5809 | 5911 | |
---|
5810 | 5912 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5811 | 5913 | { |
---|
.. | .. |
---|
7209 | 7311 | } |
---|
7210 | 7312 | } |
---|
7211 | 7313 | |
---|
7212 | | - protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec) |
---|
| 7314 | + static ClickInfo clickInfo = new ClickInfo(); |
---|
| 7315 | + |
---|
| 7316 | + protected void calcHotSpot(cVector in, //ClickInfo clickInfo, |
---|
| 7317 | + Point outPt, Rectangle outRec) |
---|
7213 | 7318 | { |
---|
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; |
---|
| 7319 | + int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2; |
---|
| 7320 | + int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2; |
---|
| 7321 | + double[][] toscreen = clickInfo.toScreen; |
---|
7217 | 7322 | if (toscreen == null) |
---|
7218 | 7323 | { |
---|
7219 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7324 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
7220 | 7325 | } |
---|
7221 | 7326 | cVector vec = in; |
---|
7222 | 7327 | LA.xformPos(in, toscreen, in); |
---|
7223 | 7328 | //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(); |
---|
| 7329 | + vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
| 7330 | + vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
7226 | 7331 | outPt.x = hc + (int) vec.x; |
---|
7227 | 7332 | outPt.y = vc - (int) vec.y; |
---|
7228 | 7333 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
7230 | 7335 | outRec.width = outRec.height = 6; |
---|
7231 | 7336 | } |
---|
7232 | 7337 | |
---|
7233 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7338 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7339 | + ) |
---|
7234 | 7340 | { |
---|
7235 | 7341 | Point pt = new Point(0, 0); |
---|
7236 | 7342 | Rectangle rec = new Rectangle(); |
---|
7237 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7343 | + calcHotSpot(in, //clickInfo, |
---|
| 7344 | + pt, rec); |
---|
7238 | 7345 | return rec; |
---|
7239 | 7346 | } |
---|
7240 | 7347 | |
---|
7241 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7348 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7349 | + int level) |
---|
7242 | 7350 | { |
---|
7243 | 7351 | if (level == 0) |
---|
7244 | 7352 | { |
---|
.. | .. |
---|
7247 | 7355 | { |
---|
7248 | 7356 | cVector origin = new cVector(); |
---|
7249 | 7357 | //LA.xformPos(origin, toParent, origin); |
---|
7250 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7358 | + if (this.clickInfo == null) |
---|
| 7359 | + this.clickInfo = new ClickInfo(); |
---|
| 7360 | + |
---|
| 7361 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
7251 | 7362 | Rectangle boundary = new Rectangle(); |
---|
7252 | 7363 | boundary.x = spot.x - 30; |
---|
7253 | 7364 | boundary.y = spot.y - 30; |
---|
7254 | 7365 | boundary.width = spot.width + 60; |
---|
7255 | 7366 | boundary.height = spot.height + 60; |
---|
7256 | | - info.g.setColor(Color.red); |
---|
| 7367 | + clickInfo.g.setColor(Color.red); |
---|
7257 | 7368 | int spotw = spot.x + spot.width; |
---|
7258 | 7369 | int spoth = spot.y + spot.height; |
---|
7259 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7370 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7260 | 7371 | // if (CameraPane.Xmin > spot.x) |
---|
7261 | 7372 | // { |
---|
7262 | 7373 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7276 | 7387 | spot.translate(32, 32); |
---|
7277 | 7388 | spotw = spot.x + spot.width; |
---|
7278 | 7389 | spoth = spot.y + spot.height; |
---|
7279 | | - info.g.setColor(Color.cyan); |
---|
7280 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7390 | + clickInfo.g.setColor(Color.cyan); |
---|
| 7391 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7281 | 7392 | // if (CameraPane.Xmin > spot.x) |
---|
7282 | 7393 | // { |
---|
7283 | 7394 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7297 | 7408 | // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7298 | 7409 | //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7299 | 7410 | 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); |
---|
| 7411 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7412 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7413 | + clickInfo.g.setColor(Color.green); |
---|
7303 | 7414 | // if (CameraPane.Xmin > spot.x) |
---|
7304 | 7415 | // { |
---|
7305 | 7416 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7316 | 7427 | // { |
---|
7317 | 7428 | // CameraPane.Ymax = spoth; |
---|
7318 | 7429 | // } |
---|
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); |
---|
| 7430 | + clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
| 7431 | + (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7321 | 7432 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7322 | 7433 | // if (CameraPane.Xmin > boundary.x) |
---|
7323 | 7434 | // { |
---|
.. | .. |
---|
7339 | 7450 | } |
---|
7340 | 7451 | } |
---|
7341 | 7452 | |
---|
7342 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7453 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7454 | + int level) |
---|
7343 | 7455 | { |
---|
7344 | 7456 | if (level == 0) |
---|
7345 | 7457 | { |
---|
.. | .. |
---|
7348 | 7460 | |
---|
7349 | 7461 | boolean retval = false; |
---|
7350 | 7462 | |
---|
7351 | | - startX = info.x; |
---|
7352 | | - startY = info.y; |
---|
| 7463 | + startX = clickInfo.x; |
---|
| 7464 | + startY = clickInfo.y; |
---|
7353 | 7465 | |
---|
7354 | 7466 | hitSomething = -1; |
---|
7355 | 7467 | cVector origin = new cVector(); |
---|
.. | .. |
---|
7359 | 7471 | { |
---|
7360 | 7472 | centerPt = new Point(0, 0); |
---|
7361 | 7473 | } |
---|
7362 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
7363 | | - if (spot.contains(info.x, info.y)) |
---|
| 7474 | + calcHotSpot(origin, //info, |
---|
| 7475 | + centerPt, spot); |
---|
| 7476 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7364 | 7477 | { |
---|
7365 | 7478 | hitSomething = hitCenter; |
---|
7366 | 7479 | retval = true; |
---|
7367 | 7480 | } |
---|
7368 | 7481 | spot.translate(32, 0); |
---|
7369 | | - if (spot.contains(info.x, info.y)) |
---|
| 7482 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7370 | 7483 | { |
---|
7371 | 7484 | hitSomething = hitRotate; |
---|
7372 | 7485 | retval = true; |
---|
7373 | 7486 | } |
---|
7374 | 7487 | spot.translate(0, 32); |
---|
7375 | | - if (spot.contains(info.x, info.y)) |
---|
| 7488 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7376 | 7489 | { |
---|
7377 | 7490 | hitSomething = hitScale; |
---|
| 7491 | + |
---|
| 7492 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
| 7493 | + double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32; |
---|
| 7494 | + double sign = 1; |
---|
| 7495 | + if (hScale < 0) |
---|
| 7496 | + { |
---|
| 7497 | + sign = -1; |
---|
| 7498 | + } |
---|
| 7499 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
| 7500 | + if (hScale < 0.01) |
---|
| 7501 | + { |
---|
| 7502 | + //hScale = 0.01; |
---|
| 7503 | + } |
---|
| 7504 | + |
---|
| 7505 | + double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32; |
---|
| 7506 | + sign = 1; |
---|
| 7507 | + if (vScale < 0) |
---|
| 7508 | + { |
---|
| 7509 | + sign = -1; |
---|
| 7510 | + } |
---|
| 7511 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
| 7512 | + if (vScale < 0.01) |
---|
| 7513 | + { |
---|
| 7514 | + //vScale = 0.01; |
---|
| 7515 | + } |
---|
| 7516 | + |
---|
| 7517 | + clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale); |
---|
| 7518 | + |
---|
7378 | 7519 | retval = true; |
---|
7379 | 7520 | } |
---|
7380 | 7521 | |
---|
.. | .. |
---|
7384 | 7525 | } |
---|
7385 | 7526 | |
---|
7386 | 7527 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7387 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
| 7528 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7388 | 7529 | //System.out.println("modified = " + modified); |
---|
7389 | 7530 | //new Exception().printStackTrace(); |
---|
7390 | 7531 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7412 | 7553 | return true; |
---|
7413 | 7554 | } |
---|
7414 | 7555 | |
---|
7415 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
---|
| 7556 | + void doEditDrag0(//ClickInfo info, |
---|
| 7557 | + boolean opposite) |
---|
7416 | 7558 | { |
---|
7417 | 7559 | if (hitSomething == 0) |
---|
7418 | 7560 | { |
---|
.. | .. |
---|
7426 | 7568 | |
---|
7427 | 7569 | //System.out.println("hitSomething = " + hitSomething); |
---|
7428 | 7570 | |
---|
7429 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7571 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7430 | 7572 | |
---|
7431 | 7573 | cVector xlate = new cVector(); |
---|
7432 | 7574 | //cVector xlate2 = new cVector(); |
---|
.. | .. |
---|
7460 | 7602 | toParent[3][i] = xlate.get(i); |
---|
7461 | 7603 | LA.matInvert(toParent, fromParent); |
---|
7462 | 7604 | */ |
---|
7463 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7464 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7605 | + cVector delta = LA.newVector(0, 0, startY - clickInfo.y); |
---|
| 7606 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7465 | 7607 | |
---|
7466 | 7608 | LA.matCopy(startMat, toParent); |
---|
7467 | 7609 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7470 | 7612 | } else |
---|
7471 | 7613 | { |
---|
7472 | 7614 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7473 | | - cVector up = new cVector(info.camera.up); |
---|
| 7615 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7474 | 7616 | cVector away = new cVector(); |
---|
7475 | 7617 | //cVector right2 = new cVector(); |
---|
7476 | 7618 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7487 | 7629 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7488 | 7630 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7489 | 7631 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7490 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 7632 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7491 | 7633 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7492 | 7634 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7493 | 7635 | //LA.vecCross(up, cVector.Z, right2); |
---|
7494 | 7636 | |
---|
7495 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 7637 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7496 | 7638 | |
---|
7497 | 7639 | //System.out.println("DELTA0 = " + delta); |
---|
7498 | 7640 | //System.out.println("AWAY = " + info.camera.away); |
---|
7499 | 7641 | //System.out.println("UP = " + info.camera.up); |
---|
7500 | 7642 | if (away.z > 0) |
---|
7501 | 7643 | { |
---|
7502 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 7644 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7503 | 7645 | { |
---|
7504 | 7646 | delta.x = -delta.x; |
---|
7505 | 7647 | } else |
---|
.. | .. |
---|
7514 | 7656 | //System.out.println("DELTA1 = " + delta); |
---|
7515 | 7657 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7516 | 7658 | //System.out.println("DELTA2 = " + delta); |
---|
7517 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7659 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7518 | 7660 | LA.matCopy(startMat, toParent); |
---|
7519 | 7661 | //System.out.println("DELTA3 = " + delta); |
---|
7520 | 7662 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7524 | 7666 | break; |
---|
7525 | 7667 | |
---|
7526 | 7668 | case hitRotate: // rotate |
---|
7527 | | - int dx = info.x - centerPt.x; |
---|
7528 | | - int dy = -(info.y - centerPt.y); |
---|
| 7669 | + int dx = clickInfo.x - centerPt.x; |
---|
| 7670 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7529 | 7671 | double angle = (double) Math.atan2(dx, dy); |
---|
7530 | 7672 | angle = -(1.570796 - angle); |
---|
7531 | 7673 | |
---|
.. | .. |
---|
7548 | 7690 | } |
---|
7549 | 7691 | /**/ |
---|
7550 | 7692 | |
---|
7551 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7693 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7552 | 7694 | { |
---|
7553 | 7695 | case 1: // '\001' |
---|
7554 | 7696 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7575 | 7717 | break; |
---|
7576 | 7718 | |
---|
7577 | 7719 | case hitScale: // scale |
---|
7578 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7720 | + double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32; |
---|
7579 | 7721 | double sign = 1; |
---|
7580 | 7722 | if (hScale < 0) |
---|
7581 | 7723 | { |
---|
.. | .. |
---|
7587 | 7729 | //hScale = 0.01; |
---|
7588 | 7730 | } |
---|
7589 | 7731 | |
---|
7590 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 7732 | + double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32; |
---|
7591 | 7733 | sign = 1; |
---|
7592 | 7734 | if (vScale < 0) |
---|
7593 | 7735 | { |
---|
.. | .. |
---|
7598 | 7740 | { |
---|
7599 | 7741 | //vScale = 0.01; |
---|
7600 | 7742 | } |
---|
| 7743 | + |
---|
7601 | 7744 | LA.matCopy(startMat, toParent); |
---|
7602 | 7745 | /**/ |
---|
7603 | 7746 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7607 | 7750 | } |
---|
7608 | 7751 | /**/ |
---|
7609 | 7752 | |
---|
7610 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7753 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
7611 | 7754 | |
---|
7612 | 7755 | if (totalScale < 0.01) |
---|
7613 | 7756 | { |
---|
7614 | 7757 | totalScale = 0.01; |
---|
7615 | 7758 | } |
---|
7616 | 7759 | |
---|
7617 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7760 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7618 | 7761 | { |
---|
7619 | 7762 | case 3: // '\001' |
---|
7620 | 7763 | if (modified || opposite) |
---|
.. | .. |
---|
7681 | 7824 | } // NEW ... |
---|
7682 | 7825 | |
---|
7683 | 7826 | |
---|
7684 | | - info.pane.repaint(); |
---|
| 7827 | + clickInfo.pane.repaint(); |
---|
7685 | 7828 | } |
---|
7686 | 7829 | |
---|
7687 | 7830 | boolean overflow = false; |
---|