.. | .. |
---|
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; |
---|
| 24 | + |
---|
| 25 | + private UUID uuid = UUID.randomUUID(); |
---|
| 26 | + |
---|
| 27 | + // TEMPORARY for mocap undo |
---|
| 28 | + mocap.reader.BVHReader.BVHResult bvh; |
---|
| 29 | + Object3D skeleton; |
---|
| 30 | + // |
---|
21 | 31 | |
---|
22 | 32 | ScriptNode scriptnode; |
---|
23 | 33 | |
---|
.. | .. |
---|
99 | 109 | |
---|
100 | 110 | // transient boolean reduced; // for morph reduction |
---|
101 | 111 | |
---|
102 | | -transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
103 | | -transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
| 112 | + transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
| 113 | + transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
104 | 114 | |
---|
105 | | -transient Object3D transientsupport; // for cloning |
---|
106 | | -transient boolean transientlink2master; |
---|
| 115 | + transient Object3D transientsupport; // for cloning |
---|
| 116 | + transient boolean transientlink2master; |
---|
107 | 117 | |
---|
108 | | -void SaveSupports() |
---|
109 | | -{ |
---|
110 | | - if (blockloop) |
---|
111 | | - return; |
---|
112 | | - |
---|
113 | | - transientsupport = support; |
---|
114 | | - transientlink2master = link2master; |
---|
115 | | - |
---|
116 | | - support = null; |
---|
117 | | - link2master = false; |
---|
118 | | - |
---|
119 | | - if (bRep != null) |
---|
| 118 | + void SaveSupports() |
---|
120 | 119 | { |
---|
121 | | - bRep.SaveSupports(); |
---|
122 | | - } |
---|
123 | | - |
---|
124 | | - for (int i = 0; i < Size(); i++) |
---|
125 | | - { |
---|
126 | | - Object3D child = (Object3D) get(i); |
---|
127 | | - if (child == null) |
---|
128 | | - continue; |
---|
129 | | - blockloop = true; |
---|
130 | | - child.SaveSupports(); |
---|
131 | | - blockloop = false; |
---|
132 | | - } |
---|
133 | | -} |
---|
| 120 | + if (blockloop) |
---|
| 121 | + return; |
---|
134 | 122 | |
---|
135 | | -void RestoreSupports() |
---|
136 | | -{ |
---|
137 | | - if (blockloop) |
---|
138 | | - return; |
---|
| 123 | + transientsupport = support; |
---|
| 124 | + transientlink2master = link2master; |
---|
139 | 125 | |
---|
140 | | - support = transientsupport; |
---|
141 | | - link2master = transientlink2master; |
---|
142 | | - transientsupport = null; |
---|
143 | | - transientlink2master = false; |
---|
144 | | - |
---|
145 | | - if (bRep != null) |
---|
146 | | - { |
---|
147 | | - bRep.RestoreSupports(); |
---|
| 126 | + support = null; |
---|
| 127 | + link2master = false; |
---|
| 128 | + |
---|
| 129 | + if (bRep != null) |
---|
| 130 | + { |
---|
| 131 | + bRep.SaveSupports(); |
---|
| 132 | + } |
---|
| 133 | + |
---|
| 134 | + for (int i = 0; i < Size(); i++) |
---|
| 135 | + { |
---|
| 136 | + Object3D child = (Object3D) get(i); |
---|
| 137 | + if (child == null) |
---|
| 138 | + continue; |
---|
| 139 | + blockloop = true; |
---|
| 140 | + child.SaveSupports(); |
---|
| 141 | + blockloop = false; |
---|
| 142 | + } |
---|
148 | 143 | } |
---|
149 | | - |
---|
150 | | - for (int i = 0; i < Size(); i++) |
---|
| 144 | + |
---|
| 145 | + void RestoreSupports() |
---|
151 | 146 | { |
---|
152 | | - Object3D child = (Object3D) get(i); |
---|
153 | | - if (child == null) |
---|
154 | | - continue; |
---|
155 | | - blockloop = true; |
---|
156 | | - child.RestoreSupports(); |
---|
157 | | - blockloop = false; |
---|
| 147 | + if (blockloop) |
---|
| 148 | + return; |
---|
| 149 | + |
---|
| 150 | + support = transientsupport; |
---|
| 151 | + link2master = transientlink2master; |
---|
| 152 | + transientsupport = null; |
---|
| 153 | + transientlink2master = false; |
---|
| 154 | + |
---|
| 155 | + if (bRep != null) |
---|
| 156 | + { |
---|
| 157 | + bRep.RestoreSupports(); |
---|
| 158 | + } |
---|
| 159 | + |
---|
| 160 | + for (int i = 0; i < Size(); i++) |
---|
| 161 | + { |
---|
| 162 | + Object3D child = (Object3D) get(i); |
---|
| 163 | + if (child == null) |
---|
| 164 | + continue; |
---|
| 165 | + blockloop = true; |
---|
| 166 | + child.RestoreSupports(); |
---|
| 167 | + blockloop = false; |
---|
| 168 | + } |
---|
158 | 169 | } |
---|
159 | | -} |
---|
| 170 | + |
---|
| 171 | + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 172 | + { |
---|
| 173 | + if (hashtable.containsKey(GetUUID())) |
---|
| 174 | + { |
---|
| 175 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 176 | + |
---|
| 177 | + Grafreed.Assert(this.bRep == o.bRep); |
---|
| 178 | + if (this.bRep != null) |
---|
| 179 | + assert(this.bRep.support == o.transientrep); |
---|
| 180 | + |
---|
| 181 | + return; |
---|
| 182 | + } |
---|
| 183 | + |
---|
| 184 | + Object3D o = new Object3D(); |
---|
| 185 | + |
---|
| 186 | + hashtable.put(GetUUID(), o); |
---|
| 187 | + |
---|
| 188 | + for (int i=0; i<Size(); i++) |
---|
| 189 | + { |
---|
| 190 | + get(i).ExtractBigData(hashtable); |
---|
| 191 | + } |
---|
| 192 | + |
---|
| 193 | + ExtractBigData(o); |
---|
| 194 | + } |
---|
| 195 | + |
---|
| 196 | + void ExtractBigData(Object3D o) |
---|
| 197 | + { |
---|
| 198 | + o.bRep = this.bRep; |
---|
| 199 | + if (this.bRep != null) |
---|
| 200 | + { |
---|
| 201 | + o.transientrep = this.bRep.support; |
---|
| 202 | + o.bRep.support = null; |
---|
| 203 | + } |
---|
| 204 | + |
---|
| 205 | + // o.support = this.support; |
---|
| 206 | + // o.fileparent = this.fileparent; |
---|
| 207 | + // if (this.bRep != null) |
---|
| 208 | + // o.bRep = this.bRep.support; |
---|
| 209 | + |
---|
| 210 | + this.bRep = null; |
---|
| 211 | + // if (this.bRep != null) |
---|
| 212 | + // this.bRep.support = null; |
---|
| 213 | + // this.support = null; |
---|
| 214 | + // this.fileparent = null; |
---|
| 215 | + } |
---|
| 216 | + |
---|
| 217 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 218 | + { |
---|
| 219 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 220 | + return; |
---|
| 221 | + |
---|
| 222 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 223 | + |
---|
| 224 | + RestoreBigData(o); |
---|
| 225 | + |
---|
| 226 | + hashtable.remove(GetUUID()); |
---|
| 227 | + |
---|
| 228 | + for (int i=0; i<Size(); i++) |
---|
| 229 | + { |
---|
| 230 | + get(i).RestoreBigData(hashtable); |
---|
| 231 | + } |
---|
| 232 | + } |
---|
| 233 | + |
---|
| 234 | + void RestoreBigData(Object3D o) |
---|
| 235 | + { |
---|
| 236 | + this.bRep = o.bRep; |
---|
| 237 | + if (this.bRep != null) |
---|
| 238 | + this.bRep.support = o.transientrep; |
---|
| 239 | + // this.support = o.support; |
---|
| 240 | + // this.fileparent = o.fileparent; |
---|
| 241 | + } |
---|
160 | 242 | |
---|
161 | 243 | // MOCAP SUPPORT |
---|
162 | 244 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
299 | 381 | } |
---|
300 | 382 | |
---|
301 | 383 | boolean live = false; |
---|
| 384 | + boolean dontselect = false; |
---|
302 | 385 | boolean hide = false; |
---|
303 | 386 | boolean link2master = false; // performs reset support/master at each frame |
---|
304 | 387 | boolean marked = false; // animation node |
---|
.. | .. |
---|
480 | 563 | toParent = LA.newMatrix(); |
---|
481 | 564 | fromParent = LA.newMatrix(); |
---|
482 | 565 | } |
---|
| 566 | + |
---|
483 | 567 | if (toParentMarked == null) |
---|
484 | 568 | { |
---|
485 | 569 | if (maxcount != 1) |
---|
486 | 570 | { |
---|
487 | 571 | new Exception().printStackTrace(); |
---|
488 | 572 | } |
---|
| 573 | + |
---|
489 | 574 | toParentMarked = LA.newMatrix(); |
---|
490 | 575 | fromParentMarked = LA.newMatrix(); |
---|
491 | 576 | } |
---|
.. | .. |
---|
773 | 858 | if (step == 0) |
---|
774 | 859 | step = 1; |
---|
775 | 860 | if (maxcount == 0) |
---|
776 | | - maxcount = 2048; // 4; |
---|
| 861 | + maxcount = 128; // 2048; // 4; |
---|
777 | 862 | // if (acceleration == 0) |
---|
778 | 863 | // acceleration = 10; |
---|
779 | 864 | if (delay == 0) // serial |
---|
.. | .. |
---|
796 | 881 | |
---|
797 | 882 | if (marked && Globals.isLIVE() && live && |
---|
798 | 883 | //TEMP21aug2018 |
---|
799 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 884 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
800 | 885 | currentframe != Globals.framecount) |
---|
801 | 886 | { |
---|
802 | 887 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
808 | 893 | |
---|
809 | 894 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
810 | 895 | |
---|
811 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 896 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 897 | + (step == 1 && changedir)) |
---|
812 | 898 | { |
---|
813 | 899 | countdown = 1; |
---|
814 | 900 | delay = speedup?8:1; |
---|
.. | .. |
---|
880 | 966 | if (material == null || material.multiply) |
---|
881 | 967 | return true; |
---|
882 | 968 | |
---|
| 969 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
883 | 970 | return material.opacity > 0.99; |
---|
884 | 971 | } |
---|
885 | 972 | |
---|
.. | .. |
---|
911 | 998 | fromParent = null; // LA.newMatrix(); |
---|
912 | 999 | bRep = null; // new BoundaryRep(); |
---|
913 | 1000 | |
---|
| 1001 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 1002 | + { |
---|
| 1003 | + name = oname; |
---|
| 1004 | + } |
---|
| 1005 | + |
---|
914 | 1006 | /* |
---|
915 | 1007 | float hue = (float)Math.random(); |
---|
916 | 1008 | Color col; |
---|
.. | .. |
---|
953 | 1045 | |
---|
954 | 1046 | public Object clone() |
---|
955 | 1047 | { |
---|
956 | | - return GrafreeD.clone(this); |
---|
| 1048 | + return Grafreed.clone(this); |
---|
957 | 1049 | } |
---|
958 | 1050 | |
---|
959 | 1051 | Object3D copyExpand() |
---|
.. | .. |
---|
1469 | 1561 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1470 | 1562 | |
---|
1471 | 1563 | // Set default to 0.1 |
---|
1472 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1564 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1473 | 1565 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1474 | 1566 | } |
---|
1475 | 1567 | |
---|
.. | .. |
---|
1728 | 1820 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1729 | 1821 | o.bRep = transientrep; |
---|
1730 | 1822 | if (clone) |
---|
1731 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1823 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1732 | 1824 | o.CreateMaterial(); |
---|
1733 | 1825 | o.SetAttributes(this, -1); |
---|
1734 | 1826 | //parent |
---|
.. | .. |
---|
1741 | 1833 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1742 | 1834 | o.bRep = bRep; |
---|
1743 | 1835 | if (clone) |
---|
1744 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1836 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1745 | 1837 | o.CreateMaterial(); |
---|
1746 | 1838 | //o.overwriteThis(this, -1); |
---|
1747 | 1839 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1828 | 1920 | if (obj.name == null) |
---|
1829 | 1921 | continue; // can't be a null one |
---|
1830 | 1922 | |
---|
| 1923 | + // Try perfect match first. |
---|
1831 | 1924 | if (n.equals(obj.name)) |
---|
1832 | 1925 | { |
---|
1833 | 1926 | theobj = obj; |
---|
1834 | 1927 | count++; |
---|
1835 | 1928 | } |
---|
1836 | 1929 | } |
---|
| 1930 | + |
---|
| 1931 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1837 | 1932 | |
---|
1838 | 1933 | if (count != 1) |
---|
1839 | 1934 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2293 | 2388 | } |
---|
2294 | 2389 | */ |
---|
2295 | 2390 | } |
---|
| 2391 | + else |
---|
| 2392 | + { |
---|
| 2393 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2394 | + } |
---|
2296 | 2395 | } |
---|
2297 | 2396 | |
---|
2298 | 2397 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
2299 | 2398 | { |
---|
2300 | 2399 | if (newWindow) |
---|
2301 | 2400 | { |
---|
| 2401 | + new Exception().printStackTrace(); |
---|
2302 | 2402 | System.exit(0); |
---|
2303 | 2403 | if (parent != null) |
---|
2304 | 2404 | { |
---|
.. | .. |
---|
2475 | 2575 | return retval; |
---|
2476 | 2576 | } |
---|
2477 | 2577 | |
---|
2478 | | - void doEditDrag(ClickInfo info) |
---|
| 2578 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2479 | 2579 | { |
---|
2480 | 2580 | switch (doSomething) |
---|
2481 | 2581 | { |
---|
2482 | 2582 | case 1: // '\001' |
---|
2483 | 2583 | //super. |
---|
2484 | | - doEditDrag0(info); |
---|
| 2584 | + doEditDrag0(info, opposite); |
---|
2485 | 2585 | break; |
---|
2486 | 2586 | |
---|
2487 | 2587 | case 2: // '\002' |
---|
.. | .. |
---|
2494 | 2594 | { |
---|
2495 | 2595 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2496 | 2596 | //childToDrag.doEditDrag(info); |
---|
2497 | | - sel.doEditDrag(info); |
---|
| 2597 | + sel.doEditDrag(info, opposite); |
---|
2498 | 2598 | } else |
---|
2499 | 2599 | { |
---|
2500 | 2600 | //super. |
---|
2501 | | - doEditDrag0(info); |
---|
| 2601 | + doEditDrag0(info, opposite); |
---|
2502 | 2602 | } |
---|
2503 | 2603 | } |
---|
2504 | 2604 | break; |
---|
.. | .. |
---|
2608 | 2708 | void GenNormalsS(boolean crease) |
---|
2609 | 2709 | { |
---|
2610 | 2710 | selection.GenNormals(crease); |
---|
| 2711 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2712 | +// { |
---|
| 2713 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2714 | +// selectee.GenNormals(crease); |
---|
| 2715 | +// } |
---|
| 2716 | + |
---|
| 2717 | + //Touch(); |
---|
| 2718 | + } |
---|
| 2719 | + |
---|
| 2720 | + void GenNormalsMeshS() |
---|
| 2721 | + { |
---|
| 2722 | + selection.GenNormalsMesh(); |
---|
2611 | 2723 | // for (int i=0; i<selection.size(); i++) |
---|
2612 | 2724 | // { |
---|
2613 | 2725 | // Object3D selectee = (Object3D) selection.elementAt(i); |
---|
.. | .. |
---|
2748 | 2860 | if (child == null) |
---|
2749 | 2861 | continue; |
---|
2750 | 2862 | child.GenNormals(crease); |
---|
| 2863 | +// Children().release(i); |
---|
| 2864 | + } |
---|
| 2865 | + blockloop = false; |
---|
| 2866 | + } |
---|
| 2867 | + |
---|
| 2868 | + void GenNormalsMesh() |
---|
| 2869 | + { |
---|
| 2870 | + if (blockloop) |
---|
| 2871 | + return; |
---|
| 2872 | + |
---|
| 2873 | + blockloop = true; |
---|
| 2874 | + GenNormalsMesh0(); |
---|
| 2875 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2876 | + { |
---|
| 2877 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2878 | + if (child == null) |
---|
| 2879 | + continue; |
---|
| 2880 | + child.GenNormalsMesh(); |
---|
2751 | 2881 | // Children().release(i); |
---|
2752 | 2882 | } |
---|
2753 | 2883 | blockloop = false; |
---|
.. | .. |
---|
2905 | 3035 | { |
---|
2906 | 3036 | if (bRep != null) |
---|
2907 | 3037 | { |
---|
2908 | | - bRep.GenUV(); |
---|
| 3038 | + bRep.GenUV(); //1); |
---|
| 3039 | + //bRep.UnfoldUV(); |
---|
2909 | 3040 | Touch(); |
---|
2910 | 3041 | } |
---|
2911 | 3042 | } |
---|
.. | .. |
---|
2915 | 3046 | if (bRep != null) |
---|
2916 | 3047 | { |
---|
2917 | 3048 | bRep.GenerateNormals(crease); |
---|
| 3049 | + Touch(); |
---|
| 3050 | + } |
---|
| 3051 | + } |
---|
| 3052 | + |
---|
| 3053 | + void GenNormalsMesh0() |
---|
| 3054 | + { |
---|
| 3055 | + if (bRep != null) |
---|
| 3056 | + { |
---|
| 3057 | + bRep.GenerateNormalsMesh(); |
---|
2918 | 3058 | Touch(); |
---|
2919 | 3059 | } |
---|
2920 | 3060 | } |
---|
.. | .. |
---|
2980 | 3120 | blockloop = false; |
---|
2981 | 3121 | } |
---|
2982 | 3122 | |
---|
| 3123 | + void TransformChildren() |
---|
| 3124 | + { |
---|
| 3125 | + if (toParent != null) |
---|
| 3126 | + { |
---|
| 3127 | + for (int i=Size(); --i>=0;) |
---|
| 3128 | + { |
---|
| 3129 | + Object3D v = get(i); |
---|
| 3130 | + |
---|
| 3131 | + if (v.toParent == null) |
---|
| 3132 | + { |
---|
| 3133 | + v.toParent = LA.newMatrix(); |
---|
| 3134 | + v.fromParent = LA.newMatrix(); |
---|
| 3135 | + } |
---|
| 3136 | + |
---|
| 3137 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3138 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3139 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3140 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3141 | + } |
---|
| 3142 | + |
---|
| 3143 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3144 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3145 | + |
---|
| 3146 | + Touch(); |
---|
| 3147 | + } |
---|
| 3148 | + } |
---|
| 3149 | + |
---|
2983 | 3150 | void TransformGeometry() |
---|
2984 | 3151 | { |
---|
2985 | 3152 | Object3D obj = this; |
---|
.. | .. |
---|
3201 | 3368 | |
---|
3202 | 3369 | BoundaryRep sup = bRep.support; |
---|
3203 | 3370 | bRep.support = null; |
---|
3204 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3371 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3205 | 3372 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3206 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3373 | + |
---|
| 3374 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3375 | + |
---|
3207 | 3376 | bRep = temprep; |
---|
3208 | 3377 | bRep.support = sup; |
---|
3209 | 3378 | Touch(); |
---|
.. | .. |
---|
3340 | 3509 | if (blockloop) |
---|
3341 | 3510 | return; |
---|
3342 | 3511 | |
---|
3343 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3512 | + if (//marked || // does not make sense |
---|
| 3513 | + (bRep != null || material != null)) // borderline... |
---|
3344 | 3514 | live = h; |
---|
3345 | 3515 | |
---|
3346 | 3516 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3361 | 3531 | return; |
---|
3362 | 3532 | |
---|
3363 | 3533 | //if (bRep != null) |
---|
3364 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3534 | + if (//marked || // does not make sense |
---|
| 3535 | + (bRep != null || material != null)) // borderline... |
---|
3365 | 3536 | link2master = h; |
---|
3366 | 3537 | |
---|
3367 | 3538 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3381 | 3552 | if (blockloop) |
---|
3382 | 3553 | return; |
---|
3383 | 3554 | |
---|
3384 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3555 | + if (//marked || // does not make sense |
---|
| 3556 | + (bRep != null || material != null)) // borderline... |
---|
3385 | 3557 | hide = h; |
---|
3386 | 3558 | |
---|
3387 | 3559 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3401 | 3573 | if (blockloop) |
---|
3402 | 3574 | return; |
---|
3403 | 3575 | |
---|
3404 | | - if (bRep != null && material != null) // borderline... |
---|
| 3576 | + if (bRep != null || material != null) // borderline... |
---|
3405 | 3577 | marked = h; |
---|
3406 | 3578 | |
---|
3407 | 3579 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3411 | 3583 | continue; |
---|
3412 | 3584 | blockloop = true; |
---|
3413 | 3585 | child.MarkLeaves(h); |
---|
| 3586 | + blockloop = false; |
---|
| 3587 | + // release(i); |
---|
| 3588 | + } |
---|
| 3589 | + } |
---|
| 3590 | + |
---|
| 3591 | + void RewindLeaves(boolean h) |
---|
| 3592 | + { |
---|
| 3593 | + if (blockloop) |
---|
| 3594 | + return; |
---|
| 3595 | + |
---|
| 3596 | + if (bRep != null || material != null) // borderline... |
---|
| 3597 | + rewind = h; |
---|
| 3598 | + |
---|
| 3599 | + for (int i = 0; i < Size(); i++) |
---|
| 3600 | + { |
---|
| 3601 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3602 | + if (child == null) |
---|
| 3603 | + continue; |
---|
| 3604 | + blockloop = true; |
---|
| 3605 | + child.RewindLeaves(h); |
---|
| 3606 | + blockloop = false; |
---|
| 3607 | + // release(i); |
---|
| 3608 | + } |
---|
| 3609 | + } |
---|
| 3610 | + |
---|
| 3611 | + void RandomLeaves(boolean h) |
---|
| 3612 | + { |
---|
| 3613 | + if (blockloop) |
---|
| 3614 | + return; |
---|
| 3615 | + |
---|
| 3616 | + if (bRep != null || material != null) // borderline... |
---|
| 3617 | + random = h; |
---|
| 3618 | + |
---|
| 3619 | + for (int i = 0; i < Size(); i++) |
---|
| 3620 | + { |
---|
| 3621 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3622 | + if (child == null) |
---|
| 3623 | + continue; |
---|
| 3624 | + blockloop = true; |
---|
| 3625 | + child.RandomLeaves(h); |
---|
3414 | 3626 | blockloop = false; |
---|
3415 | 3627 | // release(i); |
---|
3416 | 3628 | } |
---|
.. | .. |
---|
3725 | 3937 | if (child == null) |
---|
3726 | 3938 | continue; |
---|
3727 | 3939 | |
---|
3728 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3940 | + if (Grafreed.RENDERME > 0) |
---|
3729 | 3941 | { |
---|
3730 | 3942 | if (child instanceof Merge) |
---|
3731 | 3943 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3876 | 4088 | if (child == null) |
---|
3877 | 4089 | continue; |
---|
3878 | 4090 | |
---|
3879 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4091 | + if (Grafreed.RENDERME > 0) |
---|
3880 | 4092 | { |
---|
3881 | 4093 | if (child instanceof Merge) |
---|
3882 | 4094 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4071 | 4283 | if (child == null) |
---|
4072 | 4284 | continue; |
---|
4073 | 4285 | |
---|
4074 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4286 | + if (Grafreed.RENDERME > 0) |
---|
4075 | 4287 | { |
---|
4076 | 4288 | if (child instanceof Merge) |
---|
4077 | 4289 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4184 | 4396 | { |
---|
4185 | 4397 | blockloop = true; |
---|
4186 | 4398 | get(i).RepairShadow(); |
---|
| 4399 | + blockloop = false; |
---|
| 4400 | + } |
---|
| 4401 | + } |
---|
| 4402 | + |
---|
| 4403 | + void RepairSOV() |
---|
| 4404 | + { |
---|
| 4405 | + if (blockloop) |
---|
| 4406 | + return; |
---|
| 4407 | + |
---|
| 4408 | + String texname = this.GetPigmentTexture(); |
---|
| 4409 | + |
---|
| 4410 | + if (texname.startsWith("sov")) |
---|
| 4411 | + { |
---|
| 4412 | + String[] s = texname.split("/"); |
---|
| 4413 | + |
---|
| 4414 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4415 | + |
---|
| 4416 | + texname = sname[0]; |
---|
| 4417 | + |
---|
| 4418 | + if (sname.length > 1) |
---|
| 4419 | + { |
---|
| 4420 | + texname += "Color.jpg"; |
---|
| 4421 | + } |
---|
| 4422 | + |
---|
| 4423 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4424 | + } |
---|
| 4425 | + |
---|
| 4426 | + texname = this.GetBumpTexture(); |
---|
| 4427 | + |
---|
| 4428 | + if (texname.startsWith("sov")) |
---|
| 4429 | + { |
---|
| 4430 | + String[] s = texname.split("/"); |
---|
| 4431 | + |
---|
| 4432 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4433 | + |
---|
| 4434 | + texname = sname[0]; |
---|
| 4435 | + |
---|
| 4436 | + if (sname.length > 1) |
---|
| 4437 | + { |
---|
| 4438 | + texname += "Bump.jpg"; |
---|
| 4439 | + } |
---|
| 4440 | + |
---|
| 4441 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4442 | + } |
---|
| 4443 | + |
---|
| 4444 | + for (int i=0; i<Size(); i++) |
---|
| 4445 | + { |
---|
| 4446 | + blockloop = true; |
---|
| 4447 | + get(i).RepairSOV(); |
---|
4187 | 4448 | blockloop = false; |
---|
4188 | 4449 | } |
---|
4189 | 4450 | } |
---|
.. | .. |
---|
4678 | 4939 | |
---|
4679 | 4940 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4680 | 4941 | { |
---|
4681 | | - if (hide) |
---|
| 4942 | + if (hide || dontselect) |
---|
4682 | 4943 | return null; |
---|
4683 | 4944 | |
---|
4684 | 4945 | if (count <= 0) |
---|
.. | .. |
---|
4704 | 4965 | |
---|
4705 | 4966 | cTreePath Select(int indexcount, boolean deselect) |
---|
4706 | 4967 | { |
---|
4707 | | - if (hide) |
---|
| 4968 | + if (hide || dontselect) |
---|
4708 | 4969 | return null; |
---|
4709 | 4970 | |
---|
4710 | 4971 | if (count <= 0) |
---|
.. | .. |
---|
5156 | 5417 | |
---|
5157 | 5418 | // System.out.println("Fullname = " + fullname); |
---|
5158 | 5419 | |
---|
5159 | | - if (fullname.name.indexOf(":") == -1) |
---|
5160 | | - return fullname.name; |
---|
| 5420 | + // Does not work on Windows due to C: |
---|
| 5421 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5422 | +// return fullname.name; |
---|
| 5423 | +// |
---|
| 5424 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5161 | 5425 | |
---|
5162 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5426 | + String[] split = fullname.name.split(":"); |
---|
| 5427 | + |
---|
| 5428 | + if (split.length == 0) |
---|
| 5429 | + { |
---|
| 5430 | + return ""; |
---|
| 5431 | + } |
---|
| 5432 | + |
---|
| 5433 | + if (split.length <= 2) |
---|
| 5434 | + { |
---|
| 5435 | + if (fullname.name.endsWith(":")) |
---|
| 5436 | + { |
---|
| 5437 | + // Windows |
---|
| 5438 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5439 | + } |
---|
| 5440 | + |
---|
| 5441 | + return split[0]; |
---|
| 5442 | + } |
---|
| 5443 | + |
---|
| 5444 | + // Windows |
---|
| 5445 | + assert(split.length == 4); |
---|
| 5446 | + |
---|
| 5447 | + return split[0] + ":" + split[1]; |
---|
5163 | 5448 | } |
---|
5164 | 5449 | |
---|
5165 | 5450 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5168 | 5453 | return ""; |
---|
5169 | 5454 | |
---|
5170 | 5455 | // System.out.println("Fullname = " + fullname); |
---|
5171 | | - if (fullname.name.indexOf(":") == -1) |
---|
5172 | | - return ""; |
---|
5173 | | - |
---|
5174 | | - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5456 | + // Does not work on Windows due to C: |
---|
| 5457 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5458 | +// return ""; |
---|
| 5459 | +// |
---|
| 5460 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5461 | + String[] split = fullname.name.split(":"); |
---|
| 5462 | + |
---|
| 5463 | + if (split.length == 0) |
---|
| 5464 | + { |
---|
| 5465 | + return ""; |
---|
| 5466 | + } |
---|
| 5467 | + |
---|
| 5468 | + if (split.length == 1) |
---|
| 5469 | + { |
---|
| 5470 | + return ""; |
---|
| 5471 | + } |
---|
| 5472 | + |
---|
| 5473 | + if (split.length == 2) |
---|
| 5474 | + { |
---|
| 5475 | + if (fullname.name.endsWith(":")) |
---|
| 5476 | + { |
---|
| 5477 | + // Windows |
---|
| 5478 | + return ""; |
---|
| 5479 | + } |
---|
| 5480 | + |
---|
| 5481 | + return split[1]; |
---|
| 5482 | + } |
---|
| 5483 | + |
---|
| 5484 | + // Windows |
---|
| 5485 | + assert(split.length == 4); |
---|
| 5486 | + |
---|
| 5487 | + return split[2] + ":" + split[3]; |
---|
5175 | 5488 | } |
---|
5176 | 5489 | |
---|
5177 | 5490 | String GetPigmentTexture() |
---|
.. | .. |
---|
5245 | 5558 | System.out.print("; textures = " + textures); |
---|
5246 | 5559 | System.out.println("; usedtextures = " + usedtextures); |
---|
5247 | 5560 | |
---|
5248 | | - if (GetTextures() == null) |
---|
| 5561 | + if (GetTextures() == null) // What is that?? |
---|
5249 | 5562 | GetTextures().name = ":"; |
---|
5250 | 5563 | |
---|
5251 | 5564 | String texname = tex; |
---|
.. | .. |
---|
5276 | 5589 | child.ResetPigmentTexture(); |
---|
5277 | 5590 | blockloop = false; |
---|
5278 | 5591 | } |
---|
| 5592 | + } |
---|
| 5593 | + |
---|
| 5594 | + UUID GetUUID() |
---|
| 5595 | + { |
---|
| 5596 | + if (uuid == null) |
---|
| 5597 | + { |
---|
| 5598 | + // Serial |
---|
| 5599 | + uuid = UUID.randomUUID(); |
---|
| 5600 | + } |
---|
| 5601 | + |
---|
| 5602 | + return uuid; |
---|
| 5603 | + } |
---|
| 5604 | + |
---|
| 5605 | + Object3D GetObject(UUID uid) |
---|
| 5606 | + { |
---|
| 5607 | + if (blockloop) |
---|
| 5608 | + return null; |
---|
| 5609 | + |
---|
| 5610 | + if (GetUUID().equals(uid)) |
---|
| 5611 | + return this; |
---|
| 5612 | + |
---|
| 5613 | + int nb = Size(); |
---|
| 5614 | + for (int i = 0; i < nb; i++) |
---|
| 5615 | + { |
---|
| 5616 | + Object3D child = (Object3D) get(i); |
---|
| 5617 | + |
---|
| 5618 | + if (child == null) |
---|
| 5619 | + continue; |
---|
| 5620 | + |
---|
| 5621 | + blockloop = true; |
---|
| 5622 | + Object3D obj = child.GetObject(uid); |
---|
| 5623 | + blockloop = false; |
---|
| 5624 | + if (obj != null) |
---|
| 5625 | + return obj; |
---|
| 5626 | + } |
---|
| 5627 | + |
---|
| 5628 | + return null; |
---|
5279 | 5629 | } |
---|
5280 | 5630 | |
---|
5281 | 5631 | void SetBumpTexture(String tex) |
---|
.. | .. |
---|
5322 | 5672 | boolean NeedSupport() |
---|
5323 | 5673 | { |
---|
5324 | 5674 | return |
---|
5325 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5675 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5326 | 5676 | // PROBLEM with CROWD!! |
---|
5327 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5677 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5328 | 5678 | } |
---|
5329 | 5679 | |
---|
5330 | 5680 | static boolean DEBUG_SELECTION = false; |
---|
| 5681 | + |
---|
| 5682 | + boolean IsLive() |
---|
| 5683 | + { |
---|
| 5684 | + if (live) |
---|
| 5685 | + return true; |
---|
| 5686 | + |
---|
| 5687 | + if (parent == null) |
---|
| 5688 | + return false; |
---|
| 5689 | + |
---|
| 5690 | + return parent.IsLive(); |
---|
| 5691 | + } |
---|
5331 | 5692 | |
---|
5332 | 5693 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5333 | 5694 | { |
---|
.. | .. |
---|
5339 | 5700 | } |
---|
5340 | 5701 | |
---|
5341 | 5702 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5342 | | - hide) |
---|
| 5703 | + (hide || dontselect)) |
---|
5343 | 5704 | return; |
---|
5344 | 5705 | |
---|
5345 | 5706 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5371 | 5732 | return; |
---|
5372 | 5733 | } |
---|
5373 | 5734 | |
---|
5374 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5735 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5375 | 5736 | |
---|
5376 | 5737 | /* |
---|
5377 | 5738 | if (touched) |
---|
.. | .. |
---|
5390 | 5751 | support = support; |
---|
5391 | 5752 | |
---|
5392 | 5753 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5393 | | - boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5754 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5394 | 5755 | |
---|
5395 | 5756 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5396 | 5757 | { |
---|
.. | .. |
---|
5410 | 5771 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5411 | 5772 | |
---|
5412 | 5773 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5413 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5774 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5775 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
5414 | 5776 | { |
---|
5415 | 5777 | Globals.lighttouched = true; |
---|
5416 | 5778 | } // all panes... |
---|
| 5779 | + |
---|
5417 | 5780 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5418 | 5781 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5419 | 5782 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5423 | 5786 | //if (displaylist == -1 && usecalllists) |
---|
5424 | 5787 | if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
5425 | 5788 | { |
---|
5426 | | - bRep.displaylist = gl.glGenLists(1); |
---|
| 5789 | + bRep.displaylist = display.GenList(); |
---|
5427 | 5790 | assert(bRep.displaylist != 0); |
---|
5428 | 5791 | // System.err.println("glGenLists: " + bRep.displaylist + " for " + this); |
---|
5429 | 5792 | //System.out.println("\tgen list " + list); |
---|
.. | .. |
---|
5435 | 5798 | if (usecalllists) |
---|
5436 | 5799 | { |
---|
5437 | 5800 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5438 | | - gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE); |
---|
| 5801 | + display.NewList(bRep.displaylist); |
---|
5439 | 5802 | } |
---|
| 5803 | + |
---|
5440 | 5804 | CallList(display, root, selected, blocked); |
---|
| 5805 | + |
---|
5441 | 5806 | // compiled = true; |
---|
5442 | 5807 | if (usecalllists) |
---|
5443 | 5808 | { |
---|
5444 | 5809 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5445 | | - gl.glEndList(); |
---|
| 5810 | + display.EndList(); |
---|
5446 | 5811 | } |
---|
5447 | 5812 | //gl.glDrawBuffer(gl.GL_BACK); |
---|
5448 | 5813 | // XXX touched = false; |
---|
.. | .. |
---|
5490 | 5855 | if (display.DrawMode() == iCameraPane.SHADOW) |
---|
5491 | 5856 | { |
---|
5492 | 5857 | if (!link2master // tricky to cull in shadow mode. |
---|
5493 | | - && GetBRep().FrustumCull(this, gl, display.LightCamera(), true)) |
---|
| 5858 | + && GetBRep().FrustumCull(this, null, display.LightCamera(), true)) |
---|
5494 | 5859 | { |
---|
5495 | 5860 | //System.out.print("CULLED"); |
---|
5496 | 5861 | culled = true; |
---|
.. | .. |
---|
5498 | 5863 | } |
---|
5499 | 5864 | else |
---|
5500 | 5865 | //GetBRep().getBounds(v0, v1, this); |
---|
5501 | | - if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false)) |
---|
| 5866 | + if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false)) |
---|
5502 | 5867 | culled = true; |
---|
5503 | 5868 | |
---|
5504 | 5869 | // LA.xformPos(v0, display.renderCamera.toScreen, v0); |
---|
.. | .. |
---|
5538 | 5903 | { |
---|
5539 | 5904 | if (GetBRep() != null) |
---|
5540 | 5905 | { |
---|
5541 | | - CameraPane.NextIndex(this, gl); |
---|
| 5906 | + display.NextIndex(); |
---|
5542 | 5907 | // vertex color conflict : gl.glCallList(list); |
---|
5543 | 5908 | DrawNode(display, root, selected); |
---|
5544 | 5909 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5579 | 5944 | tex = GetTextures(); |
---|
5580 | 5945 | } |
---|
5581 | 5946 | |
---|
5582 | | - display.BindTextures(tex, texres); |
---|
| 5947 | + boolean failedPigment = false; |
---|
| 5948 | + boolean failedBump = false; |
---|
| 5949 | + |
---|
| 5950 | + try |
---|
| 5951 | + { |
---|
| 5952 | + display.BindPigmentTexture(tex, texres); |
---|
| 5953 | + } |
---|
| 5954 | + catch (Exception e) |
---|
| 5955 | + { |
---|
| 5956 | + System.err.println("FAILED: " + this); |
---|
| 5957 | + failedPigment = true; |
---|
| 5958 | + } |
---|
| 5959 | + |
---|
| 5960 | + try |
---|
| 5961 | + { |
---|
| 5962 | + display.BindBumpTexture(tex, texres); |
---|
| 5963 | + } |
---|
| 5964 | + catch (Exception e) |
---|
| 5965 | + { |
---|
| 5966 | + //System.err.println("FAILED: " + this); |
---|
| 5967 | + failedBump = true; |
---|
| 5968 | + } |
---|
5583 | 5969 | |
---|
5584 | 5970 | if (!compiled) |
---|
5585 | 5971 | { |
---|
.. | .. |
---|
5595 | 5981 | |
---|
5596 | 5982 | // System.err.println("glCallList: " + bRep.displaylist + " for " + this); |
---|
5597 | 5983 | assert(bRep.displaylist != 0); |
---|
5598 | | - gl.glCallList(bRep.displaylist); |
---|
| 5984 | + display.CallList(bRep.displaylist); |
---|
5599 | 5985 | // june 2013 drawSelf(display, root, selected); |
---|
5600 | 5986 | } |
---|
5601 | 5987 | } |
---|
5602 | 5988 | } |
---|
5603 | 5989 | |
---|
5604 | | - display.ReleaseTextures(tex); |
---|
| 5990 | + if (!failedBump) |
---|
| 5991 | + display.ReleaseBumpTexture(tex); |
---|
| 5992 | + |
---|
| 5993 | + if (!failedPigment) |
---|
| 5994 | + display.ReleasePigmentTexture(tex); |
---|
5605 | 5995 | |
---|
5606 | 5996 | display.PopMaterial(this, selected); |
---|
5607 | 5997 | } |
---|
.. | .. |
---|
5730 | 6120 | |
---|
5731 | 6121 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5732 | 6122 | { |
---|
| 6123 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6124 | + return; |
---|
| 6125 | + |
---|
5733 | 6126 | if (hide) |
---|
5734 | 6127 | return; |
---|
5735 | 6128 | // shadow optimisation |
---|
.. | .. |
---|
5855 | 6248 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5856 | 6249 | return; // no shadow for transparent objects |
---|
5857 | 6250 | |
---|
| 6251 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6252 | + return; |
---|
| 6253 | + |
---|
5858 | 6254 | if (hide) |
---|
5859 | 6255 | return; |
---|
5860 | 6256 | |
---|
.. | .. |
---|
5895 | 6291 | return; |
---|
5896 | 6292 | } |
---|
5897 | 6293 | |
---|
| 6294 | + //bRep.GenUV(1/material.diffuseness); |
---|
5898 | 6295 | // bRep.lock = true; |
---|
5899 | 6296 | |
---|
5900 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 6297 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5901 | 6298 | |
---|
5902 | 6299 | if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
5903 | 6300 | { |
---|
.. | .. |
---|
5914 | 6311 | |
---|
5915 | 6312 | bRep.getMinMax(min, max, 100); |
---|
5916 | 6313 | |
---|
5917 | | - gl.glBegin(gl.GL_LINES); |
---|
5918 | | - |
---|
5919 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5920 | | - gl.glVertex3d(min.x, min.y, max.z); |
---|
5921 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5922 | | - gl.glVertex3d(min.x, max.y, min.z); |
---|
5923 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5924 | | - gl.glVertex3d(max.x, min.y, min.z); |
---|
5925 | | - |
---|
5926 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5927 | | - gl.glVertex3d(min.x, max.y, max.z); |
---|
5928 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5929 | | - gl.glVertex3d(max.x, min.y, max.z); |
---|
5930 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5931 | | - gl.glVertex3d(max.x, max.y, min.z); |
---|
5932 | | - |
---|
5933 | | - gl.glEnd(); |
---|
| 6314 | + display.DrawBox(min, max); |
---|
5934 | 6315 | |
---|
5935 | 6316 | return; |
---|
5936 | 6317 | } |
---|
.. | .. |
---|
5984 | 6365 | new Exception().printStackTrace(); |
---|
5985 | 6366 | return; |
---|
5986 | 6367 | } |
---|
5987 | | - |
---|
5988 | | - // TRIANGLE STRIP ARRAY |
---|
5989 | | - if (bRep.trimmed) |
---|
| 6368 | + |
---|
| 6369 | + if (dontselect) |
---|
5990 | 6370 | { |
---|
5991 | | - float[] v = bRep.getRawVertices(); |
---|
5992 | | - float[] n = bRep.getRawNormals(); |
---|
5993 | | - float[] c = bRep.getRawColors(); |
---|
5994 | | - float[] uv = bRep.getRawUVMap(); |
---|
5995 | | - |
---|
5996 | | - int count2 = 0; |
---|
5997 | | - int count3 = 0; |
---|
5998 | | - |
---|
5999 | | - if (n.length > 0) |
---|
6000 | | - { |
---|
6001 | | - for (int i = 0; i < strips.length; i++) |
---|
6002 | | - { |
---|
6003 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6004 | | - |
---|
6005 | | - /* |
---|
6006 | | - boolean locked = false; |
---|
6007 | | - float eps = 0.1f; |
---|
6008 | | - boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6009 | | - |
---|
6010 | | - int dot = 0; |
---|
6011 | | - |
---|
6012 | | - if ((dot&1) == 0) |
---|
6013 | | - dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6014 | | - |
---|
6015 | | - if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6016 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6017 | | - else |
---|
6018 | | - { |
---|
6019 | | - locked = true; |
---|
6020 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6021 | | - } |
---|
6022 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6023 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6024 | | - if (hasnorm) |
---|
6025 | | - { |
---|
6026 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6027 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6028 | | - } |
---|
6029 | | - |
---|
6030 | | - if ((dot&4) == 0) |
---|
6031 | | - dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6032 | | - |
---|
6033 | | - if (wrap || !locked && (dot&8) != 0) |
---|
6034 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6035 | | - else |
---|
6036 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6037 | | - |
---|
6038 | | - f.dot = dot; |
---|
6039 | | - */ |
---|
6040 | | - |
---|
6041 | | - if (!selectmode) |
---|
6042 | | - { |
---|
6043 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6044 | | - { |
---|
6045 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6046 | | - } else |
---|
6047 | | - { |
---|
6048 | | - gl.glNormal3f(0, 0, 1); |
---|
6049 | | - } |
---|
6050 | | - |
---|
6051 | | - if (c != null) |
---|
6052 | | - //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]); |
---|
6053 | | - { |
---|
6054 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6055 | | - } |
---|
6056 | | - } |
---|
6057 | | - if (flipV) |
---|
6058 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6059 | | - else |
---|
6060 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6061 | | - //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6062 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6063 | | - |
---|
6064 | | - count2 += 2; |
---|
6065 | | - count3 += 3; |
---|
6066 | | - if (!selectmode) |
---|
6067 | | - { |
---|
6068 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6069 | | - { |
---|
6070 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6071 | | - } else |
---|
6072 | | - { |
---|
6073 | | - gl.glNormal3f(0, 0, 1); |
---|
6074 | | - } |
---|
6075 | | - if (c != null) |
---|
6076 | | - { |
---|
6077 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6078 | | - } |
---|
6079 | | - } |
---|
6080 | | - if (flipV) |
---|
6081 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6082 | | - else |
---|
6083 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6084 | | - //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6085 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6086 | | - |
---|
6087 | | - count2 += 2; |
---|
6088 | | - count3 += 3; |
---|
6089 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6090 | | - { |
---|
6091 | | - //gl.glTexCoord2d(...); |
---|
6092 | | - if (!selectmode) |
---|
6093 | | - { |
---|
6094 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6095 | | - { |
---|
6096 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6097 | | - } else |
---|
6098 | | - { |
---|
6099 | | - gl.glNormal3f(0, 0, 1); |
---|
6100 | | - } |
---|
6101 | | - if (c != null) |
---|
6102 | | - { |
---|
6103 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6104 | | - } |
---|
6105 | | - } |
---|
6106 | | - |
---|
6107 | | - if (flipV) |
---|
6108 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6109 | | - else |
---|
6110 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6111 | | - //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
6112 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6113 | | - count2 += 2; |
---|
6114 | | - count3 += 3; |
---|
6115 | | - } |
---|
6116 | | - |
---|
6117 | | - gl.glEnd(); |
---|
6118 | | - } |
---|
6119 | | - } |
---|
6120 | | - |
---|
6121 | | - assert count3 == v.length; |
---|
| 6371 | + //bRep.GenerateNormalsMINE(); |
---|
6122 | 6372 | } |
---|
6123 | | - else // !trimmed |
---|
6124 | | - { |
---|
6125 | | - int count = 0; |
---|
6126 | | - for (int i = 0; i < strips.length; i++) |
---|
6127 | | - { |
---|
6128 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6129 | | - |
---|
6130 | | - Vertex p = bRep.GetVertex(bRep.indices[count++]); |
---|
6131 | | - Vertex q = bRep.GetVertex(bRep.indices[count++]); |
---|
6132 | | - |
---|
6133 | | - drawVertex(gl, p, selectmode); |
---|
6134 | | - drawVertex(gl, q, selectmode); |
---|
6135 | | - |
---|
6136 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6137 | | - { |
---|
6138 | | - Vertex r = bRep.GetVertex(bRep.indices[count++]); |
---|
6139 | | - |
---|
6140 | | -// if (j%2 == 0) |
---|
6141 | | -// drawFace(p, q, r, display, null); |
---|
6142 | | -// else |
---|
6143 | | -// drawFace(p, r, q, display, null); |
---|
6144 | | - |
---|
6145 | | -// p = q; |
---|
6146 | | -// q = r; |
---|
6147 | | - drawVertex(gl, r, selectmode); |
---|
6148 | | - } |
---|
6149 | | - |
---|
6150 | | - gl.glEnd(); |
---|
6151 | | - } |
---|
6152 | | - } |
---|
| 6373 | + |
---|
| 6374 | + display.DrawGeometry(bRep, flipV, selectmode); |
---|
6153 | 6375 | } else // catch (Error e) |
---|
6154 | 6376 | { |
---|
6155 | 6377 | // TRIANGLE ARRAY |
---|
6156 | 6378 | if (IsOpaque()) // Static()) |
---|
6157 | 6379 | { |
---|
6158 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6380 | + display.StartTriangles(); |
---|
6159 | 6381 | int facecount = bRep.FaceCount(); |
---|
6160 | 6382 | for (int i = 0; i < facecount; i++) |
---|
6161 | 6383 | { |
---|
.. | .. |
---|
6220 | 6442 | |
---|
6221 | 6443 | display.DrawFace(this, p, q, r, face); |
---|
6222 | 6444 | } |
---|
6223 | | - gl.glEnd(); |
---|
| 6445 | + display.EndTriangles(); |
---|
6224 | 6446 | } |
---|
6225 | 6447 | else |
---|
6226 | 6448 | { |
---|
.. | .. |
---|
6249 | 6471 | //System.out.println("SORT"); |
---|
6250 | 6472 | |
---|
6251 | 6473 | java.util.Arrays.sort(facescompare); |
---|
6252 | | - |
---|
6253 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6474 | + |
---|
| 6475 | + display.StartTriangles(); |
---|
6254 | 6476 | for (int i = 0; i < facecount; i++) |
---|
6255 | 6477 | { |
---|
6256 | 6478 | Face face = bRep.GetFace(facescompare[i].index); |
---|
.. | .. |
---|
6264 | 6486 | |
---|
6265 | 6487 | display.DrawFace(this, p, q, r, face); |
---|
6266 | 6488 | } |
---|
6267 | | - gl.glEnd(); |
---|
| 6489 | + display.EndTriangles(); |
---|
6268 | 6490 | } |
---|
6269 | 6491 | |
---|
6270 | 6492 | if (false) // live && support != null && support.bRep != null) // debug weights |
---|
6271 | 6493 | { |
---|
| 6494 | + /* |
---|
6272 | 6495 | gl.glDisable(gl.GL_LIGHTING); |
---|
6273 | 6496 | float[] colorV = new float[3]; |
---|
6274 | 6497 | |
---|
.. | .. |
---|
6347 | 6570 | // gl.glEnd(); |
---|
6348 | 6571 | } |
---|
6349 | 6572 | } |
---|
| 6573 | + */ |
---|
6350 | 6574 | } |
---|
6351 | 6575 | } |
---|
6352 | 6576 | |
---|
.. | .. |
---|
6405 | 6629 | void Print(Vertex v) |
---|
6406 | 6630 | { |
---|
6407 | 6631 | //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")"); |
---|
6408 | | - } |
---|
6409 | | - |
---|
6410 | | - void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode) |
---|
6411 | | - { |
---|
6412 | | - if (!selectmode) |
---|
6413 | | - { |
---|
6414 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6415 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6416 | | - |
---|
6417 | | - if (flipV) |
---|
6418 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6419 | | - else |
---|
6420 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6421 | | - } |
---|
6422 | | - |
---|
6423 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6424 | 6632 | } |
---|
6425 | 6633 | |
---|
6426 | 6634 | void drawSelf(ClickInfo info, int level, boolean select) |
---|
.. | .. |
---|
7013 | 7221 | spot.translate(32, 32); |
---|
7014 | 7222 | spotw = spot.x + spot.width; |
---|
7015 | 7223 | spoth = spot.y + spot.height; |
---|
7016 | | - info.g.setColor(Color.blue); |
---|
| 7224 | + info.g.setColor(Color.cyan); |
---|
7017 | 7225 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7018 | 7226 | // if (CameraPane.Xmin > spot.x) |
---|
7019 | 7227 | // { |
---|
.. | .. |
---|
7031 | 7239 | // { |
---|
7032 | 7240 | // CameraPane.Ymax = spoth; |
---|
7033 | 7241 | // } |
---|
7034 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
7035 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7242 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7243 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7036 | 7244 | spot.translate(0, -32); |
---|
7037 | | - info.g.setColor(Color.green); |
---|
| 7245 | + info.g.setColor(Color.yellow); |
---|
7038 | 7246 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7247 | + info.g.setColor(Color.green); |
---|
7039 | 7248 | // if (CameraPane.Xmin > spot.x) |
---|
7040 | 7249 | // { |
---|
7041 | 7250 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7087 | 7296 | startX = info.x; |
---|
7088 | 7297 | startY = info.y; |
---|
7089 | 7298 | |
---|
7090 | | - hitSomething = 0; |
---|
| 7299 | + hitSomething = -1; |
---|
7091 | 7300 | cVector origin = new cVector(); |
---|
7092 | 7301 | //LA.xformPos(origin, toParent, origin); |
---|
7093 | 7302 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
7120 | 7329 | } |
---|
7121 | 7330 | |
---|
7122 | 7331 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7123 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7332 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7124 | 7333 | //System.out.println("modified = " + modified); |
---|
7125 | 7334 | //new Exception().printStackTrace(); |
---|
7126 | 7335 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7148 | 7357 | return true; |
---|
7149 | 7358 | } |
---|
7150 | 7359 | |
---|
7151 | | - void doEditDrag0(ClickInfo info) |
---|
| 7360 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
7152 | 7361 | { |
---|
7153 | 7362 | if (hitSomething == 0) |
---|
7154 | 7363 | { |
---|
.. | .. |
---|
7163 | 7372 | //System.out.println("hitSomething = " + hitSomething); |
---|
7164 | 7373 | |
---|
7165 | 7374 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7375 | + |
---|
7166 | 7376 | cVector xlate = new cVector(); |
---|
7167 | 7377 | //cVector xlate2 = new cVector(); |
---|
7168 | 7378 | switch (hitSomething) |
---|
.. | .. |
---|
7175 | 7385 | |
---|
7176 | 7386 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7177 | 7387 | |
---|
7178 | | - if (modified) |
---|
| 7388 | + if (modified || opposite) |
---|
7179 | 7389 | { |
---|
7180 | 7390 | //assert(false); |
---|
7181 | 7391 | /* |
---|
.. | .. |
---|
7269 | 7479 | |
---|
7270 | 7480 | if (modified) |
---|
7271 | 7481 | { |
---|
| 7482 | + // Rotate 90 degrees |
---|
7272 | 7483 | angle /= (Math.PI / 4); |
---|
7273 | 7484 | angle = Math.floor(angle + 0.5); |
---|
7274 | 7485 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7310 | 7521 | |
---|
7311 | 7522 | case hitScale: // scale |
---|
7312 | 7523 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7524 | + double sign = 1; |
---|
| 7525 | + if (hScale < 0) |
---|
| 7526 | + { |
---|
| 7527 | + sign = -1; |
---|
| 7528 | + } |
---|
| 7529 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7313 | 7530 | if (hScale < 0.01) |
---|
7314 | 7531 | { |
---|
7315 | | - hScale = 0.01; |
---|
| 7532 | + //hScale = 0.01; |
---|
7316 | 7533 | } |
---|
7317 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7318 | | - if (hScale < 0.01) |
---|
7319 | | - { |
---|
7320 | | - hScale = 0.01; |
---|
7321 | | - } |
---|
| 7534 | + |
---|
7322 | 7535 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7323 | | - if (vScale < 0.01) |
---|
| 7536 | + sign = 1; |
---|
| 7537 | + if (vScale < 0) |
---|
7324 | 7538 | { |
---|
7325 | | - vScale = 0.01; |
---|
| 7539 | + sign = -1; |
---|
7326 | 7540 | } |
---|
7327 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7541 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7328 | 7542 | if (vScale < 0.01) |
---|
7329 | 7543 | { |
---|
7330 | | - vScale = 0.01; |
---|
| 7544 | + //vScale = 0.01; |
---|
7331 | 7545 | } |
---|
7332 | 7546 | LA.matCopy(startMat, toParent); |
---|
7333 | 7547 | /**/ |
---|
.. | .. |
---|
7338 | 7552 | } |
---|
7339 | 7553 | /**/ |
---|
7340 | 7554 | |
---|
| 7555 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7556 | + |
---|
| 7557 | + if (totalScale < 0.01) |
---|
| 7558 | + { |
---|
| 7559 | + totalScale = 0.01; |
---|
| 7560 | + } |
---|
| 7561 | + |
---|
7341 | 7562 | switch (info.pane.RenderCamera().viewCode) |
---|
7342 | 7563 | { |
---|
7343 | 7564 | case 3: // '\001' |
---|
7344 | | - if (modified) |
---|
| 7565 | + if (modified || opposite) |
---|
7345 | 7566 | { |
---|
7346 | 7567 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7347 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7568 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7348 | 7569 | } // vScale, 1); |
---|
7349 | 7570 | else |
---|
7350 | 7571 | { |
---|
7351 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7572 | + // EXCEPTION! |
---|
| 7573 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7352 | 7574 | } // vScale, 1); |
---|
7353 | 7575 | break; |
---|
7354 | 7576 | |
---|
7355 | 7577 | case 2: // '\002' |
---|
7356 | | - if (modified) |
---|
| 7578 | + if (modified || opposite) |
---|
7357 | 7579 | { |
---|
7358 | 7580 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7359 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7581 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7360 | 7582 | } else |
---|
7361 | 7583 | { |
---|
7362 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7584 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7363 | 7585 | } |
---|
7364 | 7586 | break; |
---|
7365 | 7587 | |
---|
7366 | 7588 | case 1: // '\003' |
---|
7367 | | - if (modified) |
---|
| 7589 | + if (modified || opposite) |
---|
7368 | 7590 | { |
---|
7369 | 7591 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7370 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7592 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7371 | 7593 | } else |
---|
7372 | 7594 | { |
---|
7373 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7595 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7374 | 7596 | } |
---|
7375 | 7597 | break; |
---|
7376 | 7598 | } |
---|
.. | .. |
---|
7503 | 7725 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7504 | 7726 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7505 | 7727 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7728 | + |
---|
| 7729 | + String objname; |
---|
| 7730 | + |
---|
7506 | 7731 | if (false) //parent != null) |
---|
7507 | 7732 | { |
---|
7508 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7733 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7509 | 7734 | } else |
---|
7510 | 7735 | { |
---|
7511 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7736 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7512 | 7737 | } // + super.toString(); |
---|
7513 | 7738 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7739 | + |
---|
| 7740 | + if (!Globals.ADVANCED) |
---|
| 7741 | + return objname; |
---|
| 7742 | + |
---|
| 7743 | + return objname + " " + System.identityHashCode(this); |
---|
7514 | 7744 | } |
---|
7515 | 7745 | |
---|
7516 | 7746 | public int hashCode() |
---|
.. | .. |
---|
7566 | 7796 | objectUI.closeUI(); |
---|
7567 | 7797 | if (editWindow != null) |
---|
7568 | 7798 | { |
---|
| 7799 | + editWindow.ctrlPanel.FlushUI(); |
---|
7569 | 7800 | editWindow.refreshContents(); |
---|
7570 | 7801 | } // ? new |
---|
7571 | 7802 | objectUI = null; |
---|
.. | .. |
---|
7574 | 7805 | { |
---|
7575 | 7806 | editWindow = null; |
---|
7576 | 7807 | } // ? |
---|
| 7808 | + } |
---|
| 7809 | + else |
---|
| 7810 | + { |
---|
| 7811 | + //editWindow.closeUI(); |
---|
7577 | 7812 | } |
---|
7578 | 7813 | } |
---|
7579 | 7814 | |
---|
.. | .. |
---|
7586 | 7821 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7587 | 7822 | |
---|
7588 | 7823 | Object3D /*Composite*/ parent; |
---|
7589 | | - Object3D /*Composite*/ fileparent; |
---|
| 7824 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7590 | 7825 | |
---|
7591 | 7826 | double[][] toParent; // dynamic matrix |
---|
7592 | 7827 | double[][] fromParent; |
---|
.. | .. |
---|
7701 | 7936 | { |
---|
7702 | 7937 | assert(bRep != null); |
---|
7703 | 7938 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7704 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 7939 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7705 | 7940 | } |
---|
7706 | 7941 | else |
---|
7707 | 7942 | { |
---|
.. | .. |
---|
7750 | 7985 | private static cVector edge2 = new cVector(); |
---|
7751 | 7986 | //private static cVector norm = new cVector(); |
---|
7752 | 7987 | /*transient private*/ int hitSomething; |
---|
7753 | | - private static final int hitCenter = 1; |
---|
7754 | | - private static final int hitScale = 2; |
---|
7755 | | - private static final int hitRotate = 3; |
---|
| 7988 | + static final int hitCenter = 1; |
---|
| 7989 | + static final int hitScale = 2; |
---|
| 7990 | + static final int hitRotate = 3; |
---|
7756 | 7991 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7757 | 7992 | /*transient*/ private Point centerPt; |
---|
7758 | 7993 | /*transient*/ private int startX; |
---|