.. | .. |
---|
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 |
---|
.. | .. |
---|
327 | 326 | cStatic.objectstack[materialdepth++] = obj; |
---|
328 | 327 | //System.out.println("material " + material); |
---|
329 | 328 | //Applet3D.tracein(this, selected); |
---|
330 | | - display.vector2buffer = obj.projectedVertices; |
---|
| 329 | + //display.vector2buffer = obj.projectedVertices; |
---|
331 | 330 | if (obj instanceof Camera) |
---|
332 | 331 | { |
---|
333 | 332 | display.options1[0] = material.shift; |
---|
.. | .. |
---|
336 | 335 | display.options1[2] = material.shadowbias; |
---|
337 | 336 | display.options1[3] = material.aniso; |
---|
338 | 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]); |
---|
339 | 343 | display.options2[0] = material.opacity; |
---|
340 | 344 | display.options2[1] = material.diffuse; |
---|
341 | 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]); |
---|
342 | 349 | |
---|
343 | 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]); |
---|
344 | 354 | display.options4[0] = material.cameralight/0.2f; |
---|
345 | 355 | display.options4[1] = material.subsurface; |
---|
346 | 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]); |
---|
347 | 360 | |
---|
348 | 361 | // if (display.CURRENTANTIALIAS > 0) |
---|
349 | 362 | // display.options3[3] /= 4; |
---|
.. | .. |
---|
359 | 372 | /**/ |
---|
360 | 373 | } else |
---|
361 | 374 | { |
---|
362 | | - DrawMaterial(material, selected); |
---|
| 375 | + DrawMaterial(material, selected, obj.projectedVertices); |
---|
363 | 376 | } |
---|
364 | 377 | } else |
---|
365 | 378 | { |
---|
.. | .. |
---|
383 | 396 | cStatic.objectstack[materialdepth++] = obj; |
---|
384 | 397 | //System.out.println("material " + material); |
---|
385 | 398 | //Applet3D.tracein("selected ", selected); |
---|
386 | | - display.vector2buffer = obj.projectedVertices; |
---|
387 | | - display.DrawMaterial(material, selected); |
---|
| 399 | + //display.vector2buffer = obj.projectedVertices; |
---|
| 400 | + display.DrawMaterial(material, selected, obj.projectedVertices); |
---|
388 | 401 | } |
---|
389 | 402 | } |
---|
390 | 403 | |
---|
.. | .. |
---|
401 | 414 | materialdepth -= 1; |
---|
402 | 415 | if (materialdepth > 0) |
---|
403 | 416 | { |
---|
404 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
405 | | - 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); |
---|
406 | 419 | } |
---|
407 | 420 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
408 | 421 | } else if (selected && CameraPane.flash && obj.GetMaterial() != null) |
---|
.. | .. |
---|
422 | 435 | materialdepth -= 1; |
---|
423 | 436 | if (materialdepth > 0) |
---|
424 | 437 | { |
---|
425 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
426 | | - 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); |
---|
427 | 440 | } |
---|
428 | 441 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
429 | 442 | //else |
---|
.. | .. |
---|
464 | 477 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
465 | 478 | { |
---|
466 | 479 | //gl.glBegin(gl.GL_TRIANGLES); |
---|
467 | | - 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 | + ; |
---|
468 | 483 | if (!hasnorm) |
---|
469 | 484 | { |
---|
470 | | - // System.out.println("FUCK!!"); |
---|
| 485 | + // System.out.println("Mesh normal"); |
---|
471 | 486 | LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0); |
---|
472 | 487 | LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1); |
---|
473 | 488 | LA.vecCross(obj.v0, obj.v1, obj.v2); |
---|
.. | .. |
---|
1192 | 1207 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1193 | 1208 | } |
---|
1194 | 1209 | } |
---|
| 1210 | + |
---|
1195 | 1211 | if (flipV) |
---|
1196 | 1212 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1197 | 1213 | else |
---|
1198 | 1214 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1215 | + |
---|
1199 | 1216 | //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1200 | 1217 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1201 | 1218 | |
---|
.. | .. |
---|
1215 | 1232 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1216 | 1233 | } |
---|
1217 | 1234 | } |
---|
| 1235 | + |
---|
1218 | 1236 | if (flipV) |
---|
1219 | 1237 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1220 | 1238 | else |
---|
1221 | 1239 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1240 | + |
---|
1222 | 1241 | //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1223 | 1242 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1224 | 1243 | |
---|
.. | .. |
---|
1246 | 1265 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1247 | 1266 | else |
---|
1248 | 1267 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1268 | + |
---|
1249 | 1269 | //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
1250 | 1270 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1271 | + |
---|
1251 | 1272 | count2 += 2; |
---|
1252 | 1273 | count3 += 3; |
---|
1253 | 1274 | } |
---|
.. | .. |
---|
1603 | 1624 | // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
1604 | 1625 | } |
---|
1605 | 1626 | |
---|
1606 | | - void DrawMaterial(cMaterial material, boolean selected) |
---|
| 1627 | + void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others) |
---|
1607 | 1628 | { |
---|
1608 | 1629 | CameraPane display = this; |
---|
1609 | 1630 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
1638 | 1659 | colorV[0] = display.modelParams0[0] * material.diffuse; |
---|
1639 | 1660 | colorV[1] = display.modelParams0[1] * material.diffuse; |
---|
1640 | 1661 | colorV[2] = display.modelParams0[2] * material.diffuse; |
---|
1641 | | - colorV[3] = material.opacity; |
---|
| 1662 | + colorV[3] = 1; // material.opacity; |
---|
1642 | 1663 | |
---|
1643 | 1664 | gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity); |
---|
1644 | 1665 | //System.out.println("Opacity = " + opacity); |
---|
.. | .. |
---|
1746 | 1767 | display.modelParams7[2] = 0; |
---|
1747 | 1768 | display.modelParams7[3] = 0; |
---|
1748 | 1769 | |
---|
1749 | | - display.modelParams6[0] = 100; // criss de bug de bump |
---|
| 1770 | + //display.modelParams6[0] = 100; // criss de bug de bump |
---|
1750 | 1771 | |
---|
1751 | | - Object3D.cVector2[] extparams = display.vector2buffer; |
---|
| 1772 | + Object3D.cVector2[] extparams = others; // display.vector2buffer; |
---|
1752 | 1773 | if (extparams != null && extparams.length > 0 && extparams[0] != null) |
---|
1753 | 1774 | { |
---|
1754 | 1775 | display.modelParams6[0] = extparams[0].x / 1000.0f; // bump |
---|
.. | .. |
---|
2259 | 2280 | |
---|
2260 | 2281 | void ToggleDebug() |
---|
2261 | 2282 | { |
---|
2262 | | - DEBUG ^= true; |
---|
| 2283 | + Globals.DEBUG ^= true; |
---|
2263 | 2284 | } |
---|
2264 | 2285 | |
---|
2265 | 2286 | void ToggleLookAt() |
---|
.. | .. |
---|
2375 | 2396 | public GL GetGL() // INTERFACE |
---|
2376 | 2397 | { |
---|
2377 | 2398 | return currentGL; |
---|
| 2399 | + } |
---|
| 2400 | + |
---|
| 2401 | + private void GetRemoteZip(String url, String name, boolean unzip, boolean save) |
---|
| 2402 | + { |
---|
| 2403 | + java.net.URL u; |
---|
| 2404 | + InputStream is = null; |
---|
| 2405 | + DataInputStream dis; |
---|
| 2406 | + java.util.zip.ZipInputStream zis; |
---|
| 2407 | + //String s; |
---|
| 2408 | + |
---|
| 2409 | + System.out.println("GetRemoteZip " + name); |
---|
| 2410 | + |
---|
| 2411 | + int total = 0; // dis.available(); |
---|
| 2412 | + |
---|
| 2413 | + byte[] bytes = new byte[16384]; |
---|
| 2414 | + |
---|
| 2415 | + try |
---|
| 2416 | + { |
---|
| 2417 | + u = new java.net.URL(url + name); |
---|
| 2418 | + is = u.openStream(); |
---|
| 2419 | + |
---|
| 2420 | + System.out.println(url + name); |
---|
| 2421 | + |
---|
| 2422 | + if (unzip) |
---|
| 2423 | + { |
---|
| 2424 | + //dis = new DataInputStream(new BufferedInputStream(is)); |
---|
| 2425 | + zis = new java.util.zip.ZipInputStream(new BufferedInputStream(is)); |
---|
| 2426 | + //while ((s = dis.readLine()) != null) |
---|
| 2427 | + |
---|
| 2428 | + if (save) |
---|
| 2429 | + new java.io.File(name).mkdirs(); |
---|
| 2430 | + |
---|
| 2431 | + // FileOutputStream stream = new FileOutputStream("test.zip"); |
---|
| 2432 | + // |
---|
| 2433 | + // int count; |
---|
| 2434 | + // |
---|
| 2435 | + // while ((count = dis.read(bytes)) != -1) |
---|
| 2436 | + // { |
---|
| 2437 | + // //System.out.println(s); |
---|
| 2438 | + // System.out.println(count); |
---|
| 2439 | + // total += count; |
---|
| 2440 | + // stream.write(bytes); |
---|
| 2441 | + // } |
---|
| 2442 | + // |
---|
| 2443 | + // stream.close(); |
---|
| 2444 | + |
---|
| 2445 | + // now iterate through each item in the stream. The get next |
---|
| 2446 | + // entry call will return a ZipEntry for each file in the |
---|
| 2447 | + // stream |
---|
| 2448 | + java.util.zip.ZipEntry entry; |
---|
| 2449 | + while((entry = zis.getNextEntry())!=null) |
---|
| 2450 | + { |
---|
| 2451 | + if (entry.getName().endsWith(".gsm")) |
---|
| 2452 | + { |
---|
| 2453 | + continue; |
---|
| 2454 | + } |
---|
| 2455 | + |
---|
| 2456 | + String s = String.format("Entry: %s len %d added %TD", |
---|
| 2457 | + entry.getName(), entry.getSize(), |
---|
| 2458 | + new java.util.Date(entry.getTime())); |
---|
| 2459 | + System.out.println(s); |
---|
| 2460 | + |
---|
| 2461 | + if (save) |
---|
| 2462 | + { |
---|
| 2463 | + // Once we get the entry from the stream, the stream is |
---|
| 2464 | + // positioned read to read the raw data, and we keep |
---|
| 2465 | + // reading until read returns 0 or less. |
---|
| 2466 | + String outpath = name + "/" + entry.getName(); |
---|
| 2467 | + FileOutputStream output = null; |
---|
| 2468 | + try |
---|
| 2469 | + { |
---|
| 2470 | + output = new FileOutputStream(outpath); |
---|
| 2471 | + int len = 0; |
---|
| 2472 | + while ((len = zis.read(bytes)) > 0) |
---|
| 2473 | + { |
---|
| 2474 | + output.write(bytes, 0, len); |
---|
| 2475 | + } |
---|
| 2476 | + } |
---|
| 2477 | + finally |
---|
| 2478 | + { |
---|
| 2479 | + // we must always close the output file |
---|
| 2480 | + if(output!=null) output.close(); |
---|
| 2481 | + } |
---|
| 2482 | + } |
---|
| 2483 | + } |
---|
| 2484 | + } |
---|
| 2485 | + } |
---|
| 2486 | + catch (java.net.MalformedURLException mue) |
---|
| 2487 | + { |
---|
| 2488 | + System.err.println("Ouch - a MalformedURLException happened."); |
---|
| 2489 | + mue.printStackTrace(); |
---|
| 2490 | + //System.exit(2); |
---|
| 2491 | + } |
---|
| 2492 | + catch (IOException ioe) |
---|
| 2493 | + { |
---|
| 2494 | + //System.err.println("Oops - an IOException happened."); |
---|
| 2495 | + //ioe.printStackTrace(); |
---|
| 2496 | + //System.exit(3); |
---|
| 2497 | + } |
---|
| 2498 | + finally |
---|
| 2499 | + { |
---|
| 2500 | + try |
---|
| 2501 | + { |
---|
| 2502 | + if (is != null) |
---|
| 2503 | + is.close(); |
---|
| 2504 | + } |
---|
| 2505 | + catch (IOException ioe) |
---|
| 2506 | + { |
---|
| 2507 | + } |
---|
| 2508 | + } |
---|
| 2509 | + |
---|
| 2510 | + // System.out.println("length = " + total); |
---|
| 2511 | + |
---|
| 2512 | +// try |
---|
| 2513 | +// { |
---|
| 2514 | +// Runtime.getRuntime().exec("/usr/local/bin/wget https://archive3d.net/?a=download&do=get&id=7caca905"); |
---|
| 2515 | +// } |
---|
| 2516 | +// catch (Exception e) |
---|
| 2517 | +// { |
---|
| 2518 | +// e.printStackTrace(); |
---|
| 2519 | +// } |
---|
| 2520 | + |
---|
2378 | 2521 | } |
---|
2379 | 2522 | |
---|
2380 | 2523 | /**/ |
---|
.. | .. |
---|
7921 | 8064 | ReleaseTexture(pigment, false); |
---|
7922 | 8065 | } |
---|
7923 | 8066 | |
---|
| 8067 | + public void ReleasePigmentTexture(cTexture tex) // INTERFACE |
---|
| 8068 | + { |
---|
| 8069 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 8070 | + { |
---|
| 8071 | + return; |
---|
| 8072 | + } |
---|
| 8073 | + |
---|
| 8074 | + if (tex == null) |
---|
| 8075 | + { |
---|
| 8076 | + ReleaseTexture(null, false); |
---|
| 8077 | + return; |
---|
| 8078 | + } |
---|
| 8079 | + |
---|
| 8080 | + String pigment = Object3D.GetPigment(tex); |
---|
| 8081 | + |
---|
| 8082 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8083 | + { |
---|
| 8084 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 8085 | + // System.out.println("; bump = " + bump); |
---|
| 8086 | + } |
---|
| 8087 | + |
---|
| 8088 | + if (pigment.equals("")) |
---|
| 8089 | + { |
---|
| 8090 | + pigment = null; |
---|
| 8091 | + } |
---|
| 8092 | + |
---|
| 8093 | + ReleaseTexture(pigment, false); |
---|
| 8094 | + } |
---|
| 8095 | + |
---|
| 8096 | + public void ReleaseBumpTexture(cTexture tex) // INTERFACE |
---|
| 8097 | + { |
---|
| 8098 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 8099 | + { |
---|
| 8100 | + return; |
---|
| 8101 | + } |
---|
| 8102 | + |
---|
| 8103 | + if (tex == null) |
---|
| 8104 | + { |
---|
| 8105 | + ReleaseTexture(null, true); |
---|
| 8106 | + return; |
---|
| 8107 | + } |
---|
| 8108 | + |
---|
| 8109 | + String bump = Object3D.GetBump(tex); |
---|
| 8110 | + |
---|
| 8111 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8112 | + { |
---|
| 8113 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 8114 | + // System.out.println("; bump = " + bump); |
---|
| 8115 | + } |
---|
| 8116 | + |
---|
| 8117 | + if (bump.equals("")) |
---|
| 8118 | + { |
---|
| 8119 | + bump = null; |
---|
| 8120 | + } |
---|
| 8121 | + |
---|
| 8122 | + ReleaseTexture(bump, true); |
---|
| 8123 | + } |
---|
| 8124 | + |
---|
7924 | 8125 | void ReleaseTexture(String tex, boolean bump) |
---|
7925 | 8126 | { |
---|
7926 | 8127 | if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
.. | .. |
---|
8067 | 8268 | GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8068 | 8269 | |
---|
8069 | 8270 | return; // true; |
---|
| 8271 | + } |
---|
| 8272 | + |
---|
| 8273 | + /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8274 | + { |
---|
| 8275 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8276 | + ambientOcclusion ) // || !textureon) |
---|
| 8277 | + { |
---|
| 8278 | + return; // false; |
---|
| 8279 | + } |
---|
| 8280 | + |
---|
| 8281 | + if (tex == null) |
---|
| 8282 | + { |
---|
| 8283 | + BindTexture(null,false,resolution); |
---|
| 8284 | + return; |
---|
| 8285 | + } |
---|
| 8286 | + |
---|
| 8287 | + String pigment = Object3D.GetPigment(tex); |
---|
| 8288 | + |
---|
| 8289 | + usedtextures.put(pigment, pigment); |
---|
| 8290 | + |
---|
| 8291 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8292 | + { |
---|
| 8293 | + // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8294 | + // System.out.println("; bump = " + bump); |
---|
| 8295 | + } |
---|
| 8296 | + |
---|
| 8297 | + if (pigment.equals("")) |
---|
| 8298 | + { |
---|
| 8299 | + pigment = null; |
---|
| 8300 | + } |
---|
| 8301 | + |
---|
| 8302 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8303 | + BindTexture(pigment, false, resolution); |
---|
| 8304 | + } |
---|
| 8305 | + |
---|
| 8306 | + /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8307 | + { |
---|
| 8308 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8309 | + ambientOcclusion ) // || !textureon) |
---|
| 8310 | + { |
---|
| 8311 | + return; // false; |
---|
| 8312 | + } |
---|
| 8313 | + |
---|
| 8314 | + if (tex == null) |
---|
| 8315 | + { |
---|
| 8316 | + BindTexture(null,true,resolution); |
---|
| 8317 | + return; |
---|
| 8318 | + } |
---|
| 8319 | + |
---|
| 8320 | + String bump = Object3D.GetBump(tex); |
---|
| 8321 | + |
---|
| 8322 | + usedtextures.put(bump, bump); |
---|
| 8323 | + |
---|
| 8324 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8325 | + { |
---|
| 8326 | + // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8327 | + // System.out.println("; bump = " + bump); |
---|
| 8328 | + } |
---|
| 8329 | + |
---|
| 8330 | + if (bump.equals("")) |
---|
| 8331 | + { |
---|
| 8332 | + bump = null; |
---|
| 8333 | + } |
---|
| 8334 | + |
---|
| 8335 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
| 8336 | + BindTexture(bump, true, resolution); |
---|
| 8337 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8070 | 8338 | } |
---|
8071 | 8339 | |
---|
8072 | 8340 | java.util.HashSet<String> missingTextures = new java.util.HashSet<String>(); |
---|
.. | .. |
---|
9234 | 9502 | jy8[3] = 0.5f; |
---|
9235 | 9503 | } |
---|
9236 | 9504 | |
---|
9237 | | - float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV |
---|
| 9505 | + float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV |
---|
9238 | 9506 | float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation |
---|
9239 | 9507 | float[] options3 = new float[]{1, 1, 1, 0}; // fog color |
---|
9240 | 9508 | float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen |
---|
9241 | 9509 | |
---|
| 9510 | + void ResetOptions() |
---|
| 9511 | + { |
---|
| 9512 | + options1[0] = 100; |
---|
| 9513 | + options1[1] = 0.025f; |
---|
| 9514 | + options1[2] = 0.01f; |
---|
| 9515 | + options1[3] = 0; |
---|
| 9516 | + options1[4] = 0; |
---|
| 9517 | + |
---|
| 9518 | + options2[0] = 0; |
---|
| 9519 | + options2[1] = 0.75f; |
---|
| 9520 | + options2[2] = 0; |
---|
| 9521 | + options2[3] = 0; |
---|
| 9522 | + |
---|
| 9523 | + options3[0] = 1; |
---|
| 9524 | + options3[1] = 1; |
---|
| 9525 | + options3[2] = 1; |
---|
| 9526 | + options3[3] = 0; |
---|
| 9527 | + |
---|
| 9528 | + options4[0] = 1; |
---|
| 9529 | + options4[1] = 0; |
---|
| 9530 | + options4[2] = 1; |
---|
| 9531 | + options4[3] = 0; |
---|
| 9532 | + } |
---|
| 9533 | + |
---|
9242 | 9534 | static int imagecount = 0; // movie generation |
---|
9243 | 9535 | |
---|
9244 | 9536 | static int jitter = 0; |
---|
.. | .. |
---|
10349 | 10641 | ANTIALIAS = 0; |
---|
10350 | 10642 | //System.out.println("RESTART"); |
---|
10351 | 10643 | AAtimer.restart(); |
---|
| 10644 | + Globals.TIMERRUNNING = true; |
---|
10352 | 10645 | } |
---|
10353 | 10646 | } |
---|
10354 | 10647 | } |
---|
.. | .. |
---|
10416 | 10709 | ambientOcclusion = false; |
---|
10417 | 10710 | } |
---|
10418 | 10711 | |
---|
10419 | | - if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
| 10712 | + if (//Globals.lighttouched && |
---|
| 10713 | + DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10420 | 10714 | { |
---|
10421 | 10715 | //if (RENDERSHADOW) // ? |
---|
10422 | 10716 | if (!IsFrozen()) |
---|
.. | .. |
---|
11326 | 11620 | |
---|
11327 | 11621 | static boolean zoomonce = false; |
---|
11328 | 11622 | |
---|
| 11623 | + static void CreateSelectedPoint() |
---|
| 11624 | + { |
---|
| 11625 | + if (selectedpoint == null) |
---|
| 11626 | + { |
---|
| 11627 | + debugpointG = new Sphere(); |
---|
| 11628 | + debugpointP = new Sphere(); |
---|
| 11629 | + debugpointC = new Sphere(); |
---|
| 11630 | + debugpointR = new Sphere(); |
---|
| 11631 | + |
---|
| 11632 | + selectedpoint = new Superellipsoid(); |
---|
| 11633 | + |
---|
| 11634 | + for (int i=0; i<8; i++) |
---|
| 11635 | + { |
---|
| 11636 | + debugpoints[i] = new Sphere(); |
---|
| 11637 | + } |
---|
| 11638 | + } |
---|
| 11639 | + } |
---|
| 11640 | + |
---|
11329 | 11641 | void DrawObject(GL gl, boolean draw) |
---|
11330 | 11642 | { |
---|
| 11643 | + // To clear camera values |
---|
| 11644 | + ResetOptions(); |
---|
| 11645 | + |
---|
11331 | 11646 | //System.out.println("DRAW OBJECT " + mouseDown); |
---|
11332 | 11647 | // DrawMode() = SELECTION; |
---|
11333 | 11648 | //GL gl = getGL(); |
---|
.. | .. |
---|
11406 | 11721 | |
---|
11407 | 11722 | if (DrawMode() == DEFAULT) |
---|
11408 | 11723 | { |
---|
11409 | | - if (DEBUG) |
---|
| 11724 | + if (Globals.DEBUG) |
---|
11410 | 11725 | { |
---|
| 11726 | + CreateSelectedPoint(); |
---|
11411 | 11727 | float radius = 0.05f; |
---|
11412 | 11728 | if (selectedpoint.radius != radius) |
---|
11413 | 11729 | { |
---|
.. | .. |
---|
11894 | 12210 | for (int i = tp.size(); --i >= 0;) |
---|
11895 | 12211 | { |
---|
11896 | 12212 | //for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
11897 | | - LA.xformPos(light, tp.get(i).GlobalTransform(), light); |
---|
| 12213 | + LA.xformPos(light, tp.get(i).GlobalTransformInv(), light); |
---|
11898 | 12214 | } |
---|
11899 | 12215 | |
---|
11900 | 12216 | |
---|
.. | .. |
---|
13164 | 13480 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13165 | 13481 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13166 | 13482 | /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
13167 | | - Object3D.cVector2[] vector2buffer; |
---|
| 13483 | + |
---|
| 13484 | + //Object3D.cVector2[] vector2buffer; |
---|
13168 | 13485 | |
---|
13169 | 13486 | // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea |
---|
13170 | 13487 | // OUT : diff, spec |
---|
.. | .. |
---|
13180 | 13497 | "DP3 " + dest + ".z," + "normals," + "eye;" + |
---|
13181 | 13498 | "MAX " + dest + ".w," + dest + ".z," + "eps.x;" + |
---|
13182 | 13499 | //"MOV " + dest + ".w," + "normal.z;" + |
---|
13183 | | - "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + |
---|
13184 | | - "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
13185 | | - //"MOV " + dest + ".z," + "params2.w;" + |
---|
| 13500 | +// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET |
---|
| 13501 | +// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
| 13502 | + |
---|
| 13503 | + "MOV " + dest + ".z," + "params2.w;" + // EXACT |
---|
13186 | 13504 | "POW " + dest + ".w," + dest + ".w," + dest + ".z;" + |
---|
13187 | 13505 | "RCP " + dest + ".w," + dest + ".w;" + |
---|
13188 | 13506 | //"RSQ " + dest + ".w," + dest + ".w;" + |
---|
.. | .. |
---|
13687 | 14005 | else |
---|
13688 | 14006 | if (evt.getSource() == AAtimer) |
---|
13689 | 14007 | { |
---|
| 14008 | + Globals.TIMERRUNNING = false; |
---|
13690 | 14009 | if (mouseDown) |
---|
13691 | 14010 | { |
---|
13692 | 14011 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
13761 | 14080 | return; |
---|
13762 | 14081 | |
---|
13763 | 14082 | AAtimer.restart(); // |
---|
| 14083 | + Globals.TIMERRUNNING = true; |
---|
13764 | 14084 | |
---|
13765 | 14085 | // waslive = LIVE; |
---|
13766 | 14086 | // LIVE = false; |
---|
.. | .. |
---|
14224 | 14544 | info.camera = renderCamera; |
---|
14225 | 14545 | info.x = x; |
---|
14226 | 14546 | info.y = y; |
---|
14227 | | - object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
| 14547 | + object.GetWindow().copy |
---|
| 14548 | + .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14228 | 14549 | } else |
---|
14229 | 14550 | { |
---|
14230 | 14551 | if (x < startX) |
---|
.. | .. |
---|
14388 | 14709 | ci.camera = renderCamera; |
---|
14389 | 14710 | if (!isRenderer) |
---|
14390 | 14711 | { |
---|
14391 | | - if (object.editWindow.copy.doEditClick(ci, 0)) |
---|
| 14712 | + //ObjEditor editWindow = object.editWindow; |
---|
| 14713 | + //Object3D copy = editWindow.copy; |
---|
| 14714 | + if (object.doEditClick(ci, 0)) |
---|
14392 | 14715 | { |
---|
14393 | 14716 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
---|
14394 | 14717 | } else |
---|
.. | .. |
---|
14769 | 15092 | RevertCamera(); |
---|
14770 | 15093 | repaint(); |
---|
14771 | 15094 | break; |
---|
14772 | | - case 'L': |
---|
14773 | 15095 | case 'l': |
---|
| 15096 | + lightMode ^= true; |
---|
| 15097 | + Globals.lighttouched = true; |
---|
| 15098 | + manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
| 15099 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 15100 | + repaint(); |
---|
| 15101 | + break; |
---|
| 15102 | + case 'L': |
---|
14774 | 15103 | if (lightMode) |
---|
14775 | 15104 | { |
---|
14776 | 15105 | lightMode = false; |
---|
.. | .. |
---|
14913 | 15242 | case '_': |
---|
14914 | 15243 | kompactbit = 5; |
---|
14915 | 15244 | break; |
---|
14916 | | - case '+': |
---|
14917 | | - kompactbit = 6; |
---|
14918 | | - break; |
---|
| 15245 | +// case '+': |
---|
| 15246 | +// kompactbit = 6; |
---|
| 15247 | +// break; |
---|
14919 | 15248 | case ' ': |
---|
14920 | | - lightMode ^= true; |
---|
14921 | | - Globals.lighttouched = true; |
---|
14922 | | - manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
14923 | | - targetLookAt.set(manipCamera.lookAt); |
---|
| 15249 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
14924 | 15250 | repaint(); |
---|
14925 | 15251 | break; |
---|
14926 | 15252 | //case '`' : |
---|
14927 | 15253 | case ESC: |
---|
14928 | 15254 | RENDERPROGRAM += 1; |
---|
14929 | 15255 | RENDERPROGRAM %= 3; |
---|
| 15256 | + |
---|
14930 | 15257 | repaint(); |
---|
14931 | 15258 | break; |
---|
14932 | 15259 | case 'Z': |
---|
.. | .. |
---|
14966 | 15293 | case DELETE: |
---|
14967 | 15294 | ClearSelection(); |
---|
14968 | 15295 | break; |
---|
14969 | | - /* |
---|
14970 | 15296 | case '+': |
---|
| 15297 | + |
---|
| 15298 | + //for (int i=0; i<0x7FFFFFFF; i++) |
---|
| 15299 | + { |
---|
| 15300 | + //String.format("%08X", i); // "7caca905" |
---|
| 15301 | + GetRemoteZip("https://archive3d.net/?a=download&do=get&id=", "7caca905", true, true); |
---|
| 15302 | + } |
---|
| 15303 | + |
---|
| 15304 | + /* |
---|
14971 | 15305 | //fontsize += 1; |
---|
14972 | 15306 | bbzoom *= 2; |
---|
14973 | 15307 | repaint(); |
---|
.. | .. |
---|
15218 | 15552 | } |
---|
15219 | 15553 | */ |
---|
15220 | 15554 | |
---|
15221 | | - object.editWindow.EditSelection(); |
---|
| 15555 | + object.editWindow.EditSelection(false); |
---|
15222 | 15556 | } |
---|
15223 | 15557 | |
---|
15224 | 15558 | void SelectParent() |
---|
.. | .. |
---|
16230 | 16564 | cStatic.objectstack[materialdepth++] = checker; |
---|
16231 | 16565 | //System.out.println("material " + material); |
---|
16232 | 16566 | //Applet3D.tracein(this, selected); |
---|
16233 | | - vector2buffer = checker.projectedVertices; |
---|
| 16567 | + //vector2buffer = checker.projectedVertices; |
---|
16234 | 16568 | |
---|
16235 | 16569 | //checker.GetMaterial().Draw(this, false); // true); |
---|
16236 | | - DrawMaterial(checker.GetMaterial(), false); // true); |
---|
| 16570 | + DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true); |
---|
16237 | 16571 | |
---|
16238 | 16572 | materialdepth -= 1; |
---|
16239 | 16573 | if (materialdepth > 0) |
---|
16240 | 16574 | { |
---|
16241 | | - vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
16242 | | - DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 16575 | + //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 16576 | + DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
16243 | 16577 | } |
---|
16244 | 16578 | //checker.GetMaterial().opacity = 1f; |
---|
16245 | 16579 | ////checker.GetMaterial().ambient = 1f; |
---|
.. | .. |
---|
16463 | 16797 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
16464 | 16798 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
16465 | 16799 | |
---|
| 16800 | + CreateSelectedPoint(); |
---|
| 16801 | + |
---|
16466 | 16802 | // Will fit the mesh !!! |
---|
16467 | 16803 | selectedpoint.toParent[0][0] = 0.0001; |
---|
16468 | 16804 | selectedpoint.toParent[1][1] = 0.0001; |
---|
.. | .. |
---|
16577 | 16913 | //System.out.println("objects[color] = " + objects[color]); |
---|
16578 | 16914 | //objects[color].Select(); |
---|
16579 | 16915 | indexcount = 0; |
---|
| 16916 | + ObjEditor window = object.GetWindow(); |
---|
| 16917 | + if (window != null && deselect) |
---|
| 16918 | + { |
---|
| 16919 | + window.Select(null, deselect, true); |
---|
| 16920 | + } |
---|
16580 | 16921 | object.Select(color, deselect); |
---|
16581 | 16922 | } |
---|
16582 | 16923 | |
---|
.. | .. |
---|
17102 | 17443 | int AAbuffersize = 0; |
---|
17103 | 17444 | |
---|
17104 | 17445 | //double[] selectedpoint = new double[3]; |
---|
17105 | | - static Superellipsoid selectedpoint = new Superellipsoid(); |
---|
| 17446 | + static Superellipsoid selectedpoint; |
---|
17106 | 17447 | static Sphere previousselectedpoint = null; |
---|
17107 | | - static Sphere debugpointG = new Sphere(); |
---|
17108 | | - static Sphere debugpointP = new Sphere(); |
---|
17109 | | - static Sphere debugpointC = new Sphere(); |
---|
17110 | | - static Sphere debugpointR = new Sphere(); |
---|
| 17448 | + static Sphere debugpointG; |
---|
| 17449 | + static Sphere debugpointP; |
---|
| 17450 | + static Sphere debugpointC; |
---|
| 17451 | + static Sphere debugpointR; |
---|
17111 | 17452 | |
---|
17112 | 17453 | static Sphere debugpoints[] = new Sphere[8]; |
---|
17113 | 17454 | |
---|
17114 | | - static |
---|
17115 | | - { |
---|
17116 | | - for (int i=0; i<8; i++) |
---|
17117 | | - { |
---|
17118 | | - debugpoints[i] = new Sphere(); |
---|
17119 | | - } |
---|
17120 | | - } |
---|
17121 | | - |
---|
17122 | 17455 | static void InitPoints(float radius) |
---|
17123 | 17456 | { |
---|
17124 | 17457 | for (int i=0; i<8; i++) |
---|