.. | .. |
---|
60 | 60 | //boolean REDUCETEXTURE = true; |
---|
61 | 61 | boolean CACHETEXTURE = true; |
---|
62 | 62 | boolean CLEANCACHE = false; // true; |
---|
63 | | - boolean MIPMAP = false; // true; |
---|
| 63 | + boolean MIPMAP = true; // false; // true; |
---|
64 | 64 | boolean COMPRESSTEXTURE = false; |
---|
65 | 65 | boolean KOMPACTTEXTURE = false; // true; |
---|
66 | 66 | boolean RESIZETEXTURE = false; |
---|
.. | .. |
---|
2065 | 2065 | //System.err.println("Oeil on"); |
---|
2066 | 2066 | OEIL = true; |
---|
2067 | 2067 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
2068 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 2068 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
2069 | 2069 | //pingthread.StepToTarget(true); |
---|
2070 | 2070 | } |
---|
2071 | 2071 | |
---|
.. | .. |
---|
2298 | 2298 | HANDLES ^= true; |
---|
2299 | 2299 | } |
---|
2300 | 2300 | |
---|
| 2301 | + Object3D paintFolder; |
---|
| 2302 | + |
---|
2301 | 2303 | void TogglePaint() |
---|
2302 | 2304 | { |
---|
2303 | 2305 | PAINTMODE ^= true; |
---|
2304 | 2306 | paintcount = 0; |
---|
| 2307 | + |
---|
| 2308 | + if (PAINTMODE) |
---|
| 2309 | + { |
---|
| 2310 | + paintFolder = GetFolder(); |
---|
| 2311 | + } |
---|
2305 | 2312 | } |
---|
2306 | 2313 | |
---|
2307 | 2314 | void SwapCamera(int a, int b) |
---|
.. | .. |
---|
2398 | 2405 | return currentGL; |
---|
2399 | 2406 | } |
---|
2400 | 2407 | |
---|
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 | | - |
---|
2521 | | - } |
---|
2522 | | - |
---|
2523 | 2408 | /**/ |
---|
2524 | 2409 | class CacheTexture |
---|
2525 | 2410 | { |
---|
.. | .. |
---|
2537 | 2422 | /**/ |
---|
2538 | 2423 | |
---|
2539 | 2424 | // TEXTURE static Texture texture; |
---|
2540 | | - static public java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/> textures |
---|
2541 | | - = new java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/>(); |
---|
2542 | | - static public java.util.Hashtable<String, String> usedtextures = new java.util.Hashtable<String, String>(); |
---|
| 2425 | + static public java.util.Hashtable<String, CacheTexture> textures = new java.util.Hashtable<String, CacheTexture>(); |
---|
| 2426 | + static public java.util.Hashtable<BufferedImage, CacheTexture> bimtextures = new java.util.Hashtable<BufferedImage, CacheTexture>(); |
---|
| 2427 | + static public java.util.HashSet<String> usedtextures = new java.util.HashSet<String>(); |
---|
| 2428 | + |
---|
2543 | 2429 | int pigmentdepth = 0; |
---|
2544 | 2430 | public com.sun.opengl.util.texture.Texture[] pigmentstack = new com.sun.opengl.util.texture.Texture[65536]; |
---|
2545 | 2431 | int bumpdepth = 0; |
---|
.. | .. |
---|
2561 | 2447 | true, |
---|
2562 | 2448 | com.sun.opengl.util.texture.TextureIO.PNG); |
---|
2563 | 2449 | } catch (java.io.IOException e) |
---|
| 2450 | + { |
---|
| 2451 | + throw new javax.media.opengl.GLException(e); |
---|
| 2452 | + } |
---|
| 2453 | + |
---|
| 2454 | + if (bump) |
---|
| 2455 | + texturedata = ConvertBump(texturedata, false); |
---|
| 2456 | + |
---|
| 2457 | + com.sun.opengl.util.texture.Texture texture = |
---|
| 2458 | + com.sun.opengl.util.texture.TextureIO.newTexture(texturedata); |
---|
| 2459 | + |
---|
| 2460 | + texture.setTexParameteri(javax.media.opengl.GL.GL_TEXTURE_WRAP_S, javax.media.opengl.GL.GL_REPEAT); |
---|
| 2461 | + texture.setTexParameteri(javax.media.opengl.GL.GL_TEXTURE_WRAP_T, javax.media.opengl.GL.GL_REPEAT); |
---|
| 2462 | + |
---|
| 2463 | + return texture; |
---|
| 2464 | + } |
---|
| 2465 | + |
---|
| 2466 | + com.sun.opengl.util.texture.Texture GetBimTexture(BufferedImage name, boolean bump) |
---|
| 2467 | + { |
---|
| 2468 | + TextureData texturedata = null; |
---|
| 2469 | + |
---|
| 2470 | + try |
---|
| 2471 | + { |
---|
| 2472 | + texturedata = |
---|
| 2473 | + com.sun.opengl.util.texture.TextureIO.newTextureData( |
---|
| 2474 | + name, |
---|
| 2475 | + true); |
---|
| 2476 | + } catch (Exception e) |
---|
2564 | 2477 | { |
---|
2565 | 2478 | throw new javax.media.opengl.GLException(e); |
---|
2566 | 2479 | } |
---|
.. | .. |
---|
3647 | 3560 | |
---|
3648 | 3561 | System.out.println("LOADING TEXTURE : " + name); |
---|
3649 | 3562 | |
---|
| 3563 | + Object x = texturedata.getMipmapData(); // .getBuffer(); |
---|
| 3564 | + |
---|
3650 | 3565 | // |
---|
3651 | 3566 | if (false) // compressbit > 0) |
---|
3652 | 3567 | { |
---|
.. | .. |
---|
8045 | 7960 | String pigment = Object3D.GetPigment(tex); |
---|
8046 | 7961 | String bump = Object3D.GetBump(tex); |
---|
8047 | 7962 | |
---|
8048 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7963 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8049 | 7964 | { |
---|
8050 | 7965 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
8051 | 7966 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8079 | 7994 | |
---|
8080 | 7995 | String pigment = Object3D.GetPigment(tex); |
---|
8081 | 7996 | |
---|
8082 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7997 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8083 | 7998 | { |
---|
8084 | 7999 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
8085 | 8000 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8108 | 8023 | |
---|
8109 | 8024 | String bump = Object3D.GetBump(tex); |
---|
8110 | 8025 | |
---|
8111 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8026 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8112 | 8027 | { |
---|
8113 | 8028 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
8114 | 8029 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8227 | 8142 | |
---|
8228 | 8143 | /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
8229 | 8144 | { |
---|
8230 | | - if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
8231 | | - ambientOcclusion ) // || !textureon) |
---|
8232 | | - { |
---|
8233 | | - return; // false; |
---|
8234 | | - } |
---|
8235 | | - |
---|
8236 | | - if (tex == null) |
---|
8237 | | - { |
---|
8238 | | - BindTexture(null,false,resolution); |
---|
8239 | | - BindTexture(null,true,resolution); |
---|
8240 | | - return; |
---|
8241 | | - } |
---|
| 8145 | +// if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8146 | +// ambientOcclusion ) // || !textureon) |
---|
| 8147 | +// { |
---|
| 8148 | +// return; // false; |
---|
| 8149 | +// } |
---|
| 8150 | +// |
---|
| 8151 | +// if (tex == null) |
---|
| 8152 | +// { |
---|
| 8153 | +// BindTexture(null,false,resolution); |
---|
| 8154 | +// BindTexture(null,true,resolution); |
---|
| 8155 | +// return; |
---|
| 8156 | +// } |
---|
| 8157 | +// |
---|
| 8158 | +// String pigment = Object3D.GetPigment(tex); |
---|
| 8159 | +// String bump = Object3D.GetBump(tex); |
---|
| 8160 | +// |
---|
| 8161 | +// usedtextures.add(pigment); |
---|
| 8162 | +// usedtextures.add(bump); |
---|
| 8163 | +// |
---|
| 8164 | +// //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8165 | +// { |
---|
| 8166 | +// // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8167 | +// // System.out.println("; bump = " + bump); |
---|
| 8168 | +// } |
---|
| 8169 | +// |
---|
| 8170 | +// if (bump.equals("")) |
---|
| 8171 | +// { |
---|
| 8172 | +// bump = null; |
---|
| 8173 | +// } |
---|
| 8174 | +// if (pigment.equals("")) |
---|
| 8175 | +// { |
---|
| 8176 | +// pigment = null; |
---|
| 8177 | +// } |
---|
| 8178 | +// |
---|
| 8179 | +// GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8180 | +// BindTexture(pigment, false, resolution); |
---|
| 8181 | +// GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
| 8182 | +// BindTexture(bump, true, resolution); |
---|
| 8183 | +// GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8184 | +// |
---|
| 8185 | +// return; // true; |
---|
8242 | 8186 | |
---|
8243 | | - String pigment = Object3D.GetPigment(tex); |
---|
8244 | | - String bump = Object3D.GetBump(tex); |
---|
8245 | | - |
---|
8246 | | - usedtextures.put(pigment, pigment); |
---|
8247 | | - usedtextures.put(bump, bump); |
---|
8248 | | - |
---|
8249 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8250 | | - { |
---|
8251 | | - // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8252 | | - // System.out.println("; bump = " + bump); |
---|
8253 | | - } |
---|
8254 | | - |
---|
8255 | | - if (bump.equals("")) |
---|
8256 | | - { |
---|
8257 | | - bump = null; |
---|
8258 | | - } |
---|
8259 | | - if (pigment.equals("")) |
---|
8260 | | - { |
---|
8261 | | - pigment = null; |
---|
8262 | | - } |
---|
8263 | | - |
---|
8264 | | - GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8265 | | - BindTexture(pigment, false, resolution); |
---|
8266 | | - GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
8267 | | - BindTexture(bump, true, resolution); |
---|
8268 | | - GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8269 | | - |
---|
8270 | | - return; // true; |
---|
| 8187 | + BindPigmentTexture(tex, resolution); |
---|
| 8188 | + BindBumpTexture(tex, resolution); |
---|
8271 | 8189 | } |
---|
8272 | 8190 | |
---|
8273 | 8191 | /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
.. | .. |
---|
8280 | 8198 | |
---|
8281 | 8199 | if (tex == null) |
---|
8282 | 8200 | { |
---|
8283 | | - BindTexture(null,false,resolution); |
---|
| 8201 | + BindTexture(null, null,false,resolution); |
---|
8284 | 8202 | return; |
---|
8285 | 8203 | } |
---|
8286 | 8204 | |
---|
8287 | 8205 | String pigment = Object3D.GetPigment(tex); |
---|
8288 | 8206 | |
---|
8289 | | - usedtextures.put(pigment, pigment); |
---|
| 8207 | + usedtextures.add(pigment); |
---|
8290 | 8208 | |
---|
8291 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8209 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8292 | 8210 | { |
---|
8293 | 8211 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8294 | 8212 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8300 | 8218 | } |
---|
8301 | 8219 | |
---|
8302 | 8220 | GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8303 | | - BindTexture(pigment, false, resolution); |
---|
| 8221 | + BindTexture(tex.pigmenttexture, pigment, false, resolution); |
---|
8304 | 8222 | } |
---|
8305 | 8223 | |
---|
8306 | 8224 | /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
.. | .. |
---|
8313 | 8231 | |
---|
8314 | 8232 | if (tex == null) |
---|
8315 | 8233 | { |
---|
8316 | | - BindTexture(null,true,resolution); |
---|
| 8234 | + BindTexture(null, null,true,resolution); |
---|
8317 | 8235 | return; |
---|
8318 | 8236 | } |
---|
8319 | 8237 | |
---|
8320 | 8238 | String bump = Object3D.GetBump(tex); |
---|
8321 | 8239 | |
---|
8322 | | - usedtextures.put(bump, bump); |
---|
| 8240 | + usedtextures.add(bump); |
---|
8323 | 8241 | |
---|
8324 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8242 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8325 | 8243 | { |
---|
8326 | 8244 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8327 | 8245 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8333 | 8251 | } |
---|
8334 | 8252 | |
---|
8335 | 8253 | GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
8336 | | - BindTexture(bump, true, resolution); |
---|
| 8254 | + BindTexture(tex.bumptexture, bump, true, resolution); |
---|
8337 | 8255 | GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8338 | 8256 | } |
---|
8339 | 8257 | |
---|
.. | .. |
---|
8357 | 8275 | return fileExists; |
---|
8358 | 8276 | } |
---|
8359 | 8277 | |
---|
8360 | | - CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception |
---|
| 8278 | + CacheTexture GetCacheTexture(java.awt.image.BufferedImage bim, String tex, boolean bump, int resolution) throws Exception |
---|
8361 | 8279 | { |
---|
8362 | | - CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null; |
---|
| 8280 | + CacheTexture texturecache = null; |
---|
8363 | 8281 | |
---|
8364 | 8282 | if (tex != null) |
---|
8365 | 8283 | { |
---|
.. | .. |
---|
8379 | 8297 | } |
---|
8380 | 8298 | |
---|
8381 | 8299 | if (CACHETEXTURE) |
---|
8382 | | - texture = textures.get(texname); // TEXTURE CACHE |
---|
8383 | | - |
---|
8384 | | - TextureData texturedata = null; |
---|
8385 | | - |
---|
8386 | | - if (texture == null || texture.resolution < resolution) |
---|
8387 | 8300 | { |
---|
| 8301 | + if (bim == null) |
---|
| 8302 | + texturecache = textures.get(texname); // TEXTURE CACHE |
---|
| 8303 | + else |
---|
| 8304 | + texturecache = bimtextures.get(bim); // TEXTURE CACHE |
---|
| 8305 | + } |
---|
| 8306 | + |
---|
| 8307 | + if (texturecache == null || texturecache.resolution < resolution) |
---|
| 8308 | + { |
---|
| 8309 | + TextureData texturedata = null; |
---|
| 8310 | + |
---|
| 8311 | + if (bim == null) |
---|
| 8312 | + { |
---|
| 8313 | + |
---|
| 8314 | + } |
---|
| 8315 | + else |
---|
8388 | 8316 | if (tex.equals("DEFAULT_TEXTURE")) // ||*/ tex.equals("")) |
---|
8389 | 8317 | { |
---|
8390 | 8318 | assert(!bump); |
---|
.. | .. |
---|
8396 | 8324 | // } |
---|
8397 | 8325 | // else |
---|
8398 | 8326 | // { |
---|
8399 | | - texture = textures.get(tex); |
---|
8400 | | - if (texture == null) |
---|
| 8327 | + texturecache = textures.get(tex); |
---|
| 8328 | + if (texturecache == null) |
---|
8401 | 8329 | { |
---|
8402 | | - texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
| 8330 | + texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
8403 | 8331 | } |
---|
8404 | 8332 | // } |
---|
8405 | 8333 | } else |
---|
8406 | 8334 | if (tex.equals("DEFAULT_TEXTURE_BUMP")) // ||*/ tex.equals("")) |
---|
8407 | 8335 | { |
---|
8408 | 8336 | assert(bump); |
---|
8409 | | - texture = textures.get(tex); |
---|
8410 | | - if (texture == null) |
---|
8411 | | - texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
| 8337 | + texturecache = textures.get(tex); |
---|
| 8338 | + if (texturecache == null) |
---|
| 8339 | + texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
8412 | 8340 | } else |
---|
8413 | 8341 | { |
---|
8414 | 8342 | //if (tex.equals("IMMORTAL")) |
---|
.. | .. |
---|
8418 | 8346 | //{ |
---|
8419 | 8347 | if (tex.equals("WHITE_NOISE")) |
---|
8420 | 8348 | { |
---|
8421 | | - texture = textures.get(tex); |
---|
8422 | | - if (texture == null) |
---|
8423 | | - texture = new CacheTexture(GetResourceTexture("whitenoise.png", bump),resolution); |
---|
| 8349 | + texturecache = textures.get(tex); |
---|
| 8350 | + if (texturecache == null) |
---|
| 8351 | + texturecache = new CacheTexture(GetResourceTexture("whitenoise.png", bump),resolution); |
---|
8424 | 8352 | } else |
---|
8425 | 8353 | { |
---|
8426 | 8354 | if (textureon) |
---|
.. | .. |
---|
8479 | 8407 | if (texturedata == null) |
---|
8480 | 8408 | throw new Exception(); |
---|
8481 | 8409 | |
---|
8482 | | - texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution); |
---|
| 8410 | + texturecache = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution); |
---|
8483 | 8411 | //texture = GetTexture(tex, bump); |
---|
8484 | 8412 | } |
---|
8485 | 8413 | } |
---|
8486 | 8414 | //} |
---|
8487 | 8415 | } |
---|
8488 | 8416 | |
---|
8489 | | - if (/*CACHETEXTURE &&*/ texture != null && textureon) |
---|
| 8417 | + if (/*CACHETEXTURE &&*/ texturecache != null && textureon) |
---|
8490 | 8418 | { |
---|
8491 | 8419 | //return false; |
---|
8492 | 8420 | |
---|
8493 | 8421 | // System.out.println("CACHE +++++++++++++++ TEXTURE : " + texname + " (" + texture.getEstimatedMemorySize() + ")"); |
---|
8494 | | - if (texturedata != null && (texname.endsWith(".jpg") || texname.endsWith(".JPG"))) |
---|
| 8422 | + if (texturedata != null && texname.toLowerCase().endsWith(".jpg")) |
---|
8495 | 8423 | { |
---|
8496 | 8424 | // String ext = "_highres"; |
---|
8497 | 8425 | // if (REDUCETEXTURE) |
---|
.. | .. |
---|
8580 | 8508 | textures.remove(texname); |
---|
8581 | 8509 | } |
---|
8582 | 8510 | |
---|
8583 | | - texture.texturedata = texturedata; |
---|
8584 | | - textures.put(texname, texture); |
---|
| 8511 | + //texture.texturedata = texturedata; |
---|
| 8512 | + textures.put(texname, texturecache); |
---|
8585 | 8513 | |
---|
8586 | 8514 | // newtex = true; |
---|
8587 | 8515 | } |
---|
.. | .. |
---|
8597 | 8525 | } |
---|
8598 | 8526 | } |
---|
8599 | 8527 | |
---|
8600 | | - return texture; |
---|
| 8528 | + return texturecache; |
---|
8601 | 8529 | } |
---|
8602 | 8530 | |
---|
8603 | | - com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception |
---|
| 8531 | + com.sun.opengl.util.texture.Texture GetTexture(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception |
---|
8604 | 8532 | { |
---|
8605 | | - CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
| 8533 | + CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution); |
---|
8606 | 8534 | |
---|
8607 | 8535 | if (bump) |
---|
8608 | 8536 | { |
---|
.. | .. |
---|
8618 | 8546 | return texture!=null?texture.texture:null; |
---|
8619 | 8547 | } |
---|
8620 | 8548 | |
---|
8621 | | - public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception |
---|
| 8549 | + public com.sun.opengl.util.texture.TextureData GetTextureData(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception |
---|
8622 | 8550 | { |
---|
8623 | | - CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
| 8551 | + CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution); |
---|
8624 | 8552 | |
---|
8625 | 8553 | return texture!=null?texture.texturedata:null; |
---|
8626 | 8554 | } |
---|
8627 | 8555 | |
---|
8628 | | - boolean BindTexture(String tex, boolean bump, int resolution) throws Exception |
---|
| 8556 | + boolean BindTexture(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception |
---|
8629 | 8557 | { |
---|
8630 | 8558 | if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
8631 | 8559 | { |
---|
8632 | 8560 | return false; |
---|
8633 | 8561 | } |
---|
8634 | 8562 | |
---|
8635 | | - boolean newtex = false; |
---|
| 8563 | + //boolean newtex = false; |
---|
8636 | 8564 | |
---|
8637 | | - com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution); |
---|
| 8565 | + com.sun.opengl.util.texture.Texture texture = GetTexture(stream, tex, bump, resolution); |
---|
8638 | 8566 | |
---|
8639 | 8567 | if (texture == null) |
---|
8640 | 8568 | return false; |
---|
.. | .. |
---|
8664 | 8592 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT); |
---|
8665 | 8593 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT); |
---|
8666 | 8594 | |
---|
8667 | | - return newtex; |
---|
| 8595 | + return true; // Warning: not used. |
---|
8668 | 8596 | } |
---|
8669 | 8597 | |
---|
8670 | 8598 | ShadowBuffer shadowPBuf; |
---|
.. | .. |
---|
11121 | 11049 | |
---|
11122 | 11050 | try |
---|
11123 | 11051 | { |
---|
11124 | | - BindTexture(NOISE_TEXTURE, false, 2); |
---|
| 11052 | + BindTexture(null, NOISE_TEXTURE, false, 2); |
---|
11125 | 11053 | } |
---|
11126 | 11054 | catch (Exception e) |
---|
11127 | 11055 | { |
---|
.. | .. |
---|
11150 | 11078 | |
---|
11151 | 11079 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
11152 | 11080 | |
---|
11153 | | -//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
11154 | | -//gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
11155 | | -//gl.glEnable(gl.GL_MULTISAMPLE); |
---|
| 11081 | +gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
| 11082 | +gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
| 11083 | +gl.glEnable(gl.GL_MULTISAMPLE); |
---|
11156 | 11084 | } else |
---|
11157 | 11085 | { |
---|
11158 | 11086 | //gl.glDisable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
11163 | 11091 | //System.out.println("BLENDING ON"); |
---|
11164 | 11092 | gl.glEnable(GL.GL_BLEND); |
---|
11165 | 11093 | gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); |
---|
11166 | | - |
---|
| 11094 | +// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE); |
---|
11167 | 11095 | gl.glMatrixMode(gl.GL_PROJECTION); |
---|
11168 | 11096 | gl.glLoadIdentity(); |
---|
11169 | 11097 | |
---|
.. | .. |
---|
11649 | 11577 | if ((TRACK || SHADOWTRACK) || zoomonce) |
---|
11650 | 11578 | { |
---|
11651 | 11579 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
11652 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 11580 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
11653 | 11581 | pingthread.StepToTarget(true); // true); |
---|
11654 | 11582 | // zoomonce = false; |
---|
11655 | 11583 | } |
---|
.. | .. |
---|
11786 | 11714 | if (tex.equals("WHITE_NOISE")) |
---|
11787 | 11715 | continue; |
---|
11788 | 11716 | |
---|
11789 | | - if (!usedtextures.containsKey(tex)) |
---|
| 11717 | + if (!usedtextures.contains(tex)) |
---|
11790 | 11718 | { |
---|
11791 | 11719 | // System.out.println("DISPOSE +++++++++++++++ " + tex); |
---|
11792 | 11720 | textures.get(tex).texture.dispose(); |
---|
.. | .. |
---|
14065 | 13993 | |
---|
14066 | 13994 | // fev 2014??? |
---|
14067 | 13995 | if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode) |
---|
14068 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 13996 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
14069 | 13997 | pingthread.StepToTarget(true); // true); |
---|
14070 | 13998 | } |
---|
14071 | 13999 | // if (!LIVE) |
---|
.. | .. |
---|
14419 | 14347 | void GoDown(int mod) |
---|
14420 | 14348 | { |
---|
14421 | 14349 | MODIFIERS |= COMMAND; |
---|
14422 | | - /* |
---|
| 14350 | + /**/ |
---|
14423 | 14351 | if((mod&SHIFT) == SHIFT) |
---|
14424 | 14352 | manipCamera.RotatePosition(0, -speed); |
---|
14425 | 14353 | else |
---|
14426 | | - manipCamera.BackForth(0, -speed*delta, getWidth()); |
---|
14427 | | - */ |
---|
| 14354 | + manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14355 | + /**/ |
---|
14428 | 14356 | if ((mod & SHIFT) == SHIFT) |
---|
14429 | 14357 | { |
---|
14430 | 14358 | mouseMode = mouseMode; // VR?? |
---|
.. | .. |
---|
14440 | 14368 | void GoUp(int mod) |
---|
14441 | 14369 | { |
---|
14442 | 14370 | MODIFIERS |= COMMAND; |
---|
14443 | | - /* |
---|
| 14371 | + /**/ |
---|
14444 | 14372 | if((mod&SHIFT) == SHIFT) |
---|
14445 | 14373 | manipCamera.RotatePosition(0, speed); |
---|
14446 | 14374 | else |
---|
14447 | | - manipCamera.BackForth(0, speed*delta, getWidth()); |
---|
14448 | | - */ |
---|
| 14375 | + manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14376 | + /**/ |
---|
14449 | 14377 | if ((mod & SHIFT) == SHIFT) |
---|
14450 | 14378 | { |
---|
14451 | 14379 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14461 | 14389 | void GoLeft(int mod) |
---|
14462 | 14390 | { |
---|
14463 | 14391 | MODIFIERS |= COMMAND; |
---|
14464 | | - /* |
---|
| 14392 | + /**/ |
---|
14465 | 14393 | if((mod&SHIFT) == SHIFT) |
---|
14466 | | - manipCamera.RotatePosition(speed, 0); |
---|
14467 | | - else |
---|
14468 | 14394 | manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14469 | | - */ |
---|
| 14395 | + else |
---|
| 14396 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14397 | + /**/ |
---|
14470 | 14398 | if ((mod & SHIFT) == SHIFT) |
---|
14471 | 14399 | { |
---|
14472 | 14400 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14482 | 14410 | void GoRight(int mod) |
---|
14483 | 14411 | { |
---|
14484 | 14412 | MODIFIERS |= COMMAND; |
---|
14485 | | - /* |
---|
| 14413 | + /**/ |
---|
14486 | 14414 | if((mod&SHIFT) == SHIFT) |
---|
14487 | | - manipCamera.RotatePosition(-speed, 0); |
---|
14488 | | - else |
---|
14489 | 14415 | manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14490 | | - */ |
---|
| 14416 | + else |
---|
| 14417 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14418 | + /**/ |
---|
14491 | 14419 | if ((mod & SHIFT) == SHIFT) |
---|
14492 | 14420 | { |
---|
14493 | 14421 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14726 | 14654 | Globals.MOUSEDRAGGED = false; |
---|
14727 | 14655 | |
---|
14728 | 14656 | movingcamera = false; |
---|
14729 | | - X = Y = 0; |
---|
| 14657 | + X = 0; // getBounds().width/2; |
---|
| 14658 | + Y = 0; // getBounds().height/2; |
---|
14730 | 14659 | //System.out.println("mouseReleased: " + e); |
---|
14731 | 14660 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14732 | 14661 | } |
---|
.. | .. |
---|
15067 | 14996 | case 'E' : COMPACT ^= true; |
---|
15068 | 14997 | repaint(); |
---|
15069 | 14998 | break; |
---|
15070 | | - case 'W' : DEBUGHSB ^= true; |
---|
| 14999 | + case 'W' : // Wide Window (fullscreen) |
---|
| 15000 | + //DEBUGHSB ^= true; |
---|
| 15001 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
15071 | 15002 | repaint(); |
---|
15072 | 15003 | break; |
---|
15073 | 15004 | case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break; |
---|
.. | .. |
---|
15093 | 15024 | repaint(); |
---|
15094 | 15025 | break; |
---|
15095 | 15026 | 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': |
---|
| 15027 | + //case 'L': |
---|
15103 | 15028 | if (lightMode) |
---|
15104 | 15029 | { |
---|
15105 | 15030 | lightMode = false; |
---|
.. | .. |
---|
15246 | 15171 | // kompactbit = 6; |
---|
15247 | 15172 | // break; |
---|
15248 | 15173 | case ' ': |
---|
15249 | | - ObjEditor.theFrame.ToggleFullScreen(); |
---|
| 15174 | + lightMode ^= true; |
---|
| 15175 | + Globals.lighttouched = true; |
---|
| 15176 | + manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
| 15177 | + targetLookAt.set(manipCamera.lookAt); |
---|
15250 | 15178 | repaint(); |
---|
15251 | 15179 | break; |
---|
15252 | 15180 | //case '`' : |
---|
.. | .. |
---|
15295 | 15223 | break; |
---|
15296 | 15224 | case '+': |
---|
15297 | 15225 | |
---|
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 | 15226 | /* |
---|
15305 | 15227 | //fontsize += 1; |
---|
15306 | 15228 | bbzoom *= 2; |
---|
.. | .. |
---|
15318 | 15240 | case '=': |
---|
15319 | 15241 | IncDepth(); |
---|
15320 | 15242 | //fontsize += 1; |
---|
15321 | | - object.editWindow.refreshContents(true); |
---|
| 15243 | + object.GetWindow().refreshContents(true); |
---|
15322 | 15244 | maskbit = 6; |
---|
15323 | 15245 | break; |
---|
15324 | 15246 | case '-': //if (PixelThreshold>1) PixelThreshold /= 2; |
---|
15325 | 15247 | DecDepth(); |
---|
15326 | 15248 | maskbit = 5; |
---|
15327 | 15249 | //if(fontsize > 1) fontsize -= 1; |
---|
15328 | | - if (object.editWindow == null) |
---|
15329 | | - new Exception().printStackTrace(); |
---|
15330 | | - else |
---|
15331 | | - object.editWindow.refreshContents(true); |
---|
| 15250 | +// if (object.editWindow == null) |
---|
| 15251 | +// new Exception().printStackTrace(); |
---|
| 15252 | +// else |
---|
| 15253 | + object.GetWindow().refreshContents(true); |
---|
15332 | 15254 | break; |
---|
15333 | 15255 | case '{': |
---|
15334 | 15256 | manipCamera.shaper_fovy /= 1.1; |
---|
.. | .. |
---|
15552 | 15474 | } |
---|
15553 | 15475 | */ |
---|
15554 | 15476 | |
---|
15555 | | - object.editWindow.EditSelection(false); |
---|
| 15477 | + object.GetWindow().EditSelection(false); |
---|
15556 | 15478 | } |
---|
15557 | 15479 | |
---|
15558 | 15480 | void SelectParent() |
---|
.. | .. |
---|
15569 | 15491 | { |
---|
15570 | 15492 | //selectees.remove(i); |
---|
15571 | 15493 | System.out.println("select parent of " + elem); |
---|
15572 | | - group.editWindow.Select(elem.parent.GetTreePath(), first, true); |
---|
| 15494 | + group.GetWindow().Select(elem.parent.GetTreePath(), first, true); |
---|
15573 | 15495 | } else |
---|
15574 | 15496 | { |
---|
15575 | | - group.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15497 | + group.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15576 | 15498 | } |
---|
15577 | 15499 | |
---|
15578 | 15500 | first = false; |
---|
.. | .. |
---|
15614 | 15536 | for (int j = 0; j < group.children.size(); j++) |
---|
15615 | 15537 | { |
---|
15616 | 15538 | elem = (Object3D) group.children.elementAt(j); |
---|
15617 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15539 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15618 | 15540 | first = false; |
---|
15619 | 15541 | } |
---|
15620 | 15542 | } else |
---|
15621 | 15543 | { |
---|
15622 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15544 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15623 | 15545 | } |
---|
15624 | 15546 | |
---|
15625 | 15547 | first = false; |
---|
.. | .. |
---|
15630 | 15552 | { |
---|
15631 | 15553 | //Composite group = (Composite) object; |
---|
15632 | 15554 | Object3D group = object; |
---|
15633 | | - group.editWindow.loadClipboard(true); // ClearSelection(false); |
---|
| 15555 | + group.GetWindow().loadClipboard(true); // ClearSelection(false); |
---|
15634 | 15556 | } |
---|
15635 | 15557 | |
---|
15636 | 15558 | void ResetTransform(int mask) |
---|
15637 | 15559 | { |
---|
15638 | 15560 | //Composite group = (Composite) object; |
---|
15639 | 15561 | Object3D group = object; |
---|
15640 | | - group.editWindow.ResetTransform(mask); |
---|
| 15562 | + group.GetWindow().ResetTransform(mask); |
---|
15641 | 15563 | } |
---|
15642 | 15564 | |
---|
15643 | 15565 | void FlipTransform() |
---|
15644 | 15566 | { |
---|
15645 | 15567 | //Composite group = (Composite) object; |
---|
15646 | 15568 | Object3D group = object; |
---|
15647 | | - group.editWindow.FlipTransform(); |
---|
| 15569 | + group.GetWindow().FlipTransform(); |
---|
15648 | 15570 | // group.editWindow.ReduceMesh(true); |
---|
15649 | 15571 | } |
---|
15650 | 15572 | |
---|
.. | .. |
---|
15652 | 15574 | { |
---|
15653 | 15575 | //Composite group = (Composite) object; |
---|
15654 | 15576 | Object3D group = object; |
---|
15655 | | - group.editWindow.PrintMemory(); |
---|
| 15577 | + group.GetWindow().PrintMemory(); |
---|
15656 | 15578 | // group.editWindow.ReduceMesh(true); |
---|
15657 | 15579 | } |
---|
15658 | 15580 | |
---|
.. | .. |
---|
15660 | 15582 | { |
---|
15661 | 15583 | //Composite group = (Composite) object; |
---|
15662 | 15584 | Object3D group = object; |
---|
15663 | | - group.editWindow.ResetCentroid(); |
---|
| 15585 | + group.GetWindow().ResetCentroid(); |
---|
15664 | 15586 | } |
---|
15665 | 15587 | |
---|
15666 | 15588 | void IncDepth() |
---|
.. | .. |
---|
15836 | 15758 | info.bounds.y += (height - desired) / 2; |
---|
15837 | 15759 | } |
---|
15838 | 15760 | } |
---|
| 15761 | + |
---|
15839 | 15762 | info.g = gr; |
---|
15840 | 15763 | info.camera = renderCamera; |
---|
15841 | 15764 | /* |
---|
.. | .. |
---|
15845 | 15768 | */ |
---|
15846 | 15769 | if (!isRenderer) |
---|
15847 | 15770 | { |
---|
15848 | | - object.drawEditHandles(info, 0); |
---|
15849 | | - |
---|
15850 | | - if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0) |
---|
| 15771 | + Grafreed.Assert(object != null); |
---|
| 15772 | + Grafreed.Assert(object.selection != null); |
---|
| 15773 | + if (object.selection.Size() > 0) |
---|
15851 | 15774 | { |
---|
15852 | | - switch (object.selection.get(0).hitSomething) |
---|
| 15775 | + int hitSomething = object.selection.get(0).hitSomething; |
---|
| 15776 | + |
---|
| 15777 | + info.DX = 0; |
---|
| 15778 | + info.DY = 0; |
---|
| 15779 | + info.W = 1; |
---|
| 15780 | + if (hitSomething == Object3D.hitCenter) |
---|
15853 | 15781 | { |
---|
15854 | | - case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
15855 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15856 | | - break; |
---|
15857 | | - case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
15858 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15859 | | - break; |
---|
15860 | | - case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
15861 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15862 | | - break; |
---|
| 15782 | + info.DX = X; |
---|
| 15783 | + if (X != 0) |
---|
| 15784 | + info.DX -= info.bounds.width/2; |
---|
| 15785 | + |
---|
| 15786 | + info.DY = Y; |
---|
| 15787 | + if (Y != 0) |
---|
| 15788 | + info.DY -= info.bounds.height/2; |
---|
15863 | 15789 | } |
---|
15864 | | - |
---|
| 15790 | + |
---|
| 15791 | + object.drawEditHandles(info, 0); |
---|
| 15792 | + |
---|
| 15793 | + if (drag && (X != 0 || Y != 0)) |
---|
| 15794 | + { |
---|
| 15795 | + switch (hitSomething) |
---|
| 15796 | + { |
---|
| 15797 | + case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 15798 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15799 | + break; |
---|
| 15800 | + case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
| 15801 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15802 | + break; |
---|
| 15803 | + case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
| 15804 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15805 | + break; |
---|
| 15806 | + } |
---|
| 15807 | + |
---|
| 15808 | + } |
---|
15865 | 15809 | } |
---|
15866 | 15810 | } |
---|
15867 | 15811 | } |
---|
.. | .. |
---|
16659 | 16603 | } |
---|
16660 | 16604 | } |
---|
16661 | 16605 | |
---|
| 16606 | + private Object3D GetFolder() |
---|
| 16607 | + { |
---|
| 16608 | + Object3D folder = object.GetWindow().copy; |
---|
| 16609 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16610 | + folder = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16611 | + return folder; |
---|
| 16612 | + } |
---|
| 16613 | + |
---|
16662 | 16614 | class SelectBuffer implements GLEventListener |
---|
16663 | 16615 | { |
---|
16664 | 16616 | |
---|
.. | .. |
---|
16738 | 16690 | |
---|
16739 | 16691 | //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); |
---|
16740 | 16692 | |
---|
| 16693 | + if (PAINTMODE) |
---|
| 16694 | + { |
---|
| 16695 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16696 | + { |
---|
| 16697 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16698 | + |
---|
| 16699 | + // Make what you paint not selectable. |
---|
| 16700 | + paintobj.ResetSelectable(); |
---|
| 16701 | + } |
---|
| 16702 | + } |
---|
| 16703 | + |
---|
16741 | 16704 | //int tmp = selection_view; |
---|
16742 | 16705 | //selection_view = -1; |
---|
16743 | 16706 | int temp = DrawMode(); |
---|
.. | .. |
---|
16749 | 16712 | // temp = DEFAULT; // patch for selection debug |
---|
16750 | 16713 | Globals.drawMode = temp; // WARNING |
---|
16751 | 16714 | |
---|
| 16715 | + if (PAINTMODE) |
---|
| 16716 | + { |
---|
| 16717 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16718 | + { |
---|
| 16719 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16720 | + |
---|
| 16721 | + // Revert. |
---|
| 16722 | + paintobj.RestoreSelectable(); |
---|
| 16723 | + } |
---|
| 16724 | + } |
---|
| 16725 | + |
---|
16752 | 16726 | //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view); |
---|
16753 | 16727 | |
---|
16754 | 16728 | // trying different ways of getting the depth info over |
---|
.. | .. |
---|
16852 | 16826 | } |
---|
16853 | 16827 | |
---|
16854 | 16828 | if (!movingcamera && !PAINTMODE) |
---|
16855 | | - object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
| 16829 | + object.GetWindow().ScreenFitPoint(); // fev 2014 |
---|
16856 | 16830 | |
---|
16857 | | - if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
| 16831 | + if (PAINTMODE) // && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
16858 | 16832 | { |
---|
16859 | | - Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
| 16833 | + //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16860 | 16834 | |
---|
16861 | | - Object3D group = new Object3D("inst" + paintcount++); |
---|
| 16835 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16836 | + { |
---|
| 16837 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
16862 | 16838 | |
---|
16863 | | - group.CreateMaterial(); // use a void leaf to select instances |
---|
16864 | | - |
---|
16865 | | - group.add(paintobj); // link |
---|
16866 | | - |
---|
16867 | | - object.editWindow.SnapObject(group); |
---|
16868 | | - |
---|
16869 | | - Object3D folder = object.editWindow.copy; |
---|
16870 | | - |
---|
16871 | | - if (object.editWindow.copy.selection.Size() > 0) |
---|
16872 | | - folder = object.editWindow.copy.selection.elementAt(0); |
---|
16873 | | - |
---|
16874 | | - folder.add(group); |
---|
16875 | | - |
---|
16876 | | - object.editWindow.ResetModel(); |
---|
16877 | | - object.editWindow.refreshContents(); |
---|
| 16839 | + Object3D inst = new Object3D("inst" + paintcount++); |
---|
| 16840 | + |
---|
| 16841 | + inst.CreateMaterial(); // use a void leaf to select instances |
---|
| 16842 | + |
---|
| 16843 | + inst.add(paintobj); // link |
---|
| 16844 | + |
---|
| 16845 | + object.GetWindow().SnapObject(inst); |
---|
| 16846 | + |
---|
| 16847 | + Object3D folder = paintFolder; // GetFolder(); |
---|
| 16848 | + |
---|
| 16849 | + folder.add(inst); |
---|
| 16850 | + |
---|
| 16851 | + object.GetWindow().ResetModel(); |
---|
| 16852 | + object.GetWindow().refreshContents(); |
---|
| 16853 | + } |
---|
16878 | 16854 | } |
---|
16879 | 16855 | else |
---|
16880 | 16856 | paintcount = 0; |
---|