.. | .. |
---|
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(); |
---|
21 | 26 | |
---|
22 | 27 | ScriptNode scriptnode; |
---|
23 | 28 | |
---|
.. | .. |
---|
155 | 160 | blockloop = true; |
---|
156 | 161 | child.RestoreSupports(); |
---|
157 | 162 | blockloop = false; |
---|
| 163 | + } |
---|
| 164 | +} |
---|
| 165 | + |
---|
| 166 | +void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 167 | +{ |
---|
| 168 | + if (hashtable.containsKey(GetUUID())) |
---|
| 169 | + { |
---|
| 170 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 171 | + |
---|
| 172 | + assert(this.bRep == o.bRep); |
---|
| 173 | + if (this.bRep != null) |
---|
| 174 | + assert(this.bRep.support == o.transientrep); |
---|
| 175 | + |
---|
| 176 | + return; |
---|
| 177 | + } |
---|
| 178 | + |
---|
| 179 | + Object3D o = new Object3D(); |
---|
| 180 | + o.bRep = this.bRep; |
---|
| 181 | + if (this.bRep != null) |
---|
| 182 | + { |
---|
| 183 | + o.transientrep = this.bRep.support; |
---|
| 184 | + o.bRep.support = null; |
---|
| 185 | + } |
---|
| 186 | + |
---|
| 187 | +// o.support = this.support; |
---|
| 188 | +// o.fileparent = this.fileparent; |
---|
| 189 | +// if (this.bRep != null) |
---|
| 190 | +// o.bRep = this.bRep.support; |
---|
| 191 | + |
---|
| 192 | + hashtable.put(GetUUID(), o); |
---|
| 193 | + |
---|
| 194 | + this.bRep = null; |
---|
| 195 | +// if (this.bRep != null) |
---|
| 196 | +// this.bRep.support = null; |
---|
| 197 | +// this.support = null; |
---|
| 198 | +// this.fileparent = null; |
---|
| 199 | + |
---|
| 200 | + for (int i=0; i<Size(); i++) |
---|
| 201 | + { |
---|
| 202 | + get(i).ExtractBigData(hashtable); |
---|
| 203 | + } |
---|
| 204 | +} |
---|
| 205 | + |
---|
| 206 | +void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 207 | +{ |
---|
| 208 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 209 | + return; |
---|
| 210 | + |
---|
| 211 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 212 | + |
---|
| 213 | + this.bRep = o.bRep; |
---|
| 214 | + if (this.bRep != null) |
---|
| 215 | + this.bRep.support = o.transientrep; |
---|
| 216 | +// this.support = o.support; |
---|
| 217 | +// this.fileparent = o.fileparent; |
---|
| 218 | + |
---|
| 219 | + hashtable.remove(GetUUID()); |
---|
| 220 | + |
---|
| 221 | + for (int i=0; i<Size(); i++) |
---|
| 222 | + { |
---|
| 223 | + get(i).RestoreBigData(hashtable); |
---|
158 | 224 | } |
---|
159 | 225 | } |
---|
160 | 226 | |
---|
.. | .. |
---|
299 | 365 | } |
---|
300 | 366 | |
---|
301 | 367 | boolean live = false; |
---|
| 368 | + boolean dontselect = false; |
---|
302 | 369 | boolean hide = false; |
---|
303 | 370 | boolean link2master = false; // performs reset support/master at each frame |
---|
304 | 371 | boolean marked = false; // animation node |
---|
.. | .. |
---|
773 | 840 | if (step == 0) |
---|
774 | 841 | step = 1; |
---|
775 | 842 | if (maxcount == 0) |
---|
776 | | - maxcount = 2048; // 4; |
---|
| 843 | + maxcount = 128; // 2048; // 4; |
---|
777 | 844 | // if (acceleration == 0) |
---|
778 | 845 | // acceleration = 10; |
---|
779 | 846 | if (delay == 0) // serial |
---|
.. | .. |
---|
796 | 863 | |
---|
797 | 864 | if (marked && Globals.isLIVE() && live && |
---|
798 | 865 | //TEMP21aug2018 |
---|
799 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 866 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
800 | 867 | currentframe != Globals.framecount) |
---|
801 | 868 | { |
---|
802 | 869 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
911 | 978 | fromParent = null; // LA.newMatrix(); |
---|
912 | 979 | bRep = null; // new BoundaryRep(); |
---|
913 | 980 | |
---|
| 981 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 982 | + { |
---|
| 983 | + name = oname; |
---|
| 984 | + } |
---|
| 985 | + |
---|
914 | 986 | /* |
---|
915 | 987 | float hue = (float)Math.random(); |
---|
916 | 988 | Color col; |
---|
.. | .. |
---|
953 | 1025 | |
---|
954 | 1026 | public Object clone() |
---|
955 | 1027 | { |
---|
956 | | - return GrafreeD.clone(this); |
---|
| 1028 | + return Grafreed.clone(this); |
---|
957 | 1029 | } |
---|
958 | 1030 | |
---|
959 | 1031 | Object3D copyExpand() |
---|
.. | .. |
---|
1469 | 1541 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1470 | 1542 | |
---|
1471 | 1543 | // Set default to 0.1 |
---|
1472 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1544 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1473 | 1545 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1474 | 1546 | } |
---|
1475 | 1547 | |
---|
.. | .. |
---|
1728 | 1800 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1729 | 1801 | o.bRep = transientrep; |
---|
1730 | 1802 | if (clone) |
---|
1731 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1803 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1732 | 1804 | o.CreateMaterial(); |
---|
1733 | 1805 | o.SetAttributes(this, -1); |
---|
1734 | 1806 | //parent |
---|
.. | .. |
---|
1741 | 1813 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1742 | 1814 | o.bRep = bRep; |
---|
1743 | 1815 | if (clone) |
---|
1744 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1816 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1745 | 1817 | o.CreateMaterial(); |
---|
1746 | 1818 | //o.overwriteThis(this, -1); |
---|
1747 | 1819 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1828 | 1900 | if (obj.name == null) |
---|
1829 | 1901 | continue; // can't be a null one |
---|
1830 | 1902 | |
---|
| 1903 | + // Try perfect match first. |
---|
1831 | 1904 | if (n.equals(obj.name)) |
---|
1832 | 1905 | { |
---|
1833 | 1906 | theobj = obj; |
---|
1834 | 1907 | count++; |
---|
1835 | 1908 | } |
---|
1836 | 1909 | } |
---|
| 1910 | + |
---|
| 1911 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1837 | 1912 | |
---|
1838 | 1913 | if (count != 1) |
---|
1839 | 1914 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2299 | 2374 | { |
---|
2300 | 2375 | if (newWindow) |
---|
2301 | 2376 | { |
---|
| 2377 | + new Exception().printStackTrace(); |
---|
2302 | 2378 | System.exit(0); |
---|
2303 | 2379 | if (parent != null) |
---|
2304 | 2380 | { |
---|
.. | .. |
---|
2475 | 2551 | return retval; |
---|
2476 | 2552 | } |
---|
2477 | 2553 | |
---|
2478 | | - void doEditDrag(ClickInfo info) |
---|
| 2554 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2479 | 2555 | { |
---|
2480 | 2556 | switch (doSomething) |
---|
2481 | 2557 | { |
---|
2482 | 2558 | case 1: // '\001' |
---|
2483 | 2559 | //super. |
---|
2484 | | - doEditDrag0(info); |
---|
| 2560 | + doEditDrag0(info, opposite); |
---|
2485 | 2561 | break; |
---|
2486 | 2562 | |
---|
2487 | 2563 | case 2: // '\002' |
---|
.. | .. |
---|
2494 | 2570 | { |
---|
2495 | 2571 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2496 | 2572 | //childToDrag.doEditDrag(info); |
---|
2497 | | - sel.doEditDrag(info); |
---|
| 2573 | + sel.doEditDrag(info, opposite); |
---|
2498 | 2574 | } else |
---|
2499 | 2575 | { |
---|
2500 | 2576 | //super. |
---|
2501 | | - doEditDrag0(info); |
---|
| 2577 | + doEditDrag0(info, opposite); |
---|
2502 | 2578 | } |
---|
2503 | 2579 | } |
---|
2504 | 2580 | break; |
---|
.. | .. |
---|
2905 | 2981 | { |
---|
2906 | 2982 | if (bRep != null) |
---|
2907 | 2983 | { |
---|
2908 | | - bRep.GenUV(); |
---|
| 2984 | + bRep.GenUV(); //1); |
---|
| 2985 | + //bRep.UnfoldUV(); |
---|
2909 | 2986 | Touch(); |
---|
2910 | 2987 | } |
---|
2911 | 2988 | } |
---|
.. | .. |
---|
2980 | 3057 | blockloop = false; |
---|
2981 | 3058 | } |
---|
2982 | 3059 | |
---|
| 3060 | + void TransformChildren() |
---|
| 3061 | + { |
---|
| 3062 | + if (toParent != null) |
---|
| 3063 | + { |
---|
| 3064 | + for (int i=Size(); --i>=0;) |
---|
| 3065 | + { |
---|
| 3066 | + Object3D v = get(i); |
---|
| 3067 | + |
---|
| 3068 | + if (v.toParent == null) |
---|
| 3069 | + { |
---|
| 3070 | + v.toParent = LA.newMatrix(); |
---|
| 3071 | + v.fromParent = LA.newMatrix(); |
---|
| 3072 | + } |
---|
| 3073 | + |
---|
| 3074 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3075 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3076 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3077 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3078 | + } |
---|
| 3079 | + |
---|
| 3080 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3081 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3082 | + |
---|
| 3083 | + Touch(); |
---|
| 3084 | + } |
---|
| 3085 | + } |
---|
| 3086 | + |
---|
2983 | 3087 | void TransformGeometry() |
---|
2984 | 3088 | { |
---|
2985 | 3089 | Object3D obj = this; |
---|
.. | .. |
---|
3201 | 3305 | |
---|
3202 | 3306 | BoundaryRep sup = bRep.support; |
---|
3203 | 3307 | bRep.support = null; |
---|
3204 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3308 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3205 | 3309 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3206 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3310 | + |
---|
| 3311 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3312 | + |
---|
3207 | 3313 | bRep = temprep; |
---|
3208 | 3314 | bRep.support = sup; |
---|
3209 | 3315 | Touch(); |
---|
.. | .. |
---|
3725 | 3831 | if (child == null) |
---|
3726 | 3832 | continue; |
---|
3727 | 3833 | |
---|
3728 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3834 | + if (Grafreed.RENDERME > 0) |
---|
3729 | 3835 | { |
---|
3730 | 3836 | if (child instanceof Merge) |
---|
3731 | 3837 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3876 | 3982 | if (child == null) |
---|
3877 | 3983 | continue; |
---|
3878 | 3984 | |
---|
3879 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3985 | + if (Grafreed.RENDERME > 0) |
---|
3880 | 3986 | { |
---|
3881 | 3987 | if (child instanceof Merge) |
---|
3882 | 3988 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4071 | 4177 | if (child == null) |
---|
4072 | 4178 | continue; |
---|
4073 | 4179 | |
---|
4074 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4180 | + if (Grafreed.RENDERME > 0) |
---|
4075 | 4181 | { |
---|
4076 | 4182 | if (child instanceof Merge) |
---|
4077 | 4183 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4678 | 4784 | |
---|
4679 | 4785 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4680 | 4786 | { |
---|
4681 | | - if (hide) |
---|
| 4787 | + if (hide || dontselect) |
---|
4682 | 4788 | return null; |
---|
4683 | 4789 | |
---|
4684 | 4790 | if (count <= 0) |
---|
.. | .. |
---|
4704 | 4810 | |
---|
4705 | 4811 | cTreePath Select(int indexcount, boolean deselect) |
---|
4706 | 4812 | { |
---|
4707 | | - if (hide) |
---|
| 4813 | + if (hide || dontselect) |
---|
4708 | 4814 | return null; |
---|
4709 | 4815 | |
---|
4710 | 4816 | if (count <= 0) |
---|
.. | .. |
---|
5156 | 5262 | |
---|
5157 | 5263 | // System.out.println("Fullname = " + fullname); |
---|
5158 | 5264 | |
---|
5159 | | - if (fullname.name.indexOf(":") == -1) |
---|
5160 | | - return fullname.name; |
---|
| 5265 | + // Does not work on Windows due to C: |
---|
| 5266 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5267 | +// return fullname.name; |
---|
| 5268 | +// |
---|
| 5269 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5161 | 5270 | |
---|
5162 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5271 | + String[] split = fullname.name.split(":"); |
---|
| 5272 | + |
---|
| 5273 | + if (split.length == 0) |
---|
| 5274 | + { |
---|
| 5275 | + return ""; |
---|
| 5276 | + } |
---|
| 5277 | + |
---|
| 5278 | + if (split.length <= 2) |
---|
| 5279 | + { |
---|
| 5280 | + if (fullname.name.endsWith(":")) |
---|
| 5281 | + { |
---|
| 5282 | + // Windows |
---|
| 5283 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5284 | + } |
---|
| 5285 | + |
---|
| 5286 | + return split[0]; |
---|
| 5287 | + } |
---|
| 5288 | + |
---|
| 5289 | + // Windows |
---|
| 5290 | + assert(split.length == 4); |
---|
| 5291 | + |
---|
| 5292 | + return split[0] + ":" + split[1]; |
---|
5163 | 5293 | } |
---|
5164 | 5294 | |
---|
5165 | 5295 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5168 | 5298 | return ""; |
---|
5169 | 5299 | |
---|
5170 | 5300 | // 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()); |
---|
| 5301 | + // Does not work on Windows due to C: |
---|
| 5302 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5303 | +// return ""; |
---|
| 5304 | +// |
---|
| 5305 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5306 | + String[] split = fullname.name.split(":"); |
---|
| 5307 | + |
---|
| 5308 | + if (split.length == 0) |
---|
| 5309 | + { |
---|
| 5310 | + return ""; |
---|
| 5311 | + } |
---|
| 5312 | + |
---|
| 5313 | + if (split.length == 1) |
---|
| 5314 | + { |
---|
| 5315 | + return ""; |
---|
| 5316 | + } |
---|
| 5317 | + |
---|
| 5318 | + if (split.length == 2) |
---|
| 5319 | + { |
---|
| 5320 | + if (fullname.name.endsWith(":")) |
---|
| 5321 | + { |
---|
| 5322 | + // Windows |
---|
| 5323 | + return ""; |
---|
| 5324 | + } |
---|
| 5325 | + |
---|
| 5326 | + return split[1]; |
---|
| 5327 | + } |
---|
| 5328 | + |
---|
| 5329 | + // Windows |
---|
| 5330 | + assert(split.length == 4); |
---|
| 5331 | + |
---|
| 5332 | + return split[2] + ":" + split[3]; |
---|
5175 | 5333 | } |
---|
5176 | 5334 | |
---|
5177 | 5335 | String GetPigmentTexture() |
---|
.. | .. |
---|
5245 | 5403 | System.out.print("; textures = " + textures); |
---|
5246 | 5404 | System.out.println("; usedtextures = " + usedtextures); |
---|
5247 | 5405 | |
---|
5248 | | - if (GetTextures() == null) |
---|
| 5406 | + if (GetTextures() == null) // What is that?? |
---|
5249 | 5407 | GetTextures().name = ":"; |
---|
5250 | 5408 | |
---|
5251 | 5409 | String texname = tex; |
---|
.. | .. |
---|
5276 | 5434 | child.ResetPigmentTexture(); |
---|
5277 | 5435 | blockloop = false; |
---|
5278 | 5436 | } |
---|
| 5437 | + } |
---|
| 5438 | + |
---|
| 5439 | + UUID GetUUID() |
---|
| 5440 | + { |
---|
| 5441 | + if (uuid == null) |
---|
| 5442 | + { |
---|
| 5443 | + // Serial |
---|
| 5444 | + uuid = UUID.randomUUID(); |
---|
| 5445 | + } |
---|
| 5446 | + |
---|
| 5447 | + return uuid; |
---|
| 5448 | + } |
---|
| 5449 | + |
---|
| 5450 | + Object3D GetObject(UUID uid) |
---|
| 5451 | + { |
---|
| 5452 | + if (blockloop) |
---|
| 5453 | + return null; |
---|
| 5454 | + |
---|
| 5455 | + if (GetUUID().equals(uid)) |
---|
| 5456 | + return this; |
---|
| 5457 | + |
---|
| 5458 | + int nb = Size(); |
---|
| 5459 | + for (int i = 0; i < nb; i++) |
---|
| 5460 | + { |
---|
| 5461 | + Object3D child = (Object3D) get(i); |
---|
| 5462 | + |
---|
| 5463 | + if (child == null) |
---|
| 5464 | + continue; |
---|
| 5465 | + |
---|
| 5466 | + blockloop = true; |
---|
| 5467 | + Object3D obj = child.GetObject(uid); |
---|
| 5468 | + blockloop = false; |
---|
| 5469 | + if (obj != null) |
---|
| 5470 | + return obj; |
---|
| 5471 | + } |
---|
| 5472 | + |
---|
| 5473 | + return null; |
---|
5279 | 5474 | } |
---|
5280 | 5475 | |
---|
5281 | 5476 | void SetBumpTexture(String tex) |
---|
.. | .. |
---|
5322 | 5517 | boolean NeedSupport() |
---|
5323 | 5518 | { |
---|
5324 | 5519 | return |
---|
5325 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5520 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
5326 | 5521 | // PROBLEM with CROWD!! |
---|
5327 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5522 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5328 | 5523 | } |
---|
5329 | 5524 | |
---|
5330 | 5525 | static boolean DEBUG_SELECTION = false; |
---|
.. | .. |
---|
5339 | 5534 | } |
---|
5340 | 5535 | |
---|
5341 | 5536 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5342 | | - hide) |
---|
| 5537 | + (hide || dontselect)) |
---|
5343 | 5538 | return; |
---|
5344 | 5539 | |
---|
5345 | 5540 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5371 | 5566 | return; |
---|
5372 | 5567 | } |
---|
5373 | 5568 | |
---|
5374 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5569 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5375 | 5570 | |
---|
5376 | 5571 | /* |
---|
5377 | 5572 | if (touched) |
---|
.. | .. |
---|
5423 | 5618 | //if (displaylist == -1 && usecalllists) |
---|
5424 | 5619 | if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
5425 | 5620 | { |
---|
5426 | | - bRep.displaylist = gl.glGenLists(1); |
---|
| 5621 | + bRep.displaylist = display.GenList(); |
---|
5427 | 5622 | assert(bRep.displaylist != 0); |
---|
5428 | 5623 | // System.err.println("glGenLists: " + bRep.displaylist + " for " + this); |
---|
5429 | 5624 | //System.out.println("\tgen list " + list); |
---|
.. | .. |
---|
5435 | 5630 | if (usecalllists) |
---|
5436 | 5631 | { |
---|
5437 | 5632 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5438 | | - gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE); |
---|
| 5633 | + display.NewList(bRep.displaylist); |
---|
5439 | 5634 | } |
---|
| 5635 | + |
---|
5440 | 5636 | CallList(display, root, selected, blocked); |
---|
| 5637 | + |
---|
5441 | 5638 | // compiled = true; |
---|
5442 | 5639 | if (usecalllists) |
---|
5443 | 5640 | { |
---|
5444 | 5641 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5445 | | - gl.glEndList(); |
---|
| 5642 | + display.EndList(); |
---|
5446 | 5643 | } |
---|
5447 | 5644 | //gl.glDrawBuffer(gl.GL_BACK); |
---|
5448 | 5645 | // XXX touched = false; |
---|
.. | .. |
---|
5490 | 5687 | if (display.DrawMode() == iCameraPane.SHADOW) |
---|
5491 | 5688 | { |
---|
5492 | 5689 | if (!link2master // tricky to cull in shadow mode. |
---|
5493 | | - && GetBRep().FrustumCull(this, gl, display.LightCamera(), true)) |
---|
| 5690 | + && GetBRep().FrustumCull(this, null, display.LightCamera(), true)) |
---|
5494 | 5691 | { |
---|
5495 | 5692 | //System.out.print("CULLED"); |
---|
5496 | 5693 | culled = true; |
---|
.. | .. |
---|
5498 | 5695 | } |
---|
5499 | 5696 | else |
---|
5500 | 5697 | //GetBRep().getBounds(v0, v1, this); |
---|
5501 | | - if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false)) |
---|
| 5698 | + if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false)) |
---|
5502 | 5699 | culled = true; |
---|
5503 | 5700 | |
---|
5504 | 5701 | // LA.xformPos(v0, display.renderCamera.toScreen, v0); |
---|
.. | .. |
---|
5538 | 5735 | { |
---|
5539 | 5736 | if (GetBRep() != null) |
---|
5540 | 5737 | { |
---|
5541 | | - CameraPane.NextIndex(this, gl); |
---|
| 5738 | + display.NextIndex(); |
---|
5542 | 5739 | // vertex color conflict : gl.glCallList(list); |
---|
5543 | 5740 | DrawNode(display, root, selected); |
---|
5544 | 5741 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5579 | 5776 | tex = GetTextures(); |
---|
5580 | 5777 | } |
---|
5581 | 5778 | |
---|
5582 | | - display.BindTextures(tex, texres); |
---|
| 5779 | + boolean failed = false; |
---|
| 5780 | + |
---|
| 5781 | + try |
---|
| 5782 | + { |
---|
| 5783 | + display.BindTextures(tex, texres); |
---|
| 5784 | + } |
---|
| 5785 | + catch (Exception e) |
---|
| 5786 | + { |
---|
| 5787 | + System.err.println("FAILED: " + this); |
---|
| 5788 | + failed = true; |
---|
| 5789 | + } |
---|
5583 | 5790 | |
---|
5584 | 5791 | if (!compiled) |
---|
5585 | 5792 | { |
---|
.. | .. |
---|
5595 | 5802 | |
---|
5596 | 5803 | // System.err.println("glCallList: " + bRep.displaylist + " for " + this); |
---|
5597 | 5804 | assert(bRep.displaylist != 0); |
---|
5598 | | - gl.glCallList(bRep.displaylist); |
---|
| 5805 | + display.CallList(bRep.displaylist); |
---|
5599 | 5806 | // june 2013 drawSelf(display, root, selected); |
---|
5600 | 5807 | } |
---|
5601 | 5808 | } |
---|
5602 | 5809 | } |
---|
5603 | 5810 | |
---|
5604 | | - display.ReleaseTextures(tex); |
---|
| 5811 | + if (!failed) |
---|
| 5812 | + display.ReleaseTextures(tex); |
---|
5605 | 5813 | |
---|
5606 | 5814 | display.PopMaterial(this, selected); |
---|
5607 | 5815 | } |
---|
.. | .. |
---|
5730 | 5938 | |
---|
5731 | 5939 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5732 | 5940 | { |
---|
| 5941 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 5942 | + return; |
---|
| 5943 | + |
---|
5733 | 5944 | if (hide) |
---|
5734 | 5945 | return; |
---|
5735 | 5946 | // shadow optimisation |
---|
.. | .. |
---|
5855 | 6066 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5856 | 6067 | return; // no shadow for transparent objects |
---|
5857 | 6068 | |
---|
| 6069 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6070 | + return; |
---|
| 6071 | + |
---|
5858 | 6072 | if (hide) |
---|
5859 | 6073 | return; |
---|
5860 | 6074 | |
---|
.. | .. |
---|
5895 | 6109 | return; |
---|
5896 | 6110 | } |
---|
5897 | 6111 | |
---|
| 6112 | + //bRep.GenUV(1/material.diffuseness); |
---|
5898 | 6113 | // bRep.lock = true; |
---|
5899 | 6114 | |
---|
5900 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 6115 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5901 | 6116 | |
---|
5902 | 6117 | if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
5903 | 6118 | { |
---|
.. | .. |
---|
5914 | 6129 | |
---|
5915 | 6130 | bRep.getMinMax(min, max, 100); |
---|
5916 | 6131 | |
---|
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(); |
---|
| 6132 | + display.DrawBox(min, max); |
---|
5934 | 6133 | |
---|
5935 | 6134 | return; |
---|
5936 | 6135 | } |
---|
.. | .. |
---|
5984 | 6183 | new Exception().printStackTrace(); |
---|
5985 | 6184 | return; |
---|
5986 | 6185 | } |
---|
5987 | | - |
---|
5988 | | - // TRIANGLE STRIP ARRAY |
---|
5989 | | - if (bRep.trimmed) |
---|
5990 | | - { |
---|
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; |
---|
6122 | | - } |
---|
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 | | - } |
---|
| 6186 | + |
---|
| 6187 | + display.DrawGeometry(bRep, flipV, selectmode); |
---|
6153 | 6188 | } else // catch (Error e) |
---|
6154 | 6189 | { |
---|
6155 | 6190 | // TRIANGLE ARRAY |
---|
6156 | 6191 | if (IsOpaque()) // Static()) |
---|
6157 | 6192 | { |
---|
6158 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6193 | + display.StartTriangles(); |
---|
6159 | 6194 | int facecount = bRep.FaceCount(); |
---|
6160 | 6195 | for (int i = 0; i < facecount; i++) |
---|
6161 | 6196 | { |
---|
.. | .. |
---|
6220 | 6255 | |
---|
6221 | 6256 | display.DrawFace(this, p, q, r, face); |
---|
6222 | 6257 | } |
---|
6223 | | - gl.glEnd(); |
---|
| 6258 | + display.EndTriangles(); |
---|
6224 | 6259 | } |
---|
6225 | 6260 | else |
---|
6226 | 6261 | { |
---|
.. | .. |
---|
6249 | 6284 | //System.out.println("SORT"); |
---|
6250 | 6285 | |
---|
6251 | 6286 | java.util.Arrays.sort(facescompare); |
---|
6252 | | - |
---|
6253 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6287 | + |
---|
| 6288 | + display.StartTriangles(); |
---|
6254 | 6289 | for (int i = 0; i < facecount; i++) |
---|
6255 | 6290 | { |
---|
6256 | 6291 | Face face = bRep.GetFace(facescompare[i].index); |
---|
.. | .. |
---|
6264 | 6299 | |
---|
6265 | 6300 | display.DrawFace(this, p, q, r, face); |
---|
6266 | 6301 | } |
---|
6267 | | - gl.glEnd(); |
---|
| 6302 | + display.EndTriangles(); |
---|
6268 | 6303 | } |
---|
6269 | 6304 | |
---|
6270 | 6305 | if (false) // live && support != null && support.bRep != null) // debug weights |
---|
6271 | 6306 | { |
---|
| 6307 | + /* |
---|
6272 | 6308 | gl.glDisable(gl.GL_LIGHTING); |
---|
6273 | 6309 | float[] colorV = new float[3]; |
---|
6274 | 6310 | |
---|
.. | .. |
---|
6347 | 6383 | // gl.glEnd(); |
---|
6348 | 6384 | } |
---|
6349 | 6385 | } |
---|
| 6386 | + */ |
---|
6350 | 6387 | } |
---|
6351 | 6388 | } |
---|
6352 | 6389 | |
---|
.. | .. |
---|
6405 | 6442 | void Print(Vertex v) |
---|
6406 | 6443 | { |
---|
6407 | 6444 | //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 | 6445 | } |
---|
6425 | 6446 | |
---|
6426 | 6447 | void drawSelf(ClickInfo info, int level, boolean select) |
---|
.. | .. |
---|
7031 | 7052 | // { |
---|
7032 | 7053 | // CameraPane.Ymax = spoth; |
---|
7033 | 7054 | // } |
---|
7034 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
7035 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7055 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
| 7056 | + //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
7036 | 7057 | spot.translate(0, -32); |
---|
7037 | 7058 | info.g.setColor(Color.green); |
---|
7038 | 7059 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
.. | .. |
---|
7087 | 7108 | startX = info.x; |
---|
7088 | 7109 | startY = info.y; |
---|
7089 | 7110 | |
---|
7090 | | - hitSomething = 0; |
---|
| 7111 | + hitSomething = -1; |
---|
7091 | 7112 | cVector origin = new cVector(); |
---|
7092 | 7113 | //LA.xformPos(origin, toParent, origin); |
---|
7093 | 7114 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
7120 | 7141 | } |
---|
7121 | 7142 | |
---|
7122 | 7143 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7123 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7144 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7124 | 7145 | //System.out.println("modified = " + modified); |
---|
7125 | 7146 | //new Exception().printStackTrace(); |
---|
7126 | 7147 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7148 | 7169 | return true; |
---|
7149 | 7170 | } |
---|
7150 | 7171 | |
---|
7151 | | - void doEditDrag0(ClickInfo info) |
---|
| 7172 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
7152 | 7173 | { |
---|
7153 | 7174 | if (hitSomething == 0) |
---|
7154 | 7175 | { |
---|
.. | .. |
---|
7163 | 7184 | //System.out.println("hitSomething = " + hitSomething); |
---|
7164 | 7185 | |
---|
7165 | 7186 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7187 | + |
---|
7166 | 7188 | cVector xlate = new cVector(); |
---|
7167 | 7189 | //cVector xlate2 = new cVector(); |
---|
7168 | 7190 | switch (hitSomething) |
---|
.. | .. |
---|
7175 | 7197 | |
---|
7176 | 7198 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7177 | 7199 | |
---|
7178 | | - if (modified) |
---|
| 7200 | + if (modified || opposite) |
---|
7179 | 7201 | { |
---|
7180 | 7202 | //assert(false); |
---|
7181 | 7203 | /* |
---|
.. | .. |
---|
7269 | 7291 | |
---|
7270 | 7292 | if (modified) |
---|
7271 | 7293 | { |
---|
| 7294 | + // Rotate 90 degrees |
---|
7272 | 7295 | angle /= (Math.PI / 4); |
---|
7273 | 7296 | angle = Math.floor(angle + 0.5); |
---|
7274 | 7297 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7310 | 7333 | |
---|
7311 | 7334 | case hitScale: // scale |
---|
7312 | 7335 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7336 | + double sign = 1; |
---|
| 7337 | + if (hScale < 0) |
---|
| 7338 | + { |
---|
| 7339 | + sign = -1; |
---|
| 7340 | + } |
---|
| 7341 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7313 | 7342 | if (hScale < 0.01) |
---|
7314 | 7343 | { |
---|
7315 | | - hScale = 0.01; |
---|
| 7344 | + //hScale = 0.01; |
---|
7316 | 7345 | } |
---|
7317 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7318 | | - if (hScale < 0.01) |
---|
7319 | | - { |
---|
7320 | | - hScale = 0.01; |
---|
7321 | | - } |
---|
| 7346 | + |
---|
7322 | 7347 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7323 | | - if (vScale < 0.01) |
---|
| 7348 | + sign = 1; |
---|
| 7349 | + if (vScale < 0) |
---|
7324 | 7350 | { |
---|
7325 | | - vScale = 0.01; |
---|
| 7351 | + sign = -1; |
---|
7326 | 7352 | } |
---|
7327 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7353 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7328 | 7354 | if (vScale < 0.01) |
---|
7329 | 7355 | { |
---|
7330 | | - vScale = 0.01; |
---|
| 7356 | + //vScale = 0.01; |
---|
7331 | 7357 | } |
---|
7332 | 7358 | LA.matCopy(startMat, toParent); |
---|
7333 | 7359 | /**/ |
---|
.. | .. |
---|
7338 | 7364 | } |
---|
7339 | 7365 | /**/ |
---|
7340 | 7366 | |
---|
| 7367 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7368 | + |
---|
| 7369 | + if (totalScale < 0.01) |
---|
| 7370 | + { |
---|
| 7371 | + totalScale = 0.01; |
---|
| 7372 | + } |
---|
| 7373 | + |
---|
7341 | 7374 | switch (info.pane.RenderCamera().viewCode) |
---|
7342 | 7375 | { |
---|
7343 | 7376 | case 3: // '\001' |
---|
7344 | 7377 | if (modified) |
---|
7345 | 7378 | { |
---|
7346 | 7379 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7347 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7380 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7348 | 7381 | } // vScale, 1); |
---|
7349 | 7382 | else |
---|
7350 | 7383 | { |
---|
7351 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7384 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7352 | 7385 | } // vScale, 1); |
---|
7353 | 7386 | break; |
---|
7354 | 7387 | |
---|
.. | .. |
---|
7356 | 7389 | if (modified) |
---|
7357 | 7390 | { |
---|
7358 | 7391 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7359 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7392 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7360 | 7393 | } else |
---|
7361 | 7394 | { |
---|
7362 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7395 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7363 | 7396 | } |
---|
7364 | 7397 | break; |
---|
7365 | 7398 | |
---|
.. | .. |
---|
7367 | 7400 | if (modified) |
---|
7368 | 7401 | { |
---|
7369 | 7402 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7370 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7403 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7371 | 7404 | } else |
---|
7372 | 7405 | { |
---|
7373 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7406 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7374 | 7407 | } |
---|
7375 | 7408 | break; |
---|
7376 | 7409 | } |
---|
.. | .. |
---|
7503 | 7536 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7504 | 7537 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7505 | 7538 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7539 | + |
---|
| 7540 | + String objname; |
---|
| 7541 | + |
---|
7506 | 7542 | if (false) //parent != null) |
---|
7507 | 7543 | { |
---|
7508 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7544 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7509 | 7545 | } else |
---|
7510 | 7546 | { |
---|
7511 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7547 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7512 | 7548 | } // + super.toString(); |
---|
7513 | 7549 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7550 | + |
---|
| 7551 | + if (!Globals.ADVANCED) |
---|
| 7552 | + return objname; |
---|
| 7553 | + |
---|
| 7554 | + return objname + " " + System.identityHashCode(this); |
---|
7514 | 7555 | } |
---|
7515 | 7556 | |
---|
7516 | 7557 | public int hashCode() |
---|
.. | .. |
---|
7566 | 7607 | objectUI.closeUI(); |
---|
7567 | 7608 | if (editWindow != null) |
---|
7568 | 7609 | { |
---|
| 7610 | + editWindow.ctrlPanel.FlushUI(); |
---|
7569 | 7611 | editWindow.refreshContents(); |
---|
7570 | 7612 | } // ? new |
---|
7571 | 7613 | objectUI = null; |
---|
.. | .. |
---|
7586 | 7628 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7587 | 7629 | |
---|
7588 | 7630 | Object3D /*Composite*/ parent; |
---|
7589 | | - Object3D /*Composite*/ fileparent; |
---|
| 7631 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7590 | 7632 | |
---|
7591 | 7633 | double[][] toParent; // dynamic matrix |
---|
7592 | 7634 | double[][] fromParent; |
---|
.. | .. |
---|
7701 | 7743 | { |
---|
7702 | 7744 | assert(bRep != null); |
---|
7703 | 7745 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7704 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 7746 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7705 | 7747 | } |
---|
7706 | 7748 | else |
---|
7707 | 7749 | { |
---|
.. | .. |
---|
7750 | 7792 | private static cVector edge2 = new cVector(); |
---|
7751 | 7793 | //private static cVector norm = new cVector(); |
---|
7752 | 7794 | /*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; |
---|
| 7795 | + static final int hitCenter = 1; |
---|
| 7796 | + static final int hitScale = 2; |
---|
| 7797 | + static final int hitRotate = 3; |
---|
7756 | 7798 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7757 | 7799 | /*transient*/ private Point centerPt; |
---|
7758 | 7800 | /*transient*/ private int startX; |
---|