.. | .. |
---|
83 | 83 | |
---|
84 | 84 | void CloneSelection(boolean supports) |
---|
85 | 85 | { |
---|
86 | | - // Object3D keep = GraphreeD.clipboard; |
---|
| 86 | + // Object3D keep = GrafreeD.clipboard; |
---|
87 | 87 | //Object3D obj; |
---|
88 | 88 | for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
89 | 89 | { |
---|
.. | .. |
---|
97 | 97 | |
---|
98 | 98 | void CloneClipboard(boolean supports) |
---|
99 | 99 | { |
---|
100 | | - assert(GraphreeD.clipboard.parent == null); |
---|
101 | | - Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent; |
---|
102 | | - GraphreeD.clipboard.get(0).parent = null; // Avoid copy? |
---|
103 | | - if (LA.isIdentity(GraphreeD.clipboard.toParent)) |
---|
104 | | - makeSomething(CloneObject(GraphreeD.clipboard.get(0), false)); |
---|
| 100 | + assert(GrafreeD.clipboard.parent == null); |
---|
| 101 | + Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent; |
---|
| 102 | + GrafreeD.clipboard.get(0).parent = null; // Avoid copy? |
---|
| 103 | + if (LA.isIdentity(GrafreeD.clipboard.toParent)) |
---|
| 104 | + makeSomething(CloneObject(GrafreeD.clipboard.get(0), false)); |
---|
105 | 105 | else |
---|
106 | | - makeSomething(CloneObject(GraphreeD.clipboard, false)); |
---|
107 | | - GraphreeD.clipboard.get(0).parent = keepparent; |
---|
| 106 | + makeSomething(CloneObject(GrafreeD.clipboard, false)); |
---|
| 107 | + GrafreeD.clipboard.get(0).parent = keepparent; |
---|
108 | 108 | } |
---|
109 | 109 | |
---|
110 | 110 | static Object3D CloneObject(Object3D obj, boolean supports) |
---|
.. | .. |
---|
118 | 118 | // obj.support = null; |
---|
119 | 119 | if (!supports) |
---|
120 | 120 | obj.SaveSupports(); |
---|
121 | | - Object3D clone = (Object3D)GraphreeD.clone(obj); |
---|
| 121 | + Object3D clone = (Object3D)GrafreeD.clone(obj); |
---|
122 | 122 | obj.parent = parent; |
---|
123 | 123 | // obj.support = support; |
---|
124 | 124 | // clone.support = support; // aout 2013 |
---|
.. | .. |
---|
219 | 219 | resetsupportItem.addActionListener(this); |
---|
220 | 220 | linkverticesItem = menu.add(new MenuItem("Link to Support")); |
---|
221 | 221 | linkverticesItem.addActionListener(this); |
---|
| 222 | + relinkverticesItem = menu.add(new MenuItem("Re-link to Support")); |
---|
| 223 | + relinkverticesItem.addActionListener(this); |
---|
222 | 224 | setMasterItem = menu.add(new MenuItem("Set Master Mesh")); |
---|
223 | 225 | setMasterItem.addActionListener(this); |
---|
224 | 226 | |
---|
225 | 227 | oe.menuBar.add(menu = new Menu("Group")); |
---|
226 | 228 | grabItem = menu.add(new MenuItem("Grab")); |
---|
227 | 229 | grabItem.addActionListener(this); |
---|
228 | | - frontItem = menu.add(new MenuItem("Front")); |
---|
229 | | - frontItem.addActionListener(this); |
---|
230 | 230 | backItem = menu.add(new MenuItem("Back")); |
---|
231 | 231 | backItem.addActionListener(this); |
---|
| 232 | + frontItem = menu.add(new MenuItem("Front")); |
---|
| 233 | + frontItem.addActionListener(this); |
---|
232 | 234 | compositeItem = menu.add(new MenuItem("Composite")); |
---|
233 | 235 | compositeItem.addActionListener(this); |
---|
| 236 | + hideItem = menu.add(new MenuItem("Hide")); |
---|
| 237 | + hideItem.addActionListener(this); |
---|
| 238 | + ungroupItem = menu.add(new MenuItem("Ungroup")); |
---|
| 239 | + ungroupItem.addActionListener(this); |
---|
234 | 240 | menu.add("-"); |
---|
235 | 241 | randomItem = menu.add(new MenuItem("Random")); |
---|
236 | 242 | randomItem.addActionListener(this); |
---|
.. | .. |
---|
252 | 258 | oe.menuBar.add(menu = new Menu("Object")); |
---|
253 | 259 | textureItem = menu.add(new MenuItem("Texture")); |
---|
254 | 260 | textureItem.addActionListener(this); |
---|
| 261 | + billboardItem = menu.add(new MenuItem("Billboard")); |
---|
| 262 | + billboardItem.addActionListener(this); |
---|
255 | 263 | csgItem = menu.add(new MenuItem("CSG")); |
---|
256 | 264 | csgItem.addActionListener(this); |
---|
257 | 265 | shadowXItem = menu.add(new MenuItem("Shadow X")); |
---|
.. | .. |
---|
269 | 277 | pointflowItem = menu.add(new MenuItem("Point Flow")); |
---|
270 | 278 | pointflowItem.addActionListener(this); |
---|
271 | 279 | menu.add("-"); |
---|
272 | | - transformgeometryItem = menu.add(new MenuItem("Transform Geometry")); |
---|
273 | | - transformgeometryItem.addActionListener(this); |
---|
274 | 280 | resetTransformItem = menu.add(new MenuItem("Reset Transform")); |
---|
275 | 281 | resetTransformItem.addActionListener(this); |
---|
276 | 282 | resetCentroidItem = menu.add(new MenuItem("Reset Centroid")); |
---|
277 | 283 | resetCentroidItem.addActionListener(this); |
---|
278 | | - ungroupItem = menu.add(new MenuItem("Ungroup")); |
---|
279 | | - ungroupItem.addActionListener(this); |
---|
| 284 | + transformgeometryItem = menu.add(new MenuItem("Transform Geometry")); |
---|
| 285 | + transformgeometryItem.addActionListener(this); |
---|
280 | 286 | |
---|
281 | 287 | oe.menuBar.add(menu = new Menu("Geometry")); |
---|
282 | 288 | genUVItem = menu.add(new MenuItem("Generate UV")); |
---|
.. | .. |
---|
285 | 291 | genNormalsORGANItem.addActionListener(this); |
---|
286 | 292 | genNormalsCADItem = menu.add(new MenuItem("CAD Normals")); |
---|
287 | 293 | genNormalsCADItem.addActionListener(this); |
---|
| 294 | + genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals")); |
---|
| 295 | + genNormalsMESHItem.addActionListener(this); |
---|
| 296 | + genNormalsMINEItem = menu.add(new MenuItem("My Normals")); |
---|
| 297 | + genNormalsMINEItem.addActionListener(this); |
---|
288 | 298 | stripifyItem = menu.add(new MenuItem("Stripify")); |
---|
289 | 299 | stripifyItem.addActionListener(this); |
---|
290 | 300 | unstripifyItem = menu.add(new MenuItem("Unstripify")); |
---|
.. | .. |
---|
380 | 390 | |
---|
381 | 391 | |
---|
382 | 392 | oe.menuBar.add(menu = new Menu("Include")); |
---|
383 | | - importGFDItem = menu.add(new MenuItem("GraphreeD Object...")); |
---|
| 393 | + importGFDItem = menu.add(new MenuItem("GrafreeD Object...")); |
---|
384 | 394 | importGFDItem.addActionListener(this); |
---|
385 | 395 | importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object...")); |
---|
386 | 396 | importVRMLX3DItem.addActionListener(this); |
---|
.. | .. |
---|
1033 | 1043 | torusItem.addActionListener(this); |
---|
1034 | 1044 | superItem = menu.add(new MenuItem("Superellipsoid")); |
---|
1035 | 1045 | superItem.addActionListener(this); |
---|
| 1046 | + kleinItem = menu.add(new MenuItem("Klein Bottle")); |
---|
| 1047 | + kleinItem.addActionListener(this); |
---|
1036 | 1048 | particleItem = menu.add(new MenuItem("Particle system")); |
---|
1037 | 1049 | particleItem.addActionListener(this); |
---|
1038 | 1050 | ragdollItem = menu.add(new MenuItem("Rag Walk")); |
---|
.. | .. |
---|
1441 | 1453 | |
---|
1442 | 1454 | void Overwrite(int mask) |
---|
1443 | 1455 | { |
---|
1444 | | - if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1) |
---|
| 1456 | + if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) |
---|
1445 | 1457 | { |
---|
1446 | | - Object3D content = GraphreeD.clipboard.get(0); |
---|
| 1458 | + Object3D content = GrafreeD.clipboard.get(0); |
---|
1447 | 1459 | |
---|
1448 | 1460 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
1449 | 1461 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
1592 | 1604 | if (event.getSource() == superItem) |
---|
1593 | 1605 | { |
---|
1594 | 1606 | makeSomething(new Superellipsoid()); |
---|
| 1607 | + } else |
---|
| 1608 | + if (event.getSource() == kleinItem) |
---|
| 1609 | + { |
---|
| 1610 | + makeSomething(new Klein()); |
---|
1595 | 1611 | } else |
---|
1596 | 1612 | if (event.getSource() == blobItem) |
---|
1597 | 1613 | { |
---|
.. | .. |
---|
1778 | 1794 | if (event.getSource() == invariantsItem) |
---|
1779 | 1795 | { |
---|
1780 | 1796 | System.out.println("Invariants:"); |
---|
1781 | | - GraphreeD.theApplet3D.universe.invariants(); |
---|
| 1797 | + GrafreeD.theApplet3D.universe.invariants(); |
---|
1782 | 1798 | } else |
---|
1783 | 1799 | if (event.getSource() == memoryItem) |
---|
1784 | 1800 | { |
---|
.. | .. |
---|
1848 | 1864 | } else |
---|
1849 | 1865 | if (event.getSource() == duplicateItem) |
---|
1850 | 1866 | { |
---|
1851 | | - Object3D keep = GraphreeD.clipboard; |
---|
| 1867 | + Object3D keep = GrafreeD.clipboard; |
---|
1852 | 1868 | loadClipboard(false); |
---|
1853 | 1869 | paste(false); |
---|
1854 | | - GraphreeD.clipboard = keep; |
---|
| 1870 | + GrafreeD.clipboard = keep; |
---|
1855 | 1871 | } else |
---|
1856 | 1872 | if (event.getSource() == cloneItem) |
---|
1857 | 1873 | { |
---|
.. | .. |
---|
1895 | 1911 | } else |
---|
1896 | 1912 | if (event.getSource() == overwriteMatItem) |
---|
1897 | 1913 | { |
---|
| 1914 | + /* july 2015 |
---|
1898 | 1915 | if ((dropAttributes & Object3D.TEXTURE) == 0) |
---|
1899 | | - Overwrite(Object3D.MATERIAL); |
---|
| 1916 | + Overwrite(Object3D.MATERIAL | Object3D.COLOR); |
---|
1900 | 1917 | else |
---|
1901 | 1918 | { |
---|
1902 | 1919 | if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0) |
---|
.. | .. |
---|
1908 | 1925 | Overwrite(Object3D.MATERIAL | Object3D.TEXTURE); |
---|
1909 | 1926 | } |
---|
1910 | 1927 | } |
---|
| 1928 | + */ |
---|
| 1929 | + |
---|
| 1930 | + Overwrite(dropAttributes); |
---|
1911 | 1931 | } |
---|
1912 | 1932 | if (event.getSource() == overwriteGeoItem) |
---|
1913 | 1933 | { |
---|
1914 | 1934 | Overwrite(Object3D.GEOMETRY); |
---|
1915 | | -// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1) |
---|
| 1935 | +// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) |
---|
1916 | 1936 | // { |
---|
1917 | | -// Object3D content = GraphreeD.clipboard.get(0); |
---|
| 1937 | +// Object3D content = GrafreeD.clipboard.get(0); |
---|
1918 | 1938 | // |
---|
1919 | 1939 | // if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
1920 | 1940 | // content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
1997 | 2017 | if (group.selection.size() == 1) |
---|
1998 | 2018 | one = true; |
---|
1999 | 2019 | |
---|
| 2020 | + Object3D merge = null; |
---|
| 2021 | + |
---|
2000 | 2022 | Object3D content = new cGroup(); |
---|
2001 | 2023 | |
---|
2002 | 2024 | for (int i=0; i<group.selection.size(); i++) |
---|
2003 | 2025 | { |
---|
2004 | | - Object3D sel = new Merge(group.selection.get(i)); |
---|
| 2026 | + merge = new Merge(group.selection.get(i)); |
---|
2005 | 2027 | |
---|
2006 | 2028 | if (one) |
---|
2007 | | - makeSomething(sel, false); |
---|
| 2029 | + makeSomething(merge, false); |
---|
2008 | 2030 | else |
---|
2009 | | - content.addChild(sel); |
---|
| 2031 | + content.addChild(merge); |
---|
2010 | 2032 | } |
---|
2011 | 2033 | |
---|
2012 | 2034 | if (!one) |
---|
2013 | | - makeSomething(content, false); |
---|
2014 | | - |
---|
2015 | | - ResetModel(); |
---|
2016 | | - refreshContents(); |
---|
| 2035 | + makeSomething(content, true); |
---|
| 2036 | + else |
---|
| 2037 | + { |
---|
| 2038 | + ResetModel(); |
---|
| 2039 | + Select(merge.GetTreePath(), true, false); // unselect... false); |
---|
| 2040 | + refreshContents(); |
---|
| 2041 | + } |
---|
2017 | 2042 | } else |
---|
2018 | 2043 | if (event.getSource() == mergeGeometriesItem) |
---|
2019 | 2044 | { |
---|
.. | .. |
---|
2047 | 2072 | } else |
---|
2048 | 2073 | if (event.getSource() == linkverticesItem) |
---|
2049 | 2074 | { |
---|
2050 | | -// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1) |
---|
| 2075 | +// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1) |
---|
2051 | 2076 | // { |
---|
2052 | | -// Object3D content = GraphreeD.clipboard.get(0); |
---|
| 2077 | +// Object3D content = GrafreeD.clipboard.get(0); |
---|
2053 | 2078 | // |
---|
2054 | 2079 | // if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
2055 | 2080 | // content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
2058 | 2083 | // group.selection.get(0).setMasterThis(content); // should be identity |
---|
2059 | 2084 | // refreshContents(); |
---|
2060 | 2085 | // } |
---|
2061 | | - if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1) |
---|
| 2086 | + if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) |
---|
2062 | 2087 | { |
---|
2063 | | - Object3D content = GraphreeD.clipboard.get(0); |
---|
| 2088 | + Object3D content = GrafreeD.clipboard.get(0); |
---|
2064 | 2089 | |
---|
2065 | 2090 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
2066 | 2091 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
2090 | 2115 | |
---|
2091 | 2116 | refreshContents(); |
---|
2092 | 2117 | } else |
---|
| 2118 | + if (event.getSource() == relinkverticesItem) |
---|
| 2119 | + { |
---|
| 2120 | + boolean random = CameraPane.RANDOM; |
---|
| 2121 | + CameraPane.RANDOM = false; // parse all random nodes |
---|
| 2122 | + group.selection.RelinkToSupport(); |
---|
| 2123 | + CameraPane.RANDOM = random; |
---|
| 2124 | + |
---|
| 2125 | + refreshContents(); |
---|
| 2126 | + } else |
---|
2093 | 2127 | if (event.getSource() == resetreferencesItem) |
---|
2094 | 2128 | { |
---|
2095 | 2129 | for (int i=0; i<group.selection.size(); i++) |
---|
.. | .. |
---|
2101 | 2135 | } else |
---|
2102 | 2136 | if (event.getSource() == setMasterItem) |
---|
2103 | 2137 | { |
---|
2104 | | - if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1) |
---|
| 2138 | + if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1) |
---|
2105 | 2139 | { |
---|
2106 | | - Object3D content = GraphreeD.clipboard.get(0); |
---|
| 2140 | + Object3D content = GrafreeD.clipboard.get(0); |
---|
2107 | 2141 | |
---|
2108 | 2142 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
2109 | 2143 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
2116 | 2150 | { |
---|
2117 | 2151 | if (group.selection.size() == 1) |
---|
2118 | 2152 | { |
---|
2119 | | - if (GraphreeD.clipboard.size() == 1) |
---|
| 2153 | + if (GrafreeD.clipboard.size() == 1) |
---|
2120 | 2154 | { |
---|
2121 | | - Object3D content = GraphreeD.clipboard.get(0); |
---|
| 2155 | + Object3D content = GrafreeD.clipboard.get(0); |
---|
2122 | 2156 | |
---|
2123 | 2157 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
2124 | 2158 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
2158 | 2192 | if (event.getSource() == grabItem) |
---|
2159 | 2193 | { |
---|
2160 | 2194 | group(new cGroup(), true); |
---|
| 2195 | + } else |
---|
| 2196 | + if (event.getSource() == hideItem) |
---|
| 2197 | + { |
---|
| 2198 | + group(new HiddenObject()); |
---|
2161 | 2199 | } else |
---|
2162 | 2200 | if (event.getSource() == frontItem) |
---|
2163 | 2201 | { |
---|
.. | .. |
---|
2281 | 2319 | { |
---|
2282 | 2320 | group(new TextureNode()); |
---|
2283 | 2321 | } else |
---|
| 2322 | + if (event.getSource() == billboardItem) |
---|
| 2323 | + { |
---|
| 2324 | + group(new BillboardNode()); |
---|
| 2325 | + } else |
---|
2284 | 2326 | if (event.getSource() == shadowXItem) |
---|
2285 | 2327 | { |
---|
2286 | 2328 | CastShadow(0); |
---|
.. | .. |
---|
2295 | 2337 | } else |
---|
2296 | 2338 | if (event.getSource() == ungroupItem) |
---|
2297 | 2339 | { |
---|
2298 | | - ungroup(); |
---|
| 2340 | + //ungroup(); |
---|
| 2341 | + for (int i=0; i<group.selection.size(); i++) |
---|
| 2342 | + { |
---|
| 2343 | + Ungroup(group.selection.get(i)); |
---|
| 2344 | + } |
---|
| 2345 | + |
---|
| 2346 | + ClearSelection(false); |
---|
| 2347 | + |
---|
| 2348 | + refreshContents(); |
---|
2299 | 2349 | } else |
---|
2300 | 2350 | if (event.getSource() == genUVItem) |
---|
2301 | 2351 | { |
---|
.. | .. |
---|
2305 | 2355 | { |
---|
2306 | 2356 | GenNormals(true); |
---|
2307 | 2357 | } else |
---|
| 2358 | + if (event.getSource() == genNormalsMESHItem) |
---|
| 2359 | + { |
---|
| 2360 | + GenNormals(true); // TODO |
---|
| 2361 | + } else |
---|
2308 | 2362 | if (event.getSource() == genNormalsORGANItem) |
---|
2309 | 2363 | { |
---|
2310 | 2364 | GenNormals(false); |
---|
| 2365 | + } else |
---|
| 2366 | + if (event.getSource() == genNormalsMINEItem) |
---|
| 2367 | + { |
---|
| 2368 | + GenNormalsMINE(); |
---|
2311 | 2369 | } else |
---|
2312 | 2370 | if (event.getSource() == stripifyItem) |
---|
2313 | 2371 | { |
---|
.. | .. |
---|
2806 | 2864 | if (event.getSource() == unselectButton) |
---|
2807 | 2865 | { |
---|
2808 | 2866 | objEditor.jTree.clearSelection(); |
---|
2809 | | - // ?? oct 2012 GraphreeD.clipboard.clear(); |
---|
| 2867 | + // ?? oct 2012 GrafreeD.clipboard.clear(); |
---|
2810 | 2868 | objEditor.ResetSliders(); |
---|
2811 | 2869 | refreshContents(true); |
---|
2812 | 2870 | } else |
---|
.. | .. |
---|
3121 | 3179 | obj = (Object3D)e.nextElement(); |
---|
3122 | 3180 | |
---|
3123 | 3181 | System.out.println("Object is: " + obj); |
---|
3124 | | - GraphreeD.AnalyzeObject(obj); |
---|
| 3182 | + GrafreeD.AnalyzeObject(obj); |
---|
3125 | 3183 | System.out.println("Boundary rep: " + obj.bRep); |
---|
3126 | | - GraphreeD.AnalyzeObject(obj.bRep); |
---|
| 3184 | + GrafreeD.AnalyzeObject(obj.bRep); |
---|
3127 | 3185 | |
---|
3128 | 3186 | // System.err.println((size/1024) + " KB is the size of " + obj); |
---|
3129 | 3187 | } |
---|
.. | .. |
---|
3165 | 3223 | void GenNormals(boolean crease) |
---|
3166 | 3224 | { |
---|
3167 | 3225 | group.GenNormalsS(crease); |
---|
| 3226 | + |
---|
| 3227 | + refreshContents(); |
---|
| 3228 | + } |
---|
| 3229 | + |
---|
| 3230 | + void GenNormalsMINE() |
---|
| 3231 | + { |
---|
| 3232 | + group.selection.GenNormalsMINE(); |
---|
3168 | 3233 | |
---|
3169 | 3234 | refreshContents(); |
---|
3170 | 3235 | } |
---|
.. | .. |
---|
3250 | 3315 | // LA.matTranslate(g.toParent, temp.x, temp.y, temp.z); |
---|
3251 | 3316 | // LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z); |
---|
3252 | 3317 | // |
---|
3253 | | -// g.add(GraphreeD.clipboard); |
---|
| 3318 | +// g.add(GrafreeD.clipboard); |
---|
3254 | 3319 | // |
---|
3255 | 3320 | // buffer.add(g); |
---|
3256 | 3321 | // } |
---|
.. | .. |
---|
3269 | 3334 | // nodes = new Object3D(); |
---|
3270 | 3335 | // vertices = new Vector<Vertex>(); |
---|
3271 | 3336 | // |
---|
3272 | | -// boolean epsequal = GraphreeD.epsequal; |
---|
3273 | | -// GraphreeD.epsequal = true; |
---|
| 3337 | +// boolean epsequal = GrafreeD.epsequal; |
---|
| 3338 | +// GrafreeD.epsequal = true; |
---|
3274 | 3339 | // |
---|
3275 | 3340 | // for (int i=0; i<group.selection.size(); i++) |
---|
3276 | 3341 | // { |
---|
.. | .. |
---|
3311 | 3376 | // LA.matTranslate(g.toParent, temp.x, temp.y, temp.z); |
---|
3312 | 3377 | // LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z); |
---|
3313 | 3378 | // |
---|
3314 | | -// g.add(GraphreeD.clipboard); |
---|
| 3379 | +// g.add(GrafreeD.clipboard); |
---|
3315 | 3380 | // |
---|
3316 | 3381 | // buffer.add(g); |
---|
3317 | 3382 | // } |
---|
.. | .. |
---|
3319 | 3384 | // makeSomething(buffer, i==group.selection.size()-1); |
---|
3320 | 3385 | // } |
---|
3321 | 3386 | // |
---|
3322 | | -// GraphreeD.epsequal = epsequal; |
---|
| 3387 | +// GrafreeD.epsequal = epsequal; |
---|
3323 | 3388 | // |
---|
3324 | 3389 | // //buffer = null; |
---|
3325 | 3390 | // temprep = null; |
---|
.. | .. |
---|
3330 | 3395 | |
---|
3331 | 3396 | void ParseVertices() |
---|
3332 | 3397 | { |
---|
3333 | | - boolean epsequal = GraphreeD.epsequal; |
---|
3334 | | - GraphreeD.epsequal = true; |
---|
| 3398 | + boolean epsequal = GrafreeD.epsequal; |
---|
| 3399 | + GrafreeD.epsequal = true; |
---|
3335 | 3400 | |
---|
3336 | 3401 | for (int i=0; i<group.selection.size(); i++) |
---|
3337 | 3402 | { |
---|
.. | .. |
---|
3356 | 3421 | LA.matTranslate(g.toParent, temp.x, temp.y, temp.z); |
---|
3357 | 3422 | LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z); |
---|
3358 | 3423 | |
---|
3359 | | - g.add(GraphreeD.clipboard); |
---|
| 3424 | + g.add(GrafreeD.clipboard); |
---|
3360 | 3425 | |
---|
3361 | 3426 | buffer.add(g); |
---|
3362 | 3427 | } |
---|
.. | .. |
---|
3371 | 3436 | makeSomething(buffer, i==group.selection.size()-1); |
---|
3372 | 3437 | } |
---|
3373 | 3438 | |
---|
3374 | | - GraphreeD.epsequal = epsequal; |
---|
| 3439 | + GrafreeD.epsequal = epsequal; |
---|
3375 | 3440 | |
---|
3376 | 3441 | refreshContents(); |
---|
3377 | 3442 | } |
---|
.. | .. |
---|
3416 | 3481 | scale /= 3; |
---|
3417 | 3482 | |
---|
3418 | 3483 | scale /= 0xFF; |
---|
3419 | | - scale /= 4; |
---|
| 3484 | + // c'est quoi ca? scale /= 4; |
---|
3420 | 3485 | |
---|
3421 | 3486 | //v.AO = scale; |
---|
3422 | 3487 | |
---|
.. | .. |
---|
3437 | 3502 | |
---|
3438 | 3503 | void Align() |
---|
3439 | 3504 | { |
---|
| 3505 | + if (group.selection.size() == 0) |
---|
| 3506 | + return; |
---|
| 3507 | + |
---|
| 3508 | + cVector bbmin = new cVector(); |
---|
| 3509 | + cVector bbmax = new cVector(); |
---|
| 3510 | + |
---|
| 3511 | + group.selection.get(0).getBounds(bbmin, bbmax, true); |
---|
| 3512 | + |
---|
| 3513 | + double dx = bbmax.x - bbmin.x; |
---|
| 3514 | + double dy = bbmax.y - bbmin.y; |
---|
| 3515 | + double dz = bbmax.z - bbmin.z; |
---|
| 3516 | + |
---|
| 3517 | + double scale = Math.sqrt(dx*dx + dy*dy + dz*dz); |
---|
| 3518 | + |
---|
3440 | 3519 | for (int i=0; i<group.selection.size(); i++) |
---|
3441 | 3520 | { |
---|
3442 | 3521 | Object3D obj = group.selection.get(i); |
---|
3443 | 3522 | |
---|
3444 | | - LA.matTranslate(obj.toParent, i/2f, 0, 0); |
---|
3445 | | - LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0); |
---|
| 3523 | + LA.matTranslate(obj.toParent, i * scale, 0, 0); |
---|
| 3524 | + LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0); |
---|
3446 | 3525 | } |
---|
3447 | 3526 | |
---|
3448 | 3527 | refreshContents(); |
---|
.. | .. |
---|
3455 | 3534 | // ref.SaveSupports(); |
---|
3456 | 3535 | // Object3D par = ref.parent; |
---|
3457 | 3536 | // ref.parent = null; |
---|
3458 | | -// Object3D lowres = (Object3D) GraphreeD.clone(ref); |
---|
| 3537 | +// Object3D lowres = (Object3D) GrafreeD.clone(ref); |
---|
3459 | 3538 | // ref.parent = par; |
---|
3460 | 3539 | // ref.RestoreSupports(); |
---|
3461 | 3540 | |
---|
.. | .. |
---|
3485 | 3564 | // lowres.SaveSupports(); |
---|
3486 | 3565 | // par = lowres.parent; |
---|
3487 | 3566 | // lowres.parent = null; |
---|
3488 | | -// Object3D newlow = (Object3D) GraphreeD.clone(lowres); |
---|
| 3567 | +// Object3D newlow = (Object3D) GrafreeD.clone(lowres); |
---|
3489 | 3568 | Object3D newlow = CloneObject(lowres, false); |
---|
3490 | 3569 | newlow.name = sn.switchobject.get(i).name; |
---|
3491 | 3570 | System.out.println(" pose#" + i + " = " + newlow); |
---|
.. | .. |
---|
3507 | 3586 | return; |
---|
3508 | 3587 | |
---|
3509 | 3588 | Object3D poses = group.selection.get(0); |
---|
3510 | | - Object3D ref = GraphreeD.clipboard.get(0); |
---|
| 3589 | + Object3D ref = GrafreeD.clipboard.get(0); |
---|
3511 | 3590 | |
---|
3512 | 3591 | Object3D newgroup = new Object3D("Po:" + poses.name); |
---|
3513 | 3592 | |
---|
.. | .. |
---|
3701 | 3780 | |
---|
3702 | 3781 | void ClipMesh() |
---|
3703 | 3782 | { |
---|
3704 | | - if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1) |
---|
| 3783 | + if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) |
---|
3705 | 3784 | { |
---|
3706 | | - Object3D content = GraphreeD.clipboard.get(0); |
---|
| 3785 | + Object3D content = GrafreeD.clipboard.get(0); |
---|
3707 | 3786 | |
---|
3708 | 3787 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
3709 | 3788 | content = ((cGroup)content).get(0); |
---|
3710 | 3789 | |
---|
3711 | 3790 | // for (int i=0; i<group.selection.size(); i++) |
---|
3712 | 3791 | // { |
---|
3713 | | -// group.selection.get(i).ClipMesh(GraphreeD.clipboard); |
---|
| 3792 | +// group.selection.get(i).ClipMesh(GrafreeD.clipboard); |
---|
3714 | 3793 | // } |
---|
3715 | | - group.selection.ClipMesh(GraphreeD.clipboard); |
---|
| 3794 | + group.selection.ClipMesh(GrafreeD.clipboard); |
---|
3716 | 3795 | } |
---|
3717 | | -// group.selection.ClipMesh(GraphreeD.clipboard); |
---|
| 3796 | +// group.selection.ClipMesh(GrafreeD.clipboard); |
---|
3718 | 3797 | System.out.println("DONE."); |
---|
3719 | 3798 | refreshContents(); |
---|
3720 | 3799 | } |
---|
.. | .. |
---|
4052 | 4131 | { |
---|
4053 | 4132 | if (group.selection.isEmpty()) |
---|
4054 | 4133 | return; |
---|
4055 | | - GraphreeD.clipboardIsTempGroup = false; |
---|
| 4134 | + GrafreeD.clipboardIsTempGroup = false; |
---|
4056 | 4135 | Composite tGroup = null; |
---|
4057 | 4136 | if (group.selection.size() > 0) // 1) |
---|
4058 | 4137 | { |
---|
4059 | 4138 | tGroup = new cGroup(); |
---|
4060 | | - GraphreeD.clipboardIsTempGroup = true; |
---|
| 4139 | + GrafreeD.clipboardIsTempGroup = true; |
---|
4061 | 4140 | } |
---|
4062 | 4141 | |
---|
4063 | 4142 | if (cut) |
---|
.. | .. |
---|
4097 | 4176 | //System.out.println("cut " + child); |
---|
4098 | 4177 | //System.out.println("parent = " + child.parent); |
---|
4099 | 4178 | // tmp.addChild(child); |
---|
4100 | | - if (GraphreeD.clipboardIsTempGroup) |
---|
| 4179 | + if (GrafreeD.clipboardIsTempGroup) |
---|
4101 | 4180 | tGroup.add/*Child*/(tmp); |
---|
4102 | 4181 | else |
---|
4103 | | - GraphreeD.clipboard = tmp; |
---|
| 4182 | + GrafreeD.clipboard = tmp; |
---|
4104 | 4183 | } |
---|
4105 | 4184 | else |
---|
4106 | | - if (GraphreeD.clipboardIsTempGroup) |
---|
| 4185 | + if (GrafreeD.clipboardIsTempGroup) |
---|
4107 | 4186 | tGroup.add/*Child*/(child); |
---|
4108 | 4187 | else |
---|
4109 | | - GraphreeD.clipboard = child; |
---|
| 4188 | + GrafreeD.clipboard = child; |
---|
4110 | 4189 | } |
---|
4111 | 4190 | |
---|
4112 | 4191 | //ResetModel(); |
---|
.. | .. |
---|
4138 | 4217 | //System.out.println("cut " + elem); |
---|
4139 | 4218 | //System.out.println("parent = " + elem.parent); |
---|
4140 | 4219 | // tmp.addChild(elem); |
---|
4141 | | - if (GraphreeD.clipboardIsTempGroup) |
---|
| 4220 | + if (GrafreeD.clipboardIsTempGroup) |
---|
4142 | 4221 | tGroup.add/*Child*/(tmp); |
---|
4143 | 4222 | else |
---|
4144 | | - GraphreeD.clipboard = tmp; |
---|
| 4223 | + GrafreeD.clipboard = tmp; |
---|
4145 | 4224 | } |
---|
4146 | 4225 | else |
---|
4147 | | - if (GraphreeD.clipboardIsTempGroup) |
---|
| 4226 | + if (GrafreeD.clipboardIsTempGroup) |
---|
4148 | 4227 | tGroup.add/*Child*/(child); |
---|
4149 | 4228 | else |
---|
4150 | | - GraphreeD.clipboard = child; |
---|
| 4229 | + GrafreeD.clipboard = child; |
---|
4151 | 4230 | } |
---|
4152 | 4231 | |
---|
4153 | 4232 | } |
---|
4154 | | - if (GraphreeD.clipboardIsTempGroup) |
---|
4155 | | - GraphreeD.clipboard = tGroup; |
---|
| 4233 | + if (GrafreeD.clipboardIsTempGroup) |
---|
| 4234 | + GrafreeD.clipboard = tGroup; |
---|
4156 | 4235 | if (cut) |
---|
4157 | 4236 | { |
---|
4158 | 4237 | ResetModel(); |
---|
.. | .. |
---|
4162 | 4241 | |
---|
4163 | 4242 | void paste(boolean expand) |
---|
4164 | 4243 | { |
---|
4165 | | - // if (GraphreeD.clipboard == null) |
---|
| 4244 | + // if (GrafreeD.clipboard == null) |
---|
4166 | 4245 | // return; |
---|
4167 | 4246 | boolean first = true; |
---|
4168 | 4247 | |
---|
4169 | | - if (GraphreeD.clipboardIsTempGroup) |
---|
| 4248 | + if (GrafreeD.clipboardIsTempGroup) |
---|
4170 | 4249 | { |
---|
4171 | 4250 | Composite temp; |
---|
4172 | 4251 | |
---|
.. | .. |
---|
4177 | 4256 | temp = (Composite)Applet3D.clipboard.deepCopy(); |
---|
4178 | 4257 | */ |
---|
4179 | 4258 | Object3D elem; |
---|
4180 | | - for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name)) |
---|
| 4259 | + for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name)) |
---|
4181 | 4260 | { |
---|
4182 | 4261 | Object3D child = (Object3D)e.nextElement(); |
---|
4183 | 4262 | |
---|
.. | .. |
---|
4191 | 4270 | else |
---|
4192 | 4271 | elem = child.deepCopy(); // ? |
---|
4193 | 4272 | child.parent = keepparent; |
---|
4194 | | - //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent)) |
---|
| 4273 | + //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent)) |
---|
4195 | 4274 | // elem = elem.get(0); |
---|
4196 | 4275 | makeSomething(elem, true); // ?? first); |
---|
4197 | 4276 | //group.addChild(elem); |
---|
.. | .. |
---|
4211 | 4290 | //Object3D cb = Applet3D.clipboard; |
---|
4212 | 4291 | //temp.addChild(cb); |
---|
4213 | 4292 | //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0)); |
---|
4214 | | - assert(GraphreeD.clipboard.parent == null); |
---|
4215 | | - Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent; |
---|
4216 | | - GraphreeD.clipboard.get(0).parent = null; // Avoid copy? |
---|
4217 | | - if (LA.isIdentity(GraphreeD.clipboard.toParent)) |
---|
4218 | | - makeSomething(expand?GraphreeD.clipboard.get(0).copyExpand():GraphreeD.clipboard.get(0).deepCopy()); |
---|
| 4293 | + assert(GrafreeD.clipboard.parent == null); |
---|
| 4294 | + Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent; |
---|
| 4295 | + GrafreeD.clipboard.get(0).parent = null; // Avoid copy? |
---|
| 4296 | + if (LA.isIdentity(GrafreeD.clipboard.toParent)) |
---|
| 4297 | + makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy()); |
---|
4219 | 4298 | else |
---|
4220 | | - makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy()); |
---|
4221 | | - GraphreeD.clipboard.get(0).parent = keepparent; |
---|
| 4299 | + makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy()); |
---|
| 4300 | + GrafreeD.clipboard.get(0).parent = keepparent; |
---|
4222 | 4301 | } |
---|
4223 | 4302 | |
---|
4224 | 4303 | ResetModel(); |
---|
.. | .. |
---|
4227 | 4306 | |
---|
4228 | 4307 | void pasteInto(boolean copyit) |
---|
4229 | 4308 | { |
---|
4230 | | -// if (GraphreeD.clipboard == null) |
---|
| 4309 | +// if (GrafreeD.clipboard == null) |
---|
4231 | 4310 | // return; |
---|
4232 | 4311 | |
---|
4233 | 4312 | if (group.selection.size() != 1) |
---|
.. | .. |
---|
4260 | 4339 | { |
---|
4261 | 4340 | boolean first = true; |
---|
4262 | 4341 | |
---|
4263 | | - if (GraphreeD.clipboardIsTempGroup) |
---|
| 4342 | + if (GrafreeD.clipboardIsTempGroup) |
---|
4264 | 4343 | { |
---|
4265 | | - Composite temp = (Composite)GraphreeD.clipboard; |
---|
| 4344 | + Composite temp = (Composite)GrafreeD.clipboard; |
---|
4266 | 4345 | Object3D copy; |
---|
4267 | 4346 | for (Enumeration e = temp.children.elements(); e.hasMoreElements();) |
---|
4268 | 4347 | { |
---|
.. | .. |
---|
4272 | 4351 | } |
---|
4273 | 4352 | } else |
---|
4274 | 4353 | { |
---|
4275 | | - linkSomething(GraphreeD.clipboard); //.get(0)); |
---|
| 4354 | + linkSomething(GrafreeD.clipboard); //.get(0)); |
---|
4276 | 4355 | } |
---|
4277 | 4356 | } |
---|
4278 | 4357 | } |
---|
.. | .. |
---|
4464 | 4543 | makeSomething(csg); |
---|
4465 | 4544 | } |
---|
4466 | 4545 | |
---|
| 4546 | + void Ungroup(Object3D g) |
---|
| 4547 | + { |
---|
| 4548 | + if (g instanceof HiddenObject) |
---|
| 4549 | + { |
---|
| 4550 | + HiddenObject h = (HiddenObject) g; |
---|
| 4551 | + |
---|
| 4552 | + for (int i=0; i<h.ActualSize(); i++) |
---|
| 4553 | + { |
---|
| 4554 | + objEditor.makeSomething(h.get(i), false); |
---|
| 4555 | + } |
---|
| 4556 | + } |
---|
| 4557 | + else |
---|
| 4558 | + { |
---|
| 4559 | + for (int i=0; i<g.Size(); i++) |
---|
| 4560 | + { |
---|
| 4561 | + objEditor.makeSomething(g.get(i), false); |
---|
| 4562 | + } |
---|
| 4563 | + } |
---|
| 4564 | + } |
---|
| 4565 | + |
---|
4467 | 4566 | void ungroup() |
---|
4468 | 4567 | { |
---|
4469 | 4568 | /* |
---|
.. | .. |
---|
4659 | 4758 | |
---|
4660 | 4759 | void ImportGFD() |
---|
4661 | 4760 | { |
---|
4662 | | - FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD); |
---|
| 4761 | + FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
4663 | 4762 | browser.show(); |
---|
4664 | 4763 | String filename = browser.getFile(); |
---|
4665 | 4764 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
4697 | 4796 | |
---|
4698 | 4797 | void ImportVRMLX3D() |
---|
4699 | 4798 | { |
---|
4700 | | - if (GraphreeD.standAlone) |
---|
| 4799 | + if (GrafreeD.standAlone) |
---|
4701 | 4800 | { |
---|
4702 | 4801 | /**/ |
---|
4703 | 4802 | FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
.. | .. |
---|
4714 | 4813 | |
---|
4715 | 4814 | String GetFile(String dialogName) |
---|
4716 | 4815 | { |
---|
4717 | | - if (GraphreeD.standAlone) |
---|
| 4816 | + if (GrafreeD.standAlone) |
---|
4718 | 4817 | { |
---|
4719 | 4818 | FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD); |
---|
4720 | 4819 | browser.show(); |
---|
.. | .. |
---|
4823 | 4922 | private MenuItem resetsupportItem; |
---|
4824 | 4923 | private MenuItem resetreferencesItem; |
---|
4825 | 4924 | private MenuItem linkverticesItem; |
---|
| 4925 | + private MenuItem relinkverticesItem; |
---|
4826 | 4926 | private MenuItem setMasterItem; |
---|
4827 | 4927 | private MenuItem resetMeshItem; |
---|
4828 | 4928 | private MenuItem stepAllItem; |
---|
.. | .. |
---|
4841 | 4941 | private MenuItem clearItem; |
---|
4842 | 4942 | private MenuItem clearAllItem; |
---|
4843 | 4943 | private MenuItem genUVItem; |
---|
| 4944 | + private MenuItem genNormalsMESHItem; |
---|
4844 | 4945 | private MenuItem genNormalsCADItem; |
---|
4845 | 4946 | private MenuItem genNormalsORGANItem; |
---|
| 4947 | + private MenuItem genNormalsMINEItem; |
---|
4846 | 4948 | private MenuItem stripifyItem; |
---|
4847 | 4949 | private MenuItem unstripifyItem; |
---|
4848 | 4950 | private MenuItem trimItem; |
---|
.. | .. |
---|
4884 | 4986 | private MenuItem resetCentroidItem; |
---|
4885 | 4987 | private MenuItem transformgeometryItem; |
---|
4886 | 4988 | private MenuItem resetTransformItem; |
---|
| 4989 | + private MenuItem hideItem; |
---|
4887 | 4990 | private MenuItem grabItem; |
---|
4888 | 4991 | private MenuItem backItem; |
---|
4889 | 4992 | private MenuItem frontItem; |
---|
.. | .. |
---|
4924 | 5027 | private MenuItem coneItem; |
---|
4925 | 5028 | private MenuItem torusItem; |
---|
4926 | 5029 | private MenuItem superItem; |
---|
| 5030 | + private MenuItem kleinItem; |
---|
4927 | 5031 | private MenuItem blobItem; |
---|
4928 | 5032 | private MenuItem latheItem; |
---|
4929 | 5033 | private MenuItem bezierItem; |
---|
.. | .. |
---|
4936 | 5040 | private MenuItem csgItem; |
---|
4937 | 5041 | private MenuItem templateItem; |
---|
4938 | 5042 | private MenuItem textureItem; |
---|
| 5043 | + private MenuItem billboardItem; |
---|
4939 | 5044 | private MenuItem shadowXItem; |
---|
4940 | 5045 | private MenuItem shadowYItem; |
---|
4941 | 5046 | private MenuItem shadowZItem; |
---|