.. | .. |
---|
22 | 22 | //static final long serialVersionUID = -607422624994562685L; |
---|
23 | 23 | static final long serialVersionUID = 5022536242724664900L; |
---|
24 | 24 | |
---|
| 25 | + // Use GetUUID for backward compatibility with null. |
---|
25 | 26 | private UUID uuid = UUID.randomUUID(); |
---|
26 | 27 | |
---|
27 | 28 | // TEMPORARY for mocap undo. No need to be transient. |
---|
.. | .. |
---|
29 | 30 | Object3D saveskeleton; |
---|
30 | 31 | // |
---|
31 | 32 | |
---|
32 | | - byte[] versions[]; |
---|
| 33 | + String skyboxname; |
---|
| 34 | + String skyboxext; |
---|
| 35 | + |
---|
| 36 | + Object3D versionlist[]; |
---|
33 | 37 | int versionindex = -1; |
---|
34 | 38 | |
---|
| 39 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 40 | + |
---|
35 | 41 | ScriptNode scriptnode; |
---|
36 | 42 | |
---|
| 43 | + int VersionCount() |
---|
| 44 | + { |
---|
| 45 | + int count = 0; |
---|
| 46 | + |
---|
| 47 | + for (int i = versionlist.length; --i >= 0;) |
---|
| 48 | + { |
---|
| 49 | + if (versionlist[i] != null) |
---|
| 50 | + count++; |
---|
| 51 | + } |
---|
| 52 | + |
---|
| 53 | + return count; |
---|
| 54 | + } |
---|
| 55 | + |
---|
37 | 56 | void InitOthers() |
---|
38 | 57 | { |
---|
39 | 58 | if (projectedVertices == null || projectedVertices.length <= 2) |
---|
.. | .. |
---|
219 | 238 | // o.bRep.support = null; |
---|
220 | 239 | // } |
---|
221 | 240 | o.selection = this.selection; |
---|
222 | | - o.versions = this.versions; |
---|
| 241 | + o.versionlist = this.versionlist; |
---|
223 | 242 | o.versionindex = this.versionindex; |
---|
224 | 243 | |
---|
225 | 244 | if (this.support != null) |
---|
.. | .. |
---|
241 | 260 | // this.bRep.support = null; |
---|
242 | 261 | // this.support = null; |
---|
243 | 262 | // this.fileparent = null; |
---|
| 263 | + } |
---|
| 264 | + |
---|
| 265 | +// Object3D GetObject(java.util.UUID uuid) |
---|
| 266 | +// { |
---|
| 267 | +// if (this.uuid.equals(uuid)) |
---|
| 268 | +// return this; |
---|
| 269 | +// |
---|
| 270 | +// if (blockloop) |
---|
| 271 | +// return null; |
---|
| 272 | +// |
---|
| 273 | +// blockloop = true; |
---|
| 274 | +// |
---|
| 275 | +// for (int i=0; i<Size(); i++) |
---|
| 276 | +// { |
---|
| 277 | +// Object3D o = get(i).GetObject(uuid); |
---|
| 278 | +// |
---|
| 279 | +// if (o != null) |
---|
| 280 | +// return o; |
---|
| 281 | +// } |
---|
| 282 | +// |
---|
| 283 | +// blockloop = false; |
---|
| 284 | +// |
---|
| 285 | +// return null; |
---|
| 286 | +// } |
---|
| 287 | + |
---|
| 288 | + transient boolean tag; |
---|
| 289 | + |
---|
| 290 | + void TagObjects(Object3D o, boolean tag) |
---|
| 291 | + { |
---|
| 292 | + if (blockloop) |
---|
| 293 | + return; |
---|
| 294 | + |
---|
| 295 | + o.tag = tag; |
---|
| 296 | + |
---|
| 297 | + if (o == this) |
---|
| 298 | + return; |
---|
| 299 | + |
---|
| 300 | + blockloop = true; |
---|
| 301 | + |
---|
| 302 | + for (int i=0; i<Size(); i++) |
---|
| 303 | + { |
---|
| 304 | + get(i).TagObjects(o, tag); |
---|
| 305 | + } |
---|
| 306 | + |
---|
| 307 | + blockloop = false; |
---|
| 308 | + } |
---|
| 309 | + |
---|
| 310 | + boolean HasTags() |
---|
| 311 | + { |
---|
| 312 | + if (blockloop) |
---|
| 313 | + return false; |
---|
| 314 | + |
---|
| 315 | + blockloop = true; |
---|
| 316 | + |
---|
| 317 | + boolean hasTags = false; |
---|
| 318 | + |
---|
| 319 | + for (int i=0; i<Size(); i++) |
---|
| 320 | + { |
---|
| 321 | + hasTags |= get(i).tag || get(i).HasTags(); |
---|
| 322 | + |
---|
| 323 | + if (hasTags) |
---|
| 324 | + break; |
---|
| 325 | + } |
---|
| 326 | + |
---|
| 327 | + blockloop = false; |
---|
| 328 | + |
---|
| 329 | + return hasTags; |
---|
244 | 330 | } |
---|
245 | 331 | |
---|
246 | 332 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
.. | .. |
---|
277 | 363 | |
---|
278 | 364 | this.selection = o.selection; |
---|
279 | 365 | |
---|
280 | | - this.versions = o.versions; |
---|
| 366 | + this.versionlist = o.versionlist; |
---|
281 | 367 | this.versionindex = o.versionindex; |
---|
282 | 368 | // July 2019 if (this.bRep != null) |
---|
283 | 369 | // this.bRep.support = o.transientrep; |
---|
.. | .. |
---|
495 | 581 | } |
---|
496 | 582 | } |
---|
497 | 583 | |
---|
498 | | - int memorysize; |
---|
| 584 | + transient int memorysize; // needs to be transient, dunno why |
---|
499 | 585 | |
---|
500 | 586 | int MemorySize() |
---|
501 | 587 | { |
---|
502 | | - if (true) // memorysize == 0) |
---|
| 588 | + if (memorysize == 0) |
---|
503 | 589 | { |
---|
504 | 590 | try |
---|
505 | 591 | { |
---|
.. | .. |
---|
614 | 700 | { |
---|
615 | 701 | if (maxcount != 1) |
---|
616 | 702 | { |
---|
617 | | - new Exception().printStackTrace(); |
---|
| 703 | + //new Exception().printStackTrace(); |
---|
618 | 704 | } |
---|
619 | 705 | |
---|
620 | 706 | toParentMarked = LA.newMatrix(); |
---|
.. | .. |
---|
1011 | 1097 | |
---|
1012 | 1098 | if (material == null || material.multiply) |
---|
1013 | 1099 | return true; |
---|
| 1100 | + |
---|
| 1101 | + if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1102 | + return false; |
---|
1014 | 1103 | |
---|
1015 | 1104 | // Transparent objects are dynamic because we have to sort the triangles. |
---|
1016 | 1105 | return material.opacity > 0.99; |
---|
.. | .. |
---|
2293 | 2382 | |
---|
2294 | 2383 | InitOthers(); |
---|
2295 | 2384 | |
---|
2296 | | - if (this instanceof Camera) |
---|
2297 | | - { |
---|
2298 | | - material.shift = 90; |
---|
2299 | | - } |
---|
2300 | | - |
---|
2301 | 2385 | material.multiply = multiply; |
---|
2302 | 2386 | |
---|
2303 | 2387 | if (multiply) |
---|
.. | .. |
---|
2438 | 2522 | else |
---|
2439 | 2523 | { |
---|
2440 | 2524 | //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2525 | + if (objectUI != null) |
---|
| 2526 | + ((ObjEditor)objectUI).pinButton.setSelected(pinned); |
---|
| 2527 | + else |
---|
| 2528 | + //new Exception().printStackTrace(); |
---|
| 2529 | + System.err.println("objectUI is null"); |
---|
2441 | 2530 | } |
---|
2442 | 2531 | } |
---|
2443 | 2532 | |
---|
.. | .. |
---|
3188 | 3277 | blockloop = false; |
---|
3189 | 3278 | } |
---|
3190 | 3279 | |
---|
| 3280 | + public void ResetTransform(int mask) |
---|
| 3281 | + { |
---|
| 3282 | + Object3D obj = this; |
---|
| 3283 | + |
---|
| 3284 | + if (mask == -1) |
---|
| 3285 | + { |
---|
| 3286 | + if (obj instanceof Camera) // jan 2014 |
---|
| 3287 | + { |
---|
| 3288 | + LA.matIdentity(obj.toParent); |
---|
| 3289 | + LA.matIdentity(obj.fromParent); |
---|
| 3290 | + } |
---|
| 3291 | + else |
---|
| 3292 | + { |
---|
| 3293 | + obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent); |
---|
| 3294 | + obj.fromParent = null; // LA.matIdentity(obj.fromParent); |
---|
| 3295 | + } |
---|
| 3296 | + return; |
---|
| 3297 | + } |
---|
| 3298 | + |
---|
| 3299 | + if ((mask&2) != 0) // Scale/rotation |
---|
| 3300 | + { |
---|
| 3301 | + obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1; |
---|
| 3302 | + obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0; |
---|
| 3303 | + obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0; |
---|
| 3304 | + obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1; |
---|
| 3305 | + obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0; |
---|
| 3306 | + obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0; |
---|
| 3307 | + } |
---|
| 3308 | + if ((mask&1) != 0) // Translation |
---|
| 3309 | + { |
---|
| 3310 | + if (obj.toParent != null) |
---|
| 3311 | + { |
---|
| 3312 | + obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0; |
---|
| 3313 | + obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0; |
---|
| 3314 | + } |
---|
| 3315 | + } |
---|
| 3316 | + } |
---|
| 3317 | + |
---|
| 3318 | + public void TextureRatioTransform(int axis) |
---|
| 3319 | + { |
---|
| 3320 | + cTexture tex = GetTextures(); |
---|
| 3321 | + |
---|
| 3322 | + com.sun.opengl.util.texture.TextureData texturedata = null; |
---|
| 3323 | + |
---|
| 3324 | + try |
---|
| 3325 | + { |
---|
| 3326 | + texturedata = Globals.theRenderer.GetTextureData(tex, false, texres); |
---|
| 3327 | + } |
---|
| 3328 | + catch (Exception e) |
---|
| 3329 | + { |
---|
| 3330 | + System.err.println("FAIL TextureRatio: " + this); |
---|
| 3331 | + } |
---|
| 3332 | + |
---|
| 3333 | + LA.matIdentity(Object3D.mat); |
---|
| 3334 | + Object3D.mat[axis][axis] = (double)texturedata.getWidth() / texturedata.getHeight(); |
---|
| 3335 | + |
---|
| 3336 | + if (toParent == null) |
---|
| 3337 | + { |
---|
| 3338 | + toParent = LA.newMatrix(); |
---|
| 3339 | + fromParent = LA.newMatrix(); |
---|
| 3340 | + } |
---|
| 3341 | + |
---|
| 3342 | + ResetTransform(2); |
---|
| 3343 | + |
---|
| 3344 | + LA.matConcat(Object3D.mat, fromParent, fromParent); |
---|
| 3345 | + LA.matInvert(fromParent, toParent); |
---|
| 3346 | + } |
---|
| 3347 | + |
---|
| 3348 | + void TextureRatio(int axis) |
---|
| 3349 | + { |
---|
| 3350 | + if (blockloop) |
---|
| 3351 | + return; |
---|
| 3352 | + |
---|
| 3353 | + blockloop = true; |
---|
| 3354 | + |
---|
| 3355 | + TextureRatioTransform(axis); |
---|
| 3356 | + |
---|
| 3357 | + for (int i=Size(); --i>=0;) |
---|
| 3358 | + { |
---|
| 3359 | + Object3D v = get(i); |
---|
| 3360 | + |
---|
| 3361 | + v.TextureRatio(axis); |
---|
| 3362 | + } |
---|
| 3363 | + |
---|
| 3364 | + blockloop = false; |
---|
| 3365 | + } |
---|
| 3366 | + |
---|
3191 | 3367 | void TransformChildren() |
---|
3192 | 3368 | { |
---|
3193 | 3369 | if (toParent != null) |
---|
.. | .. |
---|
3541 | 3717 | |
---|
3542 | 3718 | void ClearMaterials() |
---|
3543 | 3719 | { |
---|
| 3720 | + if (blockloop) |
---|
| 3721 | + return; |
---|
| 3722 | + |
---|
| 3723 | + blockloop = true; |
---|
| 3724 | + |
---|
3544 | 3725 | ClearMaterial(); |
---|
3545 | | - for (int i = 0; i < size(); i++) |
---|
| 3726 | + for (int i = 0; i < Size(); i++) |
---|
3546 | 3727 | { |
---|
3547 | | - Object3D child = (Object3D) reserve(i); |
---|
| 3728 | + Object3D child = (Object3D) get(i); |
---|
3548 | 3729 | if (child == null) |
---|
3549 | 3730 | continue; |
---|
3550 | 3731 | child.ClearMaterials(); |
---|
3551 | | - release(i); |
---|
3552 | 3732 | } |
---|
| 3733 | + |
---|
| 3734 | + blockloop = false; |
---|
| 3735 | + } |
---|
| 3736 | + |
---|
| 3737 | + void ClearVersionList() |
---|
| 3738 | + { |
---|
| 3739 | + this.versionlist = null; |
---|
| 3740 | + this.versionindex = -1; |
---|
| 3741 | + this.versiontable = null; |
---|
| 3742 | + } |
---|
| 3743 | + |
---|
| 3744 | + void ClearVersions() |
---|
| 3745 | + { |
---|
| 3746 | + if (blockloop) |
---|
| 3747 | + return; |
---|
| 3748 | + |
---|
| 3749 | + blockloop = true; |
---|
| 3750 | + |
---|
| 3751 | + ClearVersionList(); |
---|
| 3752 | + for (int i = 0; i < Size(); i++) |
---|
| 3753 | + { |
---|
| 3754 | + Object3D child = (Object3D) get(i); |
---|
| 3755 | + if (child == null) |
---|
| 3756 | + continue; |
---|
| 3757 | + child.ClearVersions(); |
---|
| 3758 | + } |
---|
| 3759 | + |
---|
| 3760 | + blockloop = false; |
---|
3553 | 3761 | } |
---|
3554 | 3762 | |
---|
3555 | 3763 | void FlipV(boolean flip) |
---|
.. | .. |
---|
5539 | 5747 | if (fullname == null) |
---|
5540 | 5748 | return ""; |
---|
5541 | 5749 | |
---|
| 5750 | + if (fullname.pigment != null) |
---|
| 5751 | + { |
---|
| 5752 | + return fullname.pigment; |
---|
| 5753 | + } |
---|
| 5754 | + |
---|
5542 | 5755 | // System.out.println("Fullname = " + fullname); |
---|
5543 | 5756 | |
---|
5544 | 5757 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5551 | 5764 | |
---|
5552 | 5765 | if (split.length == 0) |
---|
5553 | 5766 | { |
---|
5554 | | - return ""; |
---|
| 5767 | + return fullname.pigment = ""; |
---|
5555 | 5768 | } |
---|
5556 | 5769 | |
---|
5557 | 5770 | if (split.length <= 2) |
---|
.. | .. |
---|
5559 | 5772 | if (fullname.name.endsWith(":")) |
---|
5560 | 5773 | { |
---|
5561 | 5774 | // Windows |
---|
5562 | | - return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5775 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
5563 | 5776 | } |
---|
5564 | 5777 | |
---|
5565 | | - return split[0]; |
---|
| 5778 | + return fullname.pigment = split[0]; |
---|
5566 | 5779 | } |
---|
5567 | 5780 | |
---|
5568 | 5781 | // Windows |
---|
5569 | 5782 | assert(split.length == 4); |
---|
5570 | 5783 | |
---|
5571 | | - return split[0] + ":" + split[1]; |
---|
| 5784 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5572 | 5785 | } |
---|
5573 | 5786 | |
---|
5574 | 5787 | static String GetBump(cTexture fullname) |
---|
5575 | 5788 | { |
---|
5576 | 5789 | if (fullname == null) |
---|
5577 | 5790 | return ""; |
---|
| 5791 | + |
---|
| 5792 | + if (fullname.bump != null) |
---|
| 5793 | + { |
---|
| 5794 | + return fullname.bump; |
---|
| 5795 | + } |
---|
5578 | 5796 | |
---|
5579 | 5797 | // System.out.println("Fullname = " + fullname); |
---|
5580 | 5798 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5586 | 5804 | |
---|
5587 | 5805 | if (split.length == 0) |
---|
5588 | 5806 | { |
---|
5589 | | - return ""; |
---|
| 5807 | + return fullname.bump = ""; |
---|
5590 | 5808 | } |
---|
5591 | 5809 | |
---|
5592 | 5810 | if (split.length == 1) |
---|
5593 | 5811 | { |
---|
5594 | | - return ""; |
---|
| 5812 | + return fullname.bump = ""; |
---|
5595 | 5813 | } |
---|
5596 | 5814 | |
---|
5597 | 5815 | if (split.length == 2) |
---|
.. | .. |
---|
5599 | 5817 | if (fullname.name.endsWith(":")) |
---|
5600 | 5818 | { |
---|
5601 | 5819 | // Windows |
---|
5602 | | - return ""; |
---|
| 5820 | + return fullname.bump = ""; |
---|
5603 | 5821 | } |
---|
5604 | 5822 | |
---|
5605 | | - return split[1]; |
---|
| 5823 | + return fullname.bump = split[1]; |
---|
5606 | 5824 | } |
---|
5607 | 5825 | |
---|
5608 | 5826 | // Windows |
---|
5609 | 5827 | assert(split.length == 4); |
---|
5610 | 5828 | |
---|
5611 | | - return split[2] + ":" + split[3]; |
---|
| 5829 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5612 | 5830 | } |
---|
5613 | 5831 | |
---|
5614 | 5832 | String GetPigmentTexture() |
---|
.. | .. |
---|
5691 | 5909 | texname = ""; |
---|
5692 | 5910 | |
---|
5693 | 5911 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 5912 | + |
---|
| 5913 | + GetTextures().pigment = null; |
---|
| 5914 | + |
---|
5694 | 5915 | Touch(); |
---|
5695 | 5916 | } |
---|
5696 | 5917 | |
---|
.. | .. |
---|
5763 | 5984 | texname = ""; |
---|
5764 | 5985 | |
---|
5765 | 5986 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
| 5987 | + |
---|
| 5988 | + GetTextures().bump = null; |
---|
5766 | 5989 | |
---|
5767 | 5990 | Touch(); |
---|
5768 | 5991 | } |
---|
.. | .. |
---|
5846 | 6069 | return parent.IsLive(); |
---|
5847 | 6070 | } |
---|
5848 | 6071 | |
---|
| 6072 | + boolean IsDynamic() |
---|
| 6073 | + { |
---|
| 6074 | + return live && bRep != null; |
---|
| 6075 | + } |
---|
| 6076 | + |
---|
5849 | 6077 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5850 | 6078 | { |
---|
5851 | 6079 | Invariants(); // june 2013 |
---|
.. | .. |
---|
5906 | 6134 | if (support != null) |
---|
5907 | 6135 | support = support; |
---|
5908 | 6136 | |
---|
5909 | | - //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5910 | | - boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6137 | + boolean usecalllists = !IsDynamic() && |
---|
| 6138 | + IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6139 | + //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6140 | + |
---|
| 6141 | + //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
5911 | 6142 | |
---|
5912 | 6143 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5913 | 6144 | { |
---|
.. | .. |
---|
5917 | 6148 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5918 | 6149 | // usecalllists = false; |
---|
5919 | 6150 | |
---|
5920 | | - if (GetBRep() != null) |
---|
5921 | | - usecalllists = usecalllists; |
---|
| 6151 | + if (display.DrawMode() == display.SHADOW) |
---|
| 6152 | + //GetBRep() != null) |
---|
| 6153 | + usecalllists = !!usecalllists; |
---|
5922 | 6154 | //System.out.println("draw " + this); |
---|
5923 | 6155 | //new Exception().printStackTrace(); |
---|
5924 | 6156 | |
---|
.. | .. |
---|
5940 | 6172 | if (!(this instanceof Composite)) |
---|
5941 | 6173 | touched = false; |
---|
5942 | 6174 | //if (displaylist == -1 && usecalllists) |
---|
5943 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 6175 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5944 | 6176 | { |
---|
5945 | 6177 | bRep.displaylist = display.GenList(); |
---|
5946 | 6178 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5951 | 6183 | |
---|
5952 | 6184 | //System.out.println("\tnew list " + list); |
---|
5953 | 6185 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5954 | | - if (usecalllists) |
---|
| 6186 | + if (usecalllists && bRep.displaylist > 0) |
---|
5955 | 6187 | { |
---|
5956 | 6188 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5957 | 6189 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5960 | 6192 | CallList(display, root, selected, blocked); |
---|
5961 | 6193 | |
---|
5962 | 6194 | // compiled = true; |
---|
5963 | | - if (usecalllists) |
---|
| 6195 | + if (usecalllists && bRep.displaylist > 0) |
---|
5964 | 6196 | { |
---|
5965 | 6197 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5966 | 6198 | display.EndList(); |
---|
.. | .. |
---|
7364 | 7596 | boundary.y = spot.y - 30; |
---|
7365 | 7597 | boundary.width = spot.width + 60; |
---|
7366 | 7598 | boundary.height = spot.height + 60; |
---|
7367 | | - clickInfo.g.setColor(Color.red); |
---|
| 7599 | + clickInfo.g.setColor(Color.white); |
---|
7368 | 7600 | int spotw = spot.x + spot.width; |
---|
7369 | 7601 | int spoth = spot.y + spot.height; |
---|
7370 | 7602 | clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
.. | .. |
---|
7384 | 7616 | // { |
---|
7385 | 7617 | // CameraPane.Ymax = spoth; |
---|
7386 | 7618 | // } |
---|
7387 | | - spot.translate(32, 32); |
---|
| 7619 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7620 | +// { |
---|
| 7621 | +// CameraPane.Xmin = spot.x; |
---|
| 7622 | +// } |
---|
| 7623 | +// if (CameraPane.Xmax < spotw) |
---|
| 7624 | +// { |
---|
| 7625 | +// CameraPane.Xmax = spotw; |
---|
| 7626 | +// } |
---|
| 7627 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7628 | +// { |
---|
| 7629 | +// CameraPane.Ymin = spot.y; |
---|
| 7630 | +// } |
---|
| 7631 | +// if (CameraPane.Ymax < spoth) |
---|
| 7632 | +// { |
---|
| 7633 | +// CameraPane.Ymax = spoth; |
---|
| 7634 | +// } |
---|
| 7635 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7636 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
| 7637 | + spot.translate(32, 0); |
---|
| 7638 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7639 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7640 | + |
---|
| 7641 | + spot.translate(32, 64); |
---|
7388 | 7642 | spotw = spot.x + spot.width; |
---|
7389 | 7643 | spoth = spot.y + spot.height; |
---|
7390 | 7644 | clickInfo.g.setColor(Color.cyan); |
---|
.. | .. |
---|
7405 | 7659 | // { |
---|
7406 | 7660 | // CameraPane.Ymax = spoth; |
---|
7407 | 7661 | // } |
---|
7408 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7409 | | - //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7410 | | - spot.translate(0, -32); |
---|
7411 | | - clickInfo.g.setColor(Color.yellow); |
---|
7412 | | - clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7413 | 7662 | clickInfo.g.setColor(Color.green); |
---|
7414 | | -// if (CameraPane.Xmin > spot.x) |
---|
7415 | | -// { |
---|
7416 | | -// CameraPane.Xmin = spot.x; |
---|
7417 | | -// } |
---|
7418 | | -// if (CameraPane.Xmax < spotw) |
---|
7419 | | -// { |
---|
7420 | | -// CameraPane.Xmax = spotw; |
---|
7421 | | -// } |
---|
7422 | | -// if (CameraPane.Ymin > spot.y) |
---|
7423 | | -// { |
---|
7424 | | -// CameraPane.Ymin = spot.y; |
---|
7425 | | -// } |
---|
7426 | | -// if (CameraPane.Ymax < spoth) |
---|
7427 | | -// { |
---|
7428 | | -// CameraPane.Ymax = spoth; |
---|
7429 | | -// } |
---|
7430 | 7663 | clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
7431 | 7664 | (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7432 | 7665 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
.. | .. |
---|
7485 | 7718 | retval = true; |
---|
7486 | 7719 | } |
---|
7487 | 7720 | spot.translate(0, 32); |
---|
| 7721 | + spot.translate(32, 0); |
---|
| 7722 | + spot.translate(0, 32); |
---|
7488 | 7723 | if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7489 | 7724 | { |
---|
7490 | 7725 | hitSomething = hitScale; |
---|
7491 | 7726 | |
---|
7492 | 7727 | double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7493 | | - double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32; |
---|
| 7728 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7494 | 7729 | double sign = 1; |
---|
7495 | 7730 | if (hScale < 0) |
---|
7496 | 7731 | { |
---|
.. | .. |
---|
7502 | 7737 | //hScale = 0.01; |
---|
7503 | 7738 | } |
---|
7504 | 7739 | |
---|
7505 | | - double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32; |
---|
| 7740 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7506 | 7741 | sign = 1; |
---|
7507 | 7742 | if (vScale < 0) |
---|
7508 | 7743 | { |
---|
.. | .. |
---|
7582 | 7817 | |
---|
7583 | 7818 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7584 | 7819 | |
---|
7585 | | - if (modified || opposite) |
---|
| 7820 | + // Modified could snap |
---|
| 7821 | + if (//modified || |
---|
| 7822 | + opposite) |
---|
7586 | 7823 | { |
---|
7587 | 7824 | //assert(false); |
---|
7588 | 7825 | /* |
---|
.. | .. |
---|
7676 | 7913 | |
---|
7677 | 7914 | if (modified) |
---|
7678 | 7915 | { |
---|
7679 | | - // Rotate 90 degrees |
---|
| 7916 | + // Rotate 45 degrees |
---|
7680 | 7917 | angle /= (Math.PI / 4); |
---|
7681 | 7918 | angle = Math.floor(angle + 0.5); |
---|
7682 | 7919 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7717 | 7954 | break; |
---|
7718 | 7955 | |
---|
7719 | 7956 | case hitScale: // scale |
---|
7720 | | - double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32; |
---|
| 7957 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7721 | 7958 | double sign = 1; |
---|
7722 | 7959 | if (hScale < 0) |
---|
7723 | 7960 | { |
---|
.. | .. |
---|
7729 | 7966 | //hScale = 0.01; |
---|
7730 | 7967 | } |
---|
7731 | 7968 | |
---|
7732 | | - double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32; |
---|
| 7969 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7733 | 7970 | sign = 1; |
---|
7734 | 7971 | if (vScale < 0) |
---|
7735 | 7972 | { |
---|
.. | .. |
---|
7762 | 7999 | case 3: // '\001' |
---|
7763 | 8000 | if (modified || opposite) |
---|
7764 | 8001 | { |
---|
| 8002 | + if (modified) // && opposite) |
---|
| 8003 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8004 | + else |
---|
7765 | 8005 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7766 | | - LA.matScale(toParent, totalScale, 1, 1); |
---|
| 8006 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7767 | 8007 | } // vScale, 1); |
---|
7768 | 8008 | else |
---|
7769 | 8009 | { |
---|
7770 | 8010 | // EXCEPTION! |
---|
7771 | | - LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8011 | + LA.matScale(toParent, 1, totalScale, totalScale); |
---|
7772 | 8012 | } // vScale, 1); |
---|
7773 | 8013 | break; |
---|
7774 | 8014 | |
---|
7775 | 8015 | case 2: // '\002' |
---|
7776 | 8016 | if (modified || opposite) |
---|
7777 | 8017 | { |
---|
7778 | | - //LA.matScale(toParent, hScale, 1, vScale); |
---|
7779 | | - LA.matScale(toParent, 1, totalScale, 1); |
---|
| 8018 | + if (modified) // && opposite) |
---|
| 8019 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8020 | + else |
---|
| 8021 | + //LA.matScale(toParent, hScale, 1, vScale); |
---|
| 8022 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7780 | 8023 | } else |
---|
7781 | 8024 | { |
---|
7782 | 8025 | LA.matScale(toParent, totalScale, 1, totalScale); |
---|
.. | .. |
---|
7786 | 8029 | case 1: // '\003' |
---|
7787 | 8030 | if (modified || opposite) |
---|
7788 | 8031 | { |
---|
7789 | | - //LA.matScale(toParent, hScale, vScale, 1); |
---|
7790 | | - LA.matScale(toParent, 1, 1, totalScale); |
---|
| 8032 | + if (modified) // && opposite) |
---|
| 8033 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8034 | + else |
---|
| 8035 | + //LA.matScale(toParent, hScale, vScale, 1); |
---|
| 8036 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7791 | 8037 | } else |
---|
7792 | 8038 | { |
---|
7793 | 8039 | LA.matScale(toParent, totalScale, totalScale, 1); |
---|
.. | .. |
---|
7935 | 8181 | } // + super.toString(); |
---|
7936 | 8182 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
7937 | 8183 | |
---|
7938 | | - if (!Globals.ADVANCED) |
---|
7939 | | - return objname; |
---|
| 8184 | +// if (!Globals.ADVANCED) |
---|
| 8185 | +// return objname; |
---|
7940 | 8186 | |
---|
7941 | | - return objname + " " + System.identityHashCode(this); |
---|
| 8187 | + return objname + " " + System.identityHashCode(this); // + GetUUID() |
---|
7942 | 8188 | } |
---|
7943 | 8189 | |
---|
7944 | 8190 | public int hashCode() |
---|