.. | .. |
---|
5 | 5 | import java.util.Vector; |
---|
6 | 6 | |
---|
7 | 7 | import javax.media.j3d.Transform3D; |
---|
| 8 | +import javax.media.opengl.GL; |
---|
8 | 9 | import javax.vecmath.Vector3d; |
---|
9 | 10 | |
---|
10 | 11 | import javax.imageio.ImageIO; |
---|
.. | .. |
---|
13 | 14 | import //weka.core. |
---|
14 | 15 | matrix.Matrix; |
---|
15 | 16 | |
---|
| 17 | +import java.util.UUID; |
---|
| 18 | + |
---|
16 | 19 | //import net.sourceforge.sizeof.SizeOf; |
---|
17 | 20 | public class Object3D extends Vector<Object3D> implements java.io.Serializable, iSendInfo //, aurelienribon.tweenengine.TweenAccessor<Object3D> |
---|
18 | 21 | { |
---|
19 | 22 | //static final long serialVersionUID = -607422624994562685L; |
---|
20 | 23 | static final long serialVersionUID = 5022536242724664900L; |
---|
21 | 24 | |
---|
| 25 | + private UUID uuid = UUID.randomUUID(); |
---|
| 26 | + |
---|
22 | 27 | ScriptNode scriptnode; |
---|
| 28 | + |
---|
| 29 | + void InitOthers() |
---|
| 30 | + { |
---|
| 31 | + if (projectedVertices == null || projectedVertices.length <= 2) |
---|
| 32 | + { |
---|
| 33 | + projectedVertices = new Object3D.cVector2[3]; |
---|
| 34 | + } |
---|
| 35 | + for (int i = 0; i < 3; i++) |
---|
| 36 | + { |
---|
| 37 | + projectedVertices[i] = new cVector2(); // Others |
---|
| 38 | + } |
---|
| 39 | + projectedVertices[0].x = 100; // bump |
---|
| 40 | + } |
---|
23 | 41 | |
---|
24 | 42 | void MinMax(cVector minima, cVector maxima) |
---|
25 | 43 | { |
---|
.. | .. |
---|
142 | 160 | blockloop = true; |
---|
143 | 161 | child.RestoreSupports(); |
---|
144 | 162 | blockloop = false; |
---|
| 163 | + } |
---|
| 164 | +} |
---|
| 165 | + |
---|
| 166 | +void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 167 | +{ |
---|
| 168 | + if (hashtable.containsKey(GetUUID())) |
---|
| 169 | + return; |
---|
| 170 | + |
---|
| 171 | + Object3D o = new Object3D(); |
---|
| 172 | + o.bRep = this.bRep; |
---|
| 173 | + if (this.bRep != null) |
---|
| 174 | + { |
---|
| 175 | + o.transientrep = this.bRep.support; |
---|
| 176 | + o.bRep.support = null; |
---|
| 177 | + } |
---|
| 178 | + |
---|
| 179 | +// o.support = this.support; |
---|
| 180 | +// o.fileparent = this.fileparent; |
---|
| 181 | +// if (this.bRep != null) |
---|
| 182 | +// o.bRep = this.bRep.support; |
---|
| 183 | + |
---|
| 184 | + hashtable.put(GetUUID(), o); |
---|
| 185 | + |
---|
| 186 | + this.bRep = null; |
---|
| 187 | +// if (this.bRep != null) |
---|
| 188 | +// this.bRep.support = null; |
---|
| 189 | +// this.support = null; |
---|
| 190 | +// this.fileparent = null; |
---|
| 191 | + |
---|
| 192 | + for (int i=0; i<Size(); i++) |
---|
| 193 | + { |
---|
| 194 | + get(i).ExtractBigData(hashtable); |
---|
| 195 | + } |
---|
| 196 | +} |
---|
| 197 | + |
---|
| 198 | +void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 199 | +{ |
---|
| 200 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 201 | + return; |
---|
| 202 | + |
---|
| 203 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 204 | + |
---|
| 205 | + this.bRep = o.bRep; |
---|
| 206 | + if (this.bRep != null) |
---|
| 207 | + this.bRep.support = o.transientrep; |
---|
| 208 | +// this.support = o.support; |
---|
| 209 | +// this.fileparent = o.fileparent; |
---|
| 210 | + |
---|
| 211 | + hashtable.remove(GetUUID()); |
---|
| 212 | + |
---|
| 213 | + for (int i=0; i<Size(); i++) |
---|
| 214 | + { |
---|
| 215 | + get(i).RestoreBigData(hashtable); |
---|
145 | 216 | } |
---|
146 | 217 | } |
---|
147 | 218 | |
---|
.. | .. |
---|
286 | 357 | } |
---|
287 | 358 | |
---|
288 | 359 | boolean live = false; |
---|
| 360 | + boolean dontselect = false; |
---|
289 | 361 | boolean hide = false; |
---|
290 | 362 | boolean link2master = false; // performs reset support/master at each frame |
---|
291 | 363 | boolean marked = false; // animation node |
---|
.. | .. |
---|
295 | 367 | boolean random = false; |
---|
296 | 368 | boolean speedup = false; |
---|
297 | 369 | boolean rewind = false; |
---|
| 370 | + |
---|
| 371 | + float NORMALPUSH = 0; |
---|
298 | 372 | |
---|
299 | 373 | Object3D support; |
---|
300 | 374 | |
---|
.. | .. |
---|
355 | 429 | |
---|
356 | 430 | int MemorySize() |
---|
357 | 431 | { |
---|
358 | | - if (memorysize == 0) |
---|
| 432 | + if (true) // memorysize == 0) |
---|
359 | 433 | { |
---|
360 | 434 | try |
---|
361 | 435 | { |
---|
.. | .. |
---|
415 | 489 | { |
---|
416 | 490 | Object3D copy = this; |
---|
417 | 491 | |
---|
418 | | - Camera parentcam = CameraPane.theRenderer.manipCamera; |
---|
| 492 | + Camera parentcam = Globals.theRenderer.ManipCamera(); |
---|
419 | 493 | |
---|
420 | | - if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0]) |
---|
| 494 | + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0]) |
---|
421 | 495 | { |
---|
422 | | - parentcam = CameraPane.theRenderer.cameras[1]; |
---|
| 496 | + parentcam = Globals.theRenderer.Cameras()[1]; |
---|
423 | 497 | } |
---|
424 | 498 | |
---|
425 | | - if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1]) |
---|
| 499 | + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1]) |
---|
426 | 500 | { |
---|
427 | | - parentcam = CameraPane.theRenderer.cameras[0]; |
---|
| 501 | + parentcam = Globals.theRenderer.Cameras()[0]; |
---|
428 | 502 | } |
---|
429 | 503 | |
---|
430 | 504 | if (this == parentcam) |
---|
.. | .. |
---|
432 | 506 | //assert(this instanceof Camera); |
---|
433 | 507 | |
---|
434 | 508 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
435 | | - LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt); |
---|
| 509 | + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt()); |
---|
436 | 510 | } |
---|
437 | 511 | |
---|
438 | 512 | copy.marked ^= true; |
---|
.. | .. |
---|
452 | 526 | //assert(this instanceof Camera); |
---|
453 | 527 | |
---|
454 | 528 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
455 | | - LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt); |
---|
| 529 | + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt()); |
---|
456 | 530 | } |
---|
457 | 531 | |
---|
458 | 532 | copy.Touch(); // display list issue |
---|
.. | .. |
---|
587 | 661 | return; |
---|
588 | 662 | } |
---|
589 | 663 | |
---|
590 | | - if (CameraPane.fromscript) |
---|
| 664 | + if (Globals.fromscript) |
---|
591 | 665 | { |
---|
592 | 666 | transformcount = 0; |
---|
593 | 667 | return; |
---|
.. | .. |
---|
745 | 819 | |
---|
746 | 820 | int GetTransformCount() |
---|
747 | 821 | { |
---|
748 | | - // marde pour serialization de Texture |
---|
| 822 | + // patch pour serialization de Texture |
---|
749 | 823 | resetmaxcount(); |
---|
750 | 824 | resettransformcount(); |
---|
751 | 825 | resetstep(); |
---|
.. | .. |
---|
758 | 832 | if (step == 0) |
---|
759 | 833 | step = 1; |
---|
760 | 834 | if (maxcount == 0) |
---|
761 | | - maxcount = 2048; // 4; |
---|
| 835 | + maxcount = 128; // 2048; // 4; |
---|
762 | 836 | // if (acceleration == 0) |
---|
763 | 837 | // acceleration = 10; |
---|
764 | 838 | if (delay == 0) // serial |
---|
.. | .. |
---|
779 | 853 | // factor = CameraPane.STEP; |
---|
780 | 854 | // } |
---|
781 | 855 | |
---|
782 | | - if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount) |
---|
| 856 | + if (marked && Globals.isLIVE() && live && |
---|
| 857 | + //TEMP21aug2018 |
---|
| 858 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 859 | + currentframe != Globals.framecount) |
---|
783 | 860 | { |
---|
784 | | - currentframe = CameraPane.framecount; |
---|
| 861 | + currentframe = Globals.framecount; |
---|
785 | 862 | |
---|
786 | 863 | // System.err.println("transformcount = " + transformcount); |
---|
787 | 864 | // System.err.println("factor = " + factor); |
---|
.. | .. |
---|
893 | 970 | fromParent = null; // LA.newMatrix(); |
---|
894 | 971 | bRep = null; // new BoundaryRep(); |
---|
895 | 972 | |
---|
| 973 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 974 | + { |
---|
| 975 | + name = oname; |
---|
| 976 | + } |
---|
| 977 | + |
---|
896 | 978 | /* |
---|
897 | 979 | float hue = (float)Math.random(); |
---|
898 | 980 | Color col; |
---|
.. | .. |
---|
935 | 1017 | |
---|
936 | 1018 | public Object clone() |
---|
937 | 1019 | { |
---|
938 | | - return GrafreeD.clone(this); |
---|
| 1020 | + return Grafreed.clone(this); |
---|
939 | 1021 | } |
---|
940 | 1022 | |
---|
941 | 1023 | Object3D copyExpand() |
---|
.. | .. |
---|
1446 | 1528 | // if (other == null) |
---|
1447 | 1529 | // return; |
---|
1448 | 1530 | |
---|
1449 | | - System.out.println("Link support this = " + this + "; other = " + other); |
---|
| 1531 | + if (other != null) |
---|
| 1532 | + { |
---|
| 1533 | + BoundaryRep.SEUIL = other.material.cameralight; |
---|
| 1534 | + |
---|
| 1535 | + // Set default to 0.1 |
---|
| 1536 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
| 1537 | + System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
| 1538 | + } |
---|
| 1539 | + |
---|
| 1540 | + System.out.println("Link this = " + this + "; support = " + other); |
---|
1450 | 1541 | |
---|
1451 | 1542 | //if (bRep != null) |
---|
1452 | 1543 | // bRep.linkVerticesThis(other.bRep); |
---|
.. | .. |
---|
1701 | 1792 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1702 | 1793 | o.bRep = transientrep; |
---|
1703 | 1794 | if (clone) |
---|
1704 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1795 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1705 | 1796 | o.CreateMaterial(); |
---|
1706 | 1797 | o.SetAttributes(this, -1); |
---|
1707 | 1798 | //parent |
---|
.. | .. |
---|
1714 | 1805 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1715 | 1806 | o.bRep = bRep; |
---|
1716 | 1807 | if (clone) |
---|
1717 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1808 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1718 | 1809 | o.CreateMaterial(); |
---|
1719 | 1810 | //o.overwriteThis(this, -1); |
---|
1720 | 1811 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1801 | 1892 | if (obj.name == null) |
---|
1802 | 1893 | continue; // can't be a null one |
---|
1803 | 1894 | |
---|
| 1895 | + // Try perfect match first. |
---|
1804 | 1896 | if (n.equals(obj.name)) |
---|
1805 | 1897 | { |
---|
1806 | 1898 | theobj = obj; |
---|
1807 | 1899 | count++; |
---|
1808 | 1900 | } |
---|
1809 | 1901 | } |
---|
| 1902 | + |
---|
| 1903 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1810 | 1904 | |
---|
1811 | 1905 | if (count != 1) |
---|
1812 | 1906 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
1816 | 1910 | if (obj.name == null) |
---|
1817 | 1911 | continue; // can't be a null one |
---|
1818 | 1912 | |
---|
1819 | | - //if (n.contains(obj.name)) // dec 2013 name.split(":")[0])) // Poser generates a count |
---|
1820 | | - if (n.startsWith(obj.name)) |
---|
| 1913 | + String name = obj.name.split(":")[0]; // Poser generates a count |
---|
| 1914 | + //if (n.startsWith(obj.name)) |
---|
| 1915 | + if (n.contains(name)) |
---|
1821 | 1916 | { |
---|
1822 | 1917 | theobj = obj; |
---|
1823 | 1918 | count++; |
---|
.. | .. |
---|
2120 | 2215 | if (/*parent != null &&*/ material == null) |
---|
2121 | 2216 | { |
---|
2122 | 2217 | material = new cMaterial(GetMaterial()); |
---|
2123 | | - if (projectedVertices == null || projectedVertices.length <= 2) |
---|
2124 | | - { |
---|
2125 | | - projectedVertices = new Object3D.cVector2[3]; |
---|
2126 | | - } |
---|
2127 | | - for (int i = 0; i < 3; i++) |
---|
2128 | | - { |
---|
2129 | | - projectedVertices[i] = new cVector2(); // Others |
---|
2130 | | - } |
---|
2131 | | - projectedVertices[0].x = 100; // bump |
---|
| 2218 | + |
---|
| 2219 | + InitOthers(); |
---|
2132 | 2220 | |
---|
2133 | 2221 | if (this instanceof Camera) |
---|
2134 | 2222 | { |
---|
.. | .. |
---|
2278 | 2366 | { |
---|
2279 | 2367 | if (newWindow) |
---|
2280 | 2368 | { |
---|
| 2369 | + new Exception().printStackTrace(); |
---|
2281 | 2370 | System.exit(0); |
---|
2282 | 2371 | if (parent != null) |
---|
2283 | 2372 | { |
---|
.. | .. |
---|
2454 | 2543 | return retval; |
---|
2455 | 2544 | } |
---|
2456 | 2545 | |
---|
2457 | | - void doEditDrag(ClickInfo info) |
---|
| 2546 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2458 | 2547 | { |
---|
2459 | 2548 | switch (doSomething) |
---|
2460 | 2549 | { |
---|
2461 | 2550 | case 1: // '\001' |
---|
2462 | 2551 | //super. |
---|
2463 | | - doEditDrag0(info); |
---|
| 2552 | + doEditDrag0(info, opposite); |
---|
2464 | 2553 | break; |
---|
2465 | 2554 | |
---|
2466 | 2555 | case 2: // '\002' |
---|
.. | .. |
---|
2473 | 2562 | { |
---|
2474 | 2563 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2475 | 2564 | //childToDrag.doEditDrag(info); |
---|
2476 | | - sel.doEditDrag(info); |
---|
| 2565 | + sel.doEditDrag(info, opposite); |
---|
2477 | 2566 | } else |
---|
2478 | 2567 | { |
---|
2479 | 2568 | //super. |
---|
2480 | | - doEditDrag0(info); |
---|
| 2569 | + doEditDrag0(info, opposite); |
---|
2481 | 2570 | } |
---|
2482 | 2571 | } |
---|
2483 | 2572 | break; |
---|
.. | .. |
---|
2732 | 2821 | blockloop = false; |
---|
2733 | 2822 | } |
---|
2734 | 2823 | |
---|
| 2824 | + void GenNormalsMINE() |
---|
| 2825 | + { |
---|
| 2826 | + if (blockloop) |
---|
| 2827 | + return; |
---|
| 2828 | + |
---|
| 2829 | + blockloop = true; |
---|
| 2830 | + GenNormalsMINE0(); |
---|
| 2831 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2832 | + { |
---|
| 2833 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2834 | + if (child == null) |
---|
| 2835 | + continue; |
---|
| 2836 | + child.GenNormalsMINE(); |
---|
| 2837 | +// Children().release(i); |
---|
| 2838 | + } |
---|
| 2839 | + blockloop = false; |
---|
| 2840 | + } |
---|
| 2841 | + |
---|
2735 | 2842 | void ClearColors() |
---|
2736 | 2843 | { |
---|
2737 | 2844 | if (blockloop) |
---|
.. | .. |
---|
2866 | 2973 | { |
---|
2867 | 2974 | if (bRep != null) |
---|
2868 | 2975 | { |
---|
2869 | | - bRep.GenUV(); |
---|
| 2976 | + bRep.GenUV(); //1); |
---|
| 2977 | + //bRep.UnfoldUV(); |
---|
2870 | 2978 | Touch(); |
---|
2871 | 2979 | } |
---|
2872 | 2980 | } |
---|
.. | .. |
---|
2876 | 2984 | if (bRep != null) |
---|
2877 | 2985 | { |
---|
2878 | 2986 | bRep.GenerateNormals(crease); |
---|
| 2987 | + Touch(); |
---|
| 2988 | + } |
---|
| 2989 | + } |
---|
| 2990 | + |
---|
| 2991 | + void GenNormalsMINE0() |
---|
| 2992 | + { |
---|
| 2993 | + if (bRep != null) |
---|
| 2994 | + { |
---|
| 2995 | + bRep.GenerateNormalsMINE(); |
---|
2879 | 2996 | Touch(); |
---|
2880 | 2997 | } |
---|
2881 | 2998 | } |
---|
.. | .. |
---|
2932 | 3049 | blockloop = false; |
---|
2933 | 3050 | } |
---|
2934 | 3051 | |
---|
| 3052 | + void TransformChildren() |
---|
| 3053 | + { |
---|
| 3054 | + if (toParent != null) |
---|
| 3055 | + { |
---|
| 3056 | + for (int i=Size(); --i>=0;) |
---|
| 3057 | + { |
---|
| 3058 | + Object3D v = get(i); |
---|
| 3059 | + |
---|
| 3060 | + if (v.toParent == null) |
---|
| 3061 | + { |
---|
| 3062 | + v.toParent = LA.newMatrix(); |
---|
| 3063 | + v.fromParent = LA.newMatrix(); |
---|
| 3064 | + } |
---|
| 3065 | + |
---|
| 3066 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3067 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3068 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3069 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3070 | + } |
---|
| 3071 | + |
---|
| 3072 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3073 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3074 | + |
---|
| 3075 | + Touch(); |
---|
| 3076 | + } |
---|
| 3077 | + } |
---|
| 3078 | + |
---|
2935 | 3079 | void TransformGeometry() |
---|
2936 | 3080 | { |
---|
2937 | 3081 | Object3D obj = this; |
---|
.. | .. |
---|
3153 | 3297 | |
---|
3154 | 3298 | BoundaryRep sup = bRep.support; |
---|
3155 | 3299 | bRep.support = null; |
---|
3156 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3300 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3157 | 3301 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3158 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3302 | + |
---|
| 3303 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3304 | + |
---|
3159 | 3305 | bRep = temprep; |
---|
3160 | 3306 | bRep.support = sup; |
---|
3161 | 3307 | Touch(); |
---|
.. | .. |
---|
3677 | 3823 | if (child == null) |
---|
3678 | 3824 | continue; |
---|
3679 | 3825 | |
---|
3680 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3826 | + if (Grafreed.RENDERME > 0) |
---|
3681 | 3827 | { |
---|
3682 | 3828 | if (child instanceof Merge) |
---|
3683 | 3829 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3828 | 3974 | if (child == null) |
---|
3829 | 3975 | continue; |
---|
3830 | 3976 | |
---|
3831 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3977 | + if (Grafreed.RENDERME > 0) |
---|
3832 | 3978 | { |
---|
3833 | 3979 | if (child instanceof Merge) |
---|
3834 | 3980 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4023 | 4169 | if (child == null) |
---|
4024 | 4170 | continue; |
---|
4025 | 4171 | |
---|
4026 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4172 | + if (Grafreed.RENDERME > 0) |
---|
4027 | 4173 | { |
---|
4028 | 4174 | if (child instanceof Merge) |
---|
4029 | 4175 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4111 | 4257 | if (blockloop) |
---|
4112 | 4258 | return; |
---|
4113 | 4259 | |
---|
4114 | | - for (int i=0; i<size(); i++) |
---|
| 4260 | + for (int i=0; i<Size(); i++) |
---|
4115 | 4261 | { |
---|
4116 | 4262 | if (get(i).parent != this) |
---|
4117 | 4263 | { |
---|
.. | .. |
---|
4120 | 4266 | } |
---|
4121 | 4267 | blockloop = true; |
---|
4122 | 4268 | get(i).RepairParent(); |
---|
| 4269 | + blockloop = false; |
---|
| 4270 | + } |
---|
| 4271 | + } |
---|
| 4272 | + |
---|
| 4273 | + void RepairShadow() |
---|
| 4274 | + { |
---|
| 4275 | + if (blockloop) |
---|
| 4276 | + return; |
---|
| 4277 | + |
---|
| 4278 | + if (this.material != null) |
---|
| 4279 | + this.InitOthers(); |
---|
| 4280 | + |
---|
| 4281 | + for (int i=0; i<Size(); i++) |
---|
| 4282 | + { |
---|
| 4283 | + blockloop = true; |
---|
| 4284 | + get(i).RepairShadow(); |
---|
4123 | 4285 | blockloop = false; |
---|
4124 | 4286 | } |
---|
4125 | 4287 | } |
---|
.. | .. |
---|
4614 | 4776 | |
---|
4615 | 4777 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4616 | 4778 | { |
---|
4617 | | - if (hide) |
---|
| 4779 | + if (hide || dontselect) |
---|
4618 | 4780 | return null; |
---|
4619 | 4781 | |
---|
4620 | 4782 | if (count <= 0) |
---|
.. | .. |
---|
4640 | 4802 | |
---|
4641 | 4803 | cTreePath Select(int indexcount, boolean deselect) |
---|
4642 | 4804 | { |
---|
4643 | | - if (hide) |
---|
| 4805 | + if (hide || dontselect) |
---|
4644 | 4806 | return null; |
---|
4645 | 4807 | |
---|
4646 | 4808 | if (count <= 0) |
---|
.. | .. |
---|
4790 | 4952 | return globalTransform; |
---|
4791 | 4953 | } |
---|
4792 | 4954 | |
---|
4793 | | - void PreprocessOcclusion(CameraPane cp) |
---|
| 4955 | + void PreprocessOcclusion(iCameraPane cp) |
---|
4794 | 4956 | { |
---|
4795 | 4957 | /* |
---|
4796 | 4958 | if (AOdone) |
---|
.. | .. |
---|
4937 | 5099 | } else // |
---|
4938 | 5100 | if (editWindow != null) |
---|
4939 | 5101 | { |
---|
4940 | | - editWindow.cameraView.lighttouched = true; |
---|
| 5102 | + //editWindow.cameraView.lighttouched = true; |
---|
| 5103 | + Globals.lighttouched = true; |
---|
4941 | 5104 | } |
---|
4942 | 5105 | } |
---|
4943 | 5106 | |
---|
.. | .. |
---|
5091 | 5254 | |
---|
5092 | 5255 | // System.out.println("Fullname = " + fullname); |
---|
5093 | 5256 | |
---|
5094 | | - if (fullname.name.indexOf(":") == -1) |
---|
5095 | | - return fullname.name; |
---|
| 5257 | + // Does not work on Windows due to C: |
---|
| 5258 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5259 | +// return fullname.name; |
---|
| 5260 | +// |
---|
| 5261 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5096 | 5262 | |
---|
5097 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5263 | + String[] split = fullname.name.split(":"); |
---|
| 5264 | + |
---|
| 5265 | + if (split.length == 0) |
---|
| 5266 | + { |
---|
| 5267 | + return ""; |
---|
| 5268 | + } |
---|
| 5269 | + |
---|
| 5270 | + if (split.length <= 2) |
---|
| 5271 | + { |
---|
| 5272 | + if (fullname.name.endsWith(":")) |
---|
| 5273 | + { |
---|
| 5274 | + // Windows |
---|
| 5275 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5276 | + } |
---|
| 5277 | + |
---|
| 5278 | + return split[0]; |
---|
| 5279 | + } |
---|
| 5280 | + |
---|
| 5281 | + // Windows |
---|
| 5282 | + assert(split.length == 4); |
---|
| 5283 | + |
---|
| 5284 | + return split[0] + ":" + split[1]; |
---|
5098 | 5285 | } |
---|
5099 | 5286 | |
---|
5100 | 5287 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5103 | 5290 | return ""; |
---|
5104 | 5291 | |
---|
5105 | 5292 | // System.out.println("Fullname = " + fullname); |
---|
5106 | | - if (fullname.name.indexOf(":") == -1) |
---|
5107 | | - return ""; |
---|
5108 | | - |
---|
5109 | | - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5293 | + // Does not work on Windows due to C: |
---|
| 5294 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5295 | +// return ""; |
---|
| 5296 | +// |
---|
| 5297 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5298 | + String[] split = fullname.name.split(":"); |
---|
| 5299 | + |
---|
| 5300 | + if (split.length == 0) |
---|
| 5301 | + { |
---|
| 5302 | + return ""; |
---|
| 5303 | + } |
---|
| 5304 | + |
---|
| 5305 | + if (split.length == 1) |
---|
| 5306 | + { |
---|
| 5307 | + return ""; |
---|
| 5308 | + } |
---|
| 5309 | + |
---|
| 5310 | + if (split.length == 2) |
---|
| 5311 | + { |
---|
| 5312 | + if (fullname.name.endsWith(":")) |
---|
| 5313 | + { |
---|
| 5314 | + // Windows |
---|
| 5315 | + return ""; |
---|
| 5316 | + } |
---|
| 5317 | + |
---|
| 5318 | + return split[1]; |
---|
| 5319 | + } |
---|
| 5320 | + |
---|
| 5321 | + // Windows |
---|
| 5322 | + assert(split.length == 4); |
---|
| 5323 | + |
---|
| 5324 | + return split[2] + ":" + split[3]; |
---|
5110 | 5325 | } |
---|
5111 | 5326 | |
---|
5112 | 5327 | String GetPigmentTexture() |
---|
.. | .. |
---|
5180 | 5395 | System.out.print("; textures = " + textures); |
---|
5181 | 5396 | System.out.println("; usedtextures = " + usedtextures); |
---|
5182 | 5397 | |
---|
5183 | | - if (GetTextures() == null) |
---|
| 5398 | + if (GetTextures() == null) // What is that?? |
---|
5184 | 5399 | GetTextures().name = ":"; |
---|
5185 | 5400 | |
---|
5186 | 5401 | String texname = tex; |
---|
.. | .. |
---|
5211 | 5426 | child.ResetPigmentTexture(); |
---|
5212 | 5427 | blockloop = false; |
---|
5213 | 5428 | } |
---|
| 5429 | + } |
---|
| 5430 | + |
---|
| 5431 | + UUID GetUUID() |
---|
| 5432 | + { |
---|
| 5433 | + if (uuid == null) |
---|
| 5434 | + { |
---|
| 5435 | + // Serial |
---|
| 5436 | + uuid = UUID.randomUUID(); |
---|
| 5437 | + } |
---|
| 5438 | + |
---|
| 5439 | + return uuid; |
---|
| 5440 | + } |
---|
| 5441 | + |
---|
| 5442 | + Object3D GetObject(UUID uid) |
---|
| 5443 | + { |
---|
| 5444 | + if (blockloop) |
---|
| 5445 | + return null; |
---|
| 5446 | + |
---|
| 5447 | + if (GetUUID().equals(uid)) |
---|
| 5448 | + return this; |
---|
| 5449 | + |
---|
| 5450 | + int nb = Size(); |
---|
| 5451 | + for (int i = 0; i < nb; i++) |
---|
| 5452 | + { |
---|
| 5453 | + Object3D child = (Object3D) get(i); |
---|
| 5454 | + |
---|
| 5455 | + if (child == null) |
---|
| 5456 | + continue; |
---|
| 5457 | + |
---|
| 5458 | + blockloop = true; |
---|
| 5459 | + Object3D obj = child.GetObject(uid); |
---|
| 5460 | + blockloop = false; |
---|
| 5461 | + if (obj != null) |
---|
| 5462 | + return obj; |
---|
| 5463 | + } |
---|
| 5464 | + |
---|
| 5465 | + return null; |
---|
5214 | 5466 | } |
---|
5215 | 5467 | |
---|
5216 | 5468 | void SetBumpTexture(String tex) |
---|
.. | .. |
---|
5249 | 5501 | } |
---|
5250 | 5502 | } |
---|
5251 | 5503 | |
---|
5252 | | - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5504 | + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5253 | 5505 | { |
---|
5254 | 5506 | Draw(display, root, selected, blocked); |
---|
5255 | 5507 | } |
---|
5256 | 5508 | |
---|
5257 | | - static cMaterial[] materialstack = new cMaterial[65536]; |
---|
5258 | | - static boolean[] selectedstack = new boolean[65536]; |
---|
5259 | | - static int materialdepth = 0; |
---|
5260 | | - |
---|
5261 | 5509 | boolean NeedSupport() |
---|
5262 | 5510 | { |
---|
5263 | 5511 | return |
---|
5264 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5512 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
5265 | 5513 | // PROBLEM with CROWD!! |
---|
5266 | | - && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD); |
---|
| 5514 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5267 | 5515 | } |
---|
5268 | 5516 | |
---|
| 5517 | + static boolean DEBUG_SELECTION = false; |
---|
5269 | 5518 | |
---|
5270 | | - void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5519 | + void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5271 | 5520 | { |
---|
5272 | 5521 | Invariants(); // june 2013 |
---|
5273 | 5522 | |
---|
.. | .. |
---|
5276 | 5525 | // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame); |
---|
5277 | 5526 | } |
---|
5278 | 5527 | |
---|
5279 | | - if (display.drawMode == CameraPane.SELECTION && |
---|
5280 | | - hide) |
---|
| 5528 | + if (display.DrawMode() == iCameraPane.SELECTION && |
---|
| 5529 | + (hide || dontselect)) |
---|
5281 | 5530 | return; |
---|
5282 | 5531 | |
---|
5283 | 5532 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5295 | 5544 | if (this instanceof Checker) |
---|
5296 | 5545 | return; |
---|
5297 | 5546 | |
---|
5298 | | - if (display.drawMode == display.SHADOW && PASSTEST) |
---|
| 5547 | + if (display.DrawMode() == display.SHADOW && PASSTEST) |
---|
5299 | 5548 | return; |
---|
5300 | 5549 | |
---|
5301 | 5550 | if (count <= 0) |
---|
.. | .. |
---|
5303 | 5552 | return; |
---|
5304 | 5553 | } |
---|
5305 | 5554 | |
---|
5306 | | - if ((//display.drawMode == CameraPane.SHADOW || |
---|
5307 | | - display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency()) |
---|
| 5555 | + if ((//display.DrawMode() == CameraPane.SHADOW || |
---|
| 5556 | + display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency()) |
---|
5308 | 5557 | { |
---|
5309 | 5558 | return; |
---|
5310 | 5559 | } |
---|
5311 | 5560 | |
---|
5312 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5561 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5313 | 5562 | |
---|
5314 | 5563 | /* |
---|
5315 | 5564 | if (touched) |
---|
.. | .. |
---|
5345 | 5594 | |
---|
5346 | 5595 | boolean compiled = false; |
---|
5347 | 5596 | |
---|
5348 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 5597 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5349 | 5598 | |
---|
5350 | | - if (!selectmode && //display.drawMode != display.SELECTION && |
---|
| 5599 | + if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5351 | 5600 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5352 | 5601 | { |
---|
5353 | | - display.lighttouched = true; |
---|
| 5602 | + Globals.lighttouched = true; |
---|
5354 | 5603 | } // all panes... |
---|
5355 | | - //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW && |
---|
5356 | | - if (bRep != null && usecalllists && !selectmode && // june 2013 display.drawMode != display.SHADOW && |
---|
| 5604 | + //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
| 5605 | + if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5357 | 5606 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5358 | 5607 | { |
---|
5359 | 5608 | if (!(this instanceof Composite)) |
---|
.. | .. |
---|
5361 | 5610 | //if (displaylist == -1 && usecalllists) |
---|
5362 | 5611 | if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
5363 | 5612 | { |
---|
5364 | | - bRep.displaylist = gl.glGenLists(1); |
---|
| 5613 | + bRep.displaylist = display.GenList(); |
---|
5365 | 5614 | assert(bRep.displaylist != 0); |
---|
5366 | 5615 | // System.err.println("glGenLists: " + bRep.displaylist + " for " + this); |
---|
5367 | 5616 | //System.out.println("\tgen list " + list); |
---|
.. | .. |
---|
5373 | 5622 | if (usecalllists) |
---|
5374 | 5623 | { |
---|
5375 | 5624 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5376 | | - gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE); |
---|
| 5625 | + display.NewList(bRep.displaylist); |
---|
5377 | 5626 | } |
---|
| 5627 | + |
---|
5378 | 5628 | CallList(display, root, selected, blocked); |
---|
| 5629 | + |
---|
5379 | 5630 | // compiled = true; |
---|
5380 | 5631 | if (usecalllists) |
---|
5381 | 5632 | { |
---|
5382 | 5633 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5383 | | - gl.glEndList(); |
---|
| 5634 | + display.EndList(); |
---|
5384 | 5635 | } |
---|
5385 | 5636 | //gl.glDrawBuffer(gl.GL_BACK); |
---|
5386 | 5637 | // XXX touched = false; |
---|
5387 | | - display.lighttouched = true; // all panes... |
---|
| 5638 | + Globals.lighttouched = true; // all panes... |
---|
5388 | 5639 | } |
---|
5389 | 5640 | |
---|
5390 | 5641 | touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false; |
---|
.. | .. |
---|
5423 | 5674 | |
---|
5424 | 5675 | // frustum culling |
---|
5425 | 5676 | if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid |
---|
5426 | | - && display.drawMode != CameraPane.SELECTION) |
---|
| 5677 | + && display.DrawMode() != iCameraPane.SELECTION) |
---|
5427 | 5678 | { |
---|
5428 | | - if (display.drawMode == CameraPane.SHADOW) |
---|
| 5679 | + if (display.DrawMode() == iCameraPane.SHADOW) |
---|
5429 | 5680 | { |
---|
5430 | 5681 | if (!link2master // tricky to cull in shadow mode. |
---|
5431 | | - && GetBRep().FrustumCull(this, gl, display.lightCamera, true)) |
---|
| 5682 | + && GetBRep().FrustumCull(this, null, display.LightCamera(), true)) |
---|
5432 | 5683 | { |
---|
5433 | 5684 | //System.out.print("CULLED"); |
---|
5434 | 5685 | culled = true; |
---|
.. | .. |
---|
5436 | 5687 | } |
---|
5437 | 5688 | else |
---|
5438 | 5689 | //GetBRep().getBounds(v0, v1, this); |
---|
5439 | | - if (GetBRep().FrustumCull(this, gl, display.renderCamera, false)) |
---|
| 5690 | + if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false)) |
---|
5440 | 5691 | culled = true; |
---|
5441 | 5692 | |
---|
5442 | 5693 | // LA.xformPos(v0, display.renderCamera.toScreen, v0); |
---|
.. | .. |
---|
5472 | 5723 | |
---|
5473 | 5724 | |
---|
5474 | 5725 | if (!culled) |
---|
5475 | | - if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION) |
---|
| 5726 | + if (display.DrawMode() == display.SELECTION || display.IsDebugSelection()) |
---|
5476 | 5727 | { |
---|
5477 | 5728 | if (GetBRep() != null) |
---|
5478 | 5729 | { |
---|
5479 | | - CameraPane.NextIndex(this, gl); |
---|
| 5730 | + display.NextIndex(); |
---|
5480 | 5731 | // vertex color conflict : gl.glCallList(list); |
---|
5481 | 5732 | DrawNode(display, root, selected); |
---|
5482 | 5733 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5498 | 5749 | color[2] /= 2; |
---|
5499 | 5750 | gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0); |
---|
5500 | 5751 | */ |
---|
5501 | | - if (material != null) |
---|
5502 | | - { |
---|
5503 | | - materialstack[materialdepth] = material; |
---|
5504 | | - selectedstack[materialdepth] = selected; |
---|
5505 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5506 | | - //System.out.println("material " + material); |
---|
5507 | | - //Applet3D.tracein(this, selected); |
---|
5508 | | - display.vector2buffer = projectedVertices; |
---|
5509 | | - if (this instanceof Camera) |
---|
5510 | | - { |
---|
5511 | | - display.options1[0] = material.shift; |
---|
5512 | | - //System.out.println("shift " + material.shift); |
---|
5513 | | - display.options1[1] = material.lightarea; |
---|
5514 | | - display.options1[2] = material.shadowbias; |
---|
5515 | | - display.options1[3] = material.aniso; |
---|
5516 | | - display.options1[4] = material.anisoV; |
---|
5517 | | - display.options2[0] = material.opacity; |
---|
5518 | | - display.options2[1] = material.diffuse; |
---|
5519 | | - display.options2[2] = material.factor; |
---|
5520 | | - |
---|
5521 | | - cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3); |
---|
5522 | | - display.options4[0] = material.cameralight/0.2f; |
---|
5523 | | - display.options4[1] = material.subsurface; |
---|
5524 | | - display.options4[2] = material.sheen; |
---|
5525 | | - |
---|
5526 | | - // if (display.CURRENTANTIALIAS > 0) |
---|
5527 | | - // display.options3[3] /= 4; |
---|
5528 | | - |
---|
5529 | | - /* |
---|
5530 | | - System.out.println("Focus = " + display.options1[0]); |
---|
5531 | | - System.out.println("Aperture = " + display.options1[1]); |
---|
5532 | | - System.out.println("ShadowBlur = " + display.options1[2]); |
---|
5533 | | - System.out.println("Antialiasing = " + display.options1[3]); |
---|
5534 | | - System.out.println("Fog = " + display.options2[0]); |
---|
5535 | | - System.out.println("Intensity = " + display.options2[1]); |
---|
5536 | | - System.out.println("Elevation = " + display.options2[2]); |
---|
5537 | | - /**/ |
---|
5538 | | - } else |
---|
5539 | | - { |
---|
5540 | | - material.Draw(display, selected); |
---|
5541 | | - } |
---|
5542 | | - } else |
---|
5543 | | - { |
---|
5544 | | - if (selected && CameraPane.flash) |
---|
5545 | | - { |
---|
5546 | | - display.modelParams4[1] = 100; |
---|
5547 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5548 | | - } |
---|
5549 | | - } |
---|
| 5752 | + display.PushMaterial(this, selected); |
---|
5550 | 5753 | |
---|
5551 | 5754 | //System.out.println("call list " + list); |
---|
5552 | 5755 | //System.out.println(); |
---|
.. | .. |
---|
5565 | 5768 | tex = GetTextures(); |
---|
5566 | 5769 | } |
---|
5567 | 5770 | |
---|
5568 | | - display.BindTextures(tex, texres); |
---|
| 5771 | + boolean failed = false; |
---|
| 5772 | + |
---|
| 5773 | + try |
---|
| 5774 | + { |
---|
| 5775 | + display.BindTextures(tex, texres); |
---|
| 5776 | + } |
---|
| 5777 | + catch (Exception e) |
---|
| 5778 | + { |
---|
| 5779 | + System.err.println("FAILED: " + this); |
---|
| 5780 | + failed = true; |
---|
| 5781 | + } |
---|
5569 | 5782 | |
---|
5570 | 5783 | if (!compiled) |
---|
5571 | 5784 | { |
---|
.. | .. |
---|
5581 | 5794 | |
---|
5582 | 5795 | // System.err.println("glCallList: " + bRep.displaylist + " for " + this); |
---|
5583 | 5796 | assert(bRep.displaylist != 0); |
---|
5584 | | - gl.glCallList(bRep.displaylist); |
---|
| 5797 | + display.CallList(bRep.displaylist); |
---|
5585 | 5798 | // june 2013 drawSelf(display, root, selected); |
---|
5586 | 5799 | } |
---|
5587 | 5800 | } |
---|
5588 | 5801 | } |
---|
5589 | 5802 | |
---|
5590 | | - display.ReleaseTextures(tex); |
---|
5591 | | - |
---|
5592 | | - //if (parent != null && parent.GetMaterial() != null) |
---|
5593 | | - // parent.GetMaterial().Draw(display, parent.IsSelected(this)); |
---|
5594 | | - if (material != null) |
---|
5595 | | - { |
---|
5596 | | - materialdepth -= 1; |
---|
5597 | | - if (materialdepth > 0) |
---|
5598 | | - { |
---|
5599 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5600 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5601 | | - } |
---|
5602 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5603 | | - } else if (selected && CameraPane.flash && GetMaterial() != null) |
---|
5604 | | - { |
---|
5605 | | - display.modelParams4[1] = GetMaterial().cameralight; |
---|
5606 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5607 | | - } |
---|
| 5803 | + if (!failed) |
---|
| 5804 | + display.ReleaseTextures(tex); |
---|
| 5805 | + |
---|
| 5806 | + display.PopMaterial(this, selected); |
---|
5608 | 5807 | } |
---|
5609 | 5808 | |
---|
5610 | 5809 | if (this instanceof Texture || this instanceof TextureNode) |
---|
.. | .. |
---|
5646 | 5845 | // resetMasterNode(); |
---|
5647 | 5846 | } |
---|
5648 | 5847 | |
---|
5649 | | - void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5848 | + void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5650 | 5849 | { |
---|
5651 | 5850 | if (GetBRep() == null) |
---|
5652 | 5851 | { |
---|
.. | .. |
---|
5729 | 5928 | boolean flipV = false; // true; |
---|
5730 | 5929 | int texres = 0; // 0 = low, 1 = normal, 2 = high res texture |
---|
5731 | 5930 | |
---|
5732 | | - void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5931 | + void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5733 | 5932 | { |
---|
| 5933 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 5934 | + return; |
---|
| 5935 | + |
---|
5734 | 5936 | if (hide) |
---|
5735 | 5937 | return; |
---|
5736 | 5938 | // shadow optimisation |
---|
.. | .. |
---|
5788 | 5990 | // // ??????????????????????????? Touch(); |
---|
5789 | 5991 | // } |
---|
5790 | 5992 | |
---|
5791 | | - if (material != null) |
---|
5792 | | - { |
---|
5793 | | - materialstack[materialdepth] = material; |
---|
5794 | | - selectedstack[materialdepth] = selected; |
---|
5795 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5796 | | - //System.out.println("material " + material); |
---|
5797 | | - //Applet3D.tracein("selected ", selected); |
---|
5798 | | - display.vector2buffer = projectedVertices; |
---|
5799 | | - material.Draw(display, selected); |
---|
5800 | | - } |
---|
| 5993 | +display.PushMaterial2(this, selected); |
---|
5801 | 5994 | |
---|
5802 | 5995 | Object3D child; |
---|
5803 | 5996 | boolean sel; |
---|
.. | .. |
---|
5849 | 6042 | */ |
---|
5850 | 6043 | //depth += 1; |
---|
5851 | 6044 | |
---|
5852 | | - if (material != null) |
---|
5853 | | - { |
---|
5854 | | - materialdepth -= 1; |
---|
5855 | | - if (materialdepth > 0) |
---|
5856 | | - { |
---|
5857 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5858 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5859 | | - } |
---|
5860 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5861 | | - //else |
---|
5862 | | - //material.Draw(display, false); |
---|
5863 | | - } |
---|
5864 | | - |
---|
| 6045 | +display.PopMaterial2(this); |
---|
5865 | 6046 | /* |
---|
5866 | 6047 | display.ReleaseTextures(tex); |
---|
5867 | 6048 | */ |
---|
.. | .. |
---|
5872 | 6053 | |
---|
5873 | 6054 | //static cVector min,max; |
---|
5874 | 6055 | |
---|
5875 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 6056 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
5876 | 6057 | { |
---|
5877 | | - if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 6058 | + if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5878 | 6059 | return; // no shadow for transparent objects |
---|
| 6060 | + |
---|
| 6061 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6062 | + return; |
---|
5879 | 6063 | |
---|
5880 | 6064 | if (hide) |
---|
5881 | 6065 | return; |
---|
.. | .. |
---|
5917 | 6101 | return; |
---|
5918 | 6102 | } |
---|
5919 | 6103 | |
---|
| 6104 | + //bRep.GenUV(1/material.diffuseness); |
---|
5920 | 6105 | // bRep.lock = true; |
---|
5921 | 6106 | |
---|
5922 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 6107 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5923 | 6108 | |
---|
5924 | | - if (CameraPane.BOXMODE) // || CameraPane.movingcamera) |
---|
| 6109 | + if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
5925 | 6110 | { |
---|
5926 | 6111 | int fc = bRep.FaceCount(); |
---|
5927 | 6112 | int vc = bRep.VertexCount(); |
---|
.. | .. |
---|
5936 | 6121 | |
---|
5937 | 6122 | bRep.getMinMax(min, max, 100); |
---|
5938 | 6123 | |
---|
5939 | | - gl.glBegin(gl.GL_LINES); |
---|
5940 | | - |
---|
5941 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5942 | | - gl.glVertex3d(min.x, min.y, max.z); |
---|
5943 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5944 | | - gl.glVertex3d(min.x, max.y, min.z); |
---|
5945 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5946 | | - gl.glVertex3d(max.x, min.y, min.z); |
---|
5947 | | - |
---|
5948 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5949 | | - gl.glVertex3d(min.x, max.y, max.z); |
---|
5950 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5951 | | - gl.glVertex3d(max.x, min.y, max.z); |
---|
5952 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5953 | | - gl.glVertex3d(max.x, max.y, min.z); |
---|
5954 | | - |
---|
5955 | | - gl.glEnd(); |
---|
| 6124 | + display.DrawBox(min, max); |
---|
5956 | 6125 | |
---|
5957 | 6126 | return; |
---|
5958 | 6127 | } |
---|
.. | .. |
---|
5996 | 6165 | { |
---|
5997 | 6166 | //throw new Error(); |
---|
5998 | 6167 | |
---|
5999 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 6168 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
6000 | 6169 | |
---|
6001 | 6170 | int[] strips = bRep.getRawIndices(); |
---|
6002 | 6171 | |
---|
.. | .. |
---|
6006 | 6175 | new Exception().printStackTrace(); |
---|
6007 | 6176 | return; |
---|
6008 | 6177 | } |
---|
6009 | | - |
---|
6010 | | - // TRIANGLE STRIP ARRAY |
---|
6011 | | - if (bRep.trimmed) |
---|
6012 | | - { |
---|
6013 | | - float[] v = bRep.getRawVertices(); |
---|
6014 | | - float[] n = bRep.getRawNormals(); |
---|
6015 | | - float[] c = bRep.getRawColors(); |
---|
6016 | | - float[] uv = bRep.getRawUVMap(); |
---|
6017 | | - |
---|
6018 | | - int count2 = 0; |
---|
6019 | | - int count3 = 0; |
---|
6020 | | - |
---|
6021 | | - if (n.length > 0) |
---|
6022 | | - { |
---|
6023 | | - for (int i = 0; i < strips.length; i++) |
---|
6024 | | - { |
---|
6025 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6026 | | - |
---|
6027 | | - /* |
---|
6028 | | - boolean locked = false; |
---|
6029 | | - float eps = 0.1f; |
---|
6030 | | - boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6031 | | - |
---|
6032 | | - int dot = 0; |
---|
6033 | | - |
---|
6034 | | - if ((dot&1) == 0) |
---|
6035 | | - dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6036 | | - |
---|
6037 | | - if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6038 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6039 | | - else |
---|
6040 | | - { |
---|
6041 | | - locked = true; |
---|
6042 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6043 | | - } |
---|
6044 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6045 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6046 | | - if (hasnorm) |
---|
6047 | | - { |
---|
6048 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6049 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6050 | | - } |
---|
6051 | | - |
---|
6052 | | - if ((dot&4) == 0) |
---|
6053 | | - dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6054 | | - |
---|
6055 | | - if (wrap || !locked && (dot&8) != 0) |
---|
6056 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6057 | | - else |
---|
6058 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6059 | | - |
---|
6060 | | - f.dot = dot; |
---|
6061 | | - */ |
---|
6062 | | - |
---|
6063 | | - if (!selectmode) |
---|
6064 | | - { |
---|
6065 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6066 | | - { |
---|
6067 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6068 | | - } else |
---|
6069 | | - { |
---|
6070 | | - gl.glNormal3f(0, 0, 1); |
---|
6071 | | - } |
---|
6072 | | - |
---|
6073 | | - if (c != null) |
---|
6074 | | - //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]); |
---|
6075 | | - { |
---|
6076 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6077 | | - } |
---|
6078 | | - } |
---|
6079 | | - if (flipV) |
---|
6080 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6081 | | - else |
---|
6082 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6083 | | - //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6084 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6085 | | - |
---|
6086 | | - count2 += 2; |
---|
6087 | | - count3 += 3; |
---|
6088 | | - if (!selectmode) |
---|
6089 | | - { |
---|
6090 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6091 | | - { |
---|
6092 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6093 | | - } else |
---|
6094 | | - { |
---|
6095 | | - gl.glNormal3f(0, 0, 1); |
---|
6096 | | - } |
---|
6097 | | - if (c != null) |
---|
6098 | | - { |
---|
6099 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6100 | | - } |
---|
6101 | | - } |
---|
6102 | | - if (flipV) |
---|
6103 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6104 | | - else |
---|
6105 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6106 | | - //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6107 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6108 | | - |
---|
6109 | | - count2 += 2; |
---|
6110 | | - count3 += 3; |
---|
6111 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6112 | | - { |
---|
6113 | | - //gl.glTexCoord2d(...); |
---|
6114 | | - if (!selectmode) |
---|
6115 | | - { |
---|
6116 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6117 | | - { |
---|
6118 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6119 | | - } else |
---|
6120 | | - { |
---|
6121 | | - gl.glNormal3f(0, 0, 1); |
---|
6122 | | - } |
---|
6123 | | - if (c != null) |
---|
6124 | | - { |
---|
6125 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6126 | | - } |
---|
6127 | | - } |
---|
6128 | | - |
---|
6129 | | - if (flipV) |
---|
6130 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6131 | | - else |
---|
6132 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6133 | | - //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
6134 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6135 | | - count2 += 2; |
---|
6136 | | - count3 += 3; |
---|
6137 | | - } |
---|
6138 | | - |
---|
6139 | | - gl.glEnd(); |
---|
6140 | | - } |
---|
6141 | | - } |
---|
6142 | | - |
---|
6143 | | - assert count3 == v.length; |
---|
6144 | | - } |
---|
6145 | | - else // !trimmed |
---|
6146 | | - { |
---|
6147 | | - int count = 0; |
---|
6148 | | - for (int i = 0; i < strips.length; i++) |
---|
6149 | | - { |
---|
6150 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6151 | | - |
---|
6152 | | - Vertex p = bRep.GetVertex(bRep.indices[count++]); |
---|
6153 | | - Vertex q = bRep.GetVertex(bRep.indices[count++]); |
---|
6154 | | - |
---|
6155 | | - drawVertex(gl, p, selectmode); |
---|
6156 | | - drawVertex(gl, q, selectmode); |
---|
6157 | | - |
---|
6158 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6159 | | - { |
---|
6160 | | - Vertex r = bRep.GetVertex(bRep.indices[count++]); |
---|
6161 | | - |
---|
6162 | | -// if (j%2 == 0) |
---|
6163 | | -// drawFace(p, q, r, display, null); |
---|
6164 | | -// else |
---|
6165 | | -// drawFace(p, r, q, display, null); |
---|
6166 | | - |
---|
6167 | | -// p = q; |
---|
6168 | | -// q = r; |
---|
6169 | | - drawVertex(gl, r, selectmode); |
---|
6170 | | - } |
---|
6171 | | - |
---|
6172 | | - gl.glEnd(); |
---|
6173 | | - } |
---|
6174 | | - } |
---|
| 6178 | + |
---|
| 6179 | + display.DrawGeometry(bRep, flipV, selectmode); |
---|
6175 | 6180 | } else // catch (Error e) |
---|
6176 | 6181 | { |
---|
6177 | 6182 | // TRIANGLE ARRAY |
---|
6178 | 6183 | if (IsOpaque()) // Static()) |
---|
6179 | 6184 | { |
---|
6180 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6185 | + display.StartTriangles(); |
---|
6181 | 6186 | int facecount = bRep.FaceCount(); |
---|
6182 | 6187 | for (int i = 0; i < facecount; i++) |
---|
6183 | 6188 | { |
---|
.. | .. |
---|
6240 | 6245 | // // r.norm.dot(v3) > -0.5) |
---|
6241 | 6246 | // // continue; |
---|
6242 | 6247 | |
---|
6243 | | - drawFace(p, q, r, display, face); |
---|
| 6248 | + display.DrawFace(this, p, q, r, face); |
---|
6244 | 6249 | } |
---|
6245 | | - gl.glEnd(); |
---|
| 6250 | + display.EndTriangles(); |
---|
6246 | 6251 | } |
---|
6247 | 6252 | else |
---|
6248 | 6253 | { |
---|
.. | .. |
---|
6271 | 6276 | //System.out.println("SORT"); |
---|
6272 | 6277 | |
---|
6273 | 6278 | java.util.Arrays.sort(facescompare); |
---|
6274 | | - |
---|
6275 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6279 | + |
---|
| 6280 | + display.StartTriangles(); |
---|
6276 | 6281 | for (int i = 0; i < facecount; i++) |
---|
6277 | 6282 | { |
---|
6278 | 6283 | Face face = bRep.GetFace(facescompare[i].index); |
---|
.. | .. |
---|
6284 | 6289 | Vertex q = bRep.GetVertex(face.q); |
---|
6285 | 6290 | Vertex r = bRep.GetVertex(face.r); |
---|
6286 | 6291 | |
---|
6287 | | - drawFace(p, q, r, display, face); |
---|
| 6292 | + display.DrawFace(this, p, q, r, face); |
---|
6288 | 6293 | } |
---|
6289 | | - gl.glEnd(); |
---|
| 6294 | + display.EndTriangles(); |
---|
6290 | 6295 | } |
---|
6291 | 6296 | |
---|
6292 | 6297 | if (false) // live && support != null && support.bRep != null) // debug weights |
---|
6293 | 6298 | { |
---|
| 6299 | + /* |
---|
6294 | 6300 | gl.glDisable(gl.GL_LIGHTING); |
---|
6295 | 6301 | float[] colorV = new float[3]; |
---|
6296 | 6302 | |
---|
.. | .. |
---|
6369 | 6375 | // gl.glEnd(); |
---|
6370 | 6376 | } |
---|
6371 | 6377 | } |
---|
| 6378 | + */ |
---|
6372 | 6379 | } |
---|
6373 | 6380 | } |
---|
6374 | 6381 | |
---|
.. | .. |
---|
6413 | 6420 | center.add(r); |
---|
6414 | 6421 | center.mul(1.0/3); |
---|
6415 | 6422 | |
---|
6416 | | - center.sub(CameraPane.theRenderer.eyeCamera.location); |
---|
| 6423 | + center.sub(Globals.theRenderer.EyeCamera().location); |
---|
6417 | 6424 | |
---|
6418 | 6425 | distance = center.dot(center); |
---|
6419 | 6426 | } |
---|
.. | .. |
---|
6424 | 6431 | |
---|
6425 | 6432 | transient FaceCompare[] facescompare = null; |
---|
6426 | 6433 | |
---|
6427 | | - void SetColor(CameraPane display, Vertex p0) |
---|
6428 | | - { |
---|
6429 | | - if (display.RENDERPROGRAM == 0) |
---|
6430 | | - { |
---|
6431 | | - float r = 0; |
---|
6432 | | - if (bRep != null) |
---|
6433 | | - { |
---|
6434 | | - if (bRep.stripified) |
---|
6435 | | - { |
---|
6436 | | - r = 1; |
---|
6437 | | - } |
---|
6438 | | - } |
---|
6439 | | - float g = 0; |
---|
6440 | | - if (bRep != null) |
---|
6441 | | - { |
---|
6442 | | - if (bRep.trimmed) |
---|
6443 | | - { |
---|
6444 | | - g = 1; |
---|
6445 | | - } |
---|
6446 | | - } |
---|
6447 | | - float b = 0; |
---|
6448 | | - if (support != null && link2master) |
---|
6449 | | - { |
---|
6450 | | - b = 1; |
---|
6451 | | - } |
---|
6452 | | - display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO); |
---|
6453 | | - return; |
---|
6454 | | - } |
---|
6455 | | - |
---|
6456 | | - if (display.drawMode != CameraPane.SHADOW) |
---|
6457 | | - return; |
---|
6458 | | - |
---|
6459 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6460 | | -// if (true) return; |
---|
6461 | | -// float ao = p.AO; |
---|
6462 | | -// |
---|
6463 | | -// // if (ao == 0 && !bRep.AOdone) // transient problem! |
---|
6464 | | -// // ao = 1; |
---|
6465 | | -// |
---|
6466 | | -// gl.glColor4f(ao, ao, ao, 1); |
---|
6467 | | - |
---|
6468 | | -// CameraPane.selectedpoint. |
---|
6469 | | -// getAverage(cStatic.point1, true); |
---|
6470 | | - if (CameraPane.pointflow == null) // !random) // live) |
---|
6471 | | - { |
---|
6472 | | - return; |
---|
6473 | | - } |
---|
6474 | | - |
---|
6475 | | - cStatic.point1.set(0,0,0); |
---|
6476 | | - LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1); |
---|
6477 | | - |
---|
6478 | | - cStatic.point1.sub(p0); |
---|
6479 | | - |
---|
6480 | | - |
---|
6481 | | -// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta? |
---|
6482 | | -// { |
---|
6483 | | -// return; |
---|
6484 | | -// } |
---|
6485 | | - |
---|
6486 | | - //if (true) |
---|
6487 | | - if (cStatic.point1.dot(cStatic.point1) > 0.000001) |
---|
6488 | | - { |
---|
6489 | | - return; |
---|
6490 | | - } |
---|
6491 | | - |
---|
6492 | | - float[] colorV = new float[3]; |
---|
6493 | | - |
---|
6494 | | - if (false) // marked) |
---|
6495 | | - { |
---|
6496 | | - // debug rigging weights |
---|
6497 | | - for (int object = 0; object < p0.vertexlinks.length; object++) |
---|
6498 | | - { |
---|
6499 | | - float weight = p0.weights[object] / p0.totalweight; |
---|
6500 | | - |
---|
6501 | | - // if (weight < 0.1) |
---|
6502 | | - // { |
---|
6503 | | - // assert(weight == 0); |
---|
6504 | | - // continue; |
---|
6505 | | - // } |
---|
6506 | | - |
---|
6507 | | - if (p0.vertexlinks[object] == -1) |
---|
6508 | | - continue; |
---|
6509 | | - |
---|
6510 | | - Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]); |
---|
6511 | | - |
---|
6512 | | - int color = //1 << object; // |
---|
6513 | | - //p.vertexlinks.length; |
---|
6514 | | - support.bRep.supports[p0.closestsupport].links[object]; |
---|
6515 | | - colorV[2] += (color & 1) * weight; |
---|
6516 | | - colorV[1] += ((color & 2) >> 1) * weight; |
---|
6517 | | - colorV[0] += ((color & 4) >> 2) * weight; |
---|
6518 | | - } |
---|
6519 | | - } |
---|
6520 | | - else |
---|
6521 | | - { |
---|
6522 | | - if (drawingstarted) |
---|
6523 | | - { |
---|
6524 | | - // find next point |
---|
6525 | | - if (bRep.GetVertex(0).faceindices == null) |
---|
6526 | | - { |
---|
6527 | | - bRep.InitFaceIndices(); |
---|
6528 | | - } |
---|
6529 | | - |
---|
6530 | | - double ymin = p0.y; |
---|
6531 | | - |
---|
6532 | | - Vertex newp = p0; |
---|
6533 | | - |
---|
6534 | | - for (int fii = 0; fii < p0.faceindices.length; fii++) |
---|
6535 | | - { |
---|
6536 | | - int fi = p0.faceindices[fii]; |
---|
6537 | | - |
---|
6538 | | - if (fi == -1) |
---|
6539 | | - break; |
---|
6540 | | - |
---|
6541 | | - Face f = bRep.GetFace(fi); |
---|
6542 | | - |
---|
6543 | | - Vertex p = bRep.GetVertex(f.p); |
---|
6544 | | - Vertex q = bRep.GetVertex(f.q); |
---|
6545 | | - Vertex r = bRep.GetVertex(f.r); |
---|
6546 | | - |
---|
6547 | | - int swap = (int)(Math.random()*3); |
---|
6548 | | - |
---|
6549 | | -// for (int s=swap; --s>=0;) |
---|
6550 | | -// { |
---|
6551 | | -// Vertex t = p; |
---|
6552 | | -// p = q; |
---|
6553 | | -// q = r; |
---|
6554 | | -// r = t; |
---|
6555 | | -// } |
---|
6556 | | - if (ymin > p.y) |
---|
6557 | | - { |
---|
6558 | | - ymin = p.y; |
---|
6559 | | - newp = p; |
---|
6560 | | -// break; |
---|
6561 | | - } |
---|
6562 | | - if (ymin > q.y) |
---|
6563 | | - { |
---|
6564 | | - ymin = q.y; |
---|
6565 | | - newp = q; |
---|
6566 | | -// break; |
---|
6567 | | - } |
---|
6568 | | - if (ymin > r.y) |
---|
6569 | | - { |
---|
6570 | | - ymin = r.y; |
---|
6571 | | - newp = r; |
---|
6572 | | -// break; |
---|
6573 | | - } |
---|
6574 | | - } |
---|
6575 | | - |
---|
6576 | | - CameraPane.selectedpoint.toParent[3][0] = newp.x; |
---|
6577 | | - CameraPane.selectedpoint.toParent[3][1] = newp.y; |
---|
6578 | | - CameraPane.selectedpoint.toParent[3][2] = newp.z; |
---|
6579 | | - |
---|
6580 | | - drawingstarted = false; |
---|
6581 | | - |
---|
6582 | | - // return; |
---|
6583 | | - } |
---|
6584 | | - |
---|
6585 | | - if (false) // CameraPane.DRAW |
---|
6586 | | - { |
---|
6587 | | - p0.AO = colorV[0] = 2; |
---|
6588 | | - colorV[1] = 2; |
---|
6589 | | - colorV[2] = 2; |
---|
6590 | | - } |
---|
6591 | | - |
---|
6592 | | - CameraPane.pointflow.add(p0); |
---|
6593 | | - CameraPane.pointflow.Touch(); |
---|
6594 | | - } |
---|
6595 | | - |
---|
6596 | | -// gl.glColor3f(colorV[0], colorV[1], colorV[2]); |
---|
6597 | | -// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0); |
---|
6598 | | -// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
6599 | | - } |
---|
6600 | | - |
---|
6601 | 6434 | void Print(Vertex v) |
---|
6602 | 6435 | { |
---|
6603 | 6436 | //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")"); |
---|
6604 | 6437 | } |
---|
6605 | 6438 | |
---|
6606 | | - void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode) |
---|
6607 | | - { |
---|
6608 | | - if (!selectmode) |
---|
6609 | | - { |
---|
6610 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6611 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6612 | | - |
---|
6613 | | - if (flipV) |
---|
6614 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6615 | | - else |
---|
6616 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6617 | | - } |
---|
6618 | | - |
---|
6619 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6620 | | - } |
---|
6621 | | - |
---|
6622 | | - void drawFace(Vertex pv, Vertex qv, Vertex rv, |
---|
6623 | | - CameraPane display, Face face) |
---|
6624 | | - { |
---|
6625 | | - if (pv.y == -10000 || |
---|
6626 | | - qv.y == -10000 || |
---|
6627 | | - rv.y == -10000) |
---|
6628 | | - return; |
---|
6629 | | - |
---|
6630 | | -// float b = f.nbiterations & 1; |
---|
6631 | | -// float g = (f.nbiterations>>1) & 1; |
---|
6632 | | -// float r = (f.nbiterations>>2) & 1; |
---|
6633 | | -// |
---|
6634 | | -// //if (f.weight == 10000) |
---|
6635 | | -// //{ |
---|
6636 | | -// // r = 1; g = b = 0; |
---|
6637 | | -// //} |
---|
6638 | | -// //else |
---|
6639 | | -// //{ |
---|
6640 | | -// // assert(f.weight < 10000); |
---|
6641 | | -// r = g = b = (float)bRep.FaceWeight(f)*100; |
---|
6642 | | -// if (r<0) |
---|
6643 | | -// assert(r>=0); |
---|
6644 | | -// //} |
---|
6645 | | - |
---|
6646 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6647 | | - |
---|
6648 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
6649 | | - |
---|
6650 | | - //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv); |
---|
6651 | | - if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
6652 | | - { |
---|
6653 | | - //gl.glBegin(gl.GL_TRIANGLES); |
---|
6654 | | - boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
6655 | | - if (!hasnorm) |
---|
6656 | | - { |
---|
6657 | | - // System.out.println("FUCK!!"); |
---|
6658 | | - LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0); |
---|
6659 | | - LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1); |
---|
6660 | | - LA.vecCross(v0, v1, v2); |
---|
6661 | | - LA.vecNormalize(v2); |
---|
6662 | | - gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z); |
---|
6663 | | - } |
---|
6664 | | - |
---|
6665 | | - if (hasnorm) |
---|
6666 | | - { |
---|
6667 | | -// if (!pv.norm.normalized()) |
---|
6668 | | -// assert(pv.norm.normalized()); |
---|
6669 | | - |
---|
6670 | | - //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z); |
---|
6671 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6672 | | - } |
---|
6673 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6674 | | - SetColor(display, pv); |
---|
6675 | | - //gl.glColor4f(r, g, b, 1); |
---|
6676 | | - //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1); |
---|
6677 | | - if (flipV) |
---|
6678 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6679 | | - else |
---|
6680 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6681 | | - //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z); |
---|
6682 | | - gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z); |
---|
6683 | | -// Print(pv); |
---|
6684 | | - if (hasnorm) |
---|
6685 | | - { |
---|
6686 | | -// assert(qv.norm.normalized()); |
---|
6687 | | - //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z); |
---|
6688 | | - gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z); |
---|
6689 | | - } |
---|
6690 | | - //System.out.println("vertexq = " + qv.s + ", " + qv.t); |
---|
6691 | | - // boolean locked = false; |
---|
6692 | | - // float eps = 0.1f; |
---|
6693 | | - // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6694 | | - |
---|
6695 | | - // int dot = 0; //*/ (int)f.dot; |
---|
6696 | | - |
---|
6697 | | - // if ((dot&1) == 0) |
---|
6698 | | - // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6699 | | - |
---|
6700 | | - // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6701 | | - if (flipV) |
---|
6702 | | - gl.glTexCoord2f((float) qv.s, 1-(float) qv.t); |
---|
6703 | | - else |
---|
6704 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6705 | | - // else |
---|
6706 | | - // { |
---|
6707 | | - // locked = true; |
---|
6708 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6709 | | - // } |
---|
6710 | | - gl.glColor4f(qv.AO, qv.AO, qv.AO, 1); |
---|
6711 | | - SetColor(display, qv); |
---|
6712 | | - //gl.glColor4f(r, g, b, 1); |
---|
6713 | | - //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1); |
---|
6714 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6715 | | - gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z); |
---|
6716 | | -// Print(qv); |
---|
6717 | | - if (hasnorm) |
---|
6718 | | - { |
---|
6719 | | -// assert(rv.norm.normalized()); |
---|
6720 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6721 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6722 | | - } |
---|
6723 | | - |
---|
6724 | | - // if ((dot&4) == 0) |
---|
6725 | | - // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6726 | | - |
---|
6727 | | - // if (wrap || !locked && (dot&8) != 0) |
---|
6728 | | - if (flipV) |
---|
6729 | | - gl.glTexCoord2f((float) rv.s, 1-(float) rv.t); |
---|
6730 | | - else |
---|
6731 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6732 | | - // else |
---|
6733 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6734 | | - |
---|
6735 | | - // f.dot = dot; |
---|
6736 | | - |
---|
6737 | | - gl.glColor4f(rv.AO, rv.AO, rv.AO, 1); |
---|
6738 | | - SetColor(display, rv); |
---|
6739 | | - //gl.glColor4f(r, g, b, 1); |
---|
6740 | | - //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1); |
---|
6741 | | - //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z); |
---|
6742 | | - gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z); |
---|
6743 | | -// Print(rv); |
---|
6744 | | - //gl.glEnd(); |
---|
6745 | | - } |
---|
6746 | | - else |
---|
6747 | | - { |
---|
6748 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6749 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6750 | | - gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z); |
---|
6751 | | - |
---|
6752 | | - } |
---|
6753 | | - |
---|
6754 | | - if (false) // (attributes & WIREFRAME) != 0) |
---|
6755 | | - { |
---|
6756 | | - gl.glDisable(gl.GL_LIGHTING); |
---|
6757 | | - |
---|
6758 | | - gl.glBegin(gl.GL_LINE_LOOP); |
---|
6759 | | - gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z); |
---|
6760 | | - gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z); |
---|
6761 | | - gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z); |
---|
6762 | | - gl.glEnd(); |
---|
6763 | | - |
---|
6764 | | - gl.glEnable(gl.GL_LIGHTING); |
---|
6765 | | - } |
---|
6766 | | - } |
---|
6767 | | - |
---|
6768 | 6439 | void drawSelf(ClickInfo info, int level, boolean select) |
---|
6769 | 6440 | { |
---|
6770 | 6441 | if (bRep == null) |
---|
.. | .. |
---|
7336 | 7007 | int spotw = spot.x + spot.width; |
---|
7337 | 7008 | int spoth = spot.y + spot.height; |
---|
7338 | 7009 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7339 | | - if (CameraPane.Xmin > spot.x) |
---|
7340 | | - { |
---|
7341 | | - CameraPane.Xmin = spot.x; |
---|
7342 | | - } |
---|
7343 | | - if (CameraPane.Xmax < spotw) |
---|
7344 | | - { |
---|
7345 | | - CameraPane.Xmax = spotw; |
---|
7346 | | - } |
---|
7347 | | - if (CameraPane.Ymin > spot.y) |
---|
7348 | | - { |
---|
7349 | | - CameraPane.Ymin = spot.y; |
---|
7350 | | - } |
---|
7351 | | - if (CameraPane.Ymax < spoth) |
---|
7352 | | - { |
---|
7353 | | - CameraPane.Ymax = spoth; |
---|
7354 | | - } |
---|
| 7010 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7011 | +// { |
---|
| 7012 | +// CameraPane.Xmin = spot.x; |
---|
| 7013 | +// } |
---|
| 7014 | +// if (CameraPane.Xmax < spotw) |
---|
| 7015 | +// { |
---|
| 7016 | +// CameraPane.Xmax = spotw; |
---|
| 7017 | +// } |
---|
| 7018 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7019 | +// { |
---|
| 7020 | +// CameraPane.Ymin = spot.y; |
---|
| 7021 | +// } |
---|
| 7022 | +// if (CameraPane.Ymax < spoth) |
---|
| 7023 | +// { |
---|
| 7024 | +// CameraPane.Ymax = spoth; |
---|
| 7025 | +// } |
---|
7355 | 7026 | spot.translate(32, 32); |
---|
7356 | 7027 | spotw = spot.x + spot.width; |
---|
7357 | 7028 | spoth = spot.y + spot.height; |
---|
7358 | 7029 | info.g.setColor(Color.blue); |
---|
7359 | 7030 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7360 | | - if (CameraPane.Xmin > spot.x) |
---|
7361 | | - { |
---|
7362 | | - CameraPane.Xmin = spot.x; |
---|
7363 | | - } |
---|
7364 | | - if (CameraPane.Xmax < spotw) |
---|
7365 | | - { |
---|
7366 | | - CameraPane.Xmax = spotw; |
---|
7367 | | - } |
---|
7368 | | - if (CameraPane.Ymin > spot.y) |
---|
7369 | | - { |
---|
7370 | | - CameraPane.Ymin = spot.y; |
---|
7371 | | - } |
---|
7372 | | - if (CameraPane.Ymax < spoth) |
---|
7373 | | - { |
---|
7374 | | - CameraPane.Ymax = spoth; |
---|
7375 | | - } |
---|
7376 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
7377 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7031 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7032 | +// { |
---|
| 7033 | +// CameraPane.Xmin = spot.x; |
---|
| 7034 | +// } |
---|
| 7035 | +// if (CameraPane.Xmax < spotw) |
---|
| 7036 | +// { |
---|
| 7037 | +// CameraPane.Xmax = spotw; |
---|
| 7038 | +// } |
---|
| 7039 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7040 | +// { |
---|
| 7041 | +// CameraPane.Ymin = spot.y; |
---|
| 7042 | +// } |
---|
| 7043 | +// if (CameraPane.Ymax < spoth) |
---|
| 7044 | +// { |
---|
| 7045 | +// CameraPane.Ymax = spoth; |
---|
| 7046 | +// } |
---|
| 7047 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
| 7048 | + //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
7378 | 7049 | spot.translate(0, -32); |
---|
7379 | 7050 | info.g.setColor(Color.green); |
---|
7380 | 7051 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7381 | | - if (CameraPane.Xmin > spot.x) |
---|
7382 | | - { |
---|
7383 | | - CameraPane.Xmin = spot.x; |
---|
7384 | | - } |
---|
7385 | | - if (CameraPane.Xmax < spotw) |
---|
7386 | | - { |
---|
7387 | | - CameraPane.Xmax = spotw; |
---|
7388 | | - } |
---|
7389 | | - if (CameraPane.Ymin > spot.y) |
---|
7390 | | - { |
---|
7391 | | - CameraPane.Ymin = spot.y; |
---|
7392 | | - } |
---|
7393 | | - if (CameraPane.Ymax < spoth) |
---|
7394 | | - { |
---|
7395 | | - CameraPane.Ymax = spoth; |
---|
7396 | | - } |
---|
| 7052 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7053 | +// { |
---|
| 7054 | +// CameraPane.Xmin = spot.x; |
---|
| 7055 | +// } |
---|
| 7056 | +// if (CameraPane.Xmax < spotw) |
---|
| 7057 | +// { |
---|
| 7058 | +// CameraPane.Xmax = spotw; |
---|
| 7059 | +// } |
---|
| 7060 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7061 | +// { |
---|
| 7062 | +// CameraPane.Ymin = spot.y; |
---|
| 7063 | +// } |
---|
| 7064 | +// if (CameraPane.Ymax < spoth) |
---|
| 7065 | +// { |
---|
| 7066 | +// CameraPane.Ymax = spoth; |
---|
| 7067 | +// } |
---|
7397 | 7068 | info.g.drawArc(boundary.x, boundary.y, |
---|
7398 | 7069 | boundary.width, boundary.height, 0, 360); |
---|
7399 | 7070 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7400 | | - if (CameraPane.Xmin > boundary.x) |
---|
7401 | | - { |
---|
7402 | | - CameraPane.Xmin = boundary.x; |
---|
7403 | | - } |
---|
7404 | | - if (CameraPane.Xmax < boundary.x + boundary.width) |
---|
7405 | | - { |
---|
7406 | | - CameraPane.Xmax = boundary.x + boundary.width; |
---|
7407 | | - } |
---|
7408 | | - if (CameraPane.Ymin > boundary.y) |
---|
7409 | | - { |
---|
7410 | | - CameraPane.Ymin = boundary.y; |
---|
7411 | | - } |
---|
7412 | | - if (CameraPane.Ymax < boundary.y + boundary.height) |
---|
7413 | | - { |
---|
7414 | | - CameraPane.Ymax = boundary.y + boundary.height; |
---|
7415 | | - } |
---|
| 7071 | +// if (CameraPane.Xmin > boundary.x) |
---|
| 7072 | +// { |
---|
| 7073 | +// CameraPane.Xmin = boundary.x; |
---|
| 7074 | +// } |
---|
| 7075 | +// if (CameraPane.Xmax < boundary.x + boundary.width) |
---|
| 7076 | +// { |
---|
| 7077 | +// CameraPane.Xmax = boundary.x + boundary.width; |
---|
| 7078 | +// } |
---|
| 7079 | +// if (CameraPane.Ymin > boundary.y) |
---|
| 7080 | +// { |
---|
| 7081 | +// CameraPane.Ymin = boundary.y; |
---|
| 7082 | +// } |
---|
| 7083 | +// if (CameraPane.Ymax < boundary.y + boundary.height) |
---|
| 7084 | +// { |
---|
| 7085 | +// CameraPane.Ymax = boundary.y + boundary.height; |
---|
| 7086 | +// } |
---|
7416 | 7087 | return; |
---|
7417 | 7088 | } |
---|
7418 | 7089 | } |
---|
.. | .. |
---|
7429 | 7100 | startX = info.x; |
---|
7430 | 7101 | startY = info.y; |
---|
7431 | 7102 | |
---|
7432 | | - hitSomething = 0; |
---|
| 7103 | + hitSomething = -1; |
---|
7433 | 7104 | cVector origin = new cVector(); |
---|
7434 | 7105 | //LA.xformPos(origin, toParent, origin); |
---|
7435 | 7106 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
7462 | 7133 | } |
---|
7463 | 7134 | |
---|
7464 | 7135 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7465 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7136 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7466 | 7137 | //System.out.println("modified = " + modified); |
---|
7467 | 7138 | //new Exception().printStackTrace(); |
---|
7468 | 7139 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7490 | 7161 | return true; |
---|
7491 | 7162 | } |
---|
7492 | 7163 | |
---|
7493 | | - void doEditDrag0(ClickInfo info) |
---|
| 7164 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
7494 | 7165 | { |
---|
7495 | 7166 | if (hitSomething == 0) |
---|
7496 | 7167 | { |
---|
.. | .. |
---|
7505 | 7176 | //System.out.println("hitSomething = " + hitSomething); |
---|
7506 | 7177 | |
---|
7507 | 7178 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7179 | + |
---|
7508 | 7180 | cVector xlate = new cVector(); |
---|
7509 | 7181 | //cVector xlate2 = new cVector(); |
---|
7510 | 7182 | switch (hitSomething) |
---|
.. | .. |
---|
7515 | 7187 | |
---|
7516 | 7188 | case hitCenter: // Translate |
---|
7517 | 7189 | |
---|
7518 | | - scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance(); |
---|
| 7190 | + scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7519 | 7191 | |
---|
7520 | | - if (modified) |
---|
| 7192 | + if (modified || opposite) |
---|
7521 | 7193 | { |
---|
7522 | 7194 | //assert(false); |
---|
7523 | 7195 | /* |
---|
.. | .. |
---|
7563 | 7235 | } |
---|
7564 | 7236 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7565 | 7237 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7566 | | - LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up); |
---|
| 7238 | + LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7567 | 7239 | LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
7568 | 7240 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7569 | | - LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away); |
---|
| 7241 | + LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7570 | 7242 | //LA.vecCross(up, cVector.Z, right2); |
---|
7571 | 7243 | |
---|
7572 | 7244 | cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
.. | .. |
---|
7611 | 7283 | |
---|
7612 | 7284 | if (modified) |
---|
7613 | 7285 | { |
---|
| 7286 | + // Rotate 90 degrees |
---|
7614 | 7287 | angle /= (Math.PI / 4); |
---|
7615 | 7288 | angle = Math.floor(angle + 0.5); |
---|
7616 | 7289 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7624 | 7297 | } |
---|
7625 | 7298 | /**/ |
---|
7626 | 7299 | |
---|
7627 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7300 | + switch (info.pane.RenderCamera().viewCode) |
---|
7628 | 7301 | { |
---|
7629 | 7302 | case 1: // '\001' |
---|
7630 | 7303 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7652 | 7325 | |
---|
7653 | 7326 | case hitScale: // scale |
---|
7654 | 7327 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7328 | + double sign = 1; |
---|
| 7329 | + if (hScale < 0) |
---|
| 7330 | + { |
---|
| 7331 | + sign = -1; |
---|
| 7332 | + } |
---|
| 7333 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7655 | 7334 | if (hScale < 0.01) |
---|
7656 | 7335 | { |
---|
7657 | | - hScale = 0.01; |
---|
| 7336 | + //hScale = 0.01; |
---|
7658 | 7337 | } |
---|
7659 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7660 | | - if (hScale < 0.01) |
---|
7661 | | - { |
---|
7662 | | - hScale = 0.01; |
---|
7663 | | - } |
---|
| 7338 | + |
---|
7664 | 7339 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7665 | | - if (vScale < 0.01) |
---|
| 7340 | + sign = 1; |
---|
| 7341 | + if (vScale < 0) |
---|
7666 | 7342 | { |
---|
7667 | | - vScale = 0.01; |
---|
| 7343 | + sign = -1; |
---|
7668 | 7344 | } |
---|
7669 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7345 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7670 | 7346 | if (vScale < 0.01) |
---|
7671 | 7347 | { |
---|
7672 | | - vScale = 0.01; |
---|
| 7348 | + //vScale = 0.01; |
---|
7673 | 7349 | } |
---|
7674 | 7350 | LA.matCopy(startMat, toParent); |
---|
7675 | 7351 | /**/ |
---|
.. | .. |
---|
7680 | 7356 | } |
---|
7681 | 7357 | /**/ |
---|
7682 | 7358 | |
---|
7683 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7359 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7360 | + |
---|
| 7361 | + if (totalScale < 0.01) |
---|
| 7362 | + { |
---|
| 7363 | + totalScale = 0.01; |
---|
| 7364 | + } |
---|
| 7365 | + |
---|
| 7366 | + switch (info.pane.RenderCamera().viewCode) |
---|
7684 | 7367 | { |
---|
7685 | 7368 | case 3: // '\001' |
---|
7686 | 7369 | if (modified) |
---|
7687 | 7370 | { |
---|
7688 | 7371 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7689 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7372 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7690 | 7373 | } // vScale, 1); |
---|
7691 | 7374 | else |
---|
7692 | 7375 | { |
---|
7693 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7376 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7694 | 7377 | } // vScale, 1); |
---|
7695 | 7378 | break; |
---|
7696 | 7379 | |
---|
.. | .. |
---|
7698 | 7381 | if (modified) |
---|
7699 | 7382 | { |
---|
7700 | 7383 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7701 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7384 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7702 | 7385 | } else |
---|
7703 | 7386 | { |
---|
7704 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7387 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7705 | 7388 | } |
---|
7706 | 7389 | break; |
---|
7707 | 7390 | |
---|
.. | .. |
---|
7709 | 7392 | if (modified) |
---|
7710 | 7393 | { |
---|
7711 | 7394 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7712 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7395 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7713 | 7396 | } else |
---|
7714 | 7397 | { |
---|
7715 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7398 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7716 | 7399 | } |
---|
7717 | 7400 | break; |
---|
7718 | 7401 | } |
---|
.. | .. |
---|
7733 | 7416 | if (parent == null) |
---|
7734 | 7417 | { |
---|
7735 | 7418 | System.out.println("NULL PARENT"); |
---|
7736 | | - new Exception().printStackTrace(); |
---|
| 7419 | + //new Exception().printStackTrace(); |
---|
7737 | 7420 | } else |
---|
7738 | 7421 | { |
---|
7739 | 7422 | if (parent instanceof BezierPatch) |
---|
.. | .. |
---|
7845 | 7528 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7846 | 7529 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7847 | 7530 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7531 | + |
---|
| 7532 | + String objname; |
---|
| 7533 | + |
---|
7848 | 7534 | if (false) //parent != null) |
---|
7849 | 7535 | { |
---|
7850 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7536 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7851 | 7537 | } else |
---|
7852 | 7538 | { |
---|
7853 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7539 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7854 | 7540 | } // + super.toString(); |
---|
7855 | 7541 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7542 | + |
---|
| 7543 | + if (!Globals.ADVANCED) |
---|
| 7544 | + return objname; |
---|
| 7545 | + |
---|
| 7546 | + return objname + " " + System.identityHashCode(this); |
---|
7856 | 7547 | } |
---|
7857 | 7548 | |
---|
7858 | 7549 | public int hashCode() |
---|
.. | .. |
---|
7908 | 7599 | objectUI.closeUI(); |
---|
7909 | 7600 | if (editWindow != null) |
---|
7910 | 7601 | { |
---|
| 7602 | + editWindow.ctrlPanel.FlushUI(); |
---|
7911 | 7603 | editWindow.refreshContents(); |
---|
7912 | 7604 | } // ? new |
---|
7913 | 7605 | objectUI = null; |
---|
.. | .. |
---|
7928 | 7620 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7929 | 7621 | |
---|
7930 | 7622 | Object3D /*Composite*/ parent; |
---|
7931 | | - Object3D /*Composite*/ fileparent; |
---|
| 7623 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7932 | 7624 | |
---|
7933 | 7625 | double[][] toParent; // dynamic matrix |
---|
7934 | 7626 | double[][] fromParent; |
---|
.. | .. |
---|
8043 | 7735 | { |
---|
8044 | 7736 | assert(bRep != null); |
---|
8045 | 7737 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
8046 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 7738 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
8047 | 7739 | } |
---|
8048 | 7740 | else |
---|
8049 | 7741 | { |
---|
.. | .. |
---|
8092 | 7784 | private static cVector edge2 = new cVector(); |
---|
8093 | 7785 | //private static cVector norm = new cVector(); |
---|
8094 | 7786 | /*transient private*/ int hitSomething; |
---|
8095 | | - private static final int hitCenter = 1; |
---|
8096 | | - private static final int hitScale = 2; |
---|
8097 | | - private static final int hitRotate = 3; |
---|
| 7787 | + static final int hitCenter = 1; |
---|
| 7788 | + static final int hitScale = 2; |
---|
| 7789 | + static final int hitRotate = 3; |
---|
8098 | 7790 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
8099 | 7791 | /*transient*/ private Point centerPt; |
---|
8100 | 7792 | /*transient*/ private int startX; |
---|
.. | .. |
---|
8126 | 7818 | { |
---|
8127 | 7819 | Object3D targ = this; |
---|
8128 | 7820 | |
---|
| 7821 | + targ.NORMALPUSH = obj.NORMALPUSH; |
---|
| 7822 | + |
---|
8129 | 7823 | if (obj.material != null) |
---|
8130 | 7824 | { |
---|
8131 | 7825 | if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL)) |
---|