.. | .. |
---|
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; |
---|
.. | .. |
---|
335 | 335 | display.options1[2] = material.shadowbias; |
---|
336 | 336 | display.options1[3] = material.aniso; |
---|
337 | 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]); |
---|
338 | 343 | display.options2[0] = material.opacity; |
---|
339 | 344 | display.options2[1] = material.diffuse; |
---|
340 | 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]); |
---|
341 | 349 | |
---|
342 | 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]); |
---|
343 | 354 | display.options4[0] = material.cameralight/0.2f; |
---|
344 | 355 | display.options4[1] = material.subsurface; |
---|
345 | 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]); |
---|
346 | 360 | |
---|
347 | 361 | // if (display.CURRENTANTIALIAS > 0) |
---|
348 | 362 | // display.options3[3] /= 4; |
---|
.. | .. |
---|
2051 | 2065 | //System.err.println("Oeil on"); |
---|
2052 | 2066 | OEIL = true; |
---|
2053 | 2067 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
2054 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 2068 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
2055 | 2069 | //pingthread.StepToTarget(true); |
---|
2056 | 2070 | } |
---|
2057 | 2071 | |
---|
.. | .. |
---|
2284 | 2298 | HANDLES ^= true; |
---|
2285 | 2299 | } |
---|
2286 | 2300 | |
---|
| 2301 | + Object3D paintFolder; |
---|
| 2302 | + |
---|
2287 | 2303 | void TogglePaint() |
---|
2288 | 2304 | { |
---|
2289 | 2305 | PAINTMODE ^= true; |
---|
2290 | 2306 | paintcount = 0; |
---|
| 2307 | + |
---|
| 2308 | + if (PAINTMODE) |
---|
| 2309 | + { |
---|
| 2310 | + paintFolder = GetFolder(); |
---|
| 2311 | + } |
---|
2291 | 2312 | } |
---|
2292 | 2313 | |
---|
2293 | 2314 | void SwapCamera(int a, int b) |
---|
.. | .. |
---|
2401 | 2422 | /**/ |
---|
2402 | 2423 | |
---|
2403 | 2424 | // TEXTURE static Texture texture; |
---|
2404 | | - static public java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/> textures |
---|
2405 | | - = new java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/>(); |
---|
2406 | | - 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 | + |
---|
2407 | 2429 | int pigmentdepth = 0; |
---|
2408 | 2430 | public com.sun.opengl.util.texture.Texture[] pigmentstack = new com.sun.opengl.util.texture.Texture[65536]; |
---|
2409 | 2431 | int bumpdepth = 0; |
---|
.. | .. |
---|
2425 | 2447 | true, |
---|
2426 | 2448 | com.sun.opengl.util.texture.TextureIO.PNG); |
---|
2427 | 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) |
---|
2428 | 2477 | { |
---|
2429 | 2478 | throw new javax.media.opengl.GLException(e); |
---|
2430 | 2479 | } |
---|
.. | .. |
---|
3511 | 3560 | |
---|
3512 | 3561 | System.out.println("LOADING TEXTURE : " + name); |
---|
3513 | 3562 | |
---|
| 3563 | + Object x = texturedata.getMipmapData(); // .getBuffer(); |
---|
| 3564 | + |
---|
3514 | 3565 | // |
---|
3515 | 3566 | if (false) // compressbit > 0) |
---|
3516 | 3567 | { |
---|
.. | .. |
---|
7909 | 7960 | String pigment = Object3D.GetPigment(tex); |
---|
7910 | 7961 | String bump = Object3D.GetBump(tex); |
---|
7911 | 7962 | |
---|
7912 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7963 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7913 | 7964 | { |
---|
7914 | 7965 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7915 | 7966 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
7943 | 7994 | |
---|
7944 | 7995 | String pigment = Object3D.GetPigment(tex); |
---|
7945 | 7996 | |
---|
7946 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7997 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7947 | 7998 | { |
---|
7948 | 7999 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7949 | 8000 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
7972 | 8023 | |
---|
7973 | 8024 | String bump = Object3D.GetBump(tex); |
---|
7974 | 8025 | |
---|
7975 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8026 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7976 | 8027 | { |
---|
7977 | 8028 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7978 | 8029 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8091 | 8142 | |
---|
8092 | 8143 | /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
8093 | 8144 | { |
---|
8094 | | - if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
8095 | | - ambientOcclusion ) // || !textureon) |
---|
8096 | | - { |
---|
8097 | | - return; // false; |
---|
8098 | | - } |
---|
8099 | | - |
---|
8100 | | - if (tex == null) |
---|
8101 | | - { |
---|
8102 | | - BindTexture(null,false,resolution); |
---|
8103 | | - BindTexture(null,true,resolution); |
---|
8104 | | - return; |
---|
8105 | | - } |
---|
| 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; |
---|
8106 | 8186 | |
---|
8107 | | - String pigment = Object3D.GetPigment(tex); |
---|
8108 | | - String bump = Object3D.GetBump(tex); |
---|
8109 | | - |
---|
8110 | | - usedtextures.put(pigment, pigment); |
---|
8111 | | - usedtextures.put(bump, bump); |
---|
8112 | | - |
---|
8113 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8114 | | - { |
---|
8115 | | - // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8116 | | - // System.out.println("; bump = " + bump); |
---|
8117 | | - } |
---|
8118 | | - |
---|
8119 | | - if (bump.equals("")) |
---|
8120 | | - { |
---|
8121 | | - bump = null; |
---|
8122 | | - } |
---|
8123 | | - if (pigment.equals("")) |
---|
8124 | | - { |
---|
8125 | | - pigment = null; |
---|
8126 | | - } |
---|
8127 | | - |
---|
8128 | | - GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8129 | | - BindTexture(pigment, false, resolution); |
---|
8130 | | - GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
8131 | | - BindTexture(bump, true, resolution); |
---|
8132 | | - GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8133 | | - |
---|
8134 | | - return; // true; |
---|
| 8187 | + BindPigmentTexture(tex, resolution); |
---|
| 8188 | + BindBumpTexture(tex, resolution); |
---|
8135 | 8189 | } |
---|
8136 | 8190 | |
---|
8137 | 8191 | /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
.. | .. |
---|
8144 | 8198 | |
---|
8145 | 8199 | if (tex == null) |
---|
8146 | 8200 | { |
---|
8147 | | - BindTexture(null,false,resolution); |
---|
| 8201 | + BindTexture(null, null,false,resolution); |
---|
8148 | 8202 | return; |
---|
8149 | 8203 | } |
---|
8150 | 8204 | |
---|
8151 | 8205 | String pigment = Object3D.GetPigment(tex); |
---|
8152 | 8206 | |
---|
8153 | | - usedtextures.put(pigment, pigment); |
---|
| 8207 | + usedtextures.add(pigment); |
---|
8154 | 8208 | |
---|
8155 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8209 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8156 | 8210 | { |
---|
8157 | 8211 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8158 | 8212 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8164 | 8218 | } |
---|
8165 | 8219 | |
---|
8166 | 8220 | GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8167 | | - BindTexture(pigment, false, resolution); |
---|
| 8221 | + BindTexture(tex.pigmenttexture, pigment, false, resolution); |
---|
8168 | 8222 | } |
---|
8169 | 8223 | |
---|
8170 | 8224 | /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
.. | .. |
---|
8177 | 8231 | |
---|
8178 | 8232 | if (tex == null) |
---|
8179 | 8233 | { |
---|
8180 | | - BindTexture(null,true,resolution); |
---|
| 8234 | + BindTexture(null, null,true,resolution); |
---|
8181 | 8235 | return; |
---|
8182 | 8236 | } |
---|
8183 | 8237 | |
---|
8184 | 8238 | String bump = Object3D.GetBump(tex); |
---|
8185 | 8239 | |
---|
8186 | | - usedtextures.put(bump, bump); |
---|
| 8240 | + usedtextures.add(bump); |
---|
8187 | 8241 | |
---|
8188 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8242 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8189 | 8243 | { |
---|
8190 | 8244 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8191 | 8245 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8197 | 8251 | } |
---|
8198 | 8252 | |
---|
8199 | 8253 | GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
8200 | | - BindTexture(bump, true, resolution); |
---|
| 8254 | + BindTexture(tex.bumptexture, bump, true, resolution); |
---|
8201 | 8255 | GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8202 | 8256 | } |
---|
8203 | 8257 | |
---|
.. | .. |
---|
8221 | 8275 | return fileExists; |
---|
8222 | 8276 | } |
---|
8223 | 8277 | |
---|
8224 | | - 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 |
---|
8225 | 8279 | { |
---|
8226 | | - CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null; |
---|
| 8280 | + CacheTexture texturecache = null; |
---|
8227 | 8281 | |
---|
8228 | 8282 | if (tex != null) |
---|
8229 | 8283 | { |
---|
.. | .. |
---|
8243 | 8297 | } |
---|
8244 | 8298 | |
---|
8245 | 8299 | if (CACHETEXTURE) |
---|
8246 | | - texture = textures.get(texname); // TEXTURE CACHE |
---|
8247 | | - |
---|
8248 | | - TextureData texturedata = null; |
---|
8249 | | - |
---|
8250 | | - if (texture == null || texture.resolution < resolution) |
---|
8251 | 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 |
---|
8252 | 8316 | if (tex.equals("DEFAULT_TEXTURE")) // ||*/ tex.equals("")) |
---|
8253 | 8317 | { |
---|
8254 | 8318 | assert(!bump); |
---|
.. | .. |
---|
8260 | 8324 | // } |
---|
8261 | 8325 | // else |
---|
8262 | 8326 | // { |
---|
8263 | | - texture = textures.get(tex); |
---|
8264 | | - if (texture == null) |
---|
| 8327 | + texturecache = textures.get(tex); |
---|
| 8328 | + if (texturecache == null) |
---|
8265 | 8329 | { |
---|
8266 | | - texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
| 8330 | + texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
8267 | 8331 | } |
---|
8268 | 8332 | // } |
---|
8269 | 8333 | } else |
---|
8270 | 8334 | if (tex.equals("DEFAULT_TEXTURE_BUMP")) // ||*/ tex.equals("")) |
---|
8271 | 8335 | { |
---|
8272 | 8336 | assert(bump); |
---|
8273 | | - texture = textures.get(tex); |
---|
8274 | | - if (texture == null) |
---|
8275 | | - 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); |
---|
8276 | 8340 | } else |
---|
8277 | 8341 | { |
---|
8278 | 8342 | //if (tex.equals("IMMORTAL")) |
---|
.. | .. |
---|
8282 | 8346 | //{ |
---|
8283 | 8347 | if (tex.equals("WHITE_NOISE")) |
---|
8284 | 8348 | { |
---|
8285 | | - texture = textures.get(tex); |
---|
8286 | | - if (texture == null) |
---|
8287 | | - 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); |
---|
8288 | 8352 | } else |
---|
8289 | 8353 | { |
---|
8290 | 8354 | if (textureon) |
---|
.. | .. |
---|
8343 | 8407 | if (texturedata == null) |
---|
8344 | 8408 | throw new Exception(); |
---|
8345 | 8409 | |
---|
8346 | | - 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); |
---|
8347 | 8411 | //texture = GetTexture(tex, bump); |
---|
8348 | 8412 | } |
---|
8349 | 8413 | } |
---|
8350 | 8414 | //} |
---|
8351 | 8415 | } |
---|
8352 | 8416 | |
---|
8353 | | - if (/*CACHETEXTURE &&*/ texture != null && textureon) |
---|
| 8417 | + if (/*CACHETEXTURE &&*/ texturecache != null && textureon) |
---|
8354 | 8418 | { |
---|
8355 | 8419 | //return false; |
---|
8356 | 8420 | |
---|
8357 | 8421 | // System.out.println("CACHE +++++++++++++++ TEXTURE : " + texname + " (" + texture.getEstimatedMemorySize() + ")"); |
---|
8358 | | - if (texturedata != null && (texname.endsWith(".jpg") || texname.endsWith(".JPG"))) |
---|
| 8422 | + if (texturedata != null && texname.toLowerCase().endsWith(".jpg")) |
---|
8359 | 8423 | { |
---|
8360 | 8424 | // String ext = "_highres"; |
---|
8361 | 8425 | // if (REDUCETEXTURE) |
---|
.. | .. |
---|
8444 | 8508 | textures.remove(texname); |
---|
8445 | 8509 | } |
---|
8446 | 8510 | |
---|
8447 | | - texture.texturedata = texturedata; |
---|
8448 | | - textures.put(texname, texture); |
---|
| 8511 | + //texture.texturedata = texturedata; |
---|
| 8512 | + textures.put(texname, texturecache); |
---|
8449 | 8513 | |
---|
8450 | 8514 | // newtex = true; |
---|
8451 | 8515 | } |
---|
.. | .. |
---|
8461 | 8525 | } |
---|
8462 | 8526 | } |
---|
8463 | 8527 | |
---|
8464 | | - return texture; |
---|
| 8528 | + return texturecache; |
---|
8465 | 8529 | } |
---|
8466 | 8530 | |
---|
8467 | | - 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 |
---|
8468 | 8532 | { |
---|
8469 | | - CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
| 8533 | + CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution); |
---|
8470 | 8534 | |
---|
8471 | 8535 | if (bump) |
---|
8472 | 8536 | { |
---|
.. | .. |
---|
8482 | 8546 | return texture!=null?texture.texture:null; |
---|
8483 | 8547 | } |
---|
8484 | 8548 | |
---|
8485 | | - 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 |
---|
8486 | 8550 | { |
---|
8487 | | - CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
| 8551 | + CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution); |
---|
8488 | 8552 | |
---|
8489 | 8553 | return texture!=null?texture.texturedata:null; |
---|
8490 | 8554 | } |
---|
8491 | 8555 | |
---|
8492 | | - 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 |
---|
8493 | 8557 | { |
---|
8494 | 8558 | if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
8495 | 8559 | { |
---|
8496 | 8560 | return false; |
---|
8497 | 8561 | } |
---|
8498 | 8562 | |
---|
8499 | | - boolean newtex = false; |
---|
| 8563 | + //boolean newtex = false; |
---|
8500 | 8564 | |
---|
8501 | | - com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution); |
---|
| 8565 | + com.sun.opengl.util.texture.Texture texture = GetTexture(stream, tex, bump, resolution); |
---|
8502 | 8566 | |
---|
8503 | 8567 | if (texture == null) |
---|
8504 | 8568 | return false; |
---|
.. | .. |
---|
8528 | 8592 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT); |
---|
8529 | 8593 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT); |
---|
8530 | 8594 | |
---|
8531 | | - return newtex; |
---|
| 8595 | + return true; // Warning: not used. |
---|
8532 | 8596 | } |
---|
8533 | 8597 | |
---|
8534 | 8598 | ShadowBuffer shadowPBuf; |
---|
.. | .. |
---|
9374 | 9438 | void ResetOptions() |
---|
9375 | 9439 | { |
---|
9376 | 9440 | options1[0] = 100; |
---|
9377 | | - options1[1] = 0.00001f; |
---|
9378 | | - options1[2] = 20; |
---|
| 9441 | + options1[1] = 0.025f; |
---|
| 9442 | + options1[2] = 0.01f; |
---|
9379 | 9443 | options1[3] = 0; |
---|
9380 | 9444 | options1[4] = 0; |
---|
9381 | 9445 | |
---|
9382 | 9446 | options2[0] = 0; |
---|
9383 | | - options2[1] = 1; |
---|
| 9447 | + options2[1] = 0.75f; |
---|
9384 | 9448 | options2[2] = 0; |
---|
9385 | 9449 | options2[3] = 0; |
---|
9386 | 9450 | |
---|
.. | .. |
---|
10985 | 11049 | |
---|
10986 | 11050 | try |
---|
10987 | 11051 | { |
---|
10988 | | - BindTexture(NOISE_TEXTURE, false, 2); |
---|
| 11052 | + BindTexture(null, NOISE_TEXTURE, false, 2); |
---|
10989 | 11053 | } |
---|
10990 | 11054 | catch (Exception e) |
---|
10991 | 11055 | { |
---|
.. | .. |
---|
11014 | 11078 | |
---|
11015 | 11079 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
11016 | 11080 | |
---|
11017 | | -//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
11018 | | -//gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
11019 | | -//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); |
---|
11020 | 11084 | } else |
---|
11021 | 11085 | { |
---|
11022 | 11086 | //gl.glDisable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
11027 | 11091 | //System.out.println("BLENDING ON"); |
---|
11028 | 11092 | gl.glEnable(GL.GL_BLEND); |
---|
11029 | 11093 | gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); |
---|
11030 | | - |
---|
| 11094 | +// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE); |
---|
11031 | 11095 | gl.glMatrixMode(gl.GL_PROJECTION); |
---|
11032 | 11096 | gl.glLoadIdentity(); |
---|
11033 | 11097 | |
---|
.. | .. |
---|
11513 | 11577 | if ((TRACK || SHADOWTRACK) || zoomonce) |
---|
11514 | 11578 | { |
---|
11515 | 11579 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
11516 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 11580 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
11517 | 11581 | pingthread.StepToTarget(true); // true); |
---|
11518 | 11582 | // zoomonce = false; |
---|
11519 | 11583 | } |
---|
.. | .. |
---|
11650 | 11714 | if (tex.equals("WHITE_NOISE")) |
---|
11651 | 11715 | continue; |
---|
11652 | 11716 | |
---|
11653 | | - if (!usedtextures.containsKey(tex)) |
---|
| 11717 | + if (!usedtextures.contains(tex)) |
---|
11654 | 11718 | { |
---|
11655 | 11719 | // System.out.println("DISPOSE +++++++++++++++ " + tex); |
---|
11656 | 11720 | textures.get(tex).texture.dispose(); |
---|
.. | .. |
---|
13361 | 13425 | "DP3 " + dest + ".z," + "normals," + "eye;" + |
---|
13362 | 13426 | "MAX " + dest + ".w," + dest + ".z," + "eps.x;" + |
---|
13363 | 13427 | //"MOV " + dest + ".w," + "normal.z;" + |
---|
13364 | | - "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + |
---|
13365 | | - "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
13366 | | - //"MOV " + dest + ".z," + "params2.w;" + |
---|
| 13428 | +// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET |
---|
| 13429 | +// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
| 13430 | + |
---|
| 13431 | + "MOV " + dest + ".z," + "params2.w;" + // EXACT |
---|
13367 | 13432 | "POW " + dest + ".w," + dest + ".w," + dest + ".z;" + |
---|
13368 | 13433 | "RCP " + dest + ".w," + dest + ".w;" + |
---|
13369 | 13434 | //"RSQ " + dest + ".w," + dest + ".w;" + |
---|
.. | .. |
---|
13928 | 13993 | |
---|
13929 | 13994 | // fev 2014??? |
---|
13930 | 13995 | if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode) |
---|
13931 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 13996 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
13932 | 13997 | pingthread.StepToTarget(true); // true); |
---|
13933 | 13998 | } |
---|
13934 | 13999 | // if (!LIVE) |
---|
.. | .. |
---|
14282 | 14347 | void GoDown(int mod) |
---|
14283 | 14348 | { |
---|
14284 | 14349 | MODIFIERS |= COMMAND; |
---|
14285 | | - /* |
---|
| 14350 | + /**/ |
---|
14286 | 14351 | if((mod&SHIFT) == SHIFT) |
---|
14287 | 14352 | manipCamera.RotatePosition(0, -speed); |
---|
14288 | 14353 | else |
---|
14289 | | - manipCamera.BackForth(0, -speed*delta, getWidth()); |
---|
14290 | | - */ |
---|
| 14354 | + manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14355 | + /**/ |
---|
14291 | 14356 | if ((mod & SHIFT) == SHIFT) |
---|
14292 | 14357 | { |
---|
14293 | 14358 | mouseMode = mouseMode; // VR?? |
---|
.. | .. |
---|
14303 | 14368 | void GoUp(int mod) |
---|
14304 | 14369 | { |
---|
14305 | 14370 | MODIFIERS |= COMMAND; |
---|
14306 | | - /* |
---|
| 14371 | + /**/ |
---|
14307 | 14372 | if((mod&SHIFT) == SHIFT) |
---|
14308 | 14373 | manipCamera.RotatePosition(0, speed); |
---|
14309 | 14374 | else |
---|
14310 | | - manipCamera.BackForth(0, speed*delta, getWidth()); |
---|
14311 | | - */ |
---|
| 14375 | + manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14376 | + /**/ |
---|
14312 | 14377 | if ((mod & SHIFT) == SHIFT) |
---|
14313 | 14378 | { |
---|
14314 | 14379 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14324 | 14389 | void GoLeft(int mod) |
---|
14325 | 14390 | { |
---|
14326 | 14391 | MODIFIERS |= COMMAND; |
---|
14327 | | - /* |
---|
| 14392 | + /**/ |
---|
14328 | 14393 | if((mod&SHIFT) == SHIFT) |
---|
14329 | | - manipCamera.RotatePosition(speed, 0); |
---|
14330 | | - else |
---|
14331 | 14394 | manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14332 | | - */ |
---|
| 14395 | + else |
---|
| 14396 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14397 | + /**/ |
---|
14333 | 14398 | if ((mod & SHIFT) == SHIFT) |
---|
14334 | 14399 | { |
---|
14335 | 14400 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14345 | 14410 | void GoRight(int mod) |
---|
14346 | 14411 | { |
---|
14347 | 14412 | MODIFIERS |= COMMAND; |
---|
14348 | | - /* |
---|
| 14413 | + /**/ |
---|
14349 | 14414 | if((mod&SHIFT) == SHIFT) |
---|
14350 | | - manipCamera.RotatePosition(-speed, 0); |
---|
14351 | | - else |
---|
14352 | 14415 | manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14353 | | - */ |
---|
| 14416 | + else |
---|
| 14417 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14418 | + /**/ |
---|
14354 | 14419 | if ((mod & SHIFT) == SHIFT) |
---|
14355 | 14420 | { |
---|
14356 | 14421 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14589 | 14654 | Globals.MOUSEDRAGGED = false; |
---|
14590 | 14655 | |
---|
14591 | 14656 | movingcamera = false; |
---|
14592 | | - X = Y = 0; |
---|
| 14657 | + X = 0; // getBounds().width/2; |
---|
| 14658 | + Y = 0; // getBounds().height/2; |
---|
14593 | 14659 | //System.out.println("mouseReleased: " + e); |
---|
14594 | 14660 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14595 | 14661 | } |
---|
.. | .. |
---|
14930 | 14996 | case 'E' : COMPACT ^= true; |
---|
14931 | 14997 | repaint(); |
---|
14932 | 14998 | break; |
---|
14933 | | - case 'W' : DEBUGHSB ^= true; |
---|
| 14999 | + case 'W' : // Wide Window (fullscreen) |
---|
| 15000 | + //DEBUGHSB ^= true; |
---|
| 15001 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
14934 | 15002 | repaint(); |
---|
14935 | 15003 | break; |
---|
14936 | 15004 | case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break; |
---|
.. | .. |
---|
14956 | 15024 | repaint(); |
---|
14957 | 15025 | break; |
---|
14958 | 15026 | case 'l': |
---|
14959 | | - lightMode ^= true; |
---|
14960 | | - Globals.lighttouched = true; |
---|
14961 | | - manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
14962 | | - targetLookAt.set(manipCamera.lookAt); |
---|
14963 | | - repaint(); |
---|
14964 | | - break; |
---|
14965 | | - case 'L': |
---|
| 15027 | + //case 'L': |
---|
14966 | 15028 | if (lightMode) |
---|
14967 | 15029 | { |
---|
14968 | 15030 | lightMode = false; |
---|
.. | .. |
---|
15105 | 15167 | case '_': |
---|
15106 | 15168 | kompactbit = 5; |
---|
15107 | 15169 | break; |
---|
15108 | | - case '+': |
---|
15109 | | - kompactbit = 6; |
---|
15110 | | - break; |
---|
| 15170 | +// case '+': |
---|
| 15171 | +// kompactbit = 6; |
---|
| 15172 | +// break; |
---|
15111 | 15173 | case ' ': |
---|
15112 | | - ObjEditor.theFrame.ToggleFullScreen(); |
---|
| 15174 | + lightMode ^= true; |
---|
| 15175 | + Globals.lighttouched = true; |
---|
| 15176 | + manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
| 15177 | + targetLookAt.set(manipCamera.lookAt); |
---|
15113 | 15178 | repaint(); |
---|
15114 | 15179 | break; |
---|
15115 | 15180 | //case '`' : |
---|
.. | .. |
---|
15156 | 15221 | case DELETE: |
---|
15157 | 15222 | ClearSelection(); |
---|
15158 | 15223 | break; |
---|
15159 | | - /* |
---|
15160 | 15224 | case '+': |
---|
| 15225 | + |
---|
| 15226 | + /* |
---|
15161 | 15227 | //fontsize += 1; |
---|
15162 | 15228 | bbzoom *= 2; |
---|
15163 | 15229 | repaint(); |
---|
.. | .. |
---|
15174 | 15240 | case '=': |
---|
15175 | 15241 | IncDepth(); |
---|
15176 | 15242 | //fontsize += 1; |
---|
15177 | | - object.editWindow.refreshContents(true); |
---|
| 15243 | + object.GetWindow().refreshContents(true); |
---|
15178 | 15244 | maskbit = 6; |
---|
15179 | 15245 | break; |
---|
15180 | 15246 | case '-': //if (PixelThreshold>1) PixelThreshold /= 2; |
---|
15181 | 15247 | DecDepth(); |
---|
15182 | 15248 | maskbit = 5; |
---|
15183 | 15249 | //if(fontsize > 1) fontsize -= 1; |
---|
15184 | | - if (object.editWindow == null) |
---|
15185 | | - new Exception().printStackTrace(); |
---|
15186 | | - else |
---|
15187 | | - object.editWindow.refreshContents(true); |
---|
| 15250 | +// if (object.editWindow == null) |
---|
| 15251 | +// new Exception().printStackTrace(); |
---|
| 15252 | +// else |
---|
| 15253 | + object.GetWindow().refreshContents(true); |
---|
15188 | 15254 | break; |
---|
15189 | 15255 | case '{': |
---|
15190 | 15256 | manipCamera.shaper_fovy /= 1.1; |
---|
.. | .. |
---|
15408 | 15474 | } |
---|
15409 | 15475 | */ |
---|
15410 | 15476 | |
---|
15411 | | - object.editWindow.EditSelection(false); |
---|
| 15477 | + object.GetWindow().EditSelection(false); |
---|
15412 | 15478 | } |
---|
15413 | 15479 | |
---|
15414 | 15480 | void SelectParent() |
---|
.. | .. |
---|
15425 | 15491 | { |
---|
15426 | 15492 | //selectees.remove(i); |
---|
15427 | 15493 | System.out.println("select parent of " + elem); |
---|
15428 | | - group.editWindow.Select(elem.parent.GetTreePath(), first, true); |
---|
| 15494 | + group.GetWindow().Select(elem.parent.GetTreePath(), first, true); |
---|
15429 | 15495 | } else |
---|
15430 | 15496 | { |
---|
15431 | | - group.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15497 | + group.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15432 | 15498 | } |
---|
15433 | 15499 | |
---|
15434 | 15500 | first = false; |
---|
.. | .. |
---|
15470 | 15536 | for (int j = 0; j < group.children.size(); j++) |
---|
15471 | 15537 | { |
---|
15472 | 15538 | elem = (Object3D) group.children.elementAt(j); |
---|
15473 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15539 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15474 | 15540 | first = false; |
---|
15475 | 15541 | } |
---|
15476 | 15542 | } else |
---|
15477 | 15543 | { |
---|
15478 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15544 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15479 | 15545 | } |
---|
15480 | 15546 | |
---|
15481 | 15547 | first = false; |
---|
.. | .. |
---|
15486 | 15552 | { |
---|
15487 | 15553 | //Composite group = (Composite) object; |
---|
15488 | 15554 | Object3D group = object; |
---|
15489 | | - group.editWindow.loadClipboard(true); // ClearSelection(false); |
---|
| 15555 | + group.GetWindow().loadClipboard(true); // ClearSelection(false); |
---|
15490 | 15556 | } |
---|
15491 | 15557 | |
---|
15492 | 15558 | void ResetTransform(int mask) |
---|
15493 | 15559 | { |
---|
15494 | 15560 | //Composite group = (Composite) object; |
---|
15495 | 15561 | Object3D group = object; |
---|
15496 | | - group.editWindow.ResetTransform(mask); |
---|
| 15562 | + group.GetWindow().ResetTransform(mask); |
---|
15497 | 15563 | } |
---|
15498 | 15564 | |
---|
15499 | 15565 | void FlipTransform() |
---|
15500 | 15566 | { |
---|
15501 | 15567 | //Composite group = (Composite) object; |
---|
15502 | 15568 | Object3D group = object; |
---|
15503 | | - group.editWindow.FlipTransform(); |
---|
| 15569 | + group.GetWindow().FlipTransform(); |
---|
15504 | 15570 | // group.editWindow.ReduceMesh(true); |
---|
15505 | 15571 | } |
---|
15506 | 15572 | |
---|
.. | .. |
---|
15508 | 15574 | { |
---|
15509 | 15575 | //Composite group = (Composite) object; |
---|
15510 | 15576 | Object3D group = object; |
---|
15511 | | - group.editWindow.PrintMemory(); |
---|
| 15577 | + group.GetWindow().PrintMemory(); |
---|
15512 | 15578 | // group.editWindow.ReduceMesh(true); |
---|
15513 | 15579 | } |
---|
15514 | 15580 | |
---|
.. | .. |
---|
15516 | 15582 | { |
---|
15517 | 15583 | //Composite group = (Composite) object; |
---|
15518 | 15584 | Object3D group = object; |
---|
15519 | | - group.editWindow.ResetCentroid(); |
---|
| 15585 | + group.GetWindow().ResetCentroid(); |
---|
15520 | 15586 | } |
---|
15521 | 15587 | |
---|
15522 | 15588 | void IncDepth() |
---|
.. | .. |
---|
15692 | 15758 | info.bounds.y += (height - desired) / 2; |
---|
15693 | 15759 | } |
---|
15694 | 15760 | } |
---|
| 15761 | + |
---|
15695 | 15762 | info.g = gr; |
---|
15696 | 15763 | info.camera = renderCamera; |
---|
15697 | 15764 | /* |
---|
.. | .. |
---|
15701 | 15768 | */ |
---|
15702 | 15769 | if (!isRenderer) |
---|
15703 | 15770 | { |
---|
15704 | | - object.drawEditHandles(info, 0); |
---|
15705 | | - |
---|
15706 | | - 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) |
---|
15707 | 15774 | { |
---|
15708 | | - 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) |
---|
15709 | 15781 | { |
---|
15710 | | - case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
15711 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15712 | | - break; |
---|
15713 | | - case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
15714 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15715 | | - break; |
---|
15716 | | - case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
15717 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15718 | | - 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; |
---|
15719 | 15789 | } |
---|
15720 | | - |
---|
| 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 | + } |
---|
15721 | 15809 | } |
---|
15722 | 15810 | } |
---|
15723 | 15811 | } |
---|
.. | .. |
---|
16515 | 16603 | } |
---|
16516 | 16604 | } |
---|
16517 | 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 | + |
---|
16518 | 16614 | class SelectBuffer implements GLEventListener |
---|
16519 | 16615 | { |
---|
16520 | 16616 | |
---|
.. | .. |
---|
16594 | 16690 | |
---|
16595 | 16691 | //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); |
---|
16596 | 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 | + |
---|
16597 | 16704 | //int tmp = selection_view; |
---|
16598 | 16705 | //selection_view = -1; |
---|
16599 | 16706 | int temp = DrawMode(); |
---|
.. | .. |
---|
16605 | 16712 | // temp = DEFAULT; // patch for selection debug |
---|
16606 | 16713 | Globals.drawMode = temp; // WARNING |
---|
16607 | 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 | + |
---|
16608 | 16726 | //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view); |
---|
16609 | 16727 | |
---|
16610 | 16728 | // trying different ways of getting the depth info over |
---|
.. | .. |
---|
16708 | 16826 | } |
---|
16709 | 16827 | |
---|
16710 | 16828 | if (!movingcamera && !PAINTMODE) |
---|
16711 | | - object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
| 16829 | + object.GetWindow().ScreenFitPoint(); // fev 2014 |
---|
16712 | 16830 | |
---|
16713 | | - 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) |
---|
16714 | 16832 | { |
---|
16715 | | - 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); |
---|
16716 | 16834 | |
---|
16717 | | - Object3D group = new Object3D("inst" + paintcount++); |
---|
| 16835 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16836 | + { |
---|
| 16837 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
16718 | 16838 | |
---|
16719 | | - group.CreateMaterial(); // use a void leaf to select instances |
---|
16720 | | - |
---|
16721 | | - group.add(paintobj); // link |
---|
16722 | | - |
---|
16723 | | - object.editWindow.SnapObject(group); |
---|
16724 | | - |
---|
16725 | | - Object3D folder = object.editWindow.copy; |
---|
16726 | | - |
---|
16727 | | - if (object.editWindow.copy.selection.Size() > 0) |
---|
16728 | | - folder = object.editWindow.copy.selection.elementAt(0); |
---|
16729 | | - |
---|
16730 | | - folder.add(group); |
---|
16731 | | - |
---|
16732 | | - object.editWindow.ResetModel(); |
---|
16733 | | - 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 | + } |
---|
16734 | 16854 | } |
---|
16735 | 16855 | else |
---|
16736 | 16856 | paintcount = 0; |
---|
.. | .. |
---|
16769 | 16889 | //System.out.println("objects[color] = " + objects[color]); |
---|
16770 | 16890 | //objects[color].Select(); |
---|
16771 | 16891 | indexcount = 0; |
---|
| 16892 | + ObjEditor window = object.GetWindow(); |
---|
| 16893 | + if (window != null && deselect) |
---|
| 16894 | + { |
---|
| 16895 | + window.Select(null, deselect, true); |
---|
| 16896 | + } |
---|
16772 | 16897 | object.Select(color, deselect); |
---|
16773 | 16898 | } |
---|
16774 | 16899 | |
---|