.. | .. |
---|
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; |
---|
.. | .. |
---|
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) |
---|
.. | .. |
---|
2415 | 2422 | /**/ |
---|
2416 | 2423 | |
---|
2417 | 2424 | // TEXTURE static Texture texture; |
---|
2418 | | - static public java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/> textures |
---|
2419 | | - = new java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/>(); |
---|
2420 | | - 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 | + |
---|
2421 | 2429 | int pigmentdepth = 0; |
---|
2422 | 2430 | public com.sun.opengl.util.texture.Texture[] pigmentstack = new com.sun.opengl.util.texture.Texture[65536]; |
---|
2423 | 2431 | int bumpdepth = 0; |
---|
.. | .. |
---|
2439 | 2447 | true, |
---|
2440 | 2448 | com.sun.opengl.util.texture.TextureIO.PNG); |
---|
2441 | 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) |
---|
2442 | 2477 | { |
---|
2443 | 2478 | throw new javax.media.opengl.GLException(e); |
---|
2444 | 2479 | } |
---|
.. | .. |
---|
3525 | 3560 | |
---|
3526 | 3561 | System.out.println("LOADING TEXTURE : " + name); |
---|
3527 | 3562 | |
---|
| 3563 | + Object x = texturedata.getMipmapData(); // .getBuffer(); |
---|
| 3564 | + |
---|
3528 | 3565 | // |
---|
3529 | 3566 | if (false) // compressbit > 0) |
---|
3530 | 3567 | { |
---|
.. | .. |
---|
7923 | 7960 | String pigment = Object3D.GetPigment(tex); |
---|
7924 | 7961 | String bump = Object3D.GetBump(tex); |
---|
7925 | 7962 | |
---|
7926 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7963 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7927 | 7964 | { |
---|
7928 | 7965 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7929 | 7966 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
7957 | 7994 | |
---|
7958 | 7995 | String pigment = Object3D.GetPigment(tex); |
---|
7959 | 7996 | |
---|
7960 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7997 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7961 | 7998 | { |
---|
7962 | 7999 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7963 | 8000 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
7986 | 8023 | |
---|
7987 | 8024 | String bump = Object3D.GetBump(tex); |
---|
7988 | 8025 | |
---|
7989 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8026 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7990 | 8027 | { |
---|
7991 | 8028 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7992 | 8029 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8105 | 8142 | |
---|
8106 | 8143 | /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
8107 | 8144 | { |
---|
8108 | | - if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
8109 | | - ambientOcclusion ) // || !textureon) |
---|
8110 | | - { |
---|
8111 | | - return; // false; |
---|
8112 | | - } |
---|
8113 | | - |
---|
8114 | | - if (tex == null) |
---|
8115 | | - { |
---|
8116 | | - BindTexture(null,false,resolution); |
---|
8117 | | - BindTexture(null,true,resolution); |
---|
8118 | | - return; |
---|
8119 | | - } |
---|
| 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; |
---|
8120 | 8186 | |
---|
8121 | | - String pigment = Object3D.GetPigment(tex); |
---|
8122 | | - String bump = Object3D.GetBump(tex); |
---|
8123 | | - |
---|
8124 | | - usedtextures.put(pigment, pigment); |
---|
8125 | | - usedtextures.put(bump, bump); |
---|
8126 | | - |
---|
8127 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8128 | | - { |
---|
8129 | | - // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8130 | | - // System.out.println("; bump = " + bump); |
---|
8131 | | - } |
---|
8132 | | - |
---|
8133 | | - if (bump.equals("")) |
---|
8134 | | - { |
---|
8135 | | - bump = null; |
---|
8136 | | - } |
---|
8137 | | - if (pigment.equals("")) |
---|
8138 | | - { |
---|
8139 | | - pigment = null; |
---|
8140 | | - } |
---|
8141 | | - |
---|
8142 | | - GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8143 | | - BindTexture(pigment, false, resolution); |
---|
8144 | | - GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
8145 | | - BindTexture(bump, true, resolution); |
---|
8146 | | - GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8147 | | - |
---|
8148 | | - return; // true; |
---|
| 8187 | + BindPigmentTexture(tex, resolution); |
---|
| 8188 | + BindBumpTexture(tex, resolution); |
---|
8149 | 8189 | } |
---|
8150 | 8190 | |
---|
8151 | 8191 | /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
.. | .. |
---|
8158 | 8198 | |
---|
8159 | 8199 | if (tex == null) |
---|
8160 | 8200 | { |
---|
8161 | | - BindTexture(null,false,resolution); |
---|
| 8201 | + BindTexture(null, null,false,resolution); |
---|
8162 | 8202 | return; |
---|
8163 | 8203 | } |
---|
8164 | 8204 | |
---|
8165 | 8205 | String pigment = Object3D.GetPigment(tex); |
---|
8166 | 8206 | |
---|
8167 | | - usedtextures.put(pigment, pigment); |
---|
| 8207 | + usedtextures.add(pigment); |
---|
8168 | 8208 | |
---|
8169 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8209 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8170 | 8210 | { |
---|
8171 | 8211 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8172 | 8212 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8178 | 8218 | } |
---|
8179 | 8219 | |
---|
8180 | 8220 | GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8181 | | - BindTexture(pigment, false, resolution); |
---|
| 8221 | + BindTexture(tex.pigmenttexture, pigment, false, resolution); |
---|
8182 | 8222 | } |
---|
8183 | 8223 | |
---|
8184 | 8224 | /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
.. | .. |
---|
8191 | 8231 | |
---|
8192 | 8232 | if (tex == null) |
---|
8193 | 8233 | { |
---|
8194 | | - BindTexture(null,true,resolution); |
---|
| 8234 | + BindTexture(null, null,true,resolution); |
---|
8195 | 8235 | return; |
---|
8196 | 8236 | } |
---|
8197 | 8237 | |
---|
8198 | 8238 | String bump = Object3D.GetBump(tex); |
---|
8199 | 8239 | |
---|
8200 | | - usedtextures.put(bump, bump); |
---|
| 8240 | + usedtextures.add(bump); |
---|
8201 | 8241 | |
---|
8202 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8242 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8203 | 8243 | { |
---|
8204 | 8244 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8205 | 8245 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8211 | 8251 | } |
---|
8212 | 8252 | |
---|
8213 | 8253 | GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
8214 | | - BindTexture(bump, true, resolution); |
---|
| 8254 | + BindTexture(tex.bumptexture, bump, true, resolution); |
---|
8215 | 8255 | GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8216 | 8256 | } |
---|
8217 | 8257 | |
---|
.. | .. |
---|
8235 | 8275 | return fileExists; |
---|
8236 | 8276 | } |
---|
8237 | 8277 | |
---|
8238 | | - 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 |
---|
8239 | 8279 | { |
---|
8240 | | - CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null; |
---|
| 8280 | + CacheTexture texturecache = null; |
---|
8241 | 8281 | |
---|
8242 | 8282 | if (tex != null) |
---|
8243 | 8283 | { |
---|
.. | .. |
---|
8257 | 8297 | } |
---|
8258 | 8298 | |
---|
8259 | 8299 | if (CACHETEXTURE) |
---|
8260 | | - texture = textures.get(texname); // TEXTURE CACHE |
---|
8261 | | - |
---|
8262 | | - TextureData texturedata = null; |
---|
8263 | | - |
---|
8264 | | - if (texture == null || texture.resolution < resolution) |
---|
8265 | 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 |
---|
8266 | 8316 | if (tex.equals("DEFAULT_TEXTURE")) // ||*/ tex.equals("")) |
---|
8267 | 8317 | { |
---|
8268 | 8318 | assert(!bump); |
---|
.. | .. |
---|
8274 | 8324 | // } |
---|
8275 | 8325 | // else |
---|
8276 | 8326 | // { |
---|
8277 | | - texture = textures.get(tex); |
---|
8278 | | - if (texture == null) |
---|
| 8327 | + texturecache = textures.get(tex); |
---|
| 8328 | + if (texturecache == null) |
---|
8279 | 8329 | { |
---|
8280 | | - texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
| 8330 | + texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
8281 | 8331 | } |
---|
8282 | 8332 | // } |
---|
8283 | 8333 | } else |
---|
8284 | 8334 | if (tex.equals("DEFAULT_TEXTURE_BUMP")) // ||*/ tex.equals("")) |
---|
8285 | 8335 | { |
---|
8286 | 8336 | assert(bump); |
---|
8287 | | - texture = textures.get(tex); |
---|
8288 | | - if (texture == null) |
---|
8289 | | - 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); |
---|
8290 | 8340 | } else |
---|
8291 | 8341 | { |
---|
8292 | 8342 | //if (tex.equals("IMMORTAL")) |
---|
.. | .. |
---|
8296 | 8346 | //{ |
---|
8297 | 8347 | if (tex.equals("WHITE_NOISE")) |
---|
8298 | 8348 | { |
---|
8299 | | - texture = textures.get(tex); |
---|
8300 | | - if (texture == null) |
---|
8301 | | - 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); |
---|
8302 | 8352 | } else |
---|
8303 | 8353 | { |
---|
8304 | 8354 | if (textureon) |
---|
.. | .. |
---|
8357 | 8407 | if (texturedata == null) |
---|
8358 | 8408 | throw new Exception(); |
---|
8359 | 8409 | |
---|
8360 | | - 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); |
---|
8361 | 8411 | //texture = GetTexture(tex, bump); |
---|
8362 | 8412 | } |
---|
8363 | 8413 | } |
---|
8364 | 8414 | //} |
---|
8365 | 8415 | } |
---|
8366 | 8416 | |
---|
8367 | | - if (/*CACHETEXTURE &&*/ texture != null && textureon) |
---|
| 8417 | + if (/*CACHETEXTURE &&*/ texturecache != null && textureon) |
---|
8368 | 8418 | { |
---|
8369 | 8419 | //return false; |
---|
8370 | 8420 | |
---|
8371 | 8421 | // System.out.println("CACHE +++++++++++++++ TEXTURE : " + texname + " (" + texture.getEstimatedMemorySize() + ")"); |
---|
8372 | | - if (texturedata != null && (texname.endsWith(".jpg") || texname.endsWith(".JPG"))) |
---|
| 8422 | + if (texturedata != null && texname.toLowerCase().endsWith(".jpg")) |
---|
8373 | 8423 | { |
---|
8374 | 8424 | // String ext = "_highres"; |
---|
8375 | 8425 | // if (REDUCETEXTURE) |
---|
.. | .. |
---|
8458 | 8508 | textures.remove(texname); |
---|
8459 | 8509 | } |
---|
8460 | 8510 | |
---|
8461 | | - texture.texturedata = texturedata; |
---|
8462 | | - textures.put(texname, texture); |
---|
| 8511 | + //texture.texturedata = texturedata; |
---|
| 8512 | + textures.put(texname, texturecache); |
---|
8463 | 8513 | |
---|
8464 | 8514 | // newtex = true; |
---|
8465 | 8515 | } |
---|
.. | .. |
---|
8475 | 8525 | } |
---|
8476 | 8526 | } |
---|
8477 | 8527 | |
---|
8478 | | - return texture; |
---|
| 8528 | + return texturecache; |
---|
8479 | 8529 | } |
---|
8480 | 8530 | |
---|
8481 | | - 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 |
---|
8482 | 8532 | { |
---|
8483 | | - CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
| 8533 | + CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution); |
---|
8484 | 8534 | |
---|
8485 | 8535 | if (bump) |
---|
8486 | 8536 | { |
---|
.. | .. |
---|
8496 | 8546 | return texture!=null?texture.texture:null; |
---|
8497 | 8547 | } |
---|
8498 | 8548 | |
---|
8499 | | - 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 |
---|
8500 | 8550 | { |
---|
8501 | | - CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
| 8551 | + CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution); |
---|
8502 | 8552 | |
---|
8503 | 8553 | return texture!=null?texture.texturedata:null; |
---|
8504 | 8554 | } |
---|
8505 | 8555 | |
---|
8506 | | - 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 |
---|
8507 | 8557 | { |
---|
8508 | 8558 | if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
8509 | 8559 | { |
---|
8510 | 8560 | return false; |
---|
8511 | 8561 | } |
---|
8512 | 8562 | |
---|
8513 | | - boolean newtex = false; |
---|
| 8563 | + //boolean newtex = false; |
---|
8514 | 8564 | |
---|
8515 | | - com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution); |
---|
| 8565 | + com.sun.opengl.util.texture.Texture texture = GetTexture(stream, tex, bump, resolution); |
---|
8516 | 8566 | |
---|
8517 | 8567 | if (texture == null) |
---|
8518 | 8568 | return false; |
---|
.. | .. |
---|
8542 | 8592 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT); |
---|
8543 | 8593 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT); |
---|
8544 | 8594 | |
---|
8545 | | - return newtex; |
---|
| 8595 | + return true; // Warning: not used. |
---|
8546 | 8596 | } |
---|
8547 | 8597 | |
---|
8548 | 8598 | ShadowBuffer shadowPBuf; |
---|
.. | .. |
---|
10999 | 11049 | |
---|
11000 | 11050 | try |
---|
11001 | 11051 | { |
---|
11002 | | - BindTexture(NOISE_TEXTURE, false, 2); |
---|
| 11052 | + BindTexture(null, NOISE_TEXTURE, false, 2); |
---|
11003 | 11053 | } |
---|
11004 | 11054 | catch (Exception e) |
---|
11005 | 11055 | { |
---|
.. | .. |
---|
11028 | 11078 | |
---|
11029 | 11079 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
11030 | 11080 | |
---|
11031 | | -//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
11032 | | -//gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
11033 | | -//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); |
---|
11034 | 11084 | } else |
---|
11035 | 11085 | { |
---|
11036 | 11086 | //gl.glDisable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
11041 | 11091 | //System.out.println("BLENDING ON"); |
---|
11042 | 11092 | gl.glEnable(GL.GL_BLEND); |
---|
11043 | 11093 | gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); |
---|
11044 | | - |
---|
| 11094 | +// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE); |
---|
11045 | 11095 | gl.glMatrixMode(gl.GL_PROJECTION); |
---|
11046 | 11096 | gl.glLoadIdentity(); |
---|
11047 | 11097 | |
---|
.. | .. |
---|
11664 | 11714 | if (tex.equals("WHITE_NOISE")) |
---|
11665 | 11715 | continue; |
---|
11666 | 11716 | |
---|
11667 | | - if (!usedtextures.containsKey(tex)) |
---|
| 11717 | + if (!usedtextures.contains(tex)) |
---|
11668 | 11718 | { |
---|
11669 | 11719 | // System.out.println("DISPOSE +++++++++++++++ " + tex); |
---|
11670 | 11720 | textures.get(tex).texture.dispose(); |
---|
.. | .. |
---|
14297 | 14347 | void GoDown(int mod) |
---|
14298 | 14348 | { |
---|
14299 | 14349 | MODIFIERS |= COMMAND; |
---|
14300 | | - /* |
---|
| 14350 | + /**/ |
---|
14301 | 14351 | if((mod&SHIFT) == SHIFT) |
---|
14302 | 14352 | manipCamera.RotatePosition(0, -speed); |
---|
14303 | 14353 | else |
---|
14304 | | - manipCamera.BackForth(0, -speed*delta, getWidth()); |
---|
14305 | | - */ |
---|
| 14354 | + manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14355 | + /**/ |
---|
14306 | 14356 | if ((mod & SHIFT) == SHIFT) |
---|
14307 | 14357 | { |
---|
14308 | 14358 | mouseMode = mouseMode; // VR?? |
---|
.. | .. |
---|
14318 | 14368 | void GoUp(int mod) |
---|
14319 | 14369 | { |
---|
14320 | 14370 | MODIFIERS |= COMMAND; |
---|
14321 | | - /* |
---|
| 14371 | + /**/ |
---|
14322 | 14372 | if((mod&SHIFT) == SHIFT) |
---|
14323 | 14373 | manipCamera.RotatePosition(0, speed); |
---|
14324 | 14374 | else |
---|
14325 | | - manipCamera.BackForth(0, speed*delta, getWidth()); |
---|
14326 | | - */ |
---|
| 14375 | + manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14376 | + /**/ |
---|
14327 | 14377 | if ((mod & SHIFT) == SHIFT) |
---|
14328 | 14378 | { |
---|
14329 | 14379 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14339 | 14389 | void GoLeft(int mod) |
---|
14340 | 14390 | { |
---|
14341 | 14391 | MODIFIERS |= COMMAND; |
---|
14342 | | - /* |
---|
| 14392 | + /**/ |
---|
14343 | 14393 | if((mod&SHIFT) == SHIFT) |
---|
14344 | | - manipCamera.RotatePosition(speed, 0); |
---|
14345 | | - else |
---|
14346 | 14394 | manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14347 | | - */ |
---|
| 14395 | + else |
---|
| 14396 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14397 | + /**/ |
---|
14348 | 14398 | if ((mod & SHIFT) == SHIFT) |
---|
14349 | 14399 | { |
---|
14350 | 14400 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14360 | 14410 | void GoRight(int mod) |
---|
14361 | 14411 | { |
---|
14362 | 14412 | MODIFIERS |= COMMAND; |
---|
14363 | | - /* |
---|
| 14413 | + /**/ |
---|
14364 | 14414 | if((mod&SHIFT) == SHIFT) |
---|
14365 | | - manipCamera.RotatePosition(-speed, 0); |
---|
14366 | | - else |
---|
14367 | 14415 | manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14368 | | - */ |
---|
| 14416 | + else |
---|
| 14417 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14418 | + /**/ |
---|
14369 | 14419 | if ((mod & SHIFT) == SHIFT) |
---|
14370 | 14420 | { |
---|
14371 | 14421 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14946 | 14996 | case 'E' : COMPACT ^= true; |
---|
14947 | 14997 | repaint(); |
---|
14948 | 14998 | break; |
---|
14949 | | - case 'W' : DEBUGHSB ^= true; |
---|
| 14999 | + case 'W' : // Wide Window (fullscreen) |
---|
| 15000 | + //DEBUGHSB ^= true; |
---|
| 15001 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
14950 | 15002 | repaint(); |
---|
14951 | 15003 | break; |
---|
14952 | 15004 | case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break; |
---|
.. | .. |
---|
14972 | 15024 | repaint(); |
---|
14973 | 15025 | break; |
---|
14974 | 15026 | case 'l': |
---|
14975 | | - lightMode ^= true; |
---|
14976 | | - Globals.lighttouched = true; |
---|
14977 | | - manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
14978 | | - targetLookAt.set(manipCamera.lookAt); |
---|
14979 | | - repaint(); |
---|
14980 | | - break; |
---|
14981 | | - case 'L': |
---|
| 15027 | + //case 'L': |
---|
14982 | 15028 | if (lightMode) |
---|
14983 | 15029 | { |
---|
14984 | 15030 | lightMode = false; |
---|
.. | .. |
---|
15125 | 15171 | // kompactbit = 6; |
---|
15126 | 15172 | // break; |
---|
15127 | 15173 | case ' ': |
---|
15128 | | - ObjEditor.theFrame.ToggleFullScreen(); |
---|
| 15174 | + lightMode ^= true; |
---|
| 15175 | + Globals.lighttouched = true; |
---|
| 15176 | + manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
| 15177 | + targetLookAt.set(manipCamera.lookAt); |
---|
15129 | 15178 | repaint(); |
---|
15130 | 15179 | break; |
---|
15131 | 15180 | //case '`' : |
---|
.. | .. |
---|
15709 | 15758 | info.bounds.y += (height - desired) / 2; |
---|
15710 | 15759 | } |
---|
15711 | 15760 | } |
---|
| 15761 | + |
---|
15712 | 15762 | info.g = gr; |
---|
15713 | 15763 | info.camera = renderCamera; |
---|
15714 | 15764 | /* |
---|
.. | .. |
---|
15718 | 15768 | */ |
---|
15719 | 15769 | if (!isRenderer) |
---|
15720 | 15770 | { |
---|
| 15771 | + Grafreed.Assert(object != null); |
---|
| 15772 | + Grafreed.Assert(object.selection != null); |
---|
15721 | 15773 | if (object.selection.Size() > 0) |
---|
15722 | 15774 | { |
---|
15723 | 15775 | int hitSomething = object.selection.get(0).hitSomething; |
---|
.. | .. |
---|
16551 | 16603 | } |
---|
16552 | 16604 | } |
---|
16553 | 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 | + |
---|
16554 | 16614 | class SelectBuffer implements GLEventListener |
---|
16555 | 16615 | { |
---|
16556 | 16616 | |
---|
.. | .. |
---|
16630 | 16690 | |
---|
16631 | 16691 | //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); |
---|
16632 | 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 | + |
---|
16633 | 16704 | //int tmp = selection_view; |
---|
16634 | 16705 | //selection_view = -1; |
---|
16635 | 16706 | int temp = DrawMode(); |
---|
.. | .. |
---|
16641 | 16712 | // temp = DEFAULT; // patch for selection debug |
---|
16642 | 16713 | Globals.drawMode = temp; // WARNING |
---|
16643 | 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 | + |
---|
16644 | 16726 | //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view); |
---|
16645 | 16727 | |
---|
16646 | 16728 | // trying different ways of getting the depth info over |
---|
.. | .. |
---|
16746 | 16828 | if (!movingcamera && !PAINTMODE) |
---|
16747 | 16829 | object.GetWindow().ScreenFitPoint(); // fev 2014 |
---|
16748 | 16830 | |
---|
16749 | | - 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) |
---|
16750 | 16832 | { |
---|
16751 | | - Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16752 | | - |
---|
16753 | | - Object3D group = new Object3D("inst" + paintcount++); |
---|
16754 | | - |
---|
16755 | | - group.CreateMaterial(); // use a void leaf to select instances |
---|
16756 | | - |
---|
16757 | | - group.add(paintobj); // link |
---|
16758 | | - |
---|
16759 | | - object.GetWindow().SnapObject(group); |
---|
16760 | | - |
---|
16761 | | - Object3D folder = object.GetWindow().copy; |
---|
| 16833 | + //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16762 | 16834 | |
---|
16763 | 16835 | if (object.GetWindow().copy.selection.Size() > 0) |
---|
16764 | | - folder = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16836 | + { |
---|
| 16837 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
16765 | 16838 | |
---|
16766 | | - folder.add(group); |
---|
16767 | | - |
---|
16768 | | - object.GetWindow().ResetModel(); |
---|
16769 | | - object.GetWindow().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 | + } |
---|
16770 | 16854 | } |
---|
16771 | 16855 | else |
---|
16772 | 16856 | paintcount = 0; |
---|