.. | .. |
---|
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 | + return; |
---|
| 170 | + |
---|
| 171 | + Object3D o = new Object3D(); |
---|
| 172 | + o.bRep = this.bRep; |
---|
| 173 | + if (this.bRep != null) |
---|
| 174 | + { |
---|
| 175 | + o.transientrep = this.bRep.support; |
---|
| 176 | + o.bRep.support = null; |
---|
| 177 | + } |
---|
| 178 | + |
---|
| 179 | +// o.support = this.support; |
---|
| 180 | +// o.fileparent = this.fileparent; |
---|
| 181 | +// if (this.bRep != null) |
---|
| 182 | +// o.bRep = this.bRep.support; |
---|
| 183 | + |
---|
| 184 | + hashtable.put(GetUUID(), o); |
---|
| 185 | + |
---|
| 186 | + this.bRep = null; |
---|
| 187 | +// if (this.bRep != null) |
---|
| 188 | +// this.bRep.support = null; |
---|
| 189 | +// this.support = null; |
---|
| 190 | +// this.fileparent = null; |
---|
| 191 | + |
---|
| 192 | + for (int i=0; i<Size(); i++) |
---|
| 193 | + { |
---|
| 194 | + get(i).ExtractBigData(hashtable); |
---|
| 195 | + } |
---|
| 196 | +} |
---|
| 197 | + |
---|
| 198 | +void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 199 | +{ |
---|
| 200 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 201 | + return; |
---|
| 202 | + |
---|
| 203 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 204 | + |
---|
| 205 | + this.bRep = o.bRep; |
---|
| 206 | + if (this.bRep != null) |
---|
| 207 | + this.bRep.support = o.transientrep; |
---|
| 208 | +// this.support = o.support; |
---|
| 209 | +// this.fileparent = o.fileparent; |
---|
| 210 | + |
---|
| 211 | + hashtable.remove(GetUUID()); |
---|
| 212 | + |
---|
| 213 | + for (int i=0; i<Size(); i++) |
---|
| 214 | + { |
---|
| 215 | + get(i).RestoreBigData(hashtable); |
---|
158 | 216 | } |
---|
159 | 217 | } |
---|
160 | 218 | |
---|
.. | .. |
---|
299 | 357 | } |
---|
300 | 358 | |
---|
301 | 359 | boolean live = false; |
---|
| 360 | + boolean dontselect = false; |
---|
302 | 361 | boolean hide = false; |
---|
303 | 362 | boolean link2master = false; // performs reset support/master at each frame |
---|
304 | 363 | boolean marked = false; // animation node |
---|
.. | .. |
---|
773 | 832 | if (step == 0) |
---|
774 | 833 | step = 1; |
---|
775 | 834 | if (maxcount == 0) |
---|
776 | | - maxcount = 2048; // 4; |
---|
| 835 | + maxcount = 128; // 2048; // 4; |
---|
777 | 836 | // if (acceleration == 0) |
---|
778 | 837 | // acceleration = 10; |
---|
779 | 838 | if (delay == 0) // serial |
---|
.. | .. |
---|
796 | 855 | |
---|
797 | 856 | if (marked && Globals.isLIVE() && live && |
---|
798 | 857 | //TEMP21aug2018 |
---|
799 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 858 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
800 | 859 | currentframe != Globals.framecount) |
---|
801 | 860 | { |
---|
802 | 861 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
911 | 970 | fromParent = null; // LA.newMatrix(); |
---|
912 | 971 | bRep = null; // new BoundaryRep(); |
---|
913 | 972 | |
---|
| 973 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 974 | + { |
---|
| 975 | + name = oname; |
---|
| 976 | + } |
---|
| 977 | + |
---|
914 | 978 | /* |
---|
915 | 979 | float hue = (float)Math.random(); |
---|
916 | 980 | Color col; |
---|
.. | .. |
---|
953 | 1017 | |
---|
954 | 1018 | public Object clone() |
---|
955 | 1019 | { |
---|
956 | | - return GrafreeD.clone(this); |
---|
| 1020 | + return Grafreed.clone(this); |
---|
957 | 1021 | } |
---|
958 | 1022 | |
---|
959 | 1023 | Object3D copyExpand() |
---|
.. | .. |
---|
1469 | 1533 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1470 | 1534 | |
---|
1471 | 1535 | // Set default to 0.1 |
---|
1472 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1536 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1473 | 1537 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1474 | 1538 | } |
---|
1475 | 1539 | |
---|
.. | .. |
---|
1728 | 1792 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1729 | 1793 | o.bRep = transientrep; |
---|
1730 | 1794 | if (clone) |
---|
1731 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1795 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1732 | 1796 | o.CreateMaterial(); |
---|
1733 | 1797 | o.SetAttributes(this, -1); |
---|
1734 | 1798 | //parent |
---|
.. | .. |
---|
1741 | 1805 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1742 | 1806 | o.bRep = bRep; |
---|
1743 | 1807 | if (clone) |
---|
1744 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1808 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1745 | 1809 | o.CreateMaterial(); |
---|
1746 | 1810 | //o.overwriteThis(this, -1); |
---|
1747 | 1811 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1828 | 1892 | if (obj.name == null) |
---|
1829 | 1893 | continue; // can't be a null one |
---|
1830 | 1894 | |
---|
| 1895 | + // Try perfect match first. |
---|
1831 | 1896 | if (n.equals(obj.name)) |
---|
1832 | 1897 | { |
---|
1833 | 1898 | theobj = obj; |
---|
1834 | 1899 | count++; |
---|
1835 | 1900 | } |
---|
1836 | 1901 | } |
---|
| 1902 | + |
---|
| 1903 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1837 | 1904 | |
---|
1838 | 1905 | if (count != 1) |
---|
1839 | 1906 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2299 | 2366 | { |
---|
2300 | 2367 | if (newWindow) |
---|
2301 | 2368 | { |
---|
| 2369 | + new Exception().printStackTrace(); |
---|
2302 | 2370 | System.exit(0); |
---|
2303 | 2371 | if (parent != null) |
---|
2304 | 2372 | { |
---|
.. | .. |
---|
2475 | 2543 | return retval; |
---|
2476 | 2544 | } |
---|
2477 | 2545 | |
---|
2478 | | - void doEditDrag(ClickInfo info) |
---|
| 2546 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2479 | 2547 | { |
---|
2480 | 2548 | switch (doSomething) |
---|
2481 | 2549 | { |
---|
2482 | 2550 | case 1: // '\001' |
---|
2483 | 2551 | //super. |
---|
2484 | | - doEditDrag0(info); |
---|
| 2552 | + doEditDrag0(info, opposite); |
---|
2485 | 2553 | break; |
---|
2486 | 2554 | |
---|
2487 | 2555 | case 2: // '\002' |
---|
.. | .. |
---|
2494 | 2562 | { |
---|
2495 | 2563 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2496 | 2564 | //childToDrag.doEditDrag(info); |
---|
2497 | | - sel.doEditDrag(info); |
---|
| 2565 | + sel.doEditDrag(info, opposite); |
---|
2498 | 2566 | } else |
---|
2499 | 2567 | { |
---|
2500 | 2568 | //super. |
---|
2501 | | - doEditDrag0(info); |
---|
| 2569 | + doEditDrag0(info, opposite); |
---|
2502 | 2570 | } |
---|
2503 | 2571 | } |
---|
2504 | 2572 | break; |
---|
.. | .. |
---|
2905 | 2973 | { |
---|
2906 | 2974 | if (bRep != null) |
---|
2907 | 2975 | { |
---|
2908 | | - bRep.GenUV(); |
---|
| 2976 | + bRep.GenUV(); //1); |
---|
| 2977 | + //bRep.UnfoldUV(); |
---|
2909 | 2978 | Touch(); |
---|
2910 | 2979 | } |
---|
2911 | 2980 | } |
---|
.. | .. |
---|
2980 | 3049 | blockloop = false; |
---|
2981 | 3050 | } |
---|
2982 | 3051 | |
---|
| 3052 | + void TransformChildren() |
---|
| 3053 | + { |
---|
| 3054 | + if (toParent != null) |
---|
| 3055 | + { |
---|
| 3056 | + for (int i=Size(); --i>=0;) |
---|
| 3057 | + { |
---|
| 3058 | + Object3D v = get(i); |
---|
| 3059 | + |
---|
| 3060 | + if (v.toParent == null) |
---|
| 3061 | + { |
---|
| 3062 | + v.toParent = LA.newMatrix(); |
---|
| 3063 | + v.fromParent = LA.newMatrix(); |
---|
| 3064 | + } |
---|
| 3065 | + |
---|
| 3066 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3067 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3068 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3069 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3070 | + } |
---|
| 3071 | + |
---|
| 3072 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3073 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3074 | + |
---|
| 3075 | + Touch(); |
---|
| 3076 | + } |
---|
| 3077 | + } |
---|
| 3078 | + |
---|
2983 | 3079 | void TransformGeometry() |
---|
2984 | 3080 | { |
---|
2985 | 3081 | Object3D obj = this; |
---|
.. | .. |
---|
3201 | 3297 | |
---|
3202 | 3298 | BoundaryRep sup = bRep.support; |
---|
3203 | 3299 | bRep.support = null; |
---|
3204 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3300 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3205 | 3301 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3206 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3302 | + |
---|
| 3303 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3304 | + |
---|
3207 | 3305 | bRep = temprep; |
---|
3208 | 3306 | bRep.support = sup; |
---|
3209 | 3307 | Touch(); |
---|
.. | .. |
---|
3725 | 3823 | if (child == null) |
---|
3726 | 3824 | continue; |
---|
3727 | 3825 | |
---|
3728 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3826 | + if (Grafreed.RENDERME > 0) |
---|
3729 | 3827 | { |
---|
3730 | 3828 | if (child instanceof Merge) |
---|
3731 | 3829 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3876 | 3974 | if (child == null) |
---|
3877 | 3975 | continue; |
---|
3878 | 3976 | |
---|
3879 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3977 | + if (Grafreed.RENDERME > 0) |
---|
3880 | 3978 | { |
---|
3881 | 3979 | if (child instanceof Merge) |
---|
3882 | 3980 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4071 | 4169 | if (child == null) |
---|
4072 | 4170 | continue; |
---|
4073 | 4171 | |
---|
4074 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4172 | + if (Grafreed.RENDERME > 0) |
---|
4075 | 4173 | { |
---|
4076 | 4174 | if (child instanceof Merge) |
---|
4077 | 4175 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4678 | 4776 | |
---|
4679 | 4777 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4680 | 4778 | { |
---|
4681 | | - if (hide) |
---|
| 4779 | + if (hide || dontselect) |
---|
4682 | 4780 | return null; |
---|
4683 | 4781 | |
---|
4684 | 4782 | if (count <= 0) |
---|
.. | .. |
---|
4704 | 4802 | |
---|
4705 | 4803 | cTreePath Select(int indexcount, boolean deselect) |
---|
4706 | 4804 | { |
---|
4707 | | - if (hide) |
---|
| 4805 | + if (hide || dontselect) |
---|
4708 | 4806 | return null; |
---|
4709 | 4807 | |
---|
4710 | 4808 | if (count <= 0) |
---|
.. | .. |
---|
5156 | 5254 | |
---|
5157 | 5255 | // System.out.println("Fullname = " + fullname); |
---|
5158 | 5256 | |
---|
5159 | | - if (fullname.name.indexOf(":") == -1) |
---|
5160 | | - return fullname.name; |
---|
| 5257 | + // Does not work on Windows due to C: |
---|
| 5258 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5259 | +// return fullname.name; |
---|
| 5260 | +// |
---|
| 5261 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5161 | 5262 | |
---|
5162 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5263 | + String[] split = fullname.name.split(":"); |
---|
| 5264 | + |
---|
| 5265 | + if (split.length == 0) |
---|
| 5266 | + { |
---|
| 5267 | + return ""; |
---|
| 5268 | + } |
---|
| 5269 | + |
---|
| 5270 | + if (split.length <= 2) |
---|
| 5271 | + { |
---|
| 5272 | + if (fullname.name.endsWith(":")) |
---|
| 5273 | + { |
---|
| 5274 | + // Windows |
---|
| 5275 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5276 | + } |
---|
| 5277 | + |
---|
| 5278 | + return split[0]; |
---|
| 5279 | + } |
---|
| 5280 | + |
---|
| 5281 | + // Windows |
---|
| 5282 | + assert(split.length == 4); |
---|
| 5283 | + |
---|
| 5284 | + return split[0] + ":" + split[1]; |
---|
5163 | 5285 | } |
---|
5164 | 5286 | |
---|
5165 | 5287 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5168 | 5290 | return ""; |
---|
5169 | 5291 | |
---|
5170 | 5292 | // 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()); |
---|
| 5293 | + // Does not work on Windows due to C: |
---|
| 5294 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5295 | +// return ""; |
---|
| 5296 | +// |
---|
| 5297 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5298 | + String[] split = fullname.name.split(":"); |
---|
| 5299 | + |
---|
| 5300 | + if (split.length == 0) |
---|
| 5301 | + { |
---|
| 5302 | + return ""; |
---|
| 5303 | + } |
---|
| 5304 | + |
---|
| 5305 | + if (split.length == 1) |
---|
| 5306 | + { |
---|
| 5307 | + return ""; |
---|
| 5308 | + } |
---|
| 5309 | + |
---|
| 5310 | + if (split.length == 2) |
---|
| 5311 | + { |
---|
| 5312 | + if (fullname.name.endsWith(":")) |
---|
| 5313 | + { |
---|
| 5314 | + // Windows |
---|
| 5315 | + return ""; |
---|
| 5316 | + } |
---|
| 5317 | + |
---|
| 5318 | + return split[1]; |
---|
| 5319 | + } |
---|
| 5320 | + |
---|
| 5321 | + // Windows |
---|
| 5322 | + assert(split.length == 4); |
---|
| 5323 | + |
---|
| 5324 | + return split[2] + ":" + split[3]; |
---|
5175 | 5325 | } |
---|
5176 | 5326 | |
---|
5177 | 5327 | String GetPigmentTexture() |
---|
.. | .. |
---|
5245 | 5395 | System.out.print("; textures = " + textures); |
---|
5246 | 5396 | System.out.println("; usedtextures = " + usedtextures); |
---|
5247 | 5397 | |
---|
5248 | | - if (GetTextures() == null) |
---|
| 5398 | + if (GetTextures() == null) // What is that?? |
---|
5249 | 5399 | GetTextures().name = ":"; |
---|
5250 | 5400 | |
---|
5251 | 5401 | String texname = tex; |
---|
.. | .. |
---|
5276 | 5426 | child.ResetPigmentTexture(); |
---|
5277 | 5427 | blockloop = false; |
---|
5278 | 5428 | } |
---|
| 5429 | + } |
---|
| 5430 | + |
---|
| 5431 | + UUID GetUUID() |
---|
| 5432 | + { |
---|
| 5433 | + if (uuid == null) |
---|
| 5434 | + { |
---|
| 5435 | + // Serial |
---|
| 5436 | + uuid = UUID.randomUUID(); |
---|
| 5437 | + } |
---|
| 5438 | + |
---|
| 5439 | + return uuid; |
---|
| 5440 | + } |
---|
| 5441 | + |
---|
| 5442 | + Object3D GetObject(UUID uid) |
---|
| 5443 | + { |
---|
| 5444 | + if (blockloop) |
---|
| 5445 | + return null; |
---|
| 5446 | + |
---|
| 5447 | + if (GetUUID().equals(uid)) |
---|
| 5448 | + return this; |
---|
| 5449 | + |
---|
| 5450 | + int nb = Size(); |
---|
| 5451 | + for (int i = 0; i < nb; i++) |
---|
| 5452 | + { |
---|
| 5453 | + Object3D child = (Object3D) get(i); |
---|
| 5454 | + |
---|
| 5455 | + if (child == null) |
---|
| 5456 | + continue; |
---|
| 5457 | + |
---|
| 5458 | + blockloop = true; |
---|
| 5459 | + Object3D obj = child.GetObject(uid); |
---|
| 5460 | + blockloop = false; |
---|
| 5461 | + if (obj != null) |
---|
| 5462 | + return obj; |
---|
| 5463 | + } |
---|
| 5464 | + |
---|
| 5465 | + return null; |
---|
5279 | 5466 | } |
---|
5280 | 5467 | |
---|
5281 | 5468 | void SetBumpTexture(String tex) |
---|
.. | .. |
---|
5322 | 5509 | boolean NeedSupport() |
---|
5323 | 5510 | { |
---|
5324 | 5511 | return |
---|
5325 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5512 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
5326 | 5513 | // PROBLEM with CROWD!! |
---|
5327 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5514 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5328 | 5515 | } |
---|
5329 | 5516 | |
---|
5330 | 5517 | static boolean DEBUG_SELECTION = false; |
---|
.. | .. |
---|
5339 | 5526 | } |
---|
5340 | 5527 | |
---|
5341 | 5528 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5342 | | - hide) |
---|
| 5529 | + (hide || dontselect)) |
---|
5343 | 5530 | return; |
---|
5344 | 5531 | |
---|
5345 | 5532 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5371 | 5558 | return; |
---|
5372 | 5559 | } |
---|
5373 | 5560 | |
---|
5374 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5561 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5375 | 5562 | |
---|
5376 | 5563 | /* |
---|
5377 | 5564 | if (touched) |
---|
.. | .. |
---|
5423 | 5610 | //if (displaylist == -1 && usecalllists) |
---|
5424 | 5611 | if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
5425 | 5612 | { |
---|
5426 | | - bRep.displaylist = gl.glGenLists(1); |
---|
| 5613 | + bRep.displaylist = display.GenList(); |
---|
5427 | 5614 | assert(bRep.displaylist != 0); |
---|
5428 | 5615 | // System.err.println("glGenLists: " + bRep.displaylist + " for " + this); |
---|
5429 | 5616 | //System.out.println("\tgen list " + list); |
---|
.. | .. |
---|
5435 | 5622 | if (usecalllists) |
---|
5436 | 5623 | { |
---|
5437 | 5624 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5438 | | - gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE); |
---|
| 5625 | + display.NewList(bRep.displaylist); |
---|
5439 | 5626 | } |
---|
| 5627 | + |
---|
5440 | 5628 | CallList(display, root, selected, blocked); |
---|
| 5629 | + |
---|
5441 | 5630 | // compiled = true; |
---|
5442 | 5631 | if (usecalllists) |
---|
5443 | 5632 | { |
---|
5444 | 5633 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5445 | | - gl.glEndList(); |
---|
| 5634 | + display.EndList(); |
---|
5446 | 5635 | } |
---|
5447 | 5636 | //gl.glDrawBuffer(gl.GL_BACK); |
---|
5448 | 5637 | // XXX touched = false; |
---|
.. | .. |
---|
5490 | 5679 | if (display.DrawMode() == iCameraPane.SHADOW) |
---|
5491 | 5680 | { |
---|
5492 | 5681 | if (!link2master // tricky to cull in shadow mode. |
---|
5493 | | - && GetBRep().FrustumCull(this, gl, display.LightCamera(), true)) |
---|
| 5682 | + && GetBRep().FrustumCull(this, null, display.LightCamera(), true)) |
---|
5494 | 5683 | { |
---|
5495 | 5684 | //System.out.print("CULLED"); |
---|
5496 | 5685 | culled = true; |
---|
.. | .. |
---|
5498 | 5687 | } |
---|
5499 | 5688 | else |
---|
5500 | 5689 | //GetBRep().getBounds(v0, v1, this); |
---|
5501 | | - if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false)) |
---|
| 5690 | + if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false)) |
---|
5502 | 5691 | culled = true; |
---|
5503 | 5692 | |
---|
5504 | 5693 | // LA.xformPos(v0, display.renderCamera.toScreen, v0); |
---|
.. | .. |
---|
5538 | 5727 | { |
---|
5539 | 5728 | if (GetBRep() != null) |
---|
5540 | 5729 | { |
---|
5541 | | - CameraPane.NextIndex(this, gl); |
---|
| 5730 | + display.NextIndex(); |
---|
5542 | 5731 | // vertex color conflict : gl.glCallList(list); |
---|
5543 | 5732 | DrawNode(display, root, selected); |
---|
5544 | 5733 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5579 | 5768 | tex = GetTextures(); |
---|
5580 | 5769 | } |
---|
5581 | 5770 | |
---|
5582 | | - display.BindTextures(tex, texres); |
---|
| 5771 | + boolean failed = false; |
---|
| 5772 | + |
---|
| 5773 | + try |
---|
| 5774 | + { |
---|
| 5775 | + display.BindTextures(tex, texres); |
---|
| 5776 | + } |
---|
| 5777 | + catch (Exception e) |
---|
| 5778 | + { |
---|
| 5779 | + System.err.println("FAILED: " + this); |
---|
| 5780 | + failed = true; |
---|
| 5781 | + } |
---|
5583 | 5782 | |
---|
5584 | 5783 | if (!compiled) |
---|
5585 | 5784 | { |
---|
.. | .. |
---|
5595 | 5794 | |
---|
5596 | 5795 | // System.err.println("glCallList: " + bRep.displaylist + " for " + this); |
---|
5597 | 5796 | assert(bRep.displaylist != 0); |
---|
5598 | | - gl.glCallList(bRep.displaylist); |
---|
| 5797 | + display.CallList(bRep.displaylist); |
---|
5599 | 5798 | // june 2013 drawSelf(display, root, selected); |
---|
5600 | 5799 | } |
---|
5601 | 5800 | } |
---|
5602 | 5801 | } |
---|
5603 | 5802 | |
---|
5604 | | - display.ReleaseTextures(tex); |
---|
| 5803 | + if (!failed) |
---|
| 5804 | + display.ReleaseTextures(tex); |
---|
5605 | 5805 | |
---|
5606 | 5806 | display.PopMaterial(this, selected); |
---|
5607 | 5807 | } |
---|
.. | .. |
---|
5730 | 5930 | |
---|
5731 | 5931 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5732 | 5932 | { |
---|
| 5933 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 5934 | + return; |
---|
| 5935 | + |
---|
5733 | 5936 | if (hide) |
---|
5734 | 5937 | return; |
---|
5735 | 5938 | // shadow optimisation |
---|
.. | .. |
---|
5855 | 6058 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5856 | 6059 | return; // no shadow for transparent objects |
---|
5857 | 6060 | |
---|
| 6061 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6062 | + return; |
---|
| 6063 | + |
---|
5858 | 6064 | if (hide) |
---|
5859 | 6065 | return; |
---|
5860 | 6066 | |
---|
.. | .. |
---|
5895 | 6101 | return; |
---|
5896 | 6102 | } |
---|
5897 | 6103 | |
---|
| 6104 | + //bRep.GenUV(1/material.diffuseness); |
---|
5898 | 6105 | // bRep.lock = true; |
---|
5899 | 6106 | |
---|
5900 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 6107 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5901 | 6108 | |
---|
5902 | 6109 | if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
5903 | 6110 | { |
---|
.. | .. |
---|
5914 | 6121 | |
---|
5915 | 6122 | bRep.getMinMax(min, max, 100); |
---|
5916 | 6123 | |
---|
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(); |
---|
| 6124 | + display.DrawBox(min, max); |
---|
5934 | 6125 | |
---|
5935 | 6126 | return; |
---|
5936 | 6127 | } |
---|
.. | .. |
---|
5984 | 6175 | new Exception().printStackTrace(); |
---|
5985 | 6176 | return; |
---|
5986 | 6177 | } |
---|
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 | | - } |
---|
| 6178 | + |
---|
| 6179 | + display.DrawGeometry(bRep, flipV, selectmode); |
---|
6153 | 6180 | } else // catch (Error e) |
---|
6154 | 6181 | { |
---|
6155 | 6182 | // TRIANGLE ARRAY |
---|
6156 | 6183 | if (IsOpaque()) // Static()) |
---|
6157 | 6184 | { |
---|
6158 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6185 | + display.StartTriangles(); |
---|
6159 | 6186 | int facecount = bRep.FaceCount(); |
---|
6160 | 6187 | for (int i = 0; i < facecount; i++) |
---|
6161 | 6188 | { |
---|
.. | .. |
---|
6220 | 6247 | |
---|
6221 | 6248 | display.DrawFace(this, p, q, r, face); |
---|
6222 | 6249 | } |
---|
6223 | | - gl.glEnd(); |
---|
| 6250 | + display.EndTriangles(); |
---|
6224 | 6251 | } |
---|
6225 | 6252 | else |
---|
6226 | 6253 | { |
---|
.. | .. |
---|
6249 | 6276 | //System.out.println("SORT"); |
---|
6250 | 6277 | |
---|
6251 | 6278 | java.util.Arrays.sort(facescompare); |
---|
6252 | | - |
---|
6253 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6279 | + |
---|
| 6280 | + display.StartTriangles(); |
---|
6254 | 6281 | for (int i = 0; i < facecount; i++) |
---|
6255 | 6282 | { |
---|
6256 | 6283 | Face face = bRep.GetFace(facescompare[i].index); |
---|
.. | .. |
---|
6264 | 6291 | |
---|
6265 | 6292 | display.DrawFace(this, p, q, r, face); |
---|
6266 | 6293 | } |
---|
6267 | | - gl.glEnd(); |
---|
| 6294 | + display.EndTriangles(); |
---|
6268 | 6295 | } |
---|
6269 | 6296 | |
---|
6270 | 6297 | if (false) // live && support != null && support.bRep != null) // debug weights |
---|
6271 | 6298 | { |
---|
| 6299 | + /* |
---|
6272 | 6300 | gl.glDisable(gl.GL_LIGHTING); |
---|
6273 | 6301 | float[] colorV = new float[3]; |
---|
6274 | 6302 | |
---|
.. | .. |
---|
6347 | 6375 | // gl.glEnd(); |
---|
6348 | 6376 | } |
---|
6349 | 6377 | } |
---|
| 6378 | + */ |
---|
6350 | 6379 | } |
---|
6351 | 6380 | } |
---|
6352 | 6381 | |
---|
.. | .. |
---|
6405 | 6434 | void Print(Vertex v) |
---|
6406 | 6435 | { |
---|
6407 | 6436 | //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 | 6437 | } |
---|
6425 | 6438 | |
---|
6426 | 6439 | void drawSelf(ClickInfo info, int level, boolean select) |
---|
.. | .. |
---|
7031 | 7044 | // { |
---|
7032 | 7045 | // CameraPane.Ymax = spoth; |
---|
7033 | 7046 | // } |
---|
7034 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
7035 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7047 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
| 7048 | + //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
7036 | 7049 | spot.translate(0, -32); |
---|
7037 | 7050 | info.g.setColor(Color.green); |
---|
7038 | 7051 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
.. | .. |
---|
7087 | 7100 | startX = info.x; |
---|
7088 | 7101 | startY = info.y; |
---|
7089 | 7102 | |
---|
7090 | | - hitSomething = 0; |
---|
| 7103 | + hitSomething = -1; |
---|
7091 | 7104 | cVector origin = new cVector(); |
---|
7092 | 7105 | //LA.xformPos(origin, toParent, origin); |
---|
7093 | 7106 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
7120 | 7133 | } |
---|
7121 | 7134 | |
---|
7122 | 7135 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7123 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7136 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7124 | 7137 | //System.out.println("modified = " + modified); |
---|
7125 | 7138 | //new Exception().printStackTrace(); |
---|
7126 | 7139 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7148 | 7161 | return true; |
---|
7149 | 7162 | } |
---|
7150 | 7163 | |
---|
7151 | | - void doEditDrag0(ClickInfo info) |
---|
| 7164 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
7152 | 7165 | { |
---|
7153 | 7166 | if (hitSomething == 0) |
---|
7154 | 7167 | { |
---|
.. | .. |
---|
7163 | 7176 | //System.out.println("hitSomething = " + hitSomething); |
---|
7164 | 7177 | |
---|
7165 | 7178 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7179 | + |
---|
7166 | 7180 | cVector xlate = new cVector(); |
---|
7167 | 7181 | //cVector xlate2 = new cVector(); |
---|
7168 | 7182 | switch (hitSomething) |
---|
.. | .. |
---|
7175 | 7189 | |
---|
7176 | 7190 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7177 | 7191 | |
---|
7178 | | - if (modified) |
---|
| 7192 | + if (modified || opposite) |
---|
7179 | 7193 | { |
---|
7180 | 7194 | //assert(false); |
---|
7181 | 7195 | /* |
---|
.. | .. |
---|
7269 | 7283 | |
---|
7270 | 7284 | if (modified) |
---|
7271 | 7285 | { |
---|
| 7286 | + // Rotate 90 degrees |
---|
7272 | 7287 | angle /= (Math.PI / 4); |
---|
7273 | 7288 | angle = Math.floor(angle + 0.5); |
---|
7274 | 7289 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7310 | 7325 | |
---|
7311 | 7326 | case hitScale: // scale |
---|
7312 | 7327 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7328 | + double sign = 1; |
---|
| 7329 | + if (hScale < 0) |
---|
| 7330 | + { |
---|
| 7331 | + sign = -1; |
---|
| 7332 | + } |
---|
| 7333 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7313 | 7334 | if (hScale < 0.01) |
---|
7314 | 7335 | { |
---|
7315 | | - hScale = 0.01; |
---|
| 7336 | + //hScale = 0.01; |
---|
7316 | 7337 | } |
---|
7317 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7318 | | - if (hScale < 0.01) |
---|
7319 | | - { |
---|
7320 | | - hScale = 0.01; |
---|
7321 | | - } |
---|
| 7338 | + |
---|
7322 | 7339 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7323 | | - if (vScale < 0.01) |
---|
| 7340 | + sign = 1; |
---|
| 7341 | + if (vScale < 0) |
---|
7324 | 7342 | { |
---|
7325 | | - vScale = 0.01; |
---|
| 7343 | + sign = -1; |
---|
7326 | 7344 | } |
---|
7327 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7345 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7328 | 7346 | if (vScale < 0.01) |
---|
7329 | 7347 | { |
---|
7330 | | - vScale = 0.01; |
---|
| 7348 | + //vScale = 0.01; |
---|
7331 | 7349 | } |
---|
7332 | 7350 | LA.matCopy(startMat, toParent); |
---|
7333 | 7351 | /**/ |
---|
.. | .. |
---|
7338 | 7356 | } |
---|
7339 | 7357 | /**/ |
---|
7340 | 7358 | |
---|
| 7359 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7360 | + |
---|
| 7361 | + if (totalScale < 0.01) |
---|
| 7362 | + { |
---|
| 7363 | + totalScale = 0.01; |
---|
| 7364 | + } |
---|
| 7365 | + |
---|
7341 | 7366 | switch (info.pane.RenderCamera().viewCode) |
---|
7342 | 7367 | { |
---|
7343 | 7368 | case 3: // '\001' |
---|
7344 | 7369 | if (modified) |
---|
7345 | 7370 | { |
---|
7346 | 7371 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7347 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7372 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7348 | 7373 | } // vScale, 1); |
---|
7349 | 7374 | else |
---|
7350 | 7375 | { |
---|
7351 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7376 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7352 | 7377 | } // vScale, 1); |
---|
7353 | 7378 | break; |
---|
7354 | 7379 | |
---|
.. | .. |
---|
7356 | 7381 | if (modified) |
---|
7357 | 7382 | { |
---|
7358 | 7383 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7359 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7384 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7360 | 7385 | } else |
---|
7361 | 7386 | { |
---|
7362 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7387 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7363 | 7388 | } |
---|
7364 | 7389 | break; |
---|
7365 | 7390 | |
---|
.. | .. |
---|
7367 | 7392 | if (modified) |
---|
7368 | 7393 | { |
---|
7369 | 7394 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7370 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7395 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7371 | 7396 | } else |
---|
7372 | 7397 | { |
---|
7373 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7398 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7374 | 7399 | } |
---|
7375 | 7400 | break; |
---|
7376 | 7401 | } |
---|
.. | .. |
---|
7503 | 7528 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7504 | 7529 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7505 | 7530 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7531 | + |
---|
| 7532 | + String objname; |
---|
| 7533 | + |
---|
7506 | 7534 | if (false) //parent != null) |
---|
7507 | 7535 | { |
---|
7508 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7536 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7509 | 7537 | } else |
---|
7510 | 7538 | { |
---|
7511 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7539 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7512 | 7540 | } // + super.toString(); |
---|
7513 | 7541 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7542 | + |
---|
| 7543 | + if (!Globals.ADVANCED) |
---|
| 7544 | + return objname; |
---|
| 7545 | + |
---|
| 7546 | + return objname + " " + System.identityHashCode(this); |
---|
7514 | 7547 | } |
---|
7515 | 7548 | |
---|
7516 | 7549 | public int hashCode() |
---|
.. | .. |
---|
7566 | 7599 | objectUI.closeUI(); |
---|
7567 | 7600 | if (editWindow != null) |
---|
7568 | 7601 | { |
---|
| 7602 | + editWindow.ctrlPanel.FlushUI(); |
---|
7569 | 7603 | editWindow.refreshContents(); |
---|
7570 | 7604 | } // ? new |
---|
7571 | 7605 | objectUI = null; |
---|
.. | .. |
---|
7586 | 7620 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7587 | 7621 | |
---|
7588 | 7622 | Object3D /*Composite*/ parent; |
---|
7589 | | - Object3D /*Composite*/ fileparent; |
---|
| 7623 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7590 | 7624 | |
---|
7591 | 7625 | double[][] toParent; // dynamic matrix |
---|
7592 | 7626 | double[][] fromParent; |
---|
.. | .. |
---|
7701 | 7735 | { |
---|
7702 | 7736 | assert(bRep != null); |
---|
7703 | 7737 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7704 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 7738 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7705 | 7739 | } |
---|
7706 | 7740 | else |
---|
7707 | 7741 | { |
---|
.. | .. |
---|
7750 | 7784 | private static cVector edge2 = new cVector(); |
---|
7751 | 7785 | //private static cVector norm = new cVector(); |
---|
7752 | 7786 | /*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; |
---|
| 7787 | + static final int hitCenter = 1; |
---|
| 7788 | + static final int hitScale = 2; |
---|
| 7789 | + static final int hitRotate = 3; |
---|
7756 | 7790 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7757 | 7791 | /*transient*/ private Point centerPt; |
---|
7758 | 7792 | /*transient*/ private int startX; |
---|