.. | .. |
---|
5 | 5 | import java.util.Vector; |
---|
6 | 6 | |
---|
7 | 7 | import javax.media.j3d.Transform3D; |
---|
| 8 | +import javax.media.opengl.GL; |
---|
8 | 9 | import javax.vecmath.Vector3d; |
---|
9 | 10 | |
---|
10 | 11 | import javax.imageio.ImageIO; |
---|
.. | .. |
---|
13 | 14 | import //weka.core. |
---|
14 | 15 | matrix.Matrix; |
---|
15 | 16 | |
---|
| 17 | +import java.util.UUID; |
---|
| 18 | + |
---|
16 | 19 | //import net.sourceforge.sizeof.SizeOf; |
---|
17 | 20 | public class Object3D extends Vector<Object3D> implements java.io.Serializable, iSendInfo //, aurelienribon.tweenengine.TweenAccessor<Object3D> |
---|
18 | 21 | { |
---|
19 | 22 | //static final long serialVersionUID = -607422624994562685L; |
---|
20 | 23 | static final long serialVersionUID = 5022536242724664900L; |
---|
21 | 24 | |
---|
| 25 | + private UUID uuid = UUID.randomUUID(); |
---|
| 26 | + |
---|
22 | 27 | ScriptNode scriptnode; |
---|
| 28 | + |
---|
| 29 | + void InitOthers() |
---|
| 30 | + { |
---|
| 31 | + if (projectedVertices == null || projectedVertices.length <= 2) |
---|
| 32 | + { |
---|
| 33 | + projectedVertices = new Object3D.cVector2[3]; |
---|
| 34 | + } |
---|
| 35 | + for (int i = 0; i < 3; i++) |
---|
| 36 | + { |
---|
| 37 | + projectedVertices[i] = new cVector2(); // Others |
---|
| 38 | + } |
---|
| 39 | + projectedVertices[0].x = 100; // bump |
---|
| 40 | + } |
---|
23 | 41 | |
---|
24 | 42 | void MinMax(cVector minima, cVector maxima) |
---|
25 | 43 | { |
---|
.. | .. |
---|
142 | 160 | blockloop = true; |
---|
143 | 161 | child.RestoreSupports(); |
---|
144 | 162 | blockloop = false; |
---|
| 163 | + } |
---|
| 164 | +} |
---|
| 165 | + |
---|
| 166 | +void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 167 | +{ |
---|
| 168 | + if (hashtable.containsKey(GetUUID())) |
---|
| 169 | + { |
---|
| 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); |
---|
145 | 224 | } |
---|
146 | 225 | } |
---|
147 | 226 | |
---|
.. | .. |
---|
286 | 365 | } |
---|
287 | 366 | |
---|
288 | 367 | boolean live = false; |
---|
| 368 | + boolean dontselect = false; |
---|
289 | 369 | boolean hide = false; |
---|
290 | 370 | boolean link2master = false; // performs reset support/master at each frame |
---|
291 | 371 | boolean marked = false; // animation node |
---|
.. | .. |
---|
295 | 375 | boolean random = false; |
---|
296 | 376 | boolean speedup = false; |
---|
297 | 377 | boolean rewind = false; |
---|
| 378 | + |
---|
| 379 | + float NORMALPUSH = 0; |
---|
298 | 380 | |
---|
299 | 381 | Object3D support; |
---|
300 | 382 | |
---|
.. | .. |
---|
355 | 437 | |
---|
356 | 438 | int MemorySize() |
---|
357 | 439 | { |
---|
358 | | - if (memorysize == 0) |
---|
| 440 | + if (true) // memorysize == 0) |
---|
359 | 441 | { |
---|
360 | 442 | try |
---|
361 | 443 | { |
---|
.. | .. |
---|
415 | 497 | { |
---|
416 | 498 | Object3D copy = this; |
---|
417 | 499 | |
---|
418 | | - Camera parentcam = CameraPane.theRenderer.manipCamera; |
---|
| 500 | + Camera parentcam = Globals.theRenderer.ManipCamera(); |
---|
419 | 501 | |
---|
420 | | - if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0]) |
---|
| 502 | + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0]) |
---|
421 | 503 | { |
---|
422 | | - parentcam = CameraPane.theRenderer.cameras[1]; |
---|
| 504 | + parentcam = Globals.theRenderer.Cameras()[1]; |
---|
423 | 505 | } |
---|
424 | 506 | |
---|
425 | | - if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1]) |
---|
| 507 | + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1]) |
---|
426 | 508 | { |
---|
427 | | - parentcam = CameraPane.theRenderer.cameras[0]; |
---|
| 509 | + parentcam = Globals.theRenderer.Cameras()[0]; |
---|
428 | 510 | } |
---|
429 | 511 | |
---|
430 | 512 | if (this == parentcam) |
---|
.. | .. |
---|
432 | 514 | //assert(this instanceof Camera); |
---|
433 | 515 | |
---|
434 | 516 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
435 | | - LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt); |
---|
| 517 | + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt()); |
---|
436 | 518 | } |
---|
437 | 519 | |
---|
438 | 520 | copy.marked ^= true; |
---|
.. | .. |
---|
452 | 534 | //assert(this instanceof Camera); |
---|
453 | 535 | |
---|
454 | 536 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
455 | | - LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt); |
---|
| 537 | + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt()); |
---|
456 | 538 | } |
---|
457 | 539 | |
---|
458 | 540 | copy.Touch(); // display list issue |
---|
.. | .. |
---|
587 | 669 | return; |
---|
588 | 670 | } |
---|
589 | 671 | |
---|
590 | | - if (CameraPane.fromscript) |
---|
| 672 | + if (Globals.fromscript) |
---|
591 | 673 | { |
---|
592 | 674 | transformcount = 0; |
---|
593 | 675 | return; |
---|
.. | .. |
---|
745 | 827 | |
---|
746 | 828 | int GetTransformCount() |
---|
747 | 829 | { |
---|
748 | | - // marde pour serialization de Texture |
---|
| 830 | + // patch pour serialization de Texture |
---|
749 | 831 | resetmaxcount(); |
---|
750 | 832 | resettransformcount(); |
---|
751 | 833 | resetstep(); |
---|
.. | .. |
---|
758 | 840 | if (step == 0) |
---|
759 | 841 | step = 1; |
---|
760 | 842 | if (maxcount == 0) |
---|
761 | | - maxcount = 2048; // 4; |
---|
| 843 | + maxcount = 128; // 2048; // 4; |
---|
762 | 844 | // if (acceleration == 0) |
---|
763 | 845 | // acceleration = 10; |
---|
764 | 846 | if (delay == 0) // serial |
---|
.. | .. |
---|
779 | 861 | // factor = CameraPane.STEP; |
---|
780 | 862 | // } |
---|
781 | 863 | |
---|
782 | | - if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount) |
---|
| 864 | + if (marked && Globals.isLIVE() && live && |
---|
| 865 | + //TEMP21aug2018 |
---|
| 866 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 867 | + currentframe != Globals.framecount) |
---|
783 | 868 | { |
---|
784 | | - currentframe = CameraPane.framecount; |
---|
| 869 | + currentframe = Globals.framecount; |
---|
785 | 870 | |
---|
786 | 871 | // System.err.println("transformcount = " + transformcount); |
---|
787 | 872 | // System.err.println("factor = " + factor); |
---|
.. | .. |
---|
893 | 978 | fromParent = null; // LA.newMatrix(); |
---|
894 | 979 | bRep = null; // new BoundaryRep(); |
---|
895 | 980 | |
---|
| 981 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 982 | + { |
---|
| 983 | + name = oname; |
---|
| 984 | + } |
---|
| 985 | + |
---|
896 | 986 | /* |
---|
897 | 987 | float hue = (float)Math.random(); |
---|
898 | 988 | Color col; |
---|
.. | .. |
---|
935 | 1025 | |
---|
936 | 1026 | public Object clone() |
---|
937 | 1027 | { |
---|
938 | | - return GraphreeD.clone(this); |
---|
| 1028 | + return Grafreed.clone(this); |
---|
939 | 1029 | } |
---|
940 | 1030 | |
---|
941 | 1031 | Object3D copyExpand() |
---|
.. | .. |
---|
1446 | 1536 | // if (other == null) |
---|
1447 | 1537 | // return; |
---|
1448 | 1538 | |
---|
1449 | | - System.out.println("Link support this = " + this + "; other = " + other); |
---|
| 1539 | + if (other != null) |
---|
| 1540 | + { |
---|
| 1541 | + BoundaryRep.SEUIL = other.material.cameralight; |
---|
| 1542 | + |
---|
| 1543 | + // Set default to 0.1 |
---|
| 1544 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
| 1545 | + System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
| 1546 | + } |
---|
| 1547 | + |
---|
| 1548 | + System.out.println("Link this = " + this + "; support = " + other); |
---|
1450 | 1549 | |
---|
1451 | 1550 | //if (bRep != null) |
---|
1452 | 1551 | // bRep.linkVerticesThis(other.bRep); |
---|
.. | .. |
---|
1701 | 1800 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1702 | 1801 | o.bRep = transientrep; |
---|
1703 | 1802 | if (clone) |
---|
1704 | | - o.bRep = (BoundaryRep) GraphreeD.clone(transientrep); |
---|
| 1803 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1705 | 1804 | o.CreateMaterial(); |
---|
1706 | 1805 | o.SetAttributes(this, -1); |
---|
1707 | 1806 | //parent |
---|
.. | .. |
---|
1714 | 1813 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1715 | 1814 | o.bRep = bRep; |
---|
1716 | 1815 | if (clone) |
---|
1717 | | - o.bRep = (BoundaryRep) GraphreeD.clone(bRep); |
---|
| 1816 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1718 | 1817 | o.CreateMaterial(); |
---|
1719 | 1818 | //o.overwriteThis(this, -1); |
---|
1720 | 1819 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1756 | 1855 | // { |
---|
1757 | 1856 | // assert(bRep == null); |
---|
1758 | 1857 | // Object3D o = new Object3D("Geometry:" + this.name); |
---|
1759 | | -// o.bRep = (BoundaryRep) GraphreeD.clone(transientrep); |
---|
| 1858 | +// o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
1760 | 1859 | // o.CreateMaterial(); |
---|
1761 | 1860 | // parent.addChild(o); |
---|
1762 | 1861 | // } |
---|
.. | .. |
---|
1765 | 1864 | // { |
---|
1766 | 1865 | // assert(transientrep == null); |
---|
1767 | 1866 | // Object3D o = new Object3D("Geometry:" + this.name); |
---|
1768 | | -// o.bRep = (BoundaryRep) GraphreeD.clone(bRep); |
---|
| 1867 | +// o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
1769 | 1868 | // o.CreateMaterial(); |
---|
1770 | 1869 | // parent.addChild(o); |
---|
1771 | 1870 | // } |
---|
.. | .. |
---|
1801 | 1900 | if (obj.name == null) |
---|
1802 | 1901 | continue; // can't be a null one |
---|
1803 | 1902 | |
---|
| 1903 | + // Try perfect match first. |
---|
1804 | 1904 | if (n.equals(obj.name)) |
---|
1805 | 1905 | { |
---|
1806 | 1906 | theobj = obj; |
---|
1807 | 1907 | count++; |
---|
1808 | 1908 | } |
---|
1809 | 1909 | } |
---|
| 1910 | + |
---|
| 1911 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1810 | 1912 | |
---|
1811 | 1913 | if (count != 1) |
---|
1812 | 1914 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
1816 | 1918 | if (obj.name == null) |
---|
1817 | 1919 | continue; // can't be a null one |
---|
1818 | 1920 | |
---|
1819 | | - //if (n.contains(obj.name)) // dec 2013 name.split(":")[0])) // Poser generates a count |
---|
1820 | | - if (n.startsWith(obj.name)) |
---|
| 1921 | + String name = obj.name.split(":")[0]; // Poser generates a count |
---|
| 1922 | + //if (n.startsWith(obj.name)) |
---|
| 1923 | + if (n.contains(name)) |
---|
1821 | 1924 | { |
---|
1822 | 1925 | theobj = obj; |
---|
1823 | 1926 | count++; |
---|
.. | .. |
---|
2120 | 2223 | if (/*parent != null &&*/ material == null) |
---|
2121 | 2224 | { |
---|
2122 | 2225 | material = new cMaterial(GetMaterial()); |
---|
2123 | | - if (projectedVertices == null || projectedVertices.length <= 2) |
---|
2124 | | - { |
---|
2125 | | - projectedVertices = new Object3D.cVector2[3]; |
---|
2126 | | - } |
---|
2127 | | - for (int i = 0; i < 3; i++) |
---|
2128 | | - { |
---|
2129 | | - projectedVertices[i] = new cVector2(); // Others |
---|
2130 | | - } |
---|
2131 | | - projectedVertices[0].x = 100; // bump |
---|
| 2226 | + |
---|
| 2227 | + InitOthers(); |
---|
2132 | 2228 | |
---|
2133 | 2229 | if (this instanceof Camera) |
---|
2134 | 2230 | { |
---|
.. | .. |
---|
2278 | 2374 | { |
---|
2279 | 2375 | if (newWindow) |
---|
2280 | 2376 | { |
---|
| 2377 | + new Exception().printStackTrace(); |
---|
2281 | 2378 | System.exit(0); |
---|
2282 | 2379 | if (parent != null) |
---|
2283 | 2380 | { |
---|
.. | .. |
---|
2454 | 2551 | return retval; |
---|
2455 | 2552 | } |
---|
2456 | 2553 | |
---|
2457 | | - void doEditDrag(ClickInfo info) |
---|
| 2554 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2458 | 2555 | { |
---|
2459 | 2556 | switch (doSomething) |
---|
2460 | 2557 | { |
---|
2461 | 2558 | case 1: // '\001' |
---|
2462 | 2559 | //super. |
---|
2463 | | - doEditDrag0(info); |
---|
| 2560 | + doEditDrag0(info, opposite); |
---|
2464 | 2561 | break; |
---|
2465 | 2562 | |
---|
2466 | 2563 | case 2: // '\002' |
---|
.. | .. |
---|
2473 | 2570 | { |
---|
2474 | 2571 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2475 | 2572 | //childToDrag.doEditDrag(info); |
---|
2476 | | - sel.doEditDrag(info); |
---|
| 2573 | + sel.doEditDrag(info, opposite); |
---|
2477 | 2574 | } else |
---|
2478 | 2575 | { |
---|
2479 | 2576 | //super. |
---|
2480 | | - doEditDrag0(info); |
---|
| 2577 | + doEditDrag0(info, opposite); |
---|
2481 | 2578 | } |
---|
2482 | 2579 | } |
---|
2483 | 2580 | break; |
---|
.. | .. |
---|
2732 | 2829 | blockloop = false; |
---|
2733 | 2830 | } |
---|
2734 | 2831 | |
---|
| 2832 | + void GenNormalsMINE() |
---|
| 2833 | + { |
---|
| 2834 | + if (blockloop) |
---|
| 2835 | + return; |
---|
| 2836 | + |
---|
| 2837 | + blockloop = true; |
---|
| 2838 | + GenNormalsMINE0(); |
---|
| 2839 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2840 | + { |
---|
| 2841 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2842 | + if (child == null) |
---|
| 2843 | + continue; |
---|
| 2844 | + child.GenNormalsMINE(); |
---|
| 2845 | +// Children().release(i); |
---|
| 2846 | + } |
---|
| 2847 | + blockloop = false; |
---|
| 2848 | + } |
---|
| 2849 | + |
---|
2735 | 2850 | void ClearColors() |
---|
2736 | 2851 | { |
---|
2737 | 2852 | if (blockloop) |
---|
.. | .. |
---|
2866 | 2981 | { |
---|
2867 | 2982 | if (bRep != null) |
---|
2868 | 2983 | { |
---|
2869 | | - bRep.GenUV(); |
---|
| 2984 | + bRep.GenUV(); //1); |
---|
| 2985 | + //bRep.UnfoldUV(); |
---|
2870 | 2986 | Touch(); |
---|
2871 | 2987 | } |
---|
2872 | 2988 | } |
---|
.. | .. |
---|
2876 | 2992 | if (bRep != null) |
---|
2877 | 2993 | { |
---|
2878 | 2994 | bRep.GenerateNormals(crease); |
---|
| 2995 | + Touch(); |
---|
| 2996 | + } |
---|
| 2997 | + } |
---|
| 2998 | + |
---|
| 2999 | + void GenNormalsMINE0() |
---|
| 3000 | + { |
---|
| 3001 | + if (bRep != null) |
---|
| 3002 | + { |
---|
| 3003 | + bRep.GenerateNormalsMINE(); |
---|
2879 | 3004 | Touch(); |
---|
2880 | 3005 | } |
---|
2881 | 3006 | } |
---|
.. | .. |
---|
2932 | 3057 | blockloop = false; |
---|
2933 | 3058 | } |
---|
2934 | 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 | + |
---|
2935 | 3087 | void TransformGeometry() |
---|
2936 | 3088 | { |
---|
2937 | 3089 | Object3D obj = this; |
---|
.. | .. |
---|
3153 | 3305 | |
---|
3154 | 3306 | BoundaryRep sup = bRep.support; |
---|
3155 | 3307 | bRep.support = null; |
---|
3156 | | - BoundaryRep temprep = (BoundaryRep) GraphreeD.clone(bRep); |
---|
| 3308 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3157 | 3309 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3158 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3310 | + |
---|
| 3311 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3312 | + |
---|
3159 | 3313 | bRep = temprep; |
---|
3160 | 3314 | bRep.support = sup; |
---|
3161 | 3315 | Touch(); |
---|
.. | .. |
---|
3677 | 3831 | if (child == null) |
---|
3678 | 3832 | continue; |
---|
3679 | 3833 | |
---|
3680 | | - if (GraphreeD.RENDERME > 0) |
---|
| 3834 | + if (Grafreed.RENDERME > 0) |
---|
3681 | 3835 | { |
---|
3682 | 3836 | if (child instanceof Merge) |
---|
3683 | 3837 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3717 | 3871 | |
---|
3718 | 3872 | boolean getCentroid(cVector centroid, boolean xform) |
---|
3719 | 3873 | { |
---|
3720 | | - assert(false); |
---|
| 3874 | +// for speaker assert(false); |
---|
3721 | 3875 | if (blockloop) |
---|
3722 | 3876 | return false; |
---|
3723 | 3877 | |
---|
.. | .. |
---|
3828 | 3982 | if (child == null) |
---|
3829 | 3983 | continue; |
---|
3830 | 3984 | |
---|
3831 | | - if (GraphreeD.RENDERME > 0) |
---|
| 3985 | + if (Grafreed.RENDERME > 0) |
---|
3832 | 3986 | { |
---|
3833 | 3987 | if (child instanceof Merge) |
---|
3834 | 3988 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4023 | 4177 | if (child == null) |
---|
4024 | 4178 | continue; |
---|
4025 | 4179 | |
---|
4026 | | - if (GraphreeD.RENDERME > 0) |
---|
| 4180 | + if (Grafreed.RENDERME > 0) |
---|
4027 | 4181 | { |
---|
4028 | 4182 | if (child instanceof Merge) |
---|
4029 | 4183 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4111 | 4265 | if (blockloop) |
---|
4112 | 4266 | return; |
---|
4113 | 4267 | |
---|
4114 | | - for (int i=0; i<size(); i++) |
---|
| 4268 | + for (int i=0; i<Size(); i++) |
---|
4115 | 4269 | { |
---|
4116 | 4270 | if (get(i).parent != this) |
---|
4117 | 4271 | { |
---|
.. | .. |
---|
4120 | 4274 | } |
---|
4121 | 4275 | blockloop = true; |
---|
4122 | 4276 | get(i).RepairParent(); |
---|
| 4277 | + blockloop = false; |
---|
| 4278 | + } |
---|
| 4279 | + } |
---|
| 4280 | + |
---|
| 4281 | + void RepairShadow() |
---|
| 4282 | + { |
---|
| 4283 | + if (blockloop) |
---|
| 4284 | + return; |
---|
| 4285 | + |
---|
| 4286 | + if (this.material != null) |
---|
| 4287 | + this.InitOthers(); |
---|
| 4288 | + |
---|
| 4289 | + for (int i=0; i<Size(); i++) |
---|
| 4290 | + { |
---|
| 4291 | + blockloop = true; |
---|
| 4292 | + get(i).RepairShadow(); |
---|
4123 | 4293 | blockloop = false; |
---|
4124 | 4294 | } |
---|
4125 | 4295 | } |
---|
.. | .. |
---|
4515 | 4685 | |
---|
4516 | 4686 | Object3D GetFileRoot() |
---|
4517 | 4687 | { |
---|
| 4688 | + if (overflow) |
---|
| 4689 | + return null; |
---|
| 4690 | + |
---|
| 4691 | + overflow = true; |
---|
| 4692 | + |
---|
| 4693 | + Object3D pfr = null; |
---|
| 4694 | + |
---|
4518 | 4695 | if (parent == null && fileparent == null) |
---|
4519 | | - return this; |
---|
| 4696 | + pfr = this; |
---|
4520 | 4697 | |
---|
4521 | 4698 | if (parent == null && fileparent != null) // V4.gfd??? |
---|
4522 | | - return fileparent; |
---|
| 4699 | + pfr = fileparent; |
---|
4523 | 4700 | |
---|
4524 | | - if (parent == null) |
---|
4525 | | - return this; |
---|
| 4701 | + if (pfr == null && parent == null) |
---|
| 4702 | + pfr = this; |
---|
4526 | 4703 | |
---|
4527 | | - return parent.GetFileRoot(); |
---|
| 4704 | + if (pfr == null) |
---|
| 4705 | + pfr = parent.GetFileRoot(); |
---|
| 4706 | + |
---|
| 4707 | + overflow = false; |
---|
| 4708 | + |
---|
| 4709 | + return pfr; |
---|
4528 | 4710 | } |
---|
4529 | 4711 | |
---|
4530 | 4712 | cTreePath GetPath() |
---|
.. | .. |
---|
4602 | 4784 | |
---|
4603 | 4785 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4604 | 4786 | { |
---|
4605 | | - if (hide) |
---|
| 4787 | + if (hide || dontselect) |
---|
4606 | 4788 | return null; |
---|
4607 | 4789 | |
---|
4608 | 4790 | if (count <= 0) |
---|
.. | .. |
---|
4628 | 4810 | |
---|
4629 | 4811 | cTreePath Select(int indexcount, boolean deselect) |
---|
4630 | 4812 | { |
---|
4631 | | - if (hide) |
---|
| 4813 | + if (hide || dontselect) |
---|
4632 | 4814 | return null; |
---|
4633 | 4815 | |
---|
4634 | 4816 | if (count <= 0) |
---|
.. | .. |
---|
4778 | 4960 | return globalTransform; |
---|
4779 | 4961 | } |
---|
4780 | 4962 | |
---|
4781 | | - void PreprocessOcclusion(CameraPane cp) |
---|
| 4963 | + void PreprocessOcclusion(iCameraPane cp) |
---|
4782 | 4964 | { |
---|
4783 | 4965 | /* |
---|
4784 | 4966 | if (AOdone) |
---|
.. | .. |
---|
4925 | 5107 | } else // |
---|
4926 | 5108 | if (editWindow != null) |
---|
4927 | 5109 | { |
---|
4928 | | - editWindow.cameraView.lighttouched = true; |
---|
| 5110 | + //editWindow.cameraView.lighttouched = true; |
---|
| 5111 | + Globals.lighttouched = true; |
---|
4929 | 5112 | } |
---|
4930 | 5113 | } |
---|
4931 | 5114 | |
---|
.. | .. |
---|
5079 | 5262 | |
---|
5080 | 5263 | // System.out.println("Fullname = " + fullname); |
---|
5081 | 5264 | |
---|
5082 | | - if (fullname.name.indexOf(":") == -1) |
---|
5083 | | - 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(":")); |
---|
5084 | 5270 | |
---|
5085 | | - 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]; |
---|
5086 | 5293 | } |
---|
5087 | 5294 | |
---|
5088 | 5295 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5091 | 5298 | return ""; |
---|
5092 | 5299 | |
---|
5093 | 5300 | // System.out.println("Fullname = " + fullname); |
---|
5094 | | - if (fullname.name.indexOf(":") == -1) |
---|
5095 | | - return ""; |
---|
5096 | | - |
---|
5097 | | - 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]; |
---|
5098 | 5333 | } |
---|
5099 | 5334 | |
---|
5100 | 5335 | String GetPigmentTexture() |
---|
.. | .. |
---|
5168 | 5403 | System.out.print("; textures = " + textures); |
---|
5169 | 5404 | System.out.println("; usedtextures = " + usedtextures); |
---|
5170 | 5405 | |
---|
5171 | | - if (GetTextures() == null) |
---|
| 5406 | + if (GetTextures() == null) // What is that?? |
---|
5172 | 5407 | GetTextures().name = ":"; |
---|
5173 | 5408 | |
---|
5174 | 5409 | String texname = tex; |
---|
.. | .. |
---|
5199 | 5434 | child.ResetPigmentTexture(); |
---|
5200 | 5435 | blockloop = false; |
---|
5201 | 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; |
---|
5202 | 5474 | } |
---|
5203 | 5475 | |
---|
5204 | 5476 | void SetBumpTexture(String tex) |
---|
.. | .. |
---|
5237 | 5509 | } |
---|
5238 | 5510 | } |
---|
5239 | 5511 | |
---|
5240 | | - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5512 | + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5241 | 5513 | { |
---|
5242 | 5514 | Draw(display, root, selected, blocked); |
---|
5243 | 5515 | } |
---|
5244 | 5516 | |
---|
5245 | | - static cMaterial[] materialstack = new cMaterial[65536]; |
---|
5246 | | - static boolean[] selectedstack = new boolean[65536]; |
---|
5247 | | - static int materialdepth = 0; |
---|
5248 | | - |
---|
5249 | 5517 | boolean NeedSupport() |
---|
5250 | 5518 | { |
---|
5251 | 5519 | return |
---|
5252 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5520 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
5253 | 5521 | // PROBLEM with CROWD!! |
---|
5254 | | - && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD); |
---|
| 5522 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5255 | 5523 | } |
---|
5256 | 5524 | |
---|
| 5525 | + static boolean DEBUG_SELECTION = false; |
---|
5257 | 5526 | |
---|
5258 | | - void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5527 | + void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5259 | 5528 | { |
---|
5260 | 5529 | Invariants(); // june 2013 |
---|
5261 | 5530 | |
---|
.. | .. |
---|
5264 | 5533 | // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame); |
---|
5265 | 5534 | } |
---|
5266 | 5535 | |
---|
5267 | | - if (display.drawMode == CameraPane.SELECTION && |
---|
5268 | | - hide) |
---|
| 5536 | + if (display.DrawMode() == iCameraPane.SELECTION && |
---|
| 5537 | + (hide || dontselect)) |
---|
5269 | 5538 | return; |
---|
5270 | 5539 | |
---|
5271 | 5540 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5280 | 5549 | if (name != null && name.contains("sclera")) |
---|
5281 | 5550 | name = name; |
---|
5282 | 5551 | |
---|
5283 | | - if (this instanceof CheckerIG) |
---|
| 5552 | + if (this instanceof Checker) |
---|
5284 | 5553 | return; |
---|
5285 | 5554 | |
---|
5286 | | - if (display.drawMode == display.SHADOW && PASSTEST) |
---|
| 5555 | + if (display.DrawMode() == display.SHADOW && PASSTEST) |
---|
5287 | 5556 | return; |
---|
5288 | 5557 | |
---|
5289 | 5558 | if (count <= 0) |
---|
.. | .. |
---|
5291 | 5560 | return; |
---|
5292 | 5561 | } |
---|
5293 | 5562 | |
---|
5294 | | - if ((//display.drawMode == CameraPane.SHADOW || |
---|
5295 | | - display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency()) |
---|
| 5563 | + if ((//display.DrawMode() == CameraPane.SHADOW || |
---|
| 5564 | + display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency()) |
---|
5296 | 5565 | { |
---|
5297 | 5566 | return; |
---|
5298 | 5567 | } |
---|
5299 | 5568 | |
---|
5300 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5569 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5301 | 5570 | |
---|
5302 | 5571 | /* |
---|
5303 | 5572 | if (touched) |
---|
.. | .. |
---|
5333 | 5602 | |
---|
5334 | 5603 | boolean compiled = false; |
---|
5335 | 5604 | |
---|
5336 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 5605 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5337 | 5606 | |
---|
5338 | | - if (!selectmode && //display.drawMode != display.SELECTION && |
---|
| 5607 | + if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5339 | 5608 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5340 | 5609 | { |
---|
5341 | | - display.lighttouched = true; |
---|
| 5610 | + Globals.lighttouched = true; |
---|
5342 | 5611 | } // all panes... |
---|
5343 | | - //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW && |
---|
5344 | | - if (bRep != null && usecalllists && !selectmode && // june 2013 display.drawMode != display.SHADOW && |
---|
| 5612 | + //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
| 5613 | + if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5345 | 5614 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5346 | 5615 | { |
---|
5347 | 5616 | if (!(this instanceof Composite)) |
---|
.. | .. |
---|
5349 | 5618 | //if (displaylist == -1 && usecalllists) |
---|
5350 | 5619 | if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
5351 | 5620 | { |
---|
5352 | | - bRep.displaylist = gl.glGenLists(1); |
---|
| 5621 | + bRep.displaylist = display.GenList(); |
---|
5353 | 5622 | assert(bRep.displaylist != 0); |
---|
5354 | 5623 | // System.err.println("glGenLists: " + bRep.displaylist + " for " + this); |
---|
5355 | 5624 | //System.out.println("\tgen list " + list); |
---|
.. | .. |
---|
5361 | 5630 | if (usecalllists) |
---|
5362 | 5631 | { |
---|
5363 | 5632 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5364 | | - gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE); |
---|
| 5633 | + display.NewList(bRep.displaylist); |
---|
5365 | 5634 | } |
---|
| 5635 | + |
---|
5366 | 5636 | CallList(display, root, selected, blocked); |
---|
| 5637 | + |
---|
5367 | 5638 | // compiled = true; |
---|
5368 | 5639 | if (usecalllists) |
---|
5369 | 5640 | { |
---|
5370 | 5641 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5371 | | - gl.glEndList(); |
---|
| 5642 | + display.EndList(); |
---|
5372 | 5643 | } |
---|
5373 | 5644 | //gl.glDrawBuffer(gl.GL_BACK); |
---|
5374 | 5645 | // XXX touched = false; |
---|
5375 | | - display.lighttouched = true; // all panes... |
---|
| 5646 | + Globals.lighttouched = true; // all panes... |
---|
5376 | 5647 | } |
---|
5377 | 5648 | |
---|
5378 | 5649 | touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false; |
---|
.. | .. |
---|
5411 | 5682 | |
---|
5412 | 5683 | // frustum culling |
---|
5413 | 5684 | if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid |
---|
5414 | | - && display.drawMode != CameraPane.SELECTION) |
---|
| 5685 | + && display.DrawMode() != iCameraPane.SELECTION) |
---|
5415 | 5686 | { |
---|
5416 | | - if (display.drawMode == CameraPane.SHADOW) |
---|
| 5687 | + if (display.DrawMode() == iCameraPane.SHADOW) |
---|
5417 | 5688 | { |
---|
5418 | 5689 | if (!link2master // tricky to cull in shadow mode. |
---|
5419 | | - && GetBRep().FrustumCull(this, gl, display.lightCamera, true)) |
---|
| 5690 | + && GetBRep().FrustumCull(this, null, display.LightCamera(), true)) |
---|
5420 | 5691 | { |
---|
5421 | 5692 | //System.out.print("CULLED"); |
---|
5422 | 5693 | culled = true; |
---|
.. | .. |
---|
5424 | 5695 | } |
---|
5425 | 5696 | else |
---|
5426 | 5697 | //GetBRep().getBounds(v0, v1, this); |
---|
5427 | | - if (GetBRep().FrustumCull(this, gl, display.renderCamera, false)) |
---|
| 5698 | + if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false)) |
---|
5428 | 5699 | culled = true; |
---|
5429 | 5700 | |
---|
5430 | 5701 | // LA.xformPos(v0, display.renderCamera.toScreen, v0); |
---|
.. | .. |
---|
5460 | 5731 | |
---|
5461 | 5732 | |
---|
5462 | 5733 | if (!culled) |
---|
5463 | | - if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION) |
---|
| 5734 | + if (display.DrawMode() == display.SELECTION || display.IsDebugSelection()) |
---|
5464 | 5735 | { |
---|
5465 | 5736 | if (GetBRep() != null) |
---|
5466 | 5737 | { |
---|
5467 | | - CameraPane.NextIndex(this, gl); |
---|
| 5738 | + display.NextIndex(); |
---|
5468 | 5739 | // vertex color conflict : gl.glCallList(list); |
---|
5469 | 5740 | DrawNode(display, root, selected); |
---|
5470 | 5741 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5486 | 5757 | color[2] /= 2; |
---|
5487 | 5758 | gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0); |
---|
5488 | 5759 | */ |
---|
5489 | | - if (material != null) |
---|
5490 | | - { |
---|
5491 | | - materialstack[materialdepth] = material; |
---|
5492 | | - selectedstack[materialdepth] = selected; |
---|
5493 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5494 | | - //System.out.println("material " + material); |
---|
5495 | | - //Applet3D.tracein(this, selected); |
---|
5496 | | - display.vector2buffer = projectedVertices; |
---|
5497 | | - if (this instanceof Camera) |
---|
5498 | | - { |
---|
5499 | | - display.options1[0] = material.shift; |
---|
5500 | | - //System.out.println("shift " + material.shift); |
---|
5501 | | - display.options1[1] = material.lightarea; |
---|
5502 | | - display.options1[2] = material.shadowbias; |
---|
5503 | | - display.options1[3] = material.aniso; |
---|
5504 | | - display.options1[4] = material.anisoV; |
---|
5505 | | - display.options2[0] = material.opacity; |
---|
5506 | | - display.options2[1] = material.diffuse; |
---|
5507 | | - display.options2[2] = material.factor; |
---|
5508 | | - |
---|
5509 | | - cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3); |
---|
5510 | | - display.options3[3] = material.cameralight/0.2f; |
---|
5511 | | - |
---|
5512 | | - // if (display.CURRENTANTIALIAS > 0) |
---|
5513 | | - // display.options3[3] /= 4; |
---|
5514 | | - |
---|
5515 | | - /* |
---|
5516 | | - System.out.println("Focus = " + display.options1[0]); |
---|
5517 | | - System.out.println("Aperture = " + display.options1[1]); |
---|
5518 | | - System.out.println("ShadowBlur = " + display.options1[2]); |
---|
5519 | | - System.out.println("Antialiasing = " + display.options1[3]); |
---|
5520 | | - System.out.println("Fog = " + display.options2[0]); |
---|
5521 | | - System.out.println("Intensity = " + display.options2[1]); |
---|
5522 | | - System.out.println("Elevation = " + display.options2[2]); |
---|
5523 | | - /**/ |
---|
5524 | | - } else |
---|
5525 | | - { |
---|
5526 | | - material.Draw(display, selected); |
---|
5527 | | - } |
---|
5528 | | - } else |
---|
5529 | | - { |
---|
5530 | | - if (selected && CameraPane.flash) |
---|
5531 | | - { |
---|
5532 | | - display.modelParams4[1] = 100; |
---|
5533 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5534 | | - } |
---|
5535 | | - } |
---|
| 5760 | + display.PushMaterial(this, selected); |
---|
5536 | 5761 | |
---|
5537 | 5762 | //System.out.println("call list " + list); |
---|
5538 | 5763 | //System.out.println(); |
---|
.. | .. |
---|
5551 | 5776 | tex = GetTextures(); |
---|
5552 | 5777 | } |
---|
5553 | 5778 | |
---|
5554 | | - 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 | + } |
---|
5555 | 5790 | |
---|
5556 | 5791 | if (!compiled) |
---|
5557 | 5792 | { |
---|
.. | .. |
---|
5567 | 5802 | |
---|
5568 | 5803 | // System.err.println("glCallList: " + bRep.displaylist + " for " + this); |
---|
5569 | 5804 | assert(bRep.displaylist != 0); |
---|
5570 | | - gl.glCallList(bRep.displaylist); |
---|
| 5805 | + display.CallList(bRep.displaylist); |
---|
5571 | 5806 | // june 2013 drawSelf(display, root, selected); |
---|
5572 | 5807 | } |
---|
5573 | 5808 | } |
---|
5574 | 5809 | } |
---|
5575 | 5810 | |
---|
5576 | | - display.ReleaseTextures(tex); |
---|
5577 | | - |
---|
5578 | | - //if (parent != null && parent.GetMaterial() != null) |
---|
5579 | | - // parent.GetMaterial().Draw(display, parent.IsSelected(this)); |
---|
5580 | | - if (material != null) |
---|
5581 | | - { |
---|
5582 | | - materialdepth -= 1; |
---|
5583 | | - if (materialdepth > 0) |
---|
5584 | | - { |
---|
5585 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5586 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5587 | | - } |
---|
5588 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5589 | | - } else if (selected && CameraPane.flash && GetMaterial() != null) |
---|
5590 | | - { |
---|
5591 | | - display.modelParams4[1] = GetMaterial().cameralight; |
---|
5592 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5593 | | - } |
---|
| 5811 | + if (!failed) |
---|
| 5812 | + display.ReleaseTextures(tex); |
---|
| 5813 | + |
---|
| 5814 | + display.PopMaterial(this, selected); |
---|
5594 | 5815 | } |
---|
5595 | 5816 | |
---|
5596 | 5817 | if (this instanceof Texture || this instanceof TextureNode) |
---|
.. | .. |
---|
5632 | 5853 | // resetMasterNode(); |
---|
5633 | 5854 | } |
---|
5634 | 5855 | |
---|
5635 | | - void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5856 | + void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5636 | 5857 | { |
---|
5637 | 5858 | if (GetBRep() == null) |
---|
5638 | 5859 | { |
---|
.. | .. |
---|
5715 | 5936 | boolean flipV = false; // true; |
---|
5716 | 5937 | int texres = 0; // 0 = low, 1 = normal, 2 = high res texture |
---|
5717 | 5938 | |
---|
5718 | | - void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5939 | + void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5719 | 5940 | { |
---|
| 5941 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 5942 | + return; |
---|
| 5943 | + |
---|
5720 | 5944 | if (hide) |
---|
5721 | 5945 | return; |
---|
5722 | 5946 | // shadow optimisation |
---|
.. | .. |
---|
5774 | 5998 | // // ??????????????????????????? Touch(); |
---|
5775 | 5999 | // } |
---|
5776 | 6000 | |
---|
5777 | | - if (material != null) |
---|
5778 | | - { |
---|
5779 | | - materialstack[materialdepth] = material; |
---|
5780 | | - selectedstack[materialdepth] = selected; |
---|
5781 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5782 | | - //System.out.println("material " + material); |
---|
5783 | | - //Applet3D.tracein("selected ", selected); |
---|
5784 | | - display.vector2buffer = projectedVertices; |
---|
5785 | | - material.Draw(display, selected); |
---|
5786 | | - } |
---|
| 6001 | +display.PushMaterial2(this, selected); |
---|
5787 | 6002 | |
---|
5788 | 6003 | Object3D child; |
---|
5789 | 6004 | boolean sel; |
---|
.. | .. |
---|
5807 | 6022 | if (!child.HasTransparency()) |
---|
5808 | 6023 | { |
---|
5809 | 6024 | sel = root != null && root.selection != null && root.selection.indexOf(child) != -1; |
---|
5810 | | - // GraphreeD.tracein("draw ", child); |
---|
| 6025 | + // GrafreeD.tracein("draw ", child); |
---|
5811 | 6026 | boolean wasblocked = blockdraw; |
---|
5812 | 6027 | blockdraw = true; |
---|
5813 | 6028 | child.draw(display, root, selected || sel, wasblocked || blocked); // || child.IsSelected()); |
---|
5814 | 6029 | blockdraw = false; |
---|
5815 | | - // GraphreeD.traceout("draw ", child); |
---|
| 6030 | + // GrafreeD.traceout("draw ", child); |
---|
5816 | 6031 | } |
---|
5817 | 6032 | |
---|
5818 | 6033 | release(i); |
---|
.. | .. |
---|
5835 | 6050 | */ |
---|
5836 | 6051 | //depth += 1; |
---|
5837 | 6052 | |
---|
5838 | | - if (material != null) |
---|
5839 | | - { |
---|
5840 | | - materialdepth -= 1; |
---|
5841 | | - if (materialdepth > 0) |
---|
5842 | | - { |
---|
5843 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5844 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5845 | | - } |
---|
5846 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5847 | | - //else |
---|
5848 | | - //material.Draw(display, false); |
---|
5849 | | - } |
---|
5850 | | - |
---|
| 6053 | +display.PopMaterial2(this); |
---|
5851 | 6054 | /* |
---|
5852 | 6055 | display.ReleaseTextures(tex); |
---|
5853 | 6056 | */ |
---|
.. | .. |
---|
5858 | 6061 | |
---|
5859 | 6062 | //static cVector min,max; |
---|
5860 | 6063 | |
---|
5861 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 6064 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
5862 | 6065 | { |
---|
5863 | | - if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 6066 | + if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5864 | 6067 | return; // no shadow for transparent objects |
---|
| 6068 | + |
---|
| 6069 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6070 | + return; |
---|
5865 | 6071 | |
---|
5866 | 6072 | if (hide) |
---|
5867 | 6073 | return; |
---|
.. | .. |
---|
5903 | 6109 | return; |
---|
5904 | 6110 | } |
---|
5905 | 6111 | |
---|
| 6112 | + //bRep.GenUV(1/material.diffuseness); |
---|
5906 | 6113 | // bRep.lock = true; |
---|
5907 | 6114 | |
---|
5908 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 6115 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5909 | 6116 | |
---|
5910 | | - if (CameraPane.BOXMODE) // || CameraPane.movingcamera) |
---|
| 6117 | + if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
5911 | 6118 | { |
---|
5912 | 6119 | int fc = bRep.FaceCount(); |
---|
5913 | 6120 | int vc = bRep.VertexCount(); |
---|
.. | .. |
---|
5922 | 6129 | |
---|
5923 | 6130 | bRep.getMinMax(min, max, 100); |
---|
5924 | 6131 | |
---|
5925 | | - gl.glBegin(gl.GL_LINES); |
---|
5926 | | - |
---|
5927 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5928 | | - gl.glVertex3d(min.x, min.y, max.z); |
---|
5929 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5930 | | - gl.glVertex3d(min.x, max.y, min.z); |
---|
5931 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5932 | | - gl.glVertex3d(max.x, min.y, min.z); |
---|
5933 | | - |
---|
5934 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5935 | | - gl.glVertex3d(min.x, max.y, max.z); |
---|
5936 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5937 | | - gl.glVertex3d(max.x, min.y, max.z); |
---|
5938 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5939 | | - gl.glVertex3d(max.x, max.y, min.z); |
---|
5940 | | - |
---|
5941 | | - gl.glEnd(); |
---|
| 6132 | + display.DrawBox(min, max); |
---|
5942 | 6133 | |
---|
5943 | 6134 | return; |
---|
5944 | 6135 | } |
---|
.. | .. |
---|
5982 | 6173 | { |
---|
5983 | 6174 | //throw new Error(); |
---|
5984 | 6175 | |
---|
5985 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 6176 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5986 | 6177 | |
---|
5987 | 6178 | int[] strips = bRep.getRawIndices(); |
---|
5988 | 6179 | |
---|
.. | .. |
---|
5992 | 6183 | new Exception().printStackTrace(); |
---|
5993 | 6184 | return; |
---|
5994 | 6185 | } |
---|
5995 | | - |
---|
5996 | | - // TRIANGLE STRIP ARRAY |
---|
5997 | | - if (bRep.trimmed) |
---|
5998 | | - { |
---|
5999 | | - float[] v = bRep.getRawVertices(); |
---|
6000 | | - float[] n = bRep.getRawNormals(); |
---|
6001 | | - float[] c = bRep.getRawColors(); |
---|
6002 | | - float[] uv = bRep.getRawUVMap(); |
---|
6003 | | - |
---|
6004 | | - int count2 = 0; |
---|
6005 | | - int count3 = 0; |
---|
6006 | | - |
---|
6007 | | - if (n.length > 0) |
---|
6008 | | - { |
---|
6009 | | - for (int i = 0; i < strips.length; i++) |
---|
6010 | | - { |
---|
6011 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6012 | | - |
---|
6013 | | - /* |
---|
6014 | | - boolean locked = false; |
---|
6015 | | - float eps = 0.1f; |
---|
6016 | | - boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6017 | | - |
---|
6018 | | - int dot = 0; |
---|
6019 | | - |
---|
6020 | | - if ((dot&1) == 0) |
---|
6021 | | - dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6022 | | - |
---|
6023 | | - if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6024 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6025 | | - else |
---|
6026 | | - { |
---|
6027 | | - locked = true; |
---|
6028 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6029 | | - } |
---|
6030 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6031 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6032 | | - if (hasnorm) |
---|
6033 | | - { |
---|
6034 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6035 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6036 | | - } |
---|
6037 | | - |
---|
6038 | | - if ((dot&4) == 0) |
---|
6039 | | - dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6040 | | - |
---|
6041 | | - if (wrap || !locked && (dot&8) != 0) |
---|
6042 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6043 | | - else |
---|
6044 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6045 | | - |
---|
6046 | | - f.dot = dot; |
---|
6047 | | - */ |
---|
6048 | | - |
---|
6049 | | - if (!selectmode) |
---|
6050 | | - { |
---|
6051 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6052 | | - { |
---|
6053 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6054 | | - } else |
---|
6055 | | - { |
---|
6056 | | - gl.glNormal3f(0, 0, 1); |
---|
6057 | | - } |
---|
6058 | | - |
---|
6059 | | - if (c != null) |
---|
6060 | | - //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]); |
---|
6061 | | - { |
---|
6062 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6063 | | - } |
---|
6064 | | - } |
---|
6065 | | - if (flipV) |
---|
6066 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6067 | | - else |
---|
6068 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6069 | | - //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6070 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6071 | | - |
---|
6072 | | - count2 += 2; |
---|
6073 | | - count3 += 3; |
---|
6074 | | - if (!selectmode) |
---|
6075 | | - { |
---|
6076 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6077 | | - { |
---|
6078 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6079 | | - } else |
---|
6080 | | - { |
---|
6081 | | - gl.glNormal3f(0, 0, 1); |
---|
6082 | | - } |
---|
6083 | | - if (c != null) |
---|
6084 | | - { |
---|
6085 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6086 | | - } |
---|
6087 | | - } |
---|
6088 | | - if (flipV) |
---|
6089 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6090 | | - else |
---|
6091 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6092 | | - //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6093 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6094 | | - |
---|
6095 | | - count2 += 2; |
---|
6096 | | - count3 += 3; |
---|
6097 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6098 | | - { |
---|
6099 | | - //gl.glTexCoord2d(...); |
---|
6100 | | - if (!selectmode) |
---|
6101 | | - { |
---|
6102 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6103 | | - { |
---|
6104 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6105 | | - } else |
---|
6106 | | - { |
---|
6107 | | - gl.glNormal3f(0, 0, 1); |
---|
6108 | | - } |
---|
6109 | | - if (c != null) |
---|
6110 | | - { |
---|
6111 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6112 | | - } |
---|
6113 | | - } |
---|
6114 | | - |
---|
6115 | | - if (flipV) |
---|
6116 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6117 | | - else |
---|
6118 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6119 | | - //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
6120 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6121 | | - count2 += 2; |
---|
6122 | | - count3 += 3; |
---|
6123 | | - } |
---|
6124 | | - |
---|
6125 | | - gl.glEnd(); |
---|
6126 | | - } |
---|
6127 | | - } |
---|
6128 | | - |
---|
6129 | | - assert count3 == v.length; |
---|
6130 | | - } |
---|
6131 | | - else // !trimmed |
---|
6132 | | - { |
---|
6133 | | - int count = 0; |
---|
6134 | | - for (int i = 0; i < strips.length; i++) |
---|
6135 | | - { |
---|
6136 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6137 | | - |
---|
6138 | | - Vertex p = bRep.GetVertex(bRep.indices[count++]); |
---|
6139 | | - Vertex q = bRep.GetVertex(bRep.indices[count++]); |
---|
6140 | | - |
---|
6141 | | - drawVertex(gl, p, selectmode); |
---|
6142 | | - drawVertex(gl, q, selectmode); |
---|
6143 | | - |
---|
6144 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6145 | | - { |
---|
6146 | | - Vertex r = bRep.GetVertex(bRep.indices[count++]); |
---|
6147 | | - |
---|
6148 | | -// if (j%2 == 0) |
---|
6149 | | -// drawFace(p, q, r, display, null); |
---|
6150 | | -// else |
---|
6151 | | -// drawFace(p, r, q, display, null); |
---|
6152 | | - |
---|
6153 | | -// p = q; |
---|
6154 | | -// q = r; |
---|
6155 | | - drawVertex(gl, r, selectmode); |
---|
6156 | | - } |
---|
6157 | | - |
---|
6158 | | - gl.glEnd(); |
---|
6159 | | - } |
---|
6160 | | - } |
---|
| 6186 | + |
---|
| 6187 | + display.DrawGeometry(bRep, flipV, selectmode); |
---|
6161 | 6188 | } else // catch (Error e) |
---|
6162 | 6189 | { |
---|
6163 | 6190 | // TRIANGLE ARRAY |
---|
6164 | 6191 | if (IsOpaque()) // Static()) |
---|
6165 | 6192 | { |
---|
6166 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6193 | + display.StartTriangles(); |
---|
6167 | 6194 | int facecount = bRep.FaceCount(); |
---|
6168 | 6195 | for (int i = 0; i < facecount; i++) |
---|
6169 | 6196 | { |
---|
.. | .. |
---|
6226 | 6253 | // // r.norm.dot(v3) > -0.5) |
---|
6227 | 6254 | // // continue; |
---|
6228 | 6255 | |
---|
6229 | | - drawFace(p, q, r, display, face); |
---|
| 6256 | + display.DrawFace(this, p, q, r, face); |
---|
6230 | 6257 | } |
---|
6231 | | - gl.glEnd(); |
---|
| 6258 | + display.EndTriangles(); |
---|
6232 | 6259 | } |
---|
6233 | 6260 | else |
---|
6234 | 6261 | { |
---|
.. | .. |
---|
6257 | 6284 | //System.out.println("SORT"); |
---|
6258 | 6285 | |
---|
6259 | 6286 | java.util.Arrays.sort(facescompare); |
---|
6260 | | - |
---|
6261 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6287 | + |
---|
| 6288 | + display.StartTriangles(); |
---|
6262 | 6289 | for (int i = 0; i < facecount; i++) |
---|
6263 | 6290 | { |
---|
6264 | 6291 | Face face = bRep.GetFace(facescompare[i].index); |
---|
.. | .. |
---|
6270 | 6297 | Vertex q = bRep.GetVertex(face.q); |
---|
6271 | 6298 | Vertex r = bRep.GetVertex(face.r); |
---|
6272 | 6299 | |
---|
6273 | | - drawFace(p, q, r, display, face); |
---|
| 6300 | + display.DrawFace(this, p, q, r, face); |
---|
6274 | 6301 | } |
---|
6275 | | - gl.glEnd(); |
---|
| 6302 | + display.EndTriangles(); |
---|
6276 | 6303 | } |
---|
6277 | 6304 | |
---|
6278 | 6305 | if (false) // live && support != null && support.bRep != null) // debug weights |
---|
6279 | 6306 | { |
---|
| 6307 | + /* |
---|
6280 | 6308 | gl.glDisable(gl.GL_LIGHTING); |
---|
6281 | 6309 | float[] colorV = new float[3]; |
---|
6282 | 6310 | |
---|
.. | .. |
---|
6355 | 6383 | // gl.glEnd(); |
---|
6356 | 6384 | } |
---|
6357 | 6385 | } |
---|
| 6386 | + */ |
---|
6358 | 6387 | } |
---|
6359 | 6388 | } |
---|
6360 | 6389 | |
---|
.. | .. |
---|
6399 | 6428 | center.add(r); |
---|
6400 | 6429 | center.mul(1.0/3); |
---|
6401 | 6430 | |
---|
6402 | | - center.sub(CameraPane.theRenderer.eyeCamera.location); |
---|
| 6431 | + center.sub(Globals.theRenderer.EyeCamera().location); |
---|
6403 | 6432 | |
---|
6404 | 6433 | distance = center.dot(center); |
---|
6405 | 6434 | } |
---|
.. | .. |
---|
6410 | 6439 | |
---|
6411 | 6440 | transient FaceCompare[] facescompare = null; |
---|
6412 | 6441 | |
---|
6413 | | - void SetColor(CameraPane display, Vertex p0) |
---|
6414 | | - { |
---|
6415 | | - if (display.RENDERPROGRAM == 0) |
---|
6416 | | - { |
---|
6417 | | - float r = 0; |
---|
6418 | | - if (bRep != null) |
---|
6419 | | - { |
---|
6420 | | - if (bRep.stripified) |
---|
6421 | | - { |
---|
6422 | | - r = 1; |
---|
6423 | | - } |
---|
6424 | | - } |
---|
6425 | | - float g = 0; |
---|
6426 | | - if (bRep != null) |
---|
6427 | | - { |
---|
6428 | | - if (bRep.trimmed) |
---|
6429 | | - { |
---|
6430 | | - g = 1; |
---|
6431 | | - } |
---|
6432 | | - } |
---|
6433 | | - float b = 0; |
---|
6434 | | - if (support != null && link2master) |
---|
6435 | | - { |
---|
6436 | | - b = 1; |
---|
6437 | | - } |
---|
6438 | | - display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO); |
---|
6439 | | - return; |
---|
6440 | | - } |
---|
6441 | | - |
---|
6442 | | - if (display.drawMode != CameraPane.SHADOW) |
---|
6443 | | - return; |
---|
6444 | | - |
---|
6445 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6446 | | -// if (true) return; |
---|
6447 | | -// float ao = p.AO; |
---|
6448 | | -// |
---|
6449 | | -// // if (ao == 0 && !bRep.AOdone) // transient problem! |
---|
6450 | | -// // ao = 1; |
---|
6451 | | -// |
---|
6452 | | -// gl.glColor4f(ao, ao, ao, 1); |
---|
6453 | | - |
---|
6454 | | -// CameraPane.selectedpoint. |
---|
6455 | | -// getAverage(cStatic.point1, true); |
---|
6456 | | - if (CameraPane.pointflow == null) // !random) // live) |
---|
6457 | | - { |
---|
6458 | | - return; |
---|
6459 | | - } |
---|
6460 | | - |
---|
6461 | | - cStatic.point1.set(0,0,0); |
---|
6462 | | - LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1); |
---|
6463 | | - |
---|
6464 | | - cStatic.point1.sub(p0); |
---|
6465 | | - |
---|
6466 | | - |
---|
6467 | | -// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta? |
---|
6468 | | -// { |
---|
6469 | | -// return; |
---|
6470 | | -// } |
---|
6471 | | - |
---|
6472 | | - //if (true) |
---|
6473 | | - if (cStatic.point1.dot(cStatic.point1) > 0.000001) |
---|
6474 | | - { |
---|
6475 | | - return; |
---|
6476 | | - } |
---|
6477 | | - |
---|
6478 | | - float[] colorV = new float[3]; |
---|
6479 | | - |
---|
6480 | | - if (false) // marked) |
---|
6481 | | - { |
---|
6482 | | - // debug rigging weights |
---|
6483 | | - for (int object = 0; object < p0.vertexlinks.length; object++) |
---|
6484 | | - { |
---|
6485 | | - float weight = p0.weights[object] / p0.totalweight; |
---|
6486 | | - |
---|
6487 | | - // if (weight < 0.1) |
---|
6488 | | - // { |
---|
6489 | | - // assert(weight == 0); |
---|
6490 | | - // continue; |
---|
6491 | | - // } |
---|
6492 | | - |
---|
6493 | | - if (p0.vertexlinks[object] == -1) |
---|
6494 | | - continue; |
---|
6495 | | - |
---|
6496 | | - Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]); |
---|
6497 | | - |
---|
6498 | | - int color = //1 << object; // |
---|
6499 | | - //p.vertexlinks.length; |
---|
6500 | | - support.bRep.supports[p0.closestsupport].links[object]; |
---|
6501 | | - colorV[2] += (color & 1) * weight; |
---|
6502 | | - colorV[1] += ((color & 2) >> 1) * weight; |
---|
6503 | | - colorV[0] += ((color & 4) >> 2) * weight; |
---|
6504 | | - } |
---|
6505 | | - } |
---|
6506 | | - else |
---|
6507 | | - { |
---|
6508 | | - if (drawingstarted) |
---|
6509 | | - { |
---|
6510 | | - // find next point |
---|
6511 | | - if (bRep.GetVertex(0).faceindices == null) |
---|
6512 | | - { |
---|
6513 | | - bRep.InitFaceIndices(); |
---|
6514 | | - } |
---|
6515 | | - |
---|
6516 | | - double ymin = p0.y; |
---|
6517 | | - |
---|
6518 | | - Vertex newp = p0; |
---|
6519 | | - |
---|
6520 | | - for (int fii = 0; fii < p0.faceindices.length; fii++) |
---|
6521 | | - { |
---|
6522 | | - int fi = p0.faceindices[fii]; |
---|
6523 | | - |
---|
6524 | | - if (fi == -1) |
---|
6525 | | - break; |
---|
6526 | | - |
---|
6527 | | - Face f = bRep.GetFace(fi); |
---|
6528 | | - |
---|
6529 | | - Vertex p = bRep.GetVertex(f.p); |
---|
6530 | | - Vertex q = bRep.GetVertex(f.q); |
---|
6531 | | - Vertex r = bRep.GetVertex(f.r); |
---|
6532 | | - |
---|
6533 | | - int swap = (int)(Math.random()*3); |
---|
6534 | | - |
---|
6535 | | -// for (int s=swap; --s>=0;) |
---|
6536 | | -// { |
---|
6537 | | -// Vertex t = p; |
---|
6538 | | -// p = q; |
---|
6539 | | -// q = r; |
---|
6540 | | -// r = t; |
---|
6541 | | -// } |
---|
6542 | | - if (ymin > p.y) |
---|
6543 | | - { |
---|
6544 | | - ymin = p.y; |
---|
6545 | | - newp = p; |
---|
6546 | | -// break; |
---|
6547 | | - } |
---|
6548 | | - if (ymin > q.y) |
---|
6549 | | - { |
---|
6550 | | - ymin = q.y; |
---|
6551 | | - newp = q; |
---|
6552 | | -// break; |
---|
6553 | | - } |
---|
6554 | | - if (ymin > r.y) |
---|
6555 | | - { |
---|
6556 | | - ymin = r.y; |
---|
6557 | | - newp = r; |
---|
6558 | | -// break; |
---|
6559 | | - } |
---|
6560 | | - } |
---|
6561 | | - |
---|
6562 | | - CameraPane.selectedpoint.toParent[3][0] = newp.x; |
---|
6563 | | - CameraPane.selectedpoint.toParent[3][1] = newp.y; |
---|
6564 | | - CameraPane.selectedpoint.toParent[3][2] = newp.z; |
---|
6565 | | - |
---|
6566 | | - drawingstarted = false; |
---|
6567 | | - |
---|
6568 | | - // return; |
---|
6569 | | - } |
---|
6570 | | - |
---|
6571 | | - if (false) // CameraPane.DRAW |
---|
6572 | | - { |
---|
6573 | | - p0.AO = colorV[0] = 2; |
---|
6574 | | - colorV[1] = 2; |
---|
6575 | | - colorV[2] = 2; |
---|
6576 | | - } |
---|
6577 | | - |
---|
6578 | | - CameraPane.pointflow.add(p0); |
---|
6579 | | - CameraPane.pointflow.Touch(); |
---|
6580 | | - } |
---|
6581 | | - |
---|
6582 | | -// gl.glColor3f(colorV[0], colorV[1], colorV[2]); |
---|
6583 | | -// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0); |
---|
6584 | | -// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
6585 | | - } |
---|
6586 | | - |
---|
6587 | 6442 | void Print(Vertex v) |
---|
6588 | 6443 | { |
---|
6589 | 6444 | //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")"); |
---|
6590 | 6445 | } |
---|
6591 | 6446 | |
---|
6592 | | - void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode) |
---|
6593 | | - { |
---|
6594 | | - if (!selectmode) |
---|
6595 | | - { |
---|
6596 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6597 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6598 | | - |
---|
6599 | | - if (flipV) |
---|
6600 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6601 | | - else |
---|
6602 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6603 | | - } |
---|
6604 | | - |
---|
6605 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6606 | | - } |
---|
6607 | | - |
---|
6608 | | - void drawFace(Vertex pv, Vertex qv, Vertex rv, |
---|
6609 | | - CameraPane display, Face face) |
---|
6610 | | - { |
---|
6611 | | - if (pv.y == -10000 || |
---|
6612 | | - qv.y == -10000 || |
---|
6613 | | - rv.y == -10000) |
---|
6614 | | - return; |
---|
6615 | | - |
---|
6616 | | -// float b = f.nbiterations & 1; |
---|
6617 | | -// float g = (f.nbiterations>>1) & 1; |
---|
6618 | | -// float r = (f.nbiterations>>2) & 1; |
---|
6619 | | -// |
---|
6620 | | -// //if (f.weight == 10000) |
---|
6621 | | -// //{ |
---|
6622 | | -// // r = 1; g = b = 0; |
---|
6623 | | -// //} |
---|
6624 | | -// //else |
---|
6625 | | -// //{ |
---|
6626 | | -// // assert(f.weight < 10000); |
---|
6627 | | -// r = g = b = (float)bRep.FaceWeight(f)*100; |
---|
6628 | | -// if (r<0) |
---|
6629 | | -// assert(r>=0); |
---|
6630 | | -// //} |
---|
6631 | | - |
---|
6632 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6633 | | - |
---|
6634 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
6635 | | - |
---|
6636 | | - //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv); |
---|
6637 | | - if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
6638 | | - { |
---|
6639 | | - //gl.glBegin(gl.GL_TRIANGLES); |
---|
6640 | | - boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
6641 | | - if (!hasnorm) |
---|
6642 | | - { |
---|
6643 | | - // System.out.println("FUCK!!"); |
---|
6644 | | - LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0); |
---|
6645 | | - LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1); |
---|
6646 | | - LA.vecCross(v0, v1, v2); |
---|
6647 | | - LA.vecNormalize(v2); |
---|
6648 | | - gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z); |
---|
6649 | | - } |
---|
6650 | | - |
---|
6651 | | - if (hasnorm) |
---|
6652 | | - { |
---|
6653 | | -// if (!pv.norm.normalized()) |
---|
6654 | | -// assert(pv.norm.normalized()); |
---|
6655 | | - |
---|
6656 | | - //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z); |
---|
6657 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6658 | | - } |
---|
6659 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6660 | | - SetColor(display, pv); |
---|
6661 | | - //gl.glColor4f(r, g, b, 1); |
---|
6662 | | - //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1); |
---|
6663 | | - if (flipV) |
---|
6664 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6665 | | - else |
---|
6666 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6667 | | - //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z); |
---|
6668 | | - gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z); |
---|
6669 | | -// Print(pv); |
---|
6670 | | - if (hasnorm) |
---|
6671 | | - { |
---|
6672 | | -// assert(qv.norm.normalized()); |
---|
6673 | | - //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z); |
---|
6674 | | - gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z); |
---|
6675 | | - } |
---|
6676 | | - //System.out.println("vertexq = " + qv.s + ", " + qv.t); |
---|
6677 | | - // boolean locked = false; |
---|
6678 | | - // float eps = 0.1f; |
---|
6679 | | - // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6680 | | - |
---|
6681 | | - // int dot = 0; //*/ (int)f.dot; |
---|
6682 | | - |
---|
6683 | | - // if ((dot&1) == 0) |
---|
6684 | | - // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6685 | | - |
---|
6686 | | - // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6687 | | - if (flipV) |
---|
6688 | | - gl.glTexCoord2f((float) qv.s, 1-(float) qv.t); |
---|
6689 | | - else |
---|
6690 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6691 | | - // else |
---|
6692 | | - // { |
---|
6693 | | - // locked = true; |
---|
6694 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6695 | | - // } |
---|
6696 | | - gl.glColor4f(qv.AO, qv.AO, qv.AO, 1); |
---|
6697 | | - SetColor(display, qv); |
---|
6698 | | - //gl.glColor4f(r, g, b, 1); |
---|
6699 | | - //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1); |
---|
6700 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6701 | | - gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z); |
---|
6702 | | -// Print(qv); |
---|
6703 | | - if (hasnorm) |
---|
6704 | | - { |
---|
6705 | | -// assert(rv.norm.normalized()); |
---|
6706 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6707 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6708 | | - } |
---|
6709 | | - |
---|
6710 | | - // if ((dot&4) == 0) |
---|
6711 | | - // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6712 | | - |
---|
6713 | | - // if (wrap || !locked && (dot&8) != 0) |
---|
6714 | | - if (flipV) |
---|
6715 | | - gl.glTexCoord2f((float) rv.s, 1-(float) rv.t); |
---|
6716 | | - else |
---|
6717 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6718 | | - // else |
---|
6719 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6720 | | - |
---|
6721 | | - // f.dot = dot; |
---|
6722 | | - |
---|
6723 | | - gl.glColor4f(rv.AO, rv.AO, rv.AO, 1); |
---|
6724 | | - SetColor(display, rv); |
---|
6725 | | - //gl.glColor4f(r, g, b, 1); |
---|
6726 | | - //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1); |
---|
6727 | | - //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z); |
---|
6728 | | - gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z); |
---|
6729 | | -// Print(rv); |
---|
6730 | | - //gl.glEnd(); |
---|
6731 | | - } |
---|
6732 | | - else |
---|
6733 | | - { |
---|
6734 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6735 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6736 | | - gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z); |
---|
6737 | | - |
---|
6738 | | - } |
---|
6739 | | - |
---|
6740 | | - if (false) // (attributes & WIREFRAME) != 0) |
---|
6741 | | - { |
---|
6742 | | - gl.glDisable(gl.GL_LIGHTING); |
---|
6743 | | - |
---|
6744 | | - gl.glBegin(gl.GL_LINE_LOOP); |
---|
6745 | | - gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z); |
---|
6746 | | - gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z); |
---|
6747 | | - gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z); |
---|
6748 | | - gl.glEnd(); |
---|
6749 | | - |
---|
6750 | | - gl.glEnable(gl.GL_LIGHTING); |
---|
6751 | | - } |
---|
6752 | | - } |
---|
6753 | | - |
---|
6754 | 6447 | void drawSelf(ClickInfo info, int level, boolean select) |
---|
6755 | 6448 | { |
---|
6756 | 6449 | if (bRep == null) |
---|
.. | .. |
---|
7322 | 7015 | int spotw = spot.x + spot.width; |
---|
7323 | 7016 | int spoth = spot.y + spot.height; |
---|
7324 | 7017 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7325 | | - if (CameraPane.Xmin > spot.x) |
---|
7326 | | - { |
---|
7327 | | - CameraPane.Xmin = spot.x; |
---|
7328 | | - } |
---|
7329 | | - if (CameraPane.Xmax < spotw) |
---|
7330 | | - { |
---|
7331 | | - CameraPane.Xmax = spotw; |
---|
7332 | | - } |
---|
7333 | | - if (CameraPane.Ymin > spot.y) |
---|
7334 | | - { |
---|
7335 | | - CameraPane.Ymin = spot.y; |
---|
7336 | | - } |
---|
7337 | | - if (CameraPane.Ymax < spoth) |
---|
7338 | | - { |
---|
7339 | | - CameraPane.Ymax = spoth; |
---|
7340 | | - } |
---|
| 7018 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7019 | +// { |
---|
| 7020 | +// CameraPane.Xmin = spot.x; |
---|
| 7021 | +// } |
---|
| 7022 | +// if (CameraPane.Xmax < spotw) |
---|
| 7023 | +// { |
---|
| 7024 | +// CameraPane.Xmax = spotw; |
---|
| 7025 | +// } |
---|
| 7026 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7027 | +// { |
---|
| 7028 | +// CameraPane.Ymin = spot.y; |
---|
| 7029 | +// } |
---|
| 7030 | +// if (CameraPane.Ymax < spoth) |
---|
| 7031 | +// { |
---|
| 7032 | +// CameraPane.Ymax = spoth; |
---|
| 7033 | +// } |
---|
7341 | 7034 | spot.translate(32, 32); |
---|
7342 | 7035 | spotw = spot.x + spot.width; |
---|
7343 | 7036 | spoth = spot.y + spot.height; |
---|
7344 | 7037 | info.g.setColor(Color.blue); |
---|
7345 | 7038 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7346 | | - if (CameraPane.Xmin > spot.x) |
---|
7347 | | - { |
---|
7348 | | - CameraPane.Xmin = spot.x; |
---|
7349 | | - } |
---|
7350 | | - if (CameraPane.Xmax < spotw) |
---|
7351 | | - { |
---|
7352 | | - CameraPane.Xmax = spotw; |
---|
7353 | | - } |
---|
7354 | | - if (CameraPane.Ymin > spot.y) |
---|
7355 | | - { |
---|
7356 | | - CameraPane.Ymin = spot.y; |
---|
7357 | | - } |
---|
7358 | | - if (CameraPane.Ymax < spoth) |
---|
7359 | | - { |
---|
7360 | | - CameraPane.Ymax = spoth; |
---|
7361 | | - } |
---|
7362 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
7363 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7039 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7040 | +// { |
---|
| 7041 | +// CameraPane.Xmin = spot.x; |
---|
| 7042 | +// } |
---|
| 7043 | +// if (CameraPane.Xmax < spotw) |
---|
| 7044 | +// { |
---|
| 7045 | +// CameraPane.Xmax = spotw; |
---|
| 7046 | +// } |
---|
| 7047 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7048 | +// { |
---|
| 7049 | +// CameraPane.Ymin = spot.y; |
---|
| 7050 | +// } |
---|
| 7051 | +// if (CameraPane.Ymax < spoth) |
---|
| 7052 | +// { |
---|
| 7053 | +// CameraPane.Ymax = spoth; |
---|
| 7054 | +// } |
---|
| 7055 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
| 7056 | + //info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
7364 | 7057 | spot.translate(0, -32); |
---|
7365 | 7058 | info.g.setColor(Color.green); |
---|
7366 | 7059 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7367 | | - if (CameraPane.Xmin > spot.x) |
---|
7368 | | - { |
---|
7369 | | - CameraPane.Xmin = spot.x; |
---|
7370 | | - } |
---|
7371 | | - if (CameraPane.Xmax < spotw) |
---|
7372 | | - { |
---|
7373 | | - CameraPane.Xmax = spotw; |
---|
7374 | | - } |
---|
7375 | | - if (CameraPane.Ymin > spot.y) |
---|
7376 | | - { |
---|
7377 | | - CameraPane.Ymin = spot.y; |
---|
7378 | | - } |
---|
7379 | | - if (CameraPane.Ymax < spoth) |
---|
7380 | | - { |
---|
7381 | | - CameraPane.Ymax = spoth; |
---|
7382 | | - } |
---|
| 7060 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7061 | +// { |
---|
| 7062 | +// CameraPane.Xmin = spot.x; |
---|
| 7063 | +// } |
---|
| 7064 | +// if (CameraPane.Xmax < spotw) |
---|
| 7065 | +// { |
---|
| 7066 | +// CameraPane.Xmax = spotw; |
---|
| 7067 | +// } |
---|
| 7068 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7069 | +// { |
---|
| 7070 | +// CameraPane.Ymin = spot.y; |
---|
| 7071 | +// } |
---|
| 7072 | +// if (CameraPane.Ymax < spoth) |
---|
| 7073 | +// { |
---|
| 7074 | +// CameraPane.Ymax = spoth; |
---|
| 7075 | +// } |
---|
7383 | 7076 | info.g.drawArc(boundary.x, boundary.y, |
---|
7384 | 7077 | boundary.width, boundary.height, 0, 360); |
---|
7385 | 7078 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7386 | | - if (CameraPane.Xmin > boundary.x) |
---|
7387 | | - { |
---|
7388 | | - CameraPane.Xmin = boundary.x; |
---|
7389 | | - } |
---|
7390 | | - if (CameraPane.Xmax < boundary.x + boundary.width) |
---|
7391 | | - { |
---|
7392 | | - CameraPane.Xmax = boundary.x + boundary.width; |
---|
7393 | | - } |
---|
7394 | | - if (CameraPane.Ymin > boundary.y) |
---|
7395 | | - { |
---|
7396 | | - CameraPane.Ymin = boundary.y; |
---|
7397 | | - } |
---|
7398 | | - if (CameraPane.Ymax < boundary.y + boundary.height) |
---|
7399 | | - { |
---|
7400 | | - CameraPane.Ymax = boundary.y + boundary.height; |
---|
7401 | | - } |
---|
| 7079 | +// if (CameraPane.Xmin > boundary.x) |
---|
| 7080 | +// { |
---|
| 7081 | +// CameraPane.Xmin = boundary.x; |
---|
| 7082 | +// } |
---|
| 7083 | +// if (CameraPane.Xmax < boundary.x + boundary.width) |
---|
| 7084 | +// { |
---|
| 7085 | +// CameraPane.Xmax = boundary.x + boundary.width; |
---|
| 7086 | +// } |
---|
| 7087 | +// if (CameraPane.Ymin > boundary.y) |
---|
| 7088 | +// { |
---|
| 7089 | +// CameraPane.Ymin = boundary.y; |
---|
| 7090 | +// } |
---|
| 7091 | +// if (CameraPane.Ymax < boundary.y + boundary.height) |
---|
| 7092 | +// { |
---|
| 7093 | +// CameraPane.Ymax = boundary.y + boundary.height; |
---|
| 7094 | +// } |
---|
7402 | 7095 | return; |
---|
7403 | 7096 | } |
---|
7404 | 7097 | } |
---|
.. | .. |
---|
7415 | 7108 | startX = info.x; |
---|
7416 | 7109 | startY = info.y; |
---|
7417 | 7110 | |
---|
7418 | | - hitSomething = 0; |
---|
| 7111 | + hitSomething = -1; |
---|
7419 | 7112 | cVector origin = new cVector(); |
---|
7420 | 7113 | //LA.xformPos(origin, toParent, origin); |
---|
7421 | 7114 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
7448 | 7141 | } |
---|
7449 | 7142 | |
---|
7450 | 7143 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7451 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7144 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7452 | 7145 | //System.out.println("modified = " + modified); |
---|
7453 | 7146 | //new Exception().printStackTrace(); |
---|
7454 | 7147 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7476 | 7169 | return true; |
---|
7477 | 7170 | } |
---|
7478 | 7171 | |
---|
7479 | | - void doEditDrag0(ClickInfo info) |
---|
| 7172 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
7480 | 7173 | { |
---|
7481 | 7174 | if (hitSomething == 0) |
---|
7482 | 7175 | { |
---|
.. | .. |
---|
7491 | 7184 | //System.out.println("hitSomething = " + hitSomething); |
---|
7492 | 7185 | |
---|
7493 | 7186 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7187 | + |
---|
7494 | 7188 | cVector xlate = new cVector(); |
---|
7495 | 7189 | //cVector xlate2 = new cVector(); |
---|
7496 | 7190 | switch (hitSomething) |
---|
.. | .. |
---|
7501 | 7195 | |
---|
7502 | 7196 | case hitCenter: // Translate |
---|
7503 | 7197 | |
---|
7504 | | - scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance(); |
---|
| 7198 | + scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7505 | 7199 | |
---|
7506 | | - if (modified) |
---|
| 7200 | + if (modified || opposite) |
---|
7507 | 7201 | { |
---|
7508 | 7202 | //assert(false); |
---|
7509 | 7203 | /* |
---|
.. | .. |
---|
7549 | 7243 | } |
---|
7550 | 7244 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7551 | 7245 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7552 | | - LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up); |
---|
| 7246 | + LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7553 | 7247 | LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
7554 | 7248 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7555 | | - LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away); |
---|
| 7249 | + LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7556 | 7250 | //LA.vecCross(up, cVector.Z, right2); |
---|
7557 | 7251 | |
---|
7558 | 7252 | cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
.. | .. |
---|
7597 | 7291 | |
---|
7598 | 7292 | if (modified) |
---|
7599 | 7293 | { |
---|
| 7294 | + // Rotate 90 degrees |
---|
7600 | 7295 | angle /= (Math.PI / 4); |
---|
7601 | 7296 | angle = Math.floor(angle + 0.5); |
---|
7602 | 7297 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7610 | 7305 | } |
---|
7611 | 7306 | /**/ |
---|
7612 | 7307 | |
---|
7613 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7308 | + switch (info.pane.RenderCamera().viewCode) |
---|
7614 | 7309 | { |
---|
7615 | 7310 | case 1: // '\001' |
---|
7616 | 7311 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7638 | 7333 | |
---|
7639 | 7334 | case hitScale: // scale |
---|
7640 | 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); |
---|
7641 | 7342 | if (hScale < 0.01) |
---|
7642 | 7343 | { |
---|
7643 | | - hScale = 0.01; |
---|
| 7344 | + //hScale = 0.01; |
---|
7644 | 7345 | } |
---|
7645 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7646 | | - if (hScale < 0.01) |
---|
7647 | | - { |
---|
7648 | | - hScale = 0.01; |
---|
7649 | | - } |
---|
| 7346 | + |
---|
7650 | 7347 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7651 | | - if (vScale < 0.01) |
---|
| 7348 | + sign = 1; |
---|
| 7349 | + if (vScale < 0) |
---|
7652 | 7350 | { |
---|
7653 | | - vScale = 0.01; |
---|
| 7351 | + sign = -1; |
---|
7654 | 7352 | } |
---|
7655 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7353 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7656 | 7354 | if (vScale < 0.01) |
---|
7657 | 7355 | { |
---|
7658 | | - vScale = 0.01; |
---|
| 7356 | + //vScale = 0.01; |
---|
7659 | 7357 | } |
---|
7660 | 7358 | LA.matCopy(startMat, toParent); |
---|
7661 | 7359 | /**/ |
---|
.. | .. |
---|
7666 | 7364 | } |
---|
7667 | 7365 | /**/ |
---|
7668 | 7366 | |
---|
7669 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 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 | + |
---|
| 7374 | + switch (info.pane.RenderCamera().viewCode) |
---|
7670 | 7375 | { |
---|
7671 | 7376 | case 3: // '\001' |
---|
7672 | 7377 | if (modified) |
---|
7673 | 7378 | { |
---|
7674 | 7379 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7675 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7380 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7676 | 7381 | } // vScale, 1); |
---|
7677 | 7382 | else |
---|
7678 | 7383 | { |
---|
7679 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7384 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7680 | 7385 | } // vScale, 1); |
---|
7681 | 7386 | break; |
---|
7682 | 7387 | |
---|
.. | .. |
---|
7684 | 7389 | if (modified) |
---|
7685 | 7390 | { |
---|
7686 | 7391 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7687 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7392 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7688 | 7393 | } else |
---|
7689 | 7394 | { |
---|
7690 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7395 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7691 | 7396 | } |
---|
7692 | 7397 | break; |
---|
7693 | 7398 | |
---|
.. | .. |
---|
7695 | 7400 | if (modified) |
---|
7696 | 7401 | { |
---|
7697 | 7402 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7698 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7403 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7699 | 7404 | } else |
---|
7700 | 7405 | { |
---|
7701 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7406 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7702 | 7407 | } |
---|
7703 | 7408 | break; |
---|
7704 | 7409 | } |
---|
.. | .. |
---|
7719 | 7424 | if (parent == null) |
---|
7720 | 7425 | { |
---|
7721 | 7426 | System.out.println("NULL PARENT"); |
---|
7722 | | - new Exception().printStackTrace(); |
---|
| 7427 | + //new Exception().printStackTrace(); |
---|
7723 | 7428 | } else |
---|
7724 | 7429 | { |
---|
7725 | 7430 | if (parent instanceof BezierPatch) |
---|
.. | .. |
---|
7735 | 7440 | info.pane.repaint(); |
---|
7736 | 7441 | } |
---|
7737 | 7442 | |
---|
| 7443 | + boolean overflow = false; |
---|
| 7444 | + |
---|
7738 | 7445 | void TransformToWorld(cVector out) // , cVector out) |
---|
7739 | 7446 | { |
---|
| 7447 | + if (overflow) |
---|
| 7448 | + return; |
---|
| 7449 | + |
---|
| 7450 | + overflow = true; |
---|
| 7451 | + |
---|
7740 | 7452 | // june 2013 ??? assert (in == out); |
---|
7741 | 7453 | cVector in = out; |
---|
7742 | 7454 | if (toParent != null && !(this instanceof Texture || this instanceof TextureNode)) |
---|
.. | .. |
---|
7753 | 7465 | { |
---|
7754 | 7466 | (parent!=null?parent:fileparent).TransformToWorld(out); //, out); |
---|
7755 | 7467 | } |
---|
| 7468 | + |
---|
| 7469 | + overflow = false; |
---|
7756 | 7470 | } |
---|
7757 | 7471 | |
---|
7758 | 7472 | void TransformToLocal(cVector out) //, cVector out) |
---|
.. | .. |
---|
7822 | 7536 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7823 | 7537 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7824 | 7538 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7539 | + |
---|
| 7540 | + String objname; |
---|
| 7541 | + |
---|
7825 | 7542 | if (false) //parent != null) |
---|
7826 | 7543 | { |
---|
7827 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7544 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7828 | 7545 | } else |
---|
7829 | 7546 | { |
---|
7830 | | - 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) ":"") */ ""; |
---|
7831 | 7548 | } // + super.toString(); |
---|
7832 | 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); |
---|
7833 | 7555 | } |
---|
7834 | 7556 | |
---|
7835 | 7557 | public int hashCode() |
---|
.. | .. |
---|
7885 | 7607 | objectUI.closeUI(); |
---|
7886 | 7608 | if (editWindow != null) |
---|
7887 | 7609 | { |
---|
| 7610 | + editWindow.ctrlPanel.FlushUI(); |
---|
7888 | 7611 | editWindow.refreshContents(); |
---|
7889 | 7612 | } // ? new |
---|
7890 | 7613 | objectUI = null; |
---|
.. | .. |
---|
7905 | 7628 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7906 | 7629 | |
---|
7907 | 7630 | Object3D /*Composite*/ parent; |
---|
7908 | | - Object3D /*Composite*/ fileparent; |
---|
| 7631 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7909 | 7632 | |
---|
7910 | 7633 | double[][] toParent; // dynamic matrix |
---|
7911 | 7634 | double[][] fromParent; |
---|
.. | .. |
---|
7995 | 7718 | max = new cVector(); |
---|
7996 | 7719 | } |
---|
7997 | 7720 | |
---|
7998 | | - Object3D sourcenode = GetFileRoot(); |
---|
7999 | | - |
---|
8000 | | - if (!sourcenode.name.contains("rclab")) |
---|
| 7721 | + if (false) // Can crawl!! |
---|
8001 | 7722 | { |
---|
8002 | | - getBounds(min, max, true); |
---|
| 7723 | + Object3D sourcenode = GetFileRoot(); |
---|
8003 | 7724 | |
---|
8004 | | - if (min.y != Double.POSITIVE_INFINITY && min.y > 2) |
---|
| 7725 | + if (sourcenode != null && !sourcenode.name.contains("rclab")) |
---|
8005 | 7726 | { |
---|
8006 | | -// sourcenode.getBounds(min, max, true); |
---|
8007 | | - sourcenode.getBounds(v0, v1, true); |
---|
8008 | | -// sourcenode.toParent = sourcenode.toParent; |
---|
8009 | | -// get(0).toParent = get(0).toParent; |
---|
8010 | | -// sourcenode.GlobalTransform(); |
---|
| 7727 | + getBounds(min, max, true); |
---|
| 7728 | + |
---|
| 7729 | + if (min.y != Double.POSITIVE_INFINITY && min.y > 2) |
---|
| 7730 | + { |
---|
| 7731 | + // sourcenode.getBounds(min, max, true); |
---|
| 7732 | + sourcenode.getBounds(v0, v1, true); |
---|
| 7733 | + // sourcenode.toParent = sourcenode.toParent; |
---|
| 7734 | + // get(0).toParent = get(0).toParent; |
---|
| 7735 | + // sourcenode.GlobalTransform(); |
---|
| 7736 | + } |
---|
8011 | 7737 | } |
---|
8012 | 7738 | } |
---|
8013 | 7739 | |
---|
.. | .. |
---|
8016 | 7742 | if (support != null) |
---|
8017 | 7743 | { |
---|
8018 | 7744 | assert(bRep != null); |
---|
8019 | | - GraphreeD.Assert(support.bRep == bRep.support); |
---|
| 7745 | + if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
| 7746 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
8020 | 7747 | } |
---|
8021 | 7748 | else |
---|
8022 | 7749 | { |
---|
.. | .. |
---|
8065 | 7792 | private static cVector edge2 = new cVector(); |
---|
8066 | 7793 | //private static cVector norm = new cVector(); |
---|
8067 | 7794 | /*transient private*/ int hitSomething; |
---|
8068 | | - private static final int hitCenter = 1; |
---|
8069 | | - private static final int hitScale = 2; |
---|
8070 | | - private static final int hitRotate = 3; |
---|
| 7795 | + static final int hitCenter = 1; |
---|
| 7796 | + static final int hitScale = 2; |
---|
| 7797 | + static final int hitRotate = 3; |
---|
8071 | 7798 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
8072 | 7799 | /*transient*/ private Point centerPt; |
---|
8073 | 7800 | /*transient*/ private int startX; |
---|
.. | .. |
---|
8099 | 7826 | { |
---|
8100 | 7827 | Object3D targ = this; |
---|
8101 | 7828 | |
---|
| 7829 | + targ.NORMALPUSH = obj.NORMALPUSH; |
---|
| 7830 | + |
---|
8102 | 7831 | if (obj.material != null) |
---|
8103 | 7832 | { |
---|
8104 | 7833 | if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL)) |
---|