.. | .. |
---|
37 | 37 | static boolean[] selectedstack = new boolean[65536]; |
---|
38 | 38 | static int materialdepth = 0; |
---|
39 | 39 | |
---|
40 | | - static boolean DEBUG = false; |
---|
41 | 40 | static boolean FRUSTUM = false; // still bogus true; // frustum culling |
---|
42 | 41 | |
---|
43 | 42 | // camera change fix |
---|
.. | .. |
---|
56 | 55 | static int CURRENTANTIALIAS = 0; // 1; |
---|
57 | 56 | /*static*/ boolean RENDERSHADOW = true; |
---|
58 | 57 | /*static*/ int RENDERPROGRAM = 2; // 0 == none, 1 == fast, 2 == normal |
---|
59 | | - static boolean ANIMATION = false; |
---|
60 | | - static String filename; |
---|
61 | 58 | |
---|
62 | 59 | boolean DISPLAYTEXT = false; |
---|
63 | 60 | //boolean REDUCETEXTURE = true; |
---|
.. | .. |
---|
92 | 89 | |
---|
93 | 90 | static int tickcount = 0; // slow pose issue |
---|
94 | 91 | |
---|
| 92 | +static boolean BUTTONLESSWHEEL = false; |
---|
| 93 | +static boolean ZOOMBOXMODE = false; |
---|
95 | 94 | static boolean BOXMODE = false; |
---|
96 | 95 | static boolean IMAGEFLIP = false; |
---|
97 | 96 | static boolean SMOOTHFOCUS = false; |
---|
.. | .. |
---|
106 | 105 | static boolean OEIL = true; |
---|
107 | 106 | static boolean OEILONCE = false; // do oeilon then oeiloff |
---|
108 | 107 | static boolean LOOKAT = true; |
---|
109 | | -static boolean RANDOM = true; // false; |
---|
| 108 | +static boolean SWITCH = true; // false; |
---|
110 | 109 | static boolean HANDLES = false; // selection doesn't work!! |
---|
111 | 110 | static boolean PAINTMODE = false; |
---|
112 | 111 | |
---|
.. | .. |
---|
149 | 148 | defaultcaps.setAccumBlueBits(16); |
---|
150 | 149 | defaultcaps.setAccumAlphaBits(16); |
---|
151 | 150 | } |
---|
| 151 | + |
---|
| 152 | + private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory(); |
---|
152 | 153 | |
---|
153 | 154 | void SetAsGLRenderer(boolean b) |
---|
154 | 155 | { |
---|
.. | .. |
---|
223 | 224 | public boolean IsBoxMode() |
---|
224 | 225 | { |
---|
225 | 226 | return BOXMODE; |
---|
| 227 | + } |
---|
| 228 | + |
---|
| 229 | + public boolean IsZoomBoxMode() |
---|
| 230 | + { |
---|
| 231 | + return ZOOMBOXMODE; |
---|
226 | 232 | } |
---|
227 | 233 | |
---|
228 | 234 | public void ClearDepth() |
---|
.. | .. |
---|
320 | 326 | cStatic.objectstack[materialdepth++] = obj; |
---|
321 | 327 | //System.out.println("material " + material); |
---|
322 | 328 | //Applet3D.tracein(this, selected); |
---|
323 | | - display.vector2buffer = obj.projectedVertices; |
---|
| 329 | + //display.vector2buffer = obj.projectedVertices; |
---|
324 | 330 | if (obj instanceof Camera) |
---|
325 | 331 | { |
---|
326 | 332 | display.options1[0] = material.shift; |
---|
.. | .. |
---|
329 | 335 | display.options1[2] = material.shadowbias; |
---|
330 | 336 | display.options1[3] = material.aniso; |
---|
331 | 337 | display.options1[4] = material.anisoV; |
---|
| 338 | +// System.out.println("display.options1[0] " + display.options1[0]); |
---|
| 339 | +// System.out.println("display.options1[1] " + display.options1[1]); |
---|
| 340 | +// System.out.println("display.options1[2] " + display.options1[2]); |
---|
| 341 | +// System.out.println("display.options1[3] " + display.options1[3]); |
---|
| 342 | +// System.out.println("display.options1[4] " + display.options1[4]); |
---|
332 | 343 | display.options2[0] = material.opacity; |
---|
333 | 344 | display.options2[1] = material.diffuse; |
---|
334 | 345 | display.options2[2] = material.factor; |
---|
| 346 | +// System.out.println("display.options2[0] " + display.options2[0]); |
---|
| 347 | +// System.out.println("display.options2[1] " + display.options2[1]); |
---|
| 348 | +// System.out.println("display.options2[2] " + display.options2[2]); |
---|
335 | 349 | |
---|
336 | 350 | cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3); |
---|
| 351 | +// System.out.println("display.options3[0] " + display.options3[0]); |
---|
| 352 | +// System.out.println("display.options3[1] " + display.options3[1]); |
---|
| 353 | +// System.out.println("display.options3[2] " + display.options3[2]); |
---|
337 | 354 | display.options4[0] = material.cameralight/0.2f; |
---|
338 | 355 | display.options4[1] = material.subsurface; |
---|
339 | 356 | display.options4[2] = material.sheen; |
---|
| 357 | +// System.out.println("display.options4[0] " + display.options4[0]); |
---|
| 358 | +// System.out.println("display.options4[1] " + display.options4[1]); |
---|
| 359 | +// System.out.println("display.options4[2] " + display.options4[2]); |
---|
340 | 360 | |
---|
341 | 361 | // if (display.CURRENTANTIALIAS > 0) |
---|
342 | 362 | // display.options3[3] /= 4; |
---|
.. | .. |
---|
352 | 372 | /**/ |
---|
353 | 373 | } else |
---|
354 | 374 | { |
---|
355 | | - DrawMaterial(material, selected); |
---|
| 375 | + DrawMaterial(material, selected, obj.projectedVertices); |
---|
356 | 376 | } |
---|
357 | 377 | } else |
---|
358 | 378 | { |
---|
.. | .. |
---|
376 | 396 | cStatic.objectstack[materialdepth++] = obj; |
---|
377 | 397 | //System.out.println("material " + material); |
---|
378 | 398 | //Applet3D.tracein("selected ", selected); |
---|
379 | | - display.vector2buffer = obj.projectedVertices; |
---|
380 | | - display.DrawMaterial(material, selected); |
---|
| 399 | + //display.vector2buffer = obj.projectedVertices; |
---|
| 400 | + display.DrawMaterial(material, selected, obj.projectedVertices); |
---|
381 | 401 | } |
---|
382 | 402 | } |
---|
383 | 403 | |
---|
.. | .. |
---|
394 | 414 | materialdepth -= 1; |
---|
395 | 415 | if (materialdepth > 0) |
---|
396 | 416 | { |
---|
397 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
398 | | - display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 417 | + //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 418 | + display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
399 | 419 | } |
---|
400 | 420 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
401 | 421 | } else if (selected && CameraPane.flash && obj.GetMaterial() != null) |
---|
.. | .. |
---|
415 | 435 | materialdepth -= 1; |
---|
416 | 436 | if (materialdepth > 0) |
---|
417 | 437 | { |
---|
418 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
419 | | - display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 438 | + //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 439 | + display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
420 | 440 | } |
---|
421 | 441 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
422 | 442 | //else |
---|
.. | .. |
---|
457 | 477 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
458 | 478 | { |
---|
459 | 479 | //gl.glBegin(gl.GL_TRIANGLES); |
---|
460 | | - boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
| 480 | + boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0) |
---|
| 481 | + // TEST LIVE NORMALS && !obj.dontselect |
---|
| 482 | + ; |
---|
461 | 483 | if (!hasnorm) |
---|
462 | 484 | { |
---|
463 | | - // System.out.println("FUCK!!"); |
---|
| 485 | + // System.out.println("Mesh normal"); |
---|
464 | 486 | LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0); |
---|
465 | 487 | LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1); |
---|
466 | 488 | LA.vecCross(obj.v0, obj.v1, obj.v2); |
---|
.. | .. |
---|
1185 | 1207 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1186 | 1208 | } |
---|
1187 | 1209 | } |
---|
| 1210 | + |
---|
1188 | 1211 | if (flipV) |
---|
1189 | 1212 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1190 | 1213 | else |
---|
1191 | 1214 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1215 | + |
---|
1192 | 1216 | //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1193 | 1217 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1194 | 1218 | |
---|
.. | .. |
---|
1208 | 1232 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1209 | 1233 | } |
---|
1210 | 1234 | } |
---|
| 1235 | + |
---|
1211 | 1236 | if (flipV) |
---|
1212 | 1237 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1213 | 1238 | else |
---|
1214 | 1239 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1240 | + |
---|
1215 | 1241 | //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1216 | 1242 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1217 | 1243 | |
---|
.. | .. |
---|
1239 | 1265 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1240 | 1266 | else |
---|
1241 | 1267 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1268 | + |
---|
1242 | 1269 | //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
1243 | 1270 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1271 | + |
---|
1244 | 1272 | count2 += 2; |
---|
1245 | 1273 | count3 += 3; |
---|
1246 | 1274 | } |
---|
.. | .. |
---|
1596 | 1624 | // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
1597 | 1625 | } |
---|
1598 | 1626 | |
---|
1599 | | - void DrawMaterial(cMaterial material, boolean selected) |
---|
| 1627 | + void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others) |
---|
1600 | 1628 | { |
---|
1601 | 1629 | CameraPane display = this; |
---|
1602 | 1630 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
1612 | 1640 | //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0); |
---|
1613 | 1641 | if (!material.multiply) |
---|
1614 | 1642 | { |
---|
1615 | | - display.color = color; |
---|
| 1643 | + display.color = material.color; |
---|
1616 | 1644 | display.saturation = material.modulation; |
---|
1617 | 1645 | } |
---|
1618 | 1646 | else |
---|
1619 | 1647 | { |
---|
1620 | | - display.color *= color*2; |
---|
| 1648 | + display.color *= material.color*2; |
---|
1621 | 1649 | display.saturation *= material.modulation*2; |
---|
1622 | 1650 | } |
---|
1623 | 1651 | |
---|
1624 | 1652 | cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0); |
---|
1625 | 1653 | |
---|
1626 | | - float[] colorV = GrafreeD.colorV; |
---|
| 1654 | + float[] colorV = Grafreed.colorV; |
---|
1627 | 1655 | |
---|
1628 | 1656 | /**/ |
---|
1629 | 1657 | if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0) |
---|
.. | .. |
---|
1631 | 1659 | colorV[0] = display.modelParams0[0] * material.diffuse; |
---|
1632 | 1660 | colorV[1] = display.modelParams0[1] * material.diffuse; |
---|
1633 | 1661 | colorV[2] = display.modelParams0[2] * material.diffuse; |
---|
1634 | | - colorV[3] = material.opacity; |
---|
| 1662 | + colorV[3] = 1; // material.opacity; |
---|
1635 | 1663 | |
---|
1636 | 1664 | gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity); |
---|
1637 | 1665 | //System.out.println("Opacity = " + opacity); |
---|
.. | .. |
---|
1739 | 1767 | display.modelParams7[2] = 0; |
---|
1740 | 1768 | display.modelParams7[3] = 0; |
---|
1741 | 1769 | |
---|
1742 | | - display.modelParams6[0] = 100; // criss de bug de bump |
---|
| 1770 | + //display.modelParams6[0] = 100; // criss de bug de bump |
---|
1743 | 1771 | |
---|
1744 | | - Object3D.cVector2[] extparams = display.vector2buffer; |
---|
| 1772 | + Object3D.cVector2[] extparams = others; // display.vector2buffer; |
---|
1745 | 1773 | if (extparams != null && extparams.length > 0 && extparams[0] != null) |
---|
1746 | 1774 | { |
---|
1747 | 1775 | display.modelParams6[0] = extparams[0].x / 1000.0f; // bump |
---|
.. | .. |
---|
1883 | 1911 | void PushMatrix(double[][] matrix) |
---|
1884 | 1912 | { |
---|
1885 | 1913 | // GrafreeD.tracein(matrix); |
---|
1886 | | - PushMatrix(matrix,1); |
---|
| 1914 | + PushMatrix(matrix, 1); |
---|
1887 | 1915 | } |
---|
1888 | 1916 | |
---|
1889 | 1917 | void PushMatrix() |
---|
.. | .. |
---|
2037 | 2065 | //System.err.println("Oeil on"); |
---|
2038 | 2066 | OEIL = true; |
---|
2039 | 2067 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
2040 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 2068 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
2041 | 2069 | //pingthread.StepToTarget(true); |
---|
2042 | 2070 | } |
---|
2043 | 2071 | |
---|
.. | .. |
---|
2135 | 2163 | System.err.println("LIVE = " + Globals.isLIVE()); |
---|
2136 | 2164 | |
---|
2137 | 2165 | if (!Globals.isLIVE()) // save sound |
---|
2138 | | - GrafreeD.savesound = true; // wav.save(); |
---|
| 2166 | + Grafreed.savesound = true; // wav.save(); |
---|
2139 | 2167 | // else |
---|
2140 | 2168 | repaint(); // start loop // may 2013 |
---|
2141 | 2169 | } |
---|
.. | .. |
---|
2168 | 2196 | public void ToggleBoxMode() |
---|
2169 | 2197 | { |
---|
2170 | 2198 | BOXMODE ^= true; |
---|
| 2199 | + } |
---|
| 2200 | + |
---|
| 2201 | + public void ToggleZoomBoxMode() |
---|
| 2202 | + { |
---|
| 2203 | + ZOOMBOXMODE ^= true; |
---|
2171 | 2204 | } |
---|
2172 | 2205 | |
---|
2173 | 2206 | public void ToggleSmoothFocus() |
---|
.. | .. |
---|
2247 | 2280 | |
---|
2248 | 2281 | void ToggleDebug() |
---|
2249 | 2282 | { |
---|
2250 | | - DEBUG ^= true; |
---|
| 2283 | + Globals.DEBUG ^= true; |
---|
2251 | 2284 | } |
---|
2252 | 2285 | |
---|
2253 | 2286 | void ToggleLookAt() |
---|
.. | .. |
---|
2255 | 2288 | LOOKAT ^= true; |
---|
2256 | 2289 | } |
---|
2257 | 2290 | |
---|
2258 | | - void ToggleRandom() |
---|
| 2291 | + void ToggleSwitch() |
---|
2259 | 2292 | { |
---|
2260 | | - RANDOM ^= true; |
---|
| 2293 | + SWITCH ^= true; |
---|
2261 | 2294 | } |
---|
2262 | 2295 | |
---|
2263 | 2296 | void ToggleHandles() |
---|
.. | .. |
---|
2265 | 2298 | HANDLES ^= true; |
---|
2266 | 2299 | } |
---|
2267 | 2300 | |
---|
| 2301 | + Object3D paintFolder; |
---|
| 2302 | + |
---|
2268 | 2303 | void TogglePaint() |
---|
2269 | 2304 | { |
---|
2270 | 2305 | PAINTMODE ^= true; |
---|
2271 | 2306 | paintcount = 0; |
---|
| 2307 | + |
---|
| 2308 | + if (PAINTMODE) |
---|
| 2309 | + { |
---|
| 2310 | + paintFolder = GetFolder(); |
---|
| 2311 | + } |
---|
2272 | 2312 | } |
---|
2273 | 2313 | |
---|
2274 | 2314 | void SwapCamera(int a, int b) |
---|
.. | .. |
---|
2364 | 2404 | { |
---|
2365 | 2405 | return currentGL; |
---|
2366 | 2406 | } |
---|
2367 | | - |
---|
| 2407 | + |
---|
2368 | 2408 | /**/ |
---|
2369 | 2409 | class CacheTexture |
---|
2370 | 2410 | { |
---|
.. | .. |
---|
4196 | 4236 | |
---|
4197 | 4237 | com.sun.opengl.util.texture.Texture CompressTexture2(String name) |
---|
4198 | 4238 | { |
---|
| 4239 | + new Exception().printStackTrace(); |
---|
4199 | 4240 | System.exit(0); |
---|
4200 | 4241 | com.sun.opengl.util.texture.Texture texture = null; |
---|
4201 | 4242 | |
---|
.. | .. |
---|
7889 | 7930 | String pigment = Object3D.GetPigment(tex); |
---|
7890 | 7931 | String bump = Object3D.GetBump(tex); |
---|
7891 | 7932 | |
---|
7892 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7933 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7893 | 7934 | { |
---|
7894 | 7935 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7895 | 7936 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
7906 | 7947 | |
---|
7907 | 7948 | ReleaseTexture(bump, true); |
---|
7908 | 7949 | ReleaseTexture(pigment, false); |
---|
| 7950 | + } |
---|
| 7951 | + |
---|
| 7952 | + public void ReleasePigmentTexture(cTexture tex) // INTERFACE |
---|
| 7953 | + { |
---|
| 7954 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 7955 | + { |
---|
| 7956 | + return; |
---|
| 7957 | + } |
---|
| 7958 | + |
---|
| 7959 | + if (tex == null) |
---|
| 7960 | + { |
---|
| 7961 | + ReleaseTexture(null, false); |
---|
| 7962 | + return; |
---|
| 7963 | + } |
---|
| 7964 | + |
---|
| 7965 | + String pigment = Object3D.GetPigment(tex); |
---|
| 7966 | + |
---|
| 7967 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7968 | + { |
---|
| 7969 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 7970 | + // System.out.println("; bump = " + bump); |
---|
| 7971 | + } |
---|
| 7972 | + |
---|
| 7973 | + if (pigment.equals("")) |
---|
| 7974 | + { |
---|
| 7975 | + pigment = null; |
---|
| 7976 | + } |
---|
| 7977 | + |
---|
| 7978 | + ReleaseTexture(pigment, false); |
---|
| 7979 | + } |
---|
| 7980 | + |
---|
| 7981 | + public void ReleaseBumpTexture(cTexture tex) // INTERFACE |
---|
| 7982 | + { |
---|
| 7983 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 7984 | + { |
---|
| 7985 | + return; |
---|
| 7986 | + } |
---|
| 7987 | + |
---|
| 7988 | + if (tex == null) |
---|
| 7989 | + { |
---|
| 7990 | + ReleaseTexture(null, true); |
---|
| 7991 | + return; |
---|
| 7992 | + } |
---|
| 7993 | + |
---|
| 7994 | + String bump = Object3D.GetBump(tex); |
---|
| 7995 | + |
---|
| 7996 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7997 | + { |
---|
| 7998 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 7999 | + // System.out.println("; bump = " + bump); |
---|
| 8000 | + } |
---|
| 8001 | + |
---|
| 8002 | + if (bump.equals("")) |
---|
| 8003 | + { |
---|
| 8004 | + bump = null; |
---|
| 8005 | + } |
---|
| 8006 | + |
---|
| 8007 | + ReleaseTexture(bump, true); |
---|
7909 | 8008 | } |
---|
7910 | 8009 | |
---|
7911 | 8010 | void ReleaseTexture(String tex, boolean bump) |
---|
.. | .. |
---|
8011 | 8110 | } |
---|
8012 | 8111 | } |
---|
8013 | 8112 | |
---|
8014 | | - /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE |
---|
| 8113 | + /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
8015 | 8114 | { |
---|
8016 | 8115 | if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
8017 | 8116 | ambientOcclusion ) // || !textureon) |
---|
.. | .. |
---|
8032 | 8131 | usedtextures.put(pigment, pigment); |
---|
8033 | 8132 | usedtextures.put(bump, bump); |
---|
8034 | 8133 | |
---|
8035 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8134 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8036 | 8135 | { |
---|
8037 | 8136 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8038 | 8137 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8056 | 8155 | return; // true; |
---|
8057 | 8156 | } |
---|
8058 | 8157 | |
---|
8059 | | - CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) |
---|
| 8158 | + /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8159 | + { |
---|
| 8160 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8161 | + ambientOcclusion ) // || !textureon) |
---|
| 8162 | + { |
---|
| 8163 | + return; // false; |
---|
| 8164 | + } |
---|
| 8165 | + |
---|
| 8166 | + if (tex == null) |
---|
| 8167 | + { |
---|
| 8168 | + BindTexture(null,false,resolution); |
---|
| 8169 | + return; |
---|
| 8170 | + } |
---|
| 8171 | + |
---|
| 8172 | + String pigment = Object3D.GetPigment(tex); |
---|
| 8173 | + |
---|
| 8174 | + usedtextures.put(pigment, pigment); |
---|
| 8175 | + |
---|
| 8176 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8177 | + { |
---|
| 8178 | + // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8179 | + // System.out.println("; bump = " + bump); |
---|
| 8180 | + } |
---|
| 8181 | + |
---|
| 8182 | + if (pigment.equals("")) |
---|
| 8183 | + { |
---|
| 8184 | + pigment = null; |
---|
| 8185 | + } |
---|
| 8186 | + |
---|
| 8187 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8188 | + BindTexture(pigment, false, resolution); |
---|
| 8189 | + } |
---|
| 8190 | + |
---|
| 8191 | + /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8192 | + { |
---|
| 8193 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8194 | + ambientOcclusion ) // || !textureon) |
---|
| 8195 | + { |
---|
| 8196 | + return; // false; |
---|
| 8197 | + } |
---|
| 8198 | + |
---|
| 8199 | + if (tex == null) |
---|
| 8200 | + { |
---|
| 8201 | + BindTexture(null,true,resolution); |
---|
| 8202 | + return; |
---|
| 8203 | + } |
---|
| 8204 | + |
---|
| 8205 | + String bump = Object3D.GetBump(tex); |
---|
| 8206 | + |
---|
| 8207 | + usedtextures.put(bump, bump); |
---|
| 8208 | + |
---|
| 8209 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8210 | + { |
---|
| 8211 | + // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8212 | + // System.out.println("; bump = " + bump); |
---|
| 8213 | + } |
---|
| 8214 | + |
---|
| 8215 | + if (bump.equals("")) |
---|
| 8216 | + { |
---|
| 8217 | + bump = null; |
---|
| 8218 | + } |
---|
| 8219 | + |
---|
| 8220 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
| 8221 | + BindTexture(bump, true, resolution); |
---|
| 8222 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8223 | + } |
---|
| 8224 | + |
---|
| 8225 | + java.util.HashSet<String> missingTextures = new java.util.HashSet<String>(); |
---|
| 8226 | + |
---|
| 8227 | + private boolean FileExists(String tex) |
---|
| 8228 | + { |
---|
| 8229 | + if (missingTextures.contains(tex)) |
---|
| 8230 | + { |
---|
| 8231 | + return false; |
---|
| 8232 | + } |
---|
| 8233 | + |
---|
| 8234 | + boolean fileExists = new File(tex).exists(); |
---|
| 8235 | + |
---|
| 8236 | + if (!fileExists) |
---|
| 8237 | + { |
---|
| 8238 | + // If file exists, the "new File()" is not executed sgain |
---|
| 8239 | + missingTextures.add(tex); |
---|
| 8240 | + } |
---|
| 8241 | + |
---|
| 8242 | + return fileExists; |
---|
| 8243 | + } |
---|
| 8244 | + |
---|
| 8245 | + CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8060 | 8246 | { |
---|
8061 | 8247 | CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null; |
---|
8062 | 8248 | |
---|
.. | .. |
---|
8064 | 8250 | { |
---|
8065 | 8251 | String texname = tex; |
---|
8066 | 8252 | |
---|
8067 | | - String[] split = tex.split("Textures"); |
---|
8068 | | - if (split.length > 1) |
---|
8069 | | - texname = "/Users/nbriere/Textures" + split[split.length-1]; |
---|
8070 | | - else |
---|
8071 | | - if (!texname.startsWith("/")) |
---|
8072 | | - texname = "/Users/nbriere/Textures/" + texname; |
---|
| 8253 | + String fallbackTextureName = defaultDirectory + "/Textures/" + texname; |
---|
| 8254 | + |
---|
| 8255 | +// String[] split = tex.split("Textures"); |
---|
| 8256 | +// if (split.length > 1) |
---|
| 8257 | +// texname = "/Users/nbriere/Textures" + split[split.length-1]; |
---|
| 8258 | +// else |
---|
| 8259 | +// if (!texname.startsWith("/")) |
---|
| 8260 | +// texname = "/Users/nbriere/Textures/" + texname; |
---|
| 8261 | + if (!FileExists(tex)) |
---|
| 8262 | + { |
---|
| 8263 | + texname = fallbackTextureName; |
---|
| 8264 | + } |
---|
8073 | 8265 | |
---|
8074 | 8266 | if (CACHETEXTURE) |
---|
8075 | 8267 | texture = textures.get(texname); // TEXTURE CACHE |
---|
.. | .. |
---|
8138 | 8330 | } |
---|
8139 | 8331 | |
---|
8140 | 8332 | cachename = texname.substring(0, texname.length()-4)+ext+".jpg"; |
---|
8141 | | - if (!new File(cachename).exists()) |
---|
| 8333 | + if (!FileExists(cachename)) |
---|
8142 | 8334 | cachename = texname; |
---|
8143 | 8335 | else |
---|
8144 | 8336 | processbump = false; // don't process bump map again |
---|
.. | .. |
---|
8160 | 8352 | } |
---|
8161 | 8353 | |
---|
8162 | 8354 | cachename = texname.substring(0, texname.length()-4)+ext+".png"; |
---|
8163 | | - if (!new File(cachename).exists()) |
---|
| 8355 | + if (!FileExists(cachename)) |
---|
8164 | 8356 | cachename = texname; |
---|
8165 | 8357 | else |
---|
8166 | 8358 | processbump = false; // don't process bump map again |
---|
.. | .. |
---|
8169 | 8361 | texturedata = GetFileTexture(cachename, processbump, resolution); |
---|
8170 | 8362 | |
---|
8171 | 8363 | |
---|
8172 | | - if (texturedata != null) |
---|
| 8364 | + if (texturedata == null) |
---|
| 8365 | + throw new Exception(); |
---|
| 8366 | + |
---|
8173 | 8367 | texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution); |
---|
8174 | 8368 | //texture = GetTexture(tex, bump); |
---|
8175 | 8369 | } |
---|
.. | .. |
---|
8291 | 8485 | return texture; |
---|
8292 | 8486 | } |
---|
8293 | 8487 | |
---|
8294 | | - com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) |
---|
| 8488 | + com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8295 | 8489 | { |
---|
8296 | 8490 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
8297 | 8491 | |
---|
.. | .. |
---|
8309 | 8503 | return texture!=null?texture.texture:null; |
---|
8310 | 8504 | } |
---|
8311 | 8505 | |
---|
8312 | | - public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) |
---|
| 8506 | + public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception |
---|
8313 | 8507 | { |
---|
8314 | 8508 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
8315 | 8509 | |
---|
8316 | 8510 | return texture!=null?texture.texturedata:null; |
---|
8317 | 8511 | } |
---|
8318 | 8512 | |
---|
8319 | | - boolean BindTexture(String tex, boolean bump, int resolution) |
---|
| 8513 | + boolean BindTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8320 | 8514 | { |
---|
8321 | 8515 | if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
8322 | 8516 | { |
---|
8323 | 8517 | return false; |
---|
8324 | 8518 | } |
---|
8325 | 8519 | |
---|
8326 | | - boolean newtex = false; |
---|
| 8520 | + //boolean newtex = false; |
---|
8327 | 8521 | |
---|
8328 | 8522 | com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution); |
---|
8329 | 8523 | |
---|
.. | .. |
---|
8355 | 8549 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT); |
---|
8356 | 8550 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT); |
---|
8357 | 8551 | |
---|
8358 | | - return newtex; |
---|
| 8552 | + return true; // Warning: not used. |
---|
8359 | 8553 | } |
---|
8360 | 8554 | |
---|
8361 | 8555 | ShadowBuffer shadowPBuf; |
---|
.. | .. |
---|
9193 | 9387 | jy8[3] = 0.5f; |
---|
9194 | 9388 | } |
---|
9195 | 9389 | |
---|
9196 | | - float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV |
---|
| 9390 | + float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV |
---|
9197 | 9391 | float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation |
---|
9198 | 9392 | float[] options3 = new float[]{1, 1, 1, 0}; // fog color |
---|
9199 | 9393 | float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen |
---|
9200 | 9394 | |
---|
| 9395 | + void ResetOptions() |
---|
| 9396 | + { |
---|
| 9397 | + options1[0] = 100; |
---|
| 9398 | + options1[1] = 0.025f; |
---|
| 9399 | + options1[2] = 0.01f; |
---|
| 9400 | + options1[3] = 0; |
---|
| 9401 | + options1[4] = 0; |
---|
| 9402 | + |
---|
| 9403 | + options2[0] = 0; |
---|
| 9404 | + options2[1] = 0.75f; |
---|
| 9405 | + options2[2] = 0; |
---|
| 9406 | + options2[3] = 0; |
---|
| 9407 | + |
---|
| 9408 | + options3[0] = 1; |
---|
| 9409 | + options3[1] = 1; |
---|
| 9410 | + options3[2] = 1; |
---|
| 9411 | + options3[3] = 0; |
---|
| 9412 | + |
---|
| 9413 | + options4[0] = 1; |
---|
| 9414 | + options4[1] = 0; |
---|
| 9415 | + options4[2] = 1; |
---|
| 9416 | + options4[3] = 0; |
---|
| 9417 | + } |
---|
| 9418 | + |
---|
9201 | 9419 | static int imagecount = 0; // movie generation |
---|
9202 | 9420 | |
---|
9203 | 9421 | static int jitter = 0; |
---|
.. | .. |
---|
9293 | 9511 | assert (parentcam != renderCamera); |
---|
9294 | 9512 | |
---|
9295 | 9513 | if (renderCamera != lightCamera) |
---|
9296 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9297 | | - LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
| 9514 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 9515 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
9298 | 9516 | |
---|
9299 | 9517 | // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix); |
---|
9300 | 9518 | |
---|
.. | .. |
---|
9309 | 9527 | LA.matCopy(renderCamera.fromScreen, matrix); |
---|
9310 | 9528 | |
---|
9311 | 9529 | if (renderCamera != lightCamera) |
---|
9312 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9313 | | - LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
| 9530 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 9531 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
9314 | 9532 | |
---|
9315 | 9533 | // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix); |
---|
9316 | 9534 | |
---|
.. | .. |
---|
9382 | 9600 | //gl.glFlush(); |
---|
9383 | 9601 | gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE); |
---|
9384 | 9602 | |
---|
9385 | | - if (ANIMATION && ABORTED) |
---|
| 9603 | + if (Globals.ANIMATION && ABORTED) |
---|
9386 | 9604 | { |
---|
9387 | 9605 | System.err.println(" ABORTED FRAME"); |
---|
9388 | 9606 | break; |
---|
.. | .. |
---|
9412 | 9630 | setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
---|
9413 | 9631 | |
---|
9414 | 9632 | // save image |
---|
9415 | | - if (ANIMATION && !ABORTED) |
---|
| 9633 | + if (Globals.ANIMATION && !ABORTED) |
---|
9416 | 9634 | { |
---|
9417 | 9635 | VPwidth = viewport[2]; |
---|
9418 | 9636 | VPheight = viewport[3]; |
---|
.. | .. |
---|
9523 | 9741 | |
---|
9524 | 9742 | // imagecount++; |
---|
9525 | 9743 | |
---|
9526 | | - String fullname = filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext; |
---|
| 9744 | + String fullname = Globals.filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext; |
---|
9527 | 9745 | |
---|
9528 | 9746 | if (!BOXMODE) |
---|
9529 | 9747 | { |
---|
9530 | | - System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")"); |
---|
| 9748 | + System.out.println("image: " + fullname + " (wav cursor=" + (Grafreed.wav.cursor / 735 / 4) + ")"); |
---|
9531 | 9749 | } |
---|
9532 | 9750 | |
---|
9533 | 9751 | if (!BOXMODE) |
---|
.. | .. |
---|
9565 | 9783 | ABORTED = false; |
---|
9566 | 9784 | } |
---|
9567 | 9785 | else |
---|
9568 | | - GrafreeD.wav.cursor += 735 * ACSIZE; |
---|
| 9786 | + Grafreed.wav.cursor += 735 * ACSIZE; |
---|
9569 | 9787 | |
---|
9570 | 9788 | if (false) |
---|
9571 | 9789 | { |
---|
.. | .. |
---|
10228 | 10446 | |
---|
10229 | 10447 | public void display(GLAutoDrawable drawable) |
---|
10230 | 10448 | { |
---|
10231 | | - if (GrafreeD.savesound && GrafreeD.hassound) |
---|
| 10449 | + if (Grafreed.savesound && Grafreed.hassound) |
---|
10232 | 10450 | { |
---|
10233 | | - GrafreeD.wav.save(); |
---|
10234 | | - GrafreeD.savesound = false; |
---|
10235 | | - GrafreeD.hassound = false; |
---|
| 10451 | + Grafreed.wav.save(); |
---|
| 10452 | + Grafreed.savesound = false; |
---|
| 10453 | + Grafreed.hassound = false; |
---|
10236 | 10454 | } |
---|
10237 | 10455 | // if (DEBUG_SELECTION) |
---|
10238 | 10456 | // { |
---|
.. | .. |
---|
10308 | 10526 | ANTIALIAS = 0; |
---|
10309 | 10527 | //System.out.println("RESTART"); |
---|
10310 | 10528 | AAtimer.restart(); |
---|
| 10529 | + Globals.TIMERRUNNING = true; |
---|
10311 | 10530 | } |
---|
10312 | 10531 | } |
---|
10313 | 10532 | } |
---|
.. | .. |
---|
10362 | 10581 | Object3D theobject = object; |
---|
10363 | 10582 | Object3D theparent = object.parent; |
---|
10364 | 10583 | object.parent = null; |
---|
10365 | | - object = (Object3D)GrafreeD.clone(object); |
---|
| 10584 | + object = (Object3D)Grafreed.clone(object); |
---|
10366 | 10585 | object.Stripify(); |
---|
10367 | 10586 | if (theobject.selection == null || theobject.selection.Size() == 0) |
---|
10368 | 10587 | theobject.PreprocessOcclusion(this); |
---|
.. | .. |
---|
10375 | 10594 | ambientOcclusion = false; |
---|
10376 | 10595 | } |
---|
10377 | 10596 | |
---|
10378 | | - if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN) |
---|
| 10597 | + if (//Globals.lighttouched && |
---|
| 10598 | + DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10379 | 10599 | { |
---|
10380 | 10600 | //if (RENDERSHADOW) // ? |
---|
10381 | 10601 | if (!IsFrozen()) |
---|
10382 | 10602 | { |
---|
10383 | 10603 | // dec 2012 |
---|
10384 | | - if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
| 10604 | + if (!ambientOcclusion && !(!flash && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
10385 | 10605 | { |
---|
10386 | 10606 | Globals.framecount++; |
---|
10387 | 10607 | shadowbuffer.display(); |
---|
.. | .. |
---|
10508 | 10728 | |
---|
10509 | 10729 | // if (parentcam != renderCamera) // not a light |
---|
10510 | 10730 | if (cam != lightCamera) |
---|
10511 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10512 | | - LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
| 10731 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 10732 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
10513 | 10733 | |
---|
10514 | 10734 | for (int j = 0; j < 4; j++) |
---|
10515 | 10735 | { |
---|
.. | .. |
---|
10523 | 10743 | |
---|
10524 | 10744 | // if (parentcam != renderCamera) // not a light |
---|
10525 | 10745 | if (cam != lightCamera) |
---|
10526 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10527 | | - LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
| 10746 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 10747 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
10528 | 10748 | |
---|
10529 | 10749 | //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix); |
---|
10530 | 10750 | |
---|
.. | .. |
---|
10783 | 11003 | // Bump noise |
---|
10784 | 11004 | gl.glActiveTexture(GL.GL_TEXTURE6); |
---|
10785 | 11005 | //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise); |
---|
10786 | | - BindTexture(NOISE_TEXTURE, false, 2); |
---|
| 11006 | + |
---|
| 11007 | + try |
---|
| 11008 | + { |
---|
| 11009 | + BindTexture(NOISE_TEXTURE, false, 2); |
---|
| 11010 | + } |
---|
| 11011 | + catch (Exception e) |
---|
| 11012 | + { |
---|
| 11013 | + System.err.println("FAILED: " + NOISE_TEXTURE); |
---|
| 11014 | + } |
---|
| 11015 | + |
---|
10787 | 11016 | |
---|
10788 | 11017 | gl.glActiveTexture(GL.GL_TEXTURE0); |
---|
10789 | 11018 | gl.glEnable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
10806 | 11035 | |
---|
10807 | 11036 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
10808 | 11037 | |
---|
10809 | | -//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
10810 | | -//gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
10811 | | -//gl.glEnable(gl.GL_MULTISAMPLE); |
---|
| 11038 | +gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
| 11039 | +gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
| 11040 | +gl.glEnable(gl.GL_MULTISAMPLE); |
---|
10812 | 11041 | } else |
---|
10813 | 11042 | { |
---|
10814 | 11043 | //gl.glDisable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
10819 | 11048 | //System.out.println("BLENDING ON"); |
---|
10820 | 11049 | gl.glEnable(GL.GL_BLEND); |
---|
10821 | 11050 | gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); |
---|
10822 | | - |
---|
| 11051 | +// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE); |
---|
10823 | 11052 | gl.glMatrixMode(gl.GL_PROJECTION); |
---|
10824 | 11053 | gl.glLoadIdentity(); |
---|
10825 | 11054 | |
---|
.. | .. |
---|
10908 | 11137 | System.err.println("parentcam != renderCamera"); |
---|
10909 | 11138 | |
---|
10910 | 11139 | // if (cam != lightCamera) |
---|
10911 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10912 | | - LA.xformDir(lightposition, parentcam.toParent, lightposition); // may 2013 |
---|
| 11140 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 11141 | + LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013 |
---|
10913 | 11142 | } |
---|
10914 | 11143 | |
---|
10915 | 11144 | LA.xformDir(lightposition, cam.toScreen, lightposition); |
---|
.. | .. |
---|
10930 | 11159 | if (true) // TODO |
---|
10931 | 11160 | { |
---|
10932 | 11161 | if (cam != lightCamera) |
---|
10933 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10934 | | - LA.xformDir(light0, parentcam.toParent, light0); // may 2013 |
---|
| 11162 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 11163 | + LA.xformDir(light0, parentcam.GlobalTransform(), light0); // may 2013 |
---|
10935 | 11164 | } |
---|
10936 | 11165 | |
---|
10937 | 11166 | LA.xformPos(light0, cam.toScreen, light0); |
---|
.. | .. |
---|
11247 | 11476 | { |
---|
11248 | 11477 | renderpass++; |
---|
11249 | 11478 | // System.out.println("Draw object... "); |
---|
| 11479 | + STEP = 1; |
---|
11250 | 11480 | if (FAST) // in case there is no script |
---|
11251 | | - STEP = 16; |
---|
| 11481 | + STEP = 8; |
---|
| 11482 | + |
---|
| 11483 | + if (CURRENTANTIALIAS == 0 || ACSIZE == 1) |
---|
| 11484 | + { |
---|
| 11485 | + STEP *= 4; |
---|
| 11486 | + } |
---|
11252 | 11487 | |
---|
11253 | 11488 | //object.FullInvariants(); |
---|
11254 | 11489 | |
---|
.. | .. |
---|
11262 | 11497 | e.printStackTrace(); |
---|
11263 | 11498 | } |
---|
11264 | 11499 | |
---|
11265 | | - if (GrafreeD.RENDERME > 0) |
---|
11266 | | - GrafreeD.RENDERME--; // mechante magouille |
---|
| 11500 | + if (Grafreed.RENDERME > 0) |
---|
| 11501 | + Grafreed.RENDERME--; // mechante magouille |
---|
11267 | 11502 | |
---|
11268 | 11503 | Globals.ONESTEP = false; |
---|
11269 | 11504 | } |
---|
11270 | 11505 | |
---|
11271 | 11506 | static boolean zoomonce = false; |
---|
11272 | 11507 | |
---|
| 11508 | + static void CreateSelectedPoint() |
---|
| 11509 | + { |
---|
| 11510 | + if (selectedpoint == null) |
---|
| 11511 | + { |
---|
| 11512 | + debugpointG = new Sphere(); |
---|
| 11513 | + debugpointP = new Sphere(); |
---|
| 11514 | + debugpointC = new Sphere(); |
---|
| 11515 | + debugpointR = new Sphere(); |
---|
| 11516 | + |
---|
| 11517 | + selectedpoint = new Superellipsoid(); |
---|
| 11518 | + |
---|
| 11519 | + for (int i=0; i<8; i++) |
---|
| 11520 | + { |
---|
| 11521 | + debugpoints[i] = new Sphere(); |
---|
| 11522 | + } |
---|
| 11523 | + } |
---|
| 11524 | + } |
---|
| 11525 | + |
---|
11273 | 11526 | void DrawObject(GL gl, boolean draw) |
---|
11274 | 11527 | { |
---|
| 11528 | + // To clear camera values |
---|
| 11529 | + ResetOptions(); |
---|
| 11530 | + |
---|
11275 | 11531 | //System.out.println("DRAW OBJECT " + mouseDown); |
---|
11276 | 11532 | // DrawMode() = SELECTION; |
---|
11277 | 11533 | //GL gl = getGL(); |
---|
11278 | 11534 | if ((TRACK || SHADOWTRACK) || zoomonce) |
---|
11279 | 11535 | { |
---|
11280 | 11536 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
11281 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 11537 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
11282 | 11538 | pingthread.StepToTarget(true); // true); |
---|
11283 | 11539 | // zoomonce = false; |
---|
11284 | 11540 | } |
---|
.. | .. |
---|
11333 | 11589 | |
---|
11334 | 11590 | usedtextures.clear(); |
---|
11335 | 11591 | |
---|
11336 | | - BindTextures(DEFAULT_TEXTURES, 2); |
---|
| 11592 | + try |
---|
| 11593 | + { |
---|
| 11594 | + BindTextures(DEFAULT_TEXTURES, 2); |
---|
| 11595 | + } |
---|
| 11596 | + catch (Exception e) |
---|
| 11597 | + { |
---|
| 11598 | + System.err.println("FAILED: " + DEFAULT_TEXTURES); |
---|
| 11599 | + } |
---|
11337 | 11600 | } |
---|
11338 | 11601 | //System.out.println("--> " + stackdepth); |
---|
11339 | 11602 | // GrafreeD.traceon(); |
---|
.. | .. |
---|
11343 | 11606 | |
---|
11344 | 11607 | if (DrawMode() == DEFAULT) |
---|
11345 | 11608 | { |
---|
11346 | | - if (DEBUG) |
---|
| 11609 | + if (Globals.DEBUG) |
---|
11347 | 11610 | { |
---|
| 11611 | + CreateSelectedPoint(); |
---|
11348 | 11612 | float radius = 0.05f; |
---|
11349 | 11613 | if (selectedpoint.radius != radius) |
---|
11350 | 11614 | { |
---|
.. | .. |
---|
11424 | 11688 | if (checker != null && DrawMode() == DEFAULT) |
---|
11425 | 11689 | { |
---|
11426 | 11690 | //BindTexture(IMMORTAL_TEXTURE); |
---|
11427 | | - BindTextures(checker.GetTextures(), checker.texres); |
---|
| 11691 | + try |
---|
| 11692 | + { |
---|
| 11693 | + BindTextures(checker.GetTextures(), checker.texres); |
---|
| 11694 | + } |
---|
| 11695 | + catch (Exception e) |
---|
| 11696 | + { |
---|
| 11697 | + System.err.println("FAILED: " + checker.GetTextures()); |
---|
| 11698 | + } |
---|
11428 | 11699 | // NEAREST |
---|
11429 | 11700 | GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR); |
---|
11430 | 11701 | DrawChecker(gl); |
---|
.. | .. |
---|
11506 | 11777 | return; |
---|
11507 | 11778 | } |
---|
11508 | 11779 | |
---|
11509 | | - String string = obj.GetToolTip(); |
---|
| 11780 | + String string = obj.toString(); //.GetToolTip(); |
---|
11510 | 11781 | |
---|
11511 | 11782 | GL gl = GetGL(); |
---|
11512 | 11783 | |
---|
.. | .. |
---|
11823 | 12094 | //obj.TransformToWorld(light, light); |
---|
11824 | 12095 | for (int i = tp.size(); --i >= 0;) |
---|
11825 | 12096 | { |
---|
11826 | | - for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
11827 | | - LA.xformPos(light, tp.get(i).toParent, light); |
---|
| 12097 | + //for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
| 12098 | + LA.xformPos(light, tp.get(i).GlobalTransformInv(), light); |
---|
11828 | 12099 | } |
---|
11829 | 12100 | |
---|
11830 | 12101 | |
---|
.. | .. |
---|
11841 | 12112 | parentcam = cameras[0]; |
---|
11842 | 12113 | } |
---|
11843 | 12114 | |
---|
11844 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
11845 | | - LA.xformPos(light, parentcam.toParent, light); // may 2013 |
---|
| 12115 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 12116 | + LA.xformPos(light, parentcam.GlobalTransform(), light); // may 2013 |
---|
11846 | 12117 | |
---|
11847 | 12118 | LA.xformPos(light, renderCamera.toScreen, light); |
---|
11848 | 12119 | |
---|
.. | .. |
---|
12456 | 12727 | |
---|
12457 | 12728 | // display shadow only (bump == 0) |
---|
12458 | 12729 | "SUB temp.x, half.x, shadow.x;" + |
---|
12459 | | - "MOV temp.y, -params6.x;" + |
---|
12460 | | - "SLT temp.z, temp.y, zero.x;" + |
---|
| 12730 | + "MOV temp.y, -params5.z;" + // params6.x;" + |
---|
| 12731 | + "SLT temp.z, temp.y, -one2048th.x;" + |
---|
12461 | 12732 | "SUB temp.y, one.x, temp.z;" + |
---|
12462 | 12733 | "MUL temp.x, temp.x, temp.y;" + |
---|
12463 | 12734 | "KIL temp.x;" + |
---|
.. | .. |
---|
12586 | 12857 | "MAX ndotl.x, ndotl.x, -ndotl.x;" + |
---|
12587 | 12858 | |
---|
12588 | 12859 | "SUB temp.x, one.x, ndotl.x;" + |
---|
12589 | | - "ADD temp.x, temp.x, options2.z;" + // lightsheen |
---|
12590 | | - "ADD temp.y, one.y, options2.y;" + // sursurface |
---|
| 12860 | + // Tuning for default skin |
---|
| 12861 | + //"ADD temp.x, temp.x, options2.z;" + // lightsheen |
---|
| 12862 | + "MAD temp.x, options2.z, half.y, temp.x;" + // lightsheen |
---|
| 12863 | + "ADD temp.y, one.y, options2.y;" + // subsurface |
---|
12591 | 12864 | "MUL temp.x, temp.x, temp.y;" + |
---|
12592 | 12865 | |
---|
12593 | 12866 | "MUL saturation, saturation, temp.xxxx;" + |
---|
.. | .. |
---|
12786 | 13059 | //once = true; |
---|
12787 | 13060 | } |
---|
12788 | 13061 | |
---|
12789 | | - System.out.print("Program #" + mode + "; length = " + program.length()); |
---|
| 13062 | + System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
12790 | 13063 | System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
12791 | 13064 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
12792 | 13065 | |
---|
.. | .. |
---|
12919 | 13192 | |
---|
12920 | 13193 | "ADD " + depth + ".z, " + depth + ".z, temp.x;" + |
---|
12921 | 13194 | //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing! |
---|
| 13195 | + |
---|
| 13196 | + // Compare fragment depth in light space with shadowmap. |
---|
12922 | 13197 | "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
12923 | 13198 | "SGE temp.y, temp.x, zero.x;" + |
---|
12924 | | - "SUB " + shadow + ".y, one.x, temp.y;" + |
---|
| 13199 | + "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded |
---|
| 13200 | + |
---|
| 13201 | + // Reverse comparison |
---|
12925 | 13202 | "SUB temp.x, one.x, temp.x;" + |
---|
12926 | 13203 | "MUL " + shadow + ".x, temp.x, temp.y;" + |
---|
12927 | | - "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded |
---|
| 13204 | + "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse |
---|
12928 | 13205 | "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth |
---|
12929 | 13206 | |
---|
12930 | 13207 | "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
.. | .. |
---|
12938 | 13215 | // No shadow for backface |
---|
12939 | 13216 | "DP3 temp.x, normal, lightd;" + |
---|
12940 | 13217 | "SLT temp.x, temp.x, zero.x;" + // shadoweps |
---|
| 13218 | + "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
| 13219 | + |
---|
| 13220 | + // No shadow when out of frustrum |
---|
| 13221 | + "SGE temp.x, " + depth + ".z, one.z;" + |
---|
12941 | 13222 | "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
12942 | 13223 | ""; |
---|
12943 | 13224 | } |
---|
.. | .. |
---|
13084 | 13365 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13085 | 13366 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13086 | 13367 | /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
13087 | | - Object3D.cVector2[] vector2buffer; |
---|
| 13368 | + |
---|
| 13369 | + //Object3D.cVector2[] vector2buffer; |
---|
13088 | 13370 | |
---|
13089 | 13371 | // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea |
---|
13090 | 13372 | // OUT : diff, spec |
---|
.. | .. |
---|
13100 | 13382 | "DP3 " + dest + ".z," + "normals," + "eye;" + |
---|
13101 | 13383 | "MAX " + dest + ".w," + dest + ".z," + "eps.x;" + |
---|
13102 | 13384 | //"MOV " + dest + ".w," + "normal.z;" + |
---|
13103 | | - "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + |
---|
13104 | | - "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
13105 | | - //"MOV " + dest + ".z," + "params2.w;" + |
---|
| 13385 | +// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET |
---|
| 13386 | +// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
| 13387 | + |
---|
| 13388 | + "MOV " + dest + ".z," + "params2.w;" + // EXACT |
---|
13106 | 13389 | "POW " + dest + ".w," + dest + ".w," + dest + ".z;" + |
---|
13107 | 13390 | "RCP " + dest + ".w," + dest + ".w;" + |
---|
13108 | 13391 | //"RSQ " + dest + ".w," + dest + ".w;" + |
---|
.. | .. |
---|
13496 | 13779 | public void mousePressed(MouseEvent e) |
---|
13497 | 13780 | { |
---|
13498 | 13781 | //System.out.println("mousePressed: " + e); |
---|
13499 | | - clickStart(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 13782 | + clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13500 | 13783 | } |
---|
13501 | 13784 | |
---|
13502 | 13785 | static long prevtime = 0; |
---|
.. | .. |
---|
13523 | 13806 | |
---|
13524 | 13807 | //System.err.println("Dtime = " + Dtime + "; units = " + e.getUnitsToScroll() + "; ratio (units/ms) = " + ratio); |
---|
13525 | 13808 | |
---|
| 13809 | + if (BUTTONLESSWHEEL) |
---|
13526 | 13810 | if (Math.abs(ratio) < 0.1 || Math.abs(Dtime) == 0) // < 30) |
---|
13527 | 13811 | { |
---|
13528 | 13812 | return; |
---|
.. | .. |
---|
13531 | 13815 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
13532 | 13816 | |
---|
13533 | 13817 | // TIMER |
---|
13534 | | - if (!wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
| 13818 | + if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
13535 | 13819 | { |
---|
13536 | 13820 | keepboxmode = BOXMODE; |
---|
13537 | 13821 | keepsupport = SUPPORT; |
---|
.. | .. |
---|
13571 | 13855 | // mode |= META; |
---|
13572 | 13856 | //} |
---|
13573 | 13857 | |
---|
13574 | | - SetMouseMode(WHEEL | e.getModifiersEx()); |
---|
13575 | | - drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0); |
---|
| 13858 | + SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx()); |
---|
| 13859 | + drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0); |
---|
13576 | 13860 | anchorX = ax; |
---|
13577 | 13861 | anchorY = ay; |
---|
13578 | 13862 | prevX = px; |
---|
.. | .. |
---|
13606 | 13890 | else |
---|
13607 | 13891 | if (evt.getSource() == AAtimer) |
---|
13608 | 13892 | { |
---|
| 13893 | + Globals.TIMERRUNNING = false; |
---|
13609 | 13894 | if (mouseDown) |
---|
13610 | 13895 | { |
---|
13611 | 13896 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
13631 | 13916 | // LIVE = waslive; |
---|
13632 | 13917 | // wasliveok = true; |
---|
13633 | 13918 | // waslive = false; |
---|
| 13919 | + |
---|
| 13920 | + // May 2019 Forget it: |
---|
| 13921 | + if (true) |
---|
| 13922 | + return; |
---|
13634 | 13923 | |
---|
13635 | 13924 | // source == timer |
---|
13636 | 13925 | if (mouseDown) |
---|
.. | .. |
---|
13661 | 13950 | |
---|
13662 | 13951 | // fev 2014??? |
---|
13663 | 13952 | if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode) |
---|
13664 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 13953 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
13665 | 13954 | pingthread.StepToTarget(true); // true); |
---|
13666 | 13955 | } |
---|
13667 | 13956 | // if (!LIVE) |
---|
.. | .. |
---|
13670 | 13959 | |
---|
13671 | 13960 | javax.swing.Timer timer = new javax.swing.Timer(350, this); |
---|
13672 | 13961 | |
---|
13673 | | - void clickStart(int x, int y, int modifiers) |
---|
| 13962 | + void clickStart(int x, int y, int modifiers, int modifiersex) |
---|
13674 | 13963 | { |
---|
13675 | 13964 | if (!wasliveok) |
---|
13676 | 13965 | return; |
---|
13677 | 13966 | |
---|
13678 | 13967 | AAtimer.restart(); // |
---|
| 13968 | + Globals.TIMERRUNNING = true; |
---|
13679 | 13969 | |
---|
13680 | 13970 | // waslive = LIVE; |
---|
13681 | 13971 | // LIVE = false; |
---|
.. | .. |
---|
13687 | 13977 | // touched = true; // main DL |
---|
13688 | 13978 | if (isRenderer) |
---|
13689 | 13979 | { |
---|
13690 | | - SetMouseMode(modifiers); |
---|
| 13980 | + SetMouseMode(modifiers, modifiersex); |
---|
13691 | 13981 | } |
---|
13692 | 13982 | |
---|
13693 | 13983 | selectX = anchorX = x; |
---|
.. | .. |
---|
13700 | 13990 | clicked = true; |
---|
13701 | 13991 | hold = false; |
---|
13702 | 13992 | |
---|
13703 | | - if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection |
---|
| 13993 | + if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection |
---|
13704 | 13994 | // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection |
---|
13705 | 13995 | { |
---|
13706 | 13996 | // System.out.println("RESTART II " + modifiers); |
---|
.. | .. |
---|
13731 | 14021 | info.camera = renderCamera; |
---|
13732 | 14022 | info.x = x; |
---|
13733 | 14023 | info.y = y; |
---|
13734 | | - info.modifiers = modifiers; |
---|
| 14024 | + info.modifiers = modifiersex; |
---|
13735 | 14025 | editObj = object.doEditClick(info, 0); |
---|
13736 | 14026 | if (!editObj) |
---|
13737 | 14027 | { |
---|
.. | .. |
---|
13748 | 14038 | |
---|
13749 | 14039 | public void mouseDragged(MouseEvent e) |
---|
13750 | 14040 | { |
---|
| 14041 | + Globals.MOUSEDRAGGED = true; |
---|
| 14042 | + |
---|
| 14043 | + //System.out.println("mouseDragged: " + e); |
---|
13751 | 14044 | if (isRenderer) |
---|
13752 | 14045 | movingcamera = true; |
---|
| 14046 | + |
---|
13753 | 14047 | //if (drawing) |
---|
13754 | 14048 | //return; |
---|
13755 | | - //System.out.println("mouseDragged: " + e); |
---|
13756 | 14049 | if ((e.getModifiersEx() & CTRL) != 0 |
---|
13757 | 14050 | || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen()) |
---|
13758 | 14051 | { |
---|
.. | .. |
---|
13760 | 14053 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
13761 | 14054 | } |
---|
13762 | 14055 | else |
---|
13763 | | - drag(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 14056 | + drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13764 | 14057 | |
---|
13765 | 14058 | //try { Thread.sleep(1); } catch (Exception ex) {} |
---|
13766 | 14059 | } |
---|
.. | .. |
---|
13933 | 14226 | |
---|
13934 | 14227 | public void run() |
---|
13935 | 14228 | { |
---|
| 14229 | + new Exception().printStackTrace(); |
---|
13936 | 14230 | System.exit(0); |
---|
13937 | 14231 | for (;;) |
---|
13938 | 14232 | { |
---|
.. | .. |
---|
13996 | 14290 | { |
---|
13997 | 14291 | Globals.lighttouched = true; |
---|
13998 | 14292 | } |
---|
13999 | | - drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS); |
---|
| 14293 | + drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS); |
---|
14000 | 14294 | } |
---|
14001 | 14295 | //else |
---|
14002 | 14296 | } |
---|
.. | .. |
---|
14010 | 14304 | void GoDown(int mod) |
---|
14011 | 14305 | { |
---|
14012 | 14306 | MODIFIERS |= COMMAND; |
---|
14013 | | - /* |
---|
| 14307 | + /**/ |
---|
14014 | 14308 | if((mod&SHIFT) == SHIFT) |
---|
14015 | 14309 | manipCamera.RotatePosition(0, -speed); |
---|
14016 | 14310 | else |
---|
14017 | | - manipCamera.BackForth(0, -speed*delta, getWidth()); |
---|
14018 | | - */ |
---|
| 14311 | + manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14312 | + /**/ |
---|
14019 | 14313 | if ((mod & SHIFT) == SHIFT) |
---|
14020 | 14314 | { |
---|
14021 | 14315 | mouseMode = mouseMode; // VR?? |
---|
.. | .. |
---|
14031 | 14325 | void GoUp(int mod) |
---|
14032 | 14326 | { |
---|
14033 | 14327 | MODIFIERS |= COMMAND; |
---|
14034 | | - /* |
---|
| 14328 | + /**/ |
---|
14035 | 14329 | if((mod&SHIFT) == SHIFT) |
---|
14036 | 14330 | manipCamera.RotatePosition(0, speed); |
---|
14037 | 14331 | else |
---|
14038 | | - manipCamera.BackForth(0, speed*delta, getWidth()); |
---|
14039 | | - */ |
---|
| 14332 | + manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14333 | + /**/ |
---|
14040 | 14334 | if ((mod & SHIFT) == SHIFT) |
---|
14041 | 14335 | { |
---|
14042 | 14336 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14052 | 14346 | void GoLeft(int mod) |
---|
14053 | 14347 | { |
---|
14054 | 14348 | MODIFIERS |= COMMAND; |
---|
14055 | | - /* |
---|
| 14349 | + /**/ |
---|
14056 | 14350 | if((mod&SHIFT) == SHIFT) |
---|
14057 | | - manipCamera.RotatePosition(speed, 0); |
---|
14058 | | - else |
---|
14059 | 14351 | manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14060 | | - */ |
---|
| 14352 | + else |
---|
| 14353 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14354 | + /**/ |
---|
14061 | 14355 | if ((mod & SHIFT) == SHIFT) |
---|
14062 | 14356 | { |
---|
14063 | 14357 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14073 | 14367 | void GoRight(int mod) |
---|
14074 | 14368 | { |
---|
14075 | 14369 | MODIFIERS |= COMMAND; |
---|
14076 | | - /* |
---|
| 14370 | + /**/ |
---|
14077 | 14371 | if((mod&SHIFT) == SHIFT) |
---|
14078 | | - manipCamera.RotatePosition(-speed, 0); |
---|
14079 | | - else |
---|
14080 | 14372 | manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14081 | | - */ |
---|
| 14373 | + else |
---|
| 14374 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14375 | + /**/ |
---|
14082 | 14376 | if ((mod & SHIFT) == SHIFT) |
---|
14083 | 14377 | { |
---|
14084 | 14378 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14096 | 14390 | int X, Y; |
---|
14097 | 14391 | boolean SX, SY; |
---|
14098 | 14392 | |
---|
14099 | | - void drag(int x, int y, int modifiers) |
---|
| 14393 | + void drag(int x, int y, int modifiers, int modifiersex) |
---|
14100 | 14394 | { |
---|
14101 | 14395 | if (IsFrozen()) |
---|
14102 | 14396 | { |
---|
.. | .. |
---|
14105 | 14399 | |
---|
14106 | 14400 | drag = true; // NEW |
---|
14107 | 14401 | |
---|
14108 | | - boolean continuous = (modifiers & COMMAND) == COMMAND; |
---|
| 14402 | + boolean continuous = (modifiersex & COMMAND) == COMMAND; |
---|
14109 | 14403 | |
---|
14110 | 14404 | X = x; |
---|
14111 | 14405 | Y = y; |
---|
14112 | 14406 | // floating state for animation |
---|
14113 | | - MODIFIERS = modifiers; |
---|
14114 | | - modifiers &= ~1024; |
---|
| 14407 | + MODIFIERS = modifiersex; |
---|
| 14408 | + modifiersex &= ~1024; |
---|
14115 | 14409 | if (false) // modifiers != 0) |
---|
14116 | 14410 | { |
---|
14117 | 14411 | //new Exception().printStackTrace(); |
---|
14118 | | - System.out.println("mouseDragged: " + modifiers); |
---|
| 14412 | + System.out.println("mouseDragged: " + modifiersex); |
---|
14119 | 14413 | System.out.println("SHIFT = " + SHIFT); |
---|
14120 | 14414 | System.out.println("CONTROL = " + COMMAND); |
---|
14121 | 14415 | System.out.println("META = " + META); |
---|
.. | .. |
---|
14135 | 14429 | info.camera = renderCamera; |
---|
14136 | 14430 | info.x = x; |
---|
14137 | 14431 | info.y = y; |
---|
14138 | | - object.editWindow.copy.doEditDrag(info); |
---|
| 14432 | + object.GetWindow().copy |
---|
| 14433 | + .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14139 | 14434 | } else |
---|
14140 | 14435 | { |
---|
14141 | 14436 | if (x < startX) |
---|
.. | .. |
---|
14287 | 14582 | public void mouseMoved(MouseEvent e) |
---|
14288 | 14583 | { |
---|
14289 | 14584 | //System.out.println("mouseMoved: " + e); |
---|
14290 | | - |
---|
14291 | 14585 | if (isRenderer) |
---|
14292 | 14586 | return; |
---|
14293 | 14587 | |
---|
.. | .. |
---|
14300 | 14594 | ci.camera = renderCamera; |
---|
14301 | 14595 | if (!isRenderer) |
---|
14302 | 14596 | { |
---|
14303 | | - if (object.editWindow.copy.doEditClick(ci, 0)) |
---|
| 14597 | + //ObjEditor editWindow = object.editWindow; |
---|
| 14598 | + //Object3D copy = editWindow.copy; |
---|
| 14599 | + if (object.doEditClick(ci, 0)) |
---|
14304 | 14600 | { |
---|
14305 | 14601 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
---|
14306 | 14602 | } else |
---|
.. | .. |
---|
14312 | 14608 | |
---|
14313 | 14609 | public void mouseReleased(MouseEvent e) |
---|
14314 | 14610 | { |
---|
| 14611 | + Globals.MOUSEDRAGGED = false; |
---|
| 14612 | + |
---|
14315 | 14613 | movingcamera = false; |
---|
| 14614 | + X = 0; // getBounds().width/2; |
---|
| 14615 | + Y = 0; // getBounds().height/2; |
---|
14316 | 14616 | //System.out.println("mouseReleased: " + e); |
---|
14317 | 14617 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14318 | 14618 | } |
---|
.. | .. |
---|
14335 | 14635 | boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection |
---|
14336 | 14636 | boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection |
---|
14337 | 14637 | |
---|
14338 | | - if (control || command || IsFrozen()) |
---|
| 14638 | +// No delay if (control || command || IsFrozen()) |
---|
14339 | 14639 | timeout = true; |
---|
14340 | | - else |
---|
| 14640 | +// ?? May 2019 else |
---|
14341 | 14641 | // timer.setDelay((modifiers & 128) != 0?0:350); |
---|
14342 | 14642 | mouseDown = false; |
---|
14343 | 14643 | if (!control && !command) // june 2013 |
---|
.. | .. |
---|
14447 | 14747 | System.out.println("keyReleased: " + e); |
---|
14448 | 14748 | } |
---|
14449 | 14749 | |
---|
14450 | | - void SetMouseMode(int modifiers) |
---|
| 14750 | + void SetMouseMode(int modifiers, int modifiersex) |
---|
14451 | 14751 | { |
---|
14452 | 14752 | //System.out.println("SetMouseMode = " + modifiers); |
---|
14453 | 14753 | //modifiers &= ~1024; |
---|
.. | .. |
---|
14459 | 14759 | //if (modifiers == 0) // || (modifiers == (1024 | CONTROL))) |
---|
14460 | 14760 | // return; |
---|
14461 | 14761 | //System.out.println("SetMode = " + modifiers); |
---|
14462 | | - if ((modifiers & WHEEL) == WHEEL) |
---|
| 14762 | + if ((modifiersex & WHEEL) == WHEEL) |
---|
14463 | 14763 | { |
---|
14464 | 14764 | mouseMode |= ZOOM; |
---|
14465 | 14765 | } |
---|
14466 | 14766 | |
---|
14467 | 14767 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
14468 | | - if (capsLocked || (modifiers & META) == META) |
---|
| 14768 | + if (capsLocked) // || (modifiers & META) == META) |
---|
14469 | 14769 | { |
---|
14470 | 14770 | mouseMode |= VR; // BACKFORTH; |
---|
14471 | 14771 | } |
---|
14472 | | - if ((modifiers & CTRLCLICK) == CTRLCLICK) |
---|
| 14772 | + if ((modifiersex & CTRLCLICK) == CTRLCLICK) |
---|
14473 | 14773 | { |
---|
14474 | 14774 | mouseMode |= SELECT; |
---|
14475 | 14775 | } |
---|
14476 | | - if ((modifiers & COMMAND) == COMMAND) |
---|
| 14776 | + if ((modifiersex & COMMAND) == COMMAND) |
---|
14477 | 14777 | { |
---|
14478 | 14778 | mouseMode |= SELECT; |
---|
14479 | 14779 | } |
---|
14480 | | - if ((modifiers & SHIFT) == SHIFT || forcetranslate) |
---|
| 14780 | + if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0) |
---|
14481 | 14781 | { |
---|
14482 | 14782 | mouseMode &= ~VR; |
---|
14483 | 14783 | mouseMode |= TRANSLATE; |
---|
.. | .. |
---|
14506 | 14806 | |
---|
14507 | 14807 | if (isRenderer) // |
---|
14508 | 14808 | { |
---|
14509 | | - SetMouseMode(modifiers); |
---|
| 14809 | + SetMouseMode(0, modifiers); |
---|
14510 | 14810 | } |
---|
14511 | 14811 | |
---|
14512 | 14812 | Globals.theRenderer.keyPressed(key); |
---|
.. | .. |
---|
14653 | 14953 | case 'E' : COMPACT ^= true; |
---|
14654 | 14954 | repaint(); |
---|
14655 | 14955 | break; |
---|
14656 | | - case 'W' : DEBUGHSB ^= true; |
---|
| 14956 | + case 'W' : // Wide Window (fullscreen) |
---|
| 14957 | + //DEBUGHSB ^= true; |
---|
| 14958 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
14657 | 14959 | repaint(); |
---|
14658 | 14960 | break; |
---|
14659 | 14961 | case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break; |
---|
.. | .. |
---|
14678 | 14980 | RevertCamera(); |
---|
14679 | 14981 | repaint(); |
---|
14680 | 14982 | break; |
---|
14681 | | - case 'L': |
---|
14682 | 14983 | case 'l': |
---|
| 14984 | + //case 'L': |
---|
14683 | 14985 | if (lightMode) |
---|
14684 | 14986 | { |
---|
14685 | 14987 | lightMode = false; |
---|
.. | .. |
---|
14822 | 15124 | case '_': |
---|
14823 | 15125 | kompactbit = 5; |
---|
14824 | 15126 | break; |
---|
14825 | | - case '+': |
---|
14826 | | - kompactbit = 6; |
---|
14827 | | - break; |
---|
| 15127 | +// case '+': |
---|
| 15128 | +// kompactbit = 6; |
---|
| 15129 | +// break; |
---|
14828 | 15130 | case ' ': |
---|
14829 | 15131 | lightMode ^= true; |
---|
14830 | 15132 | Globals.lighttouched = true; |
---|
.. | .. |
---|
14836 | 15138 | case ESC: |
---|
14837 | 15139 | RENDERPROGRAM += 1; |
---|
14838 | 15140 | RENDERPROGRAM %= 3; |
---|
| 15141 | + |
---|
14839 | 15142 | repaint(); |
---|
14840 | 15143 | break; |
---|
14841 | 15144 | case 'Z': |
---|
14842 | 15145 | //RESIZETEXTURE ^= true; |
---|
14843 | 15146 | //break; |
---|
14844 | 15147 | case 'z': |
---|
14845 | | - RENDERSHADOW ^= true; |
---|
| 15148 | + Globals.RENDERSHADOW ^= true; |
---|
14846 | 15149 | Globals.lighttouched = true; |
---|
14847 | 15150 | repaint(); |
---|
14848 | 15151 | break; |
---|
.. | .. |
---|
14875 | 15178 | case DELETE: |
---|
14876 | 15179 | ClearSelection(); |
---|
14877 | 15180 | break; |
---|
14878 | | - /* |
---|
14879 | 15181 | case '+': |
---|
| 15182 | + |
---|
| 15183 | + /* |
---|
14880 | 15184 | //fontsize += 1; |
---|
14881 | 15185 | bbzoom *= 2; |
---|
14882 | 15186 | repaint(); |
---|
.. | .. |
---|
14893 | 15197 | case '=': |
---|
14894 | 15198 | IncDepth(); |
---|
14895 | 15199 | //fontsize += 1; |
---|
14896 | | - object.editWindow.refreshContents(true); |
---|
| 15200 | + object.GetWindow().refreshContents(true); |
---|
14897 | 15201 | maskbit = 6; |
---|
14898 | 15202 | break; |
---|
14899 | 15203 | case '-': //if (PixelThreshold>1) PixelThreshold /= 2; |
---|
14900 | 15204 | DecDepth(); |
---|
14901 | 15205 | maskbit = 5; |
---|
14902 | 15206 | //if(fontsize > 1) fontsize -= 1; |
---|
14903 | | - if (object.editWindow == null) |
---|
14904 | | - new Exception().printStackTrace(); |
---|
14905 | | - else |
---|
14906 | | - object.editWindow.refreshContents(true); |
---|
| 15207 | +// if (object.editWindow == null) |
---|
| 15208 | +// new Exception().printStackTrace(); |
---|
| 15209 | +// else |
---|
| 15210 | + object.GetWindow().refreshContents(true); |
---|
14907 | 15211 | break; |
---|
14908 | 15212 | case '{': |
---|
14909 | 15213 | manipCamera.shaper_fovy /= 1.1; |
---|
.. | .. |
---|
14966 | 15270 | //mode = ROTATE; |
---|
14967 | 15271 | if ((MODIFIERS & COMMAND) == 0) // VR?? |
---|
14968 | 15272 | { |
---|
14969 | | - SetMouseMode(modifiers); |
---|
| 15273 | + SetMouseMode(0, modifiers); |
---|
14970 | 15274 | } |
---|
14971 | 15275 | } |
---|
14972 | 15276 | |
---|
.. | .. |
---|
15100 | 15404 | |
---|
15101 | 15405 | protected void processMouseMotionEvent(MouseEvent e) |
---|
15102 | 15406 | { |
---|
15103 | | - //System.out.println("processMouseMotionEvent: " + mouseMode); |
---|
15104 | | - if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15407 | + //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton()); |
---|
| 15408 | + //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15409 | + if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0) |
---|
15105 | 15410 | { |
---|
15106 | 15411 | mouseMoved(e); |
---|
15107 | 15412 | } else |
---|
.. | .. |
---|
15126 | 15431 | } |
---|
15127 | 15432 | */ |
---|
15128 | 15433 | |
---|
15129 | | - object.editWindow.EditSelection(); |
---|
| 15434 | + object.GetWindow().EditSelection(false); |
---|
15130 | 15435 | } |
---|
15131 | 15436 | |
---|
15132 | 15437 | void SelectParent() |
---|
15133 | 15438 | { |
---|
| 15439 | + new Exception().printStackTrace(); |
---|
15134 | 15440 | System.exit(0); |
---|
15135 | 15441 | Composite group = (Composite) object; |
---|
15136 | 15442 | java.util.Vector selectees = new java.util.Vector(group.selection); |
---|
.. | .. |
---|
15142 | 15448 | { |
---|
15143 | 15449 | //selectees.remove(i); |
---|
15144 | 15450 | System.out.println("select parent of " + elem); |
---|
15145 | | - group.editWindow.Select(elem.parent.GetTreePath(), first, true); |
---|
| 15451 | + group.GetWindow().Select(elem.parent.GetTreePath(), first, true); |
---|
15146 | 15452 | } else |
---|
15147 | 15453 | { |
---|
15148 | | - group.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15454 | + group.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15149 | 15455 | } |
---|
15150 | 15456 | |
---|
15151 | 15457 | first = false; |
---|
.. | .. |
---|
15154 | 15460 | |
---|
15155 | 15461 | void SelectChildren() |
---|
15156 | 15462 | { |
---|
| 15463 | + new Exception().printStackTrace(); |
---|
15157 | 15464 | System.exit(0); |
---|
15158 | 15465 | /* |
---|
15159 | 15466 | Composite group = (Composite) object; |
---|
.. | .. |
---|
15186 | 15493 | for (int j = 0; j < group.children.size(); j++) |
---|
15187 | 15494 | { |
---|
15188 | 15495 | elem = (Object3D) group.children.elementAt(j); |
---|
15189 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15496 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15190 | 15497 | first = false; |
---|
15191 | 15498 | } |
---|
15192 | 15499 | } else |
---|
15193 | 15500 | { |
---|
15194 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15501 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15195 | 15502 | } |
---|
15196 | 15503 | |
---|
15197 | 15504 | first = false; |
---|
.. | .. |
---|
15202 | 15509 | { |
---|
15203 | 15510 | //Composite group = (Composite) object; |
---|
15204 | 15511 | Object3D group = object; |
---|
15205 | | - group.editWindow.loadClipboard(true); // ClearSelection(false); |
---|
| 15512 | + group.GetWindow().loadClipboard(true); // ClearSelection(false); |
---|
15206 | 15513 | } |
---|
15207 | 15514 | |
---|
15208 | 15515 | void ResetTransform(int mask) |
---|
15209 | 15516 | { |
---|
15210 | 15517 | //Composite group = (Composite) object; |
---|
15211 | 15518 | Object3D group = object; |
---|
15212 | | - group.editWindow.ResetTransform(mask); |
---|
| 15519 | + group.GetWindow().ResetTransform(mask); |
---|
15213 | 15520 | } |
---|
15214 | 15521 | |
---|
15215 | 15522 | void FlipTransform() |
---|
15216 | 15523 | { |
---|
15217 | 15524 | //Composite group = (Composite) object; |
---|
15218 | 15525 | Object3D group = object; |
---|
15219 | | - group.editWindow.FlipTransform(); |
---|
| 15526 | + group.GetWindow().FlipTransform(); |
---|
15220 | 15527 | // group.editWindow.ReduceMesh(true); |
---|
15221 | 15528 | } |
---|
15222 | 15529 | |
---|
.. | .. |
---|
15224 | 15531 | { |
---|
15225 | 15532 | //Composite group = (Composite) object; |
---|
15226 | 15533 | Object3D group = object; |
---|
15227 | | - group.editWindow.PrintMemory(); |
---|
| 15534 | + group.GetWindow().PrintMemory(); |
---|
15228 | 15535 | // group.editWindow.ReduceMesh(true); |
---|
15229 | 15536 | } |
---|
15230 | 15537 | |
---|
.. | .. |
---|
15232 | 15539 | { |
---|
15233 | 15540 | //Composite group = (Composite) object; |
---|
15234 | 15541 | Object3D group = object; |
---|
15235 | | - group.editWindow.ResetCentroid(); |
---|
| 15542 | + group.GetWindow().ResetCentroid(); |
---|
15236 | 15543 | } |
---|
15237 | 15544 | |
---|
15238 | 15545 | void IncDepth() |
---|
.. | .. |
---|
15318 | 15625 | info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom)); |
---|
15319 | 15626 | //Image img = CreateImage(width, height); |
---|
15320 | 15627 | //System.out.println("width = " + width + "; height = " + height + "\n"); |
---|
| 15628 | + |
---|
15321 | 15629 | Graphics gr = g; // img.getGraphics(); |
---|
| 15630 | + |
---|
15322 | 15631 | if (!hasMarquee) |
---|
15323 | 15632 | { |
---|
15324 | 15633 | if (Xmin < Xmax) // !locked) |
---|
.. | .. |
---|
15406 | 15715 | info.bounds.y += (height - desired) / 2; |
---|
15407 | 15716 | } |
---|
15408 | 15717 | } |
---|
| 15718 | + |
---|
15409 | 15719 | info.g = gr; |
---|
15410 | 15720 | info.camera = renderCamera; |
---|
15411 | 15721 | /* |
---|
.. | .. |
---|
15415 | 15725 | */ |
---|
15416 | 15726 | if (!isRenderer) |
---|
15417 | 15727 | { |
---|
15418 | | - object.drawEditHandles(info, 0); |
---|
| 15728 | + Grafreed.Assert(object != null); |
---|
| 15729 | + Grafreed.Assert(object.selection != null); |
---|
| 15730 | + if (object.selection.Size() > 0) |
---|
| 15731 | + { |
---|
| 15732 | + int hitSomething = object.selection.get(0).hitSomething; |
---|
| 15733 | + |
---|
| 15734 | + info.DX = 0; |
---|
| 15735 | + info.DY = 0; |
---|
| 15736 | + info.W = 1; |
---|
| 15737 | + if (hitSomething == Object3D.hitCenter) |
---|
| 15738 | + { |
---|
| 15739 | + info.DX = X; |
---|
| 15740 | + if (X != 0) |
---|
| 15741 | + info.DX -= info.bounds.width/2; |
---|
| 15742 | + |
---|
| 15743 | + info.DY = Y; |
---|
| 15744 | + if (Y != 0) |
---|
| 15745 | + info.DY -= info.bounds.height/2; |
---|
| 15746 | + } |
---|
| 15747 | + |
---|
| 15748 | + object.drawEditHandles(info, 0); |
---|
| 15749 | + |
---|
| 15750 | + if (drag && (X != 0 || Y != 0)) |
---|
| 15751 | + { |
---|
| 15752 | + switch (hitSomething) |
---|
| 15753 | + { |
---|
| 15754 | + case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 15755 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15756 | + break; |
---|
| 15757 | + case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
| 15758 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15759 | + break; |
---|
| 15760 | + case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
| 15761 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15762 | + break; |
---|
| 15763 | + } |
---|
| 15764 | + |
---|
| 15765 | + } |
---|
| 15766 | + } |
---|
15419 | 15767 | } |
---|
15420 | 15768 | } |
---|
| 15769 | + |
---|
15421 | 15770 | if (isRenderer) |
---|
15422 | 15771 | { |
---|
15423 | 15772 | //gr.setColor(Color.black); |
---|
15424 | 15773 | //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1); |
---|
15425 | 15774 | //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3); |
---|
15426 | 15775 | } |
---|
| 15776 | + |
---|
15427 | 15777 | if (hasMarquee) |
---|
15428 | 15778 | { |
---|
15429 | 15779 | gr.setXORMode(Color.white); |
---|
.. | .. |
---|
15536 | 15886 | public boolean mouseDown(Event evt, int x, int y) |
---|
15537 | 15887 | { |
---|
15538 | 15888 | System.out.println("mouseDown: " + evt); |
---|
| 15889 | + System.exit(0); |
---|
15539 | 15890 | /* |
---|
15540 | 15891 | locked = true; |
---|
15541 | 15892 | drag = false; |
---|
.. | .. |
---|
15579 | 15930 | { |
---|
15580 | 15931 | keyPressed(0, modifiers); |
---|
15581 | 15932 | } |
---|
15582 | | - clickStart(x, y, modifiers); |
---|
| 15933 | + // clickStart(x, y, modifiers); |
---|
15583 | 15934 | return true; |
---|
15584 | 15935 | } |
---|
15585 | 15936 | |
---|
.. | .. |
---|
15697 | 16048 | { |
---|
15698 | 16049 | keyReleased(0, 0); |
---|
15699 | 16050 | } |
---|
15700 | | - drag(x, y, modifiers); |
---|
| 16051 | + drag(x, y, 0, modifiers); |
---|
15701 | 16052 | return true; |
---|
15702 | 16053 | } |
---|
15703 | 16054 | |
---|
.. | .. |
---|
15829 | 16180 | Object3D object; |
---|
15830 | 16181 | static Object3D trackedobject; |
---|
15831 | 16182 | Camera renderCamera; // Light or Eye (or Occlusion) |
---|
15832 | | - /*static*/ Camera manipCamera; // Light or Eye |
---|
| 16183 | + /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light |
---|
15833 | 16184 | /*static*/ Camera eyeCamera; |
---|
15834 | 16185 | /*static*/ Camera lightCamera; |
---|
15835 | 16186 | int cameracount; |
---|
.. | .. |
---|
16114 | 16465 | cStatic.objectstack[materialdepth++] = checker; |
---|
16115 | 16466 | //System.out.println("material " + material); |
---|
16116 | 16467 | //Applet3D.tracein(this, selected); |
---|
16117 | | - vector2buffer = checker.projectedVertices; |
---|
| 16468 | + //vector2buffer = checker.projectedVertices; |
---|
16118 | 16469 | |
---|
16119 | 16470 | //checker.GetMaterial().Draw(this, false); // true); |
---|
16120 | | - DrawMaterial(checker.GetMaterial(), false); // true); |
---|
| 16471 | + DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true); |
---|
16121 | 16472 | |
---|
16122 | 16473 | materialdepth -= 1; |
---|
16123 | 16474 | if (materialdepth > 0) |
---|
16124 | 16475 | { |
---|
16125 | | - vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
16126 | | - DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 16476 | + //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 16477 | + DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
16127 | 16478 | } |
---|
16128 | 16479 | //checker.GetMaterial().opacity = 1f; |
---|
16129 | 16480 | ////checker.GetMaterial().ambient = 1f; |
---|
.. | .. |
---|
16209 | 16560 | } |
---|
16210 | 16561 | } |
---|
16211 | 16562 | |
---|
| 16563 | + private Object3D GetFolder() |
---|
| 16564 | + { |
---|
| 16565 | + Object3D folder = object.GetWindow().copy; |
---|
| 16566 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16567 | + folder = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16568 | + return folder; |
---|
| 16569 | + } |
---|
| 16570 | + |
---|
16212 | 16571 | class SelectBuffer implements GLEventListener |
---|
16213 | 16572 | { |
---|
16214 | 16573 | |
---|
.. | .. |
---|
16267 | 16626 | { |
---|
16268 | 16627 | if (!selection) |
---|
16269 | 16628 | { |
---|
| 16629 | + new Exception().printStackTrace(); |
---|
16270 | 16630 | System.exit(0); |
---|
16271 | 16631 | return; |
---|
16272 | 16632 | } |
---|
.. | .. |
---|
16287 | 16647 | |
---|
16288 | 16648 | //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); |
---|
16289 | 16649 | |
---|
| 16650 | + if (PAINTMODE) |
---|
| 16651 | + { |
---|
| 16652 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16653 | + { |
---|
| 16654 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16655 | + |
---|
| 16656 | + // Make what you paint not selectable. |
---|
| 16657 | + paintobj.ResetSelectable(); |
---|
| 16658 | + } |
---|
| 16659 | + } |
---|
| 16660 | + |
---|
16290 | 16661 | //int tmp = selection_view; |
---|
16291 | 16662 | //selection_view = -1; |
---|
16292 | 16663 | int temp = DrawMode(); |
---|
.. | .. |
---|
16298 | 16669 | // temp = DEFAULT; // patch for selection debug |
---|
16299 | 16670 | Globals.drawMode = temp; // WARNING |
---|
16300 | 16671 | |
---|
| 16672 | + if (PAINTMODE) |
---|
| 16673 | + { |
---|
| 16674 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16675 | + { |
---|
| 16676 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16677 | + |
---|
| 16678 | + // Revert. |
---|
| 16679 | + paintobj.RestoreSelectable(); |
---|
| 16680 | + } |
---|
| 16681 | + } |
---|
| 16682 | + |
---|
16301 | 16683 | //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view); |
---|
16302 | 16684 | |
---|
16303 | 16685 | // trying different ways of getting the depth info over |
---|
.. | .. |
---|
16345 | 16727 | // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]); |
---|
16346 | 16728 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
16347 | 16729 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
| 16730 | + |
---|
| 16731 | + CreateSelectedPoint(); |
---|
16348 | 16732 | |
---|
16349 | 16733 | // Will fit the mesh !!! |
---|
16350 | 16734 | selectedpoint.toParent[0][0] = 0.0001; |
---|
.. | .. |
---|
16394 | 16778 | System.out.println("; fromto " + sel + " " + Trunk(previousselectedpoint.toParent[3][0]) + " " + Trunk(previousselectedpoint.toParent[3][2]) + " " + Trunk(selectedpoint.toParent[3][0]) + " " + Trunk(selectedpoint.toParent[3][2])); |
---|
16395 | 16779 | } |
---|
16396 | 16780 | |
---|
16397 | | - previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint); |
---|
| 16781 | + previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint); |
---|
16398 | 16782 | } |
---|
16399 | 16783 | } |
---|
16400 | 16784 | |
---|
16401 | 16785 | if (!movingcamera && !PAINTMODE) |
---|
16402 | | - object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
| 16786 | + object.GetWindow().ScreenFitPoint(); // fev 2014 |
---|
16403 | 16787 | |
---|
16404 | | - if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
| 16788 | + if (PAINTMODE) // && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
16405 | 16789 | { |
---|
16406 | | - Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
| 16790 | + //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16407 | 16791 | |
---|
16408 | | - Object3D group = new Object3D("inst" + paintcount++); |
---|
| 16792 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16793 | + { |
---|
| 16794 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
16409 | 16795 | |
---|
16410 | | - group.CreateMaterial(); // use a void leaf to select instances |
---|
16411 | | - |
---|
16412 | | - group.add(paintobj); // link |
---|
16413 | | - |
---|
16414 | | - object.editWindow.SnapObject(group); |
---|
16415 | | - |
---|
16416 | | - Object3D folder = object.editWindow.copy; |
---|
16417 | | - |
---|
16418 | | - if (object.editWindow.copy.selection.Size() > 0) |
---|
16419 | | - folder = object.editWindow.copy.selection.elementAt(0); |
---|
16420 | | - |
---|
16421 | | - folder.add(group); |
---|
16422 | | - |
---|
16423 | | - object.editWindow.ResetModel(); |
---|
16424 | | - object.editWindow.refreshContents(); |
---|
| 16796 | + Object3D inst = new Object3D("inst" + paintcount++); |
---|
| 16797 | + |
---|
| 16798 | + inst.CreateMaterial(); // use a void leaf to select instances |
---|
| 16799 | + |
---|
| 16800 | + inst.add(paintobj); // link |
---|
| 16801 | + |
---|
| 16802 | + object.GetWindow().SnapObject(inst); |
---|
| 16803 | + |
---|
| 16804 | + Object3D folder = paintFolder; // GetFolder(); |
---|
| 16805 | + |
---|
| 16806 | + folder.add(inst); |
---|
| 16807 | + |
---|
| 16808 | + object.GetWindow().ResetModel(); |
---|
| 16809 | + object.GetWindow().refreshContents(); |
---|
| 16810 | + } |
---|
16425 | 16811 | } |
---|
16426 | 16812 | else |
---|
16427 | 16813 | paintcount = 0; |
---|
.. | .. |
---|
16460 | 16846 | //System.out.println("objects[color] = " + objects[color]); |
---|
16461 | 16847 | //objects[color].Select(); |
---|
16462 | 16848 | indexcount = 0; |
---|
| 16849 | + ObjEditor window = object.GetWindow(); |
---|
| 16850 | + if (window != null && deselect) |
---|
| 16851 | + { |
---|
| 16852 | + window.Select(null, deselect, true); |
---|
| 16853 | + } |
---|
16463 | 16854 | object.Select(color, deselect); |
---|
16464 | 16855 | } |
---|
16465 | 16856 | |
---|
.. | .. |
---|
16559 | 16950 | gl.glDisable(gl.GL_CULL_FACE); |
---|
16560 | 16951 | } |
---|
16561 | 16952 | |
---|
16562 | | - if (!RENDERSHADOW) |
---|
| 16953 | + if (!Globals.RENDERSHADOW) |
---|
16563 | 16954 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16564 | 16955 | |
---|
16565 | 16956 | // SB gl.glPolygonOffset(2.5f, 10); |
---|
.. | .. |
---|
16569 | 16960 | //gl.glColorMask(false, false, false, false); |
---|
16570 | 16961 | |
---|
16571 | 16962 | //render_scene_from_light_view(gl, drawable, 0, 0); |
---|
16572 | | - if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed()) |
---|
| 16963 | + if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed()) |
---|
16573 | 16964 | { |
---|
16574 | 16965 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16575 | 16966 | |
---|
.. | .. |
---|
16985 | 17376 | int AAbuffersize = 0; |
---|
16986 | 17377 | |
---|
16987 | 17378 | //double[] selectedpoint = new double[3]; |
---|
16988 | | - static Superellipsoid selectedpoint = new Superellipsoid(); |
---|
| 17379 | + static Superellipsoid selectedpoint; |
---|
16989 | 17380 | static Sphere previousselectedpoint = null; |
---|
16990 | | - static Sphere debugpointG = new Sphere(); |
---|
16991 | | - static Sphere debugpointP = new Sphere(); |
---|
16992 | | - static Sphere debugpointC = new Sphere(); |
---|
16993 | | - static Sphere debugpointR = new Sphere(); |
---|
| 17381 | + static Sphere debugpointG; |
---|
| 17382 | + static Sphere debugpointP; |
---|
| 17383 | + static Sphere debugpointC; |
---|
| 17384 | + static Sphere debugpointR; |
---|
16994 | 17385 | |
---|
16995 | 17386 | static Sphere debugpoints[] = new Sphere[8]; |
---|
16996 | 17387 | |
---|
16997 | | - static |
---|
16998 | | - { |
---|
16999 | | - for (int i=0; i<8; i++) |
---|
17000 | | - { |
---|
17001 | | - debugpoints[i] = new Sphere(); |
---|
17002 | | - } |
---|
17003 | | - } |
---|
17004 | | - |
---|
17005 | 17388 | static void InitPoints(float radius) |
---|
17006 | 17389 | { |
---|
17007 | 17390 | for (int i=0; i<8; i++) |
---|