.. | .. |
---|
113 | 113 | /*static*/ com.sun.opengl.util.texture.Texture cubemap; // Either custom or rgb |
---|
114 | 114 | /*static*/ com.sun.opengl.util.texture.Texture cubemapcustom; |
---|
115 | 115 | /*static*/ com.sun.opengl.util.texture.Texture cubemaprgb; |
---|
| 116 | + boolean transformMode; |
---|
| 117 | + |
---|
116 | 118 | boolean reverseUP = false; |
---|
117 | 119 | static boolean frozen = false; |
---|
118 | 120 | boolean enablebackspace = false; // patch for back buffer refresh |
---|
.. | .. |
---|
166 | 168 | |
---|
167 | 169 | |
---|
168 | 170 | // OPTIONS |
---|
169 | | - boolean Skinshader = true; |
---|
| 171 | + boolean Skinshader = false; // true; |
---|
170 | 172 | boolean cameraLight = false; |
---|
171 | 173 | boolean UVdebug = false; |
---|
172 | 174 | boolean Udebug = false; |
---|
.. | .. |
---|
540 | 542 | LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1); |
---|
541 | 543 | LA.vecCross(obj.v0, obj.v1, obj.v2); |
---|
542 | 544 | LA.vecNormalize(obj.v2); |
---|
543 | | - gl.glNormal3f((float) obj.v2.x, (float) obj.v2.y, (float) obj.v2.z); |
---|
| 545 | + |
---|
| 546 | + SetGLNormal(gl, (float) obj.v2.x, (float) obj.v2.y, (float) obj.v2.z); |
---|
544 | 547 | } |
---|
545 | 548 | |
---|
546 | 549 | // P |
---|
.. | .. |
---|
562 | 565 | y += ny * obj.NORMALPUSH; |
---|
563 | 566 | z += nz * obj.NORMALPUSH; |
---|
564 | 567 | |
---|
565 | | - gl.glNormal3f(nx, ny, nz); |
---|
| 568 | + SetGLNormal(gl, nx, ny, nz); |
---|
566 | 569 | } |
---|
567 | 570 | gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
568 | 571 | SetColor(obj, pv); |
---|
.. | .. |
---|
594 | 597 | y += ny * obj.NORMALPUSH; |
---|
595 | 598 | z += nz * obj.NORMALPUSH; |
---|
596 | 599 | |
---|
597 | | - gl.glNormal3f(nx, ny, nz); |
---|
| 600 | + SetGLNormal(gl, nx, ny, nz); |
---|
598 | 601 | } |
---|
599 | 602 | //System.out.println("vertexq = " + qv.s + ", " + qv.t); |
---|
600 | 603 | // boolean locked = false; |
---|
.. | .. |
---|
642 | 645 | y += ny * obj.NORMALPUSH; |
---|
643 | 646 | z += nz * obj.NORMALPUSH; |
---|
644 | 647 | |
---|
645 | | - gl.glNormal3f(nx, ny, nz); |
---|
| 648 | + SetGLNormal(gl, nx, ny, nz); |
---|
646 | 649 | } |
---|
647 | 650 | |
---|
648 | 651 | // if ((dot&4) == 0) |
---|
.. | .. |
---|
1248 | 1251 | { |
---|
1249 | 1252 | if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
1250 | 1253 | { |
---|
1251 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
| 1254 | + SetGLNormal(gl, n[count3], n[count3 + 1], n[count3 + 2]); |
---|
1252 | 1255 | } else |
---|
1253 | 1256 | { |
---|
1254 | | - gl.glNormal3f(0, 0, 1); |
---|
| 1257 | + SetGLNormal(gl, 0, 0, 1); |
---|
1255 | 1258 | } |
---|
1256 | 1259 | |
---|
1257 | 1260 | if (c != null) |
---|
.. | .. |
---|
1275 | 1278 | { |
---|
1276 | 1279 | if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
1277 | 1280 | { |
---|
1278 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
| 1281 | + SetGLNormal(gl, n[count3], n[count3 + 1], n[count3 + 2]); |
---|
1279 | 1282 | } else |
---|
1280 | 1283 | { |
---|
1281 | | - gl.glNormal3f(0, 0, 1); |
---|
| 1284 | + SetGLNormal(gl, 0, 0, 1); |
---|
1282 | 1285 | } |
---|
1283 | 1286 | if (c != null) |
---|
1284 | 1287 | { |
---|
.. | .. |
---|
1303 | 1306 | { |
---|
1304 | 1307 | if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
1305 | 1308 | { |
---|
1306 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
| 1309 | + SetGLNormal(gl, n[count3], n[count3 + 1], n[count3 + 2]); |
---|
1307 | 1310 | } else |
---|
1308 | 1311 | { |
---|
1309 | | - gl.glNormal3f(0, 0, 1); |
---|
| 1312 | + SetGLNormal(gl, 0, 0, 1); |
---|
1310 | 1313 | } |
---|
1311 | 1314 | if (c != null) |
---|
1312 | 1315 | { |
---|
.. | .. |
---|
1488 | 1491 | { |
---|
1489 | 1492 | if (!selectmode) |
---|
1490 | 1493 | { |
---|
1491 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
| 1494 | + SetGLNormal(gl, (float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
1492 | 1495 | gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
1493 | 1496 | |
---|
1494 | 1497 | if (flipV) |
---|
.. | .. |
---|
1817 | 1820 | |
---|
1818 | 1821 | display.modelParams7[0] = 0; |
---|
1819 | 1822 | display.modelParams7[1] = 1000; |
---|
1820 | | - display.modelParams7[2] = 0; |
---|
| 1823 | + display.modelParams7[2] = material.parallax; |
---|
1821 | 1824 | display.modelParams7[3] = 0; |
---|
1822 | 1825 | |
---|
1823 | 1826 | //display.modelParams6[0] = 100; // criss de bug de bump |
---|
.. | .. |
---|
2050 | 2053 | switch(viewcode) |
---|
2051 | 2054 | { |
---|
2052 | 2055 | case 0: return "main"; |
---|
2053 | | - case 1: return "one"; |
---|
2054 | | - case 2: return "two"; |
---|
2055 | | - case 3: return "three"; |
---|
| 2056 | + case 1: return "Red"; |
---|
| 2057 | + case 2: return "Green"; |
---|
| 2058 | + case 3: return "Blue"; |
---|
2056 | 2059 | case 4: return "light"; |
---|
2057 | 2060 | } |
---|
2058 | 2061 | |
---|
.. | .. |
---|
2473 | 2476 | return CreateBim(bytes, width, height); |
---|
2474 | 2477 | } |
---|
2475 | 2478 | |
---|
| 2479 | + private void SetGLNormal(javax.media.opengl.GL gl, float nx, float ny, float nz) |
---|
| 2480 | + { |
---|
| 2481 | + gl.glNormal3f(nx, ny, nz); |
---|
| 2482 | + |
---|
| 2483 | + if (ny > 0.9 || ny < -0.9) |
---|
| 2484 | + // Ground or ceiling |
---|
| 2485 | + gl.glVertexAttrib3f(4, 1, 0, 0); |
---|
| 2486 | + else |
---|
| 2487 | + // Walls |
---|
| 2488 | + gl.glVertexAttrib3f(4, 0, 1, 0); |
---|
| 2489 | + } |
---|
| 2490 | + |
---|
2476 | 2491 | /**/ |
---|
2477 | 2492 | class CacheTexture |
---|
2478 | 2493 | { |
---|
.. | .. |
---|
2515 | 2530 | com.sun.opengl.util.texture.TextureIO.newTextureData( |
---|
2516 | 2531 | getClass().getClassLoader().getResourceAsStream(name), |
---|
2517 | 2532 | true, |
---|
2518 | | - com.sun.opengl.util.texture.TextureIO.PNG); |
---|
| 2533 | + GetFormat(name)); // com.sun.opengl.util.texture.TextureIO.PNG); |
---|
2519 | 2534 | } catch (java.io.IOException e) |
---|
2520 | 2535 | { |
---|
2521 | 2536 | throw new javax.media.opengl.GLException(e); |
---|
.. | .. |
---|
10688 | 10703 | static boolean init = false; |
---|
10689 | 10704 | |
---|
10690 | 10705 | double[][] matrix = LA.newMatrix(); |
---|
| 10706 | + |
---|
| 10707 | + // This is to refresh the UI of the material panel. |
---|
| 10708 | + ObjEditor patchMaterial; |
---|
10691 | 10709 | |
---|
10692 | 10710 | public void display(GLAutoDrawable drawable) |
---|
10693 | 10711 | { |
---|
| 10712 | + if (patchMaterial.patchMaterial) |
---|
| 10713 | + { |
---|
| 10714 | + patchMaterial.patchMaterial = false; |
---|
| 10715 | + patchMaterial.objectPanel.setSelectedIndex(1); |
---|
| 10716 | + } |
---|
| 10717 | + |
---|
10694 | 10718 | if (Grafreed.savesound && Grafreed.hassound) |
---|
10695 | 10719 | { |
---|
10696 | 10720 | Grafreed.wav.save(); |
---|
.. | .. |
---|
11082 | 11106 | // |
---|
11083 | 11107 | // newenvy = -1; |
---|
11084 | 11108 | |
---|
11085 | | - if (object.skyboxname != null && object.skyboxname.equals("cubemaps/default-skyboxes/rgb")) |
---|
| 11109 | + if (transformMode) // object.skyboxname != null && object.skyboxname.equals("cubemaps/default-skyboxes/rgb")) |
---|
11086 | 11110 | { |
---|
11087 | 11111 | if (cubemaprgb == null) |
---|
11088 | 11112 | { |
---|
11089 | | - cubemaprgb = LoadSkybox(object.skyboxname + "/", object.skyboxext, false); |
---|
| 11113 | + cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb2" + "/", "jpg", false); |
---|
11090 | 11114 | } |
---|
11091 | 11115 | |
---|
11092 | 11116 | cubemap = cubemaprgb; |
---|
.. | .. |
---|
11097 | 11121 | { |
---|
11098 | 11122 | if (!object.skyboxname.equals(this.loadedskyboxname)) |
---|
11099 | 11123 | { |
---|
| 11124 | + if (cubemap != null && cubemap != cubemaprgb) |
---|
| 11125 | + cubemap.dispose(); |
---|
11100 | 11126 | cubemapcustom = LoadSkybox(object.skyboxname + "/", object.skyboxext, false); |
---|
11101 | 11127 | loadedskyboxname = object.skyboxname; |
---|
11102 | 11128 | } |
---|
.. | .. |
---|
12580 | 12606 | "PARAM params4 = program.env[4];" + // anisoV, cameralight, selfshadow, shadow |
---|
12581 | 12607 | "PARAM params5 = program.env[5];" + // texture, opacity, fakedepth, shadowbias |
---|
12582 | 12608 | "PARAM params6 = program.env[6];" + // bump, noise, borderfade, fog punchthrough |
---|
12583 | | - "PARAM params7 = program.env[7];" + // noise power, opacity power |
---|
| 12609 | + "PARAM params7 = program.env[7];" + // noise power, opacity power, parallax |
---|
12584 | 12610 | "PARAM options0 = program.env[63];" + // fog density, intensity, elevation |
---|
12585 | 12611 | "PARAM options1 = program.env[62];" + // fog rgb color |
---|
12586 | 12612 | "PARAM options2 = program.env[61];" + // image intensity, subsurface, lightsheen |
---|
.. | .. |
---|
12825 | 12851 | "POW texSamp.a, texSamp.a, params6.w;" + // fog punch through shortcut |
---|
12826 | 12852 | // mar 2013 ??? "KIL alpha.a;" + |
---|
12827 | 12853 | "MOV alpha, texSamp.aaaa;" + // y;" + |
---|
12828 | | - "KIL alpha.a;" + |
---|
| 12854 | + "KIL alpha.a;" + // not sure with parallax mapping |
---|
12829 | 12855 | /* |
---|
12830 | 12856 | "MUL temp.xy, temp, two;" + |
---|
12831 | 12857 | "TXB bump, temp, texture[0], 2D;" + |
---|
.. | .. |
---|
12911 | 12937 | "SUB bump0, bump0, half;" + |
---|
12912 | 12938 | "ADD bump, bump, bump0;" + |
---|
12913 | 12939 | |
---|
12914 | | - "MOV temp.x, texSamp.a;" + |
---|
12915 | | - "LRP texSamp, params5.x, texSamp, one;" + // texture proportion |
---|
12916 | | - //"LRP texSamp0, params5.x, texSamp0, one;" + |
---|
12917 | | - "MOV texSamp.a, temp.x;" + |
---|
12918 | | - |
---|
12919 | 12940 | // double-sided |
---|
12920 | 12941 | /**/ |
---|
12921 | 12942 | (doublesided?"DP3 temp.z, normal, eye;" + |
---|
.. | .. |
---|
12932 | 12953 | "MOV normald, normal;" + |
---|
12933 | 12954 | "MOV normals, normal;" + |
---|
12934 | 12955 | |
---|
| 12956 | + "MOV temp, fragment.texcoord[4];" + |
---|
| 12957 | + |
---|
12935 | 12958 | // UV base |
---|
12936 | 12959 | //"DP3 UP.x,state.matrix.modelview.row[0],Y;" + |
---|
12937 | 12960 | //"DP3 UP.y,state.matrix.modelview.row[1],Y;" + |
---|
12938 | 12961 | //"DP3 UP.z,state.matrix.modelview.row[2],Y;" + |
---|
12939 | | - "DP3 UP.x,state.matrix.texture[7].row[0],Y;" + |
---|
12940 | | - "DP3 UP.y,state.matrix.texture[7].row[1],Y;" + |
---|
12941 | | - "DP3 UP.z,state.matrix.texture[7].row[2],Y;" + |
---|
| 12962 | + "DP3 UP.x,state.matrix.texture[7].row[0],temp;" + |
---|
| 12963 | + "DP3 UP.y,state.matrix.texture[7].row[1],temp;" + |
---|
| 12964 | + "DP3 UP.z,state.matrix.texture[7].row[2],temp;" + |
---|
| 12965 | + Normalize("UP") + |
---|
| 12966 | + |
---|
12942 | 12967 | "XPD V, normal, UP;" + |
---|
12943 | 12968 | Normalize("V") + |
---|
12944 | 12969 | "XPD U, V, normal;" + |
---|
12945 | 12970 | Normalize("U") + |
---|
12946 | 12971 | |
---|
12947 | 12972 | // parallax mapping |
---|
| 12973 | + |
---|
| 12974 | + "DP3 temp2.x, V, eye;" + |
---|
| 12975 | + "DP3 temp2.y, U, eye;" + |
---|
| 12976 | + "DP3 temp2.z, normal, eye;" + |
---|
| 12977 | + "RCP temp2.z, temp2.z;" + |
---|
| 12978 | + |
---|
| 12979 | + "DP3 temp2.w, texSamp, texSamp;" + // Height |
---|
| 12980 | + "RSQ temp2.w, temp2.w;" + |
---|
| 12981 | + "RCP temp2.w, temp2.w;" + |
---|
| 12982 | + |
---|
| 12983 | + "SUB temp2.w, temp2.w, half;" + |
---|
| 12984 | +// "SGE temp.x, temp2.w, eps.x;" + |
---|
| 12985 | +// "MUL temp2.w, temp2.w, temp.x;" + |
---|
| 12986 | + |
---|
| 12987 | + //"MOV texSamp, U;" + |
---|
| 12988 | + |
---|
| 12989 | + "MUL temp2.z, temp2.z, temp2.w;" + |
---|
| 12990 | + "MUL temp2.z, temp2.z, params7.z;" + // parallax |
---|
| 12991 | + |
---|
| 12992 | + "MUL temp2, temp2, temp2.z;" + |
---|
| 12993 | + |
---|
| 12994 | + "MOV temp, fragment.texcoord[0];" + |
---|
| 12995 | + |
---|
| 12996 | + "SUB temp, temp, temp2;" + |
---|
| 12997 | + |
---|
| 12998 | + "TEX temp, temp, texture[0], 2D;" + |
---|
| 12999 | + "POW temp.a, temp.a, params6.w;" + // punch through |
---|
| 13000 | + |
---|
| 13001 | + "ADD texSamp, temp, texSamp;" + |
---|
| 13002 | + "MUL texSamp.xyz, half, texSamp;" + |
---|
| 13003 | + |
---|
| 13004 | + "MOV alpha, texSamp.aaaa;" + |
---|
| 13005 | + |
---|
| 13006 | +// parallax mapping |
---|
| 13007 | + |
---|
| 13008 | + "MOV temp.x, texSamp.a;" + |
---|
| 13009 | + "LRP texSamp, params5.x, texSamp, one;" + // texture proportion |
---|
| 13010 | + //"LRP texSamp0, params5.x, texSamp0, one;" + |
---|
| 13011 | + "MOV texSamp.a, temp.x;" + |
---|
12948 | 13012 | |
---|
12949 | 13013 | //"MOV temp, fragment.texcoord[0];" + |
---|
12950 | 13014 | // |
---|
.. | .. |
---|
13415 | 13479 | program = programmin; |
---|
13416 | 13480 | } |
---|
13417 | 13481 | |
---|
13418 | | - System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
13419 | | - System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
| 13482 | + if (Globals.DEBUG) |
---|
| 13483 | + { |
---|
| 13484 | + System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
| 13485 | + System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
| 13486 | + } |
---|
| 13487 | + |
---|
13420 | 13488 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
13421 | 13489 | |
---|
13422 | 13490 | //gl.glNewList(displayListID, GL.GL_COMPILE); |
---|
.. | .. |
---|
13463 | 13531 | "\n" + |
---|
13464 | 13532 | "END\n"; |
---|
13465 | 13533 | |
---|
13466 | | - System.out.println("Program shadow #" + 0 + "; length = " + program.length()); |
---|
| 13534 | + if (Globals.DEBUG) |
---|
| 13535 | + System.out.println("Program shadow #" + 0 + "; length = " + program.length()); |
---|
13467 | 13536 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
13468 | 13537 | |
---|
13469 | 13538 | //gl.glNewList(displayListID, GL.GL_COMPILE); |
---|
.. | .. |
---|
13721 | 13790 | /*static*/ float[] modelParams4 = new float[]{0, 0, 0, 0}; // anisoV, cameralight, selfshadow, shadow |
---|
13722 | 13791 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13723 | 13792 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13724 | | - /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
| 13793 | + /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power, parallax |
---|
13725 | 13794 | |
---|
13726 | 13795 | //Object3D.cVector2[] vector2buffer; |
---|
13727 | 13796 | |
---|
.. | .. |
---|
13888 | 13957 | "PARAM p[4] = { state.matrix.projection }; # modelview projection matrix\n" + |
---|
13889 | 13958 | "PARAM zero = { 0.0, 0.0, 0.0, 1.0 };" + |
---|
13890 | 13959 | "PARAM half = { 0.5, 0.5, 0.5, 1.0 };" + |
---|
13891 | | - "PARAM one = { 1.0, 1.0, 1.0, 0.0 };" + |
---|
| 13960 | + "PARAM one = { 1.0, 1.0, 1.0, 1.0 };" + |
---|
13892 | 13961 | "PARAM two = { 2.0, 2.0, 2.0, 1.0 };" + |
---|
13893 | 13962 | "PARAM third = { 0.33333333333, 0.33333333333, 0.33333333333, 1.0 };" + |
---|
13894 | 13963 | //"PARAM v256 = { 256.0, 256.0, 256.0, 1.0 };" + |
---|
.. | .. |
---|
13949 | 14018 | "DP4 temp.x,state.matrix.texture[0].inverse.row[0],vertex.texcoord;" + |
---|
13950 | 14019 | "DP4 temp.y,state.matrix.texture[0].inverse.row[1],vertex.texcoord;" + |
---|
13951 | 14020 | "DP4 temp.z,state.matrix.texture[0].inverse.row[2],vertex.texcoord;" + |
---|
13952 | | - //"MOV result.texcoord, vertex.texcoord;" + |
---|
| 14021 | + //"MOV result.texcoord, vertex.fogcoord;" + |
---|
13953 | 14022 | "MOV result.texcoord, temp;" + |
---|
13954 | 14023 | // border fade |
---|
13955 | 14024 | "MOV result.texcoord[3], vertex.texcoord;" + |
---|
.. | .. |
---|
13996 | 14065 | |
---|
13997 | 14066 | //"ADD temp.z, temp.z, one;" + |
---|
13998 | 14067 | |
---|
13999 | | - "MOV result.color, temp;" |
---|
| 14068 | + "MOV result.texcoord[4], vertex.attrib[4];" + // U dir |
---|
| 14069 | + |
---|
| 14070 | + "MOV result.color, temp;" // Normal |
---|
14000 | 14071 | : "MOV result.color, vertex.color;") + |
---|
14001 | 14072 | ((mode & VP_PROJECTION) != 0 ? "MOV result.color, zero;" |
---|
14002 | 14073 | : "") + |
---|
.. | .. |
---|
14662 | 14733 | void GoDown(int mod) |
---|
14663 | 14734 | { |
---|
14664 | 14735 | MODIFIERS |= COMMAND; |
---|
| 14736 | + boolean isVR = (mouseMode&VR)!=0; |
---|
14665 | 14737 | /**/ |
---|
14666 | 14738 | if((mod&SHIFT) == SHIFT) |
---|
14667 | | - manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14739 | + { |
---|
| 14740 | + if (isVR) |
---|
| 14741 | + manipCamera.RotateInterest(0, -speed); |
---|
| 14742 | + else |
---|
| 14743 | + manipCamera.RotatePosition(0, -speed); |
---|
| 14744 | + } |
---|
14668 | 14745 | else |
---|
14669 | | - manipCamera.RotatePosition(0, -speed); |
---|
| 14746 | + manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth()); |
---|
14670 | 14747 | /**/ |
---|
14671 | 14748 | if ((mod & SHIFT) == SHIFT) |
---|
14672 | 14749 | { |
---|
.. | .. |
---|
14676 | 14753 | mouseMode |= BACKFORTH; |
---|
14677 | 14754 | } |
---|
14678 | 14755 | |
---|
| 14756 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14757 | + |
---|
14679 | 14758 | //prevX = X = anchorX; |
---|
14680 | 14759 | prevY = Y = anchorY - (int) (renderCamera.Distance()); |
---|
14681 | 14760 | } |
---|
.. | .. |
---|
14684 | 14763 | { |
---|
14685 | 14764 | MODIFIERS |= COMMAND; |
---|
14686 | 14765 | /**/ |
---|
| 14766 | + boolean isVR = (mouseMode&VR)!=0; |
---|
| 14767 | + |
---|
14687 | 14768 | if((mod&SHIFT) == SHIFT) |
---|
14688 | | - manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14769 | + { |
---|
| 14770 | + if (isVR) |
---|
| 14771 | + manipCamera.RotateInterest(0, speed); |
---|
| 14772 | + else |
---|
| 14773 | + manipCamera.RotatePosition(0, speed); |
---|
| 14774 | + } |
---|
14689 | 14775 | else |
---|
14690 | | - manipCamera.RotatePosition(0, speed); |
---|
| 14776 | + manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth()); |
---|
14691 | 14777 | /**/ |
---|
14692 | 14778 | if ((mod & SHIFT) == SHIFT) |
---|
14693 | 14779 | { |
---|
.. | .. |
---|
14697 | 14783 | mouseMode |= BACKFORTH; |
---|
14698 | 14784 | } |
---|
14699 | 14785 | |
---|
| 14786 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14787 | + |
---|
14700 | 14788 | //prevX = X = anchorX; |
---|
14701 | 14789 | prevY = Y = anchorY + (int) (renderCamera.Distance()); |
---|
14702 | 14790 | } |
---|
.. | .. |
---|
14706 | 14794 | MODIFIERS |= COMMAND; |
---|
14707 | 14795 | /**/ |
---|
14708 | 14796 | if((mod&SHIFT) == SHIFT) |
---|
14709 | | - manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
| 14797 | + manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14710 | 14798 | else |
---|
14711 | | - manipCamera.RotatePosition(speed, 0); |
---|
| 14799 | + { |
---|
| 14800 | + if ((mouseMode&VR)!=0) |
---|
| 14801 | + manipCamera.RotateInterest(-speed, 0); |
---|
| 14802 | + else |
---|
| 14803 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14804 | + } |
---|
14712 | 14805 | /**/ |
---|
14713 | 14806 | if ((mod & SHIFT) == SHIFT) |
---|
14714 | 14807 | { |
---|
.. | .. |
---|
14718 | 14811 | mouseMode |= ROTATE; |
---|
14719 | 14812 | } // TRANSLATE; |
---|
14720 | 14813 | |
---|
| 14814 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14815 | + |
---|
14721 | 14816 | prevX = X = anchorX - 10; // (int)(10*renderCamera.Distance()); |
---|
14722 | 14817 | prevY = Y = anchorY; |
---|
14723 | 14818 | } |
---|
.. | .. |
---|
14727 | 14822 | MODIFIERS |= COMMAND; |
---|
14728 | 14823 | /**/ |
---|
14729 | 14824 | if((mod&SHIFT) == SHIFT) |
---|
14730 | | - manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
| 14825 | + manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14731 | 14826 | else |
---|
14732 | | - manipCamera.RotatePosition(-speed, 0); |
---|
| 14827 | + { |
---|
| 14828 | + if ((mouseMode&VR)!=0) |
---|
| 14829 | + manipCamera.RotateInterest(speed, 0); |
---|
| 14830 | + else |
---|
| 14831 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14832 | + } |
---|
| 14833 | + |
---|
14733 | 14834 | /**/ |
---|
14734 | 14835 | if ((mod & SHIFT) == SHIFT) |
---|
14735 | 14836 | { |
---|
.. | .. |
---|
14739 | 14840 | mouseMode |= ROTATE; |
---|
14740 | 14841 | } // TRANSLATE; |
---|
14741 | 14842 | |
---|
| 14843 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14844 | + |
---|
14742 | 14845 | prevX = X = anchorX + 10; // (int)(10*renderCamera.Distance()); |
---|
14743 | 14846 | prevY = Y = anchorY; |
---|
14744 | 14847 | } |
---|
.. | .. |
---|
15241 | 15344 | case 'K': |
---|
15242 | 15345 | KOMPACTTEXTURE ^= true; |
---|
15243 | 15346 | //textures.clear(); |
---|
15244 | | - break; |
---|
15245 | | - case 'P': // Texture Projection macros |
---|
| 15347 | + // break; |
---|
| 15348 | + //case 'P': // Texture Projection macros |
---|
15246 | 15349 | // SAVETEXTURE ^= true; |
---|
15247 | 15350 | macromode = true; |
---|
15248 | 15351 | Udebug = Vdebug = NORMALdebug = false; programInitialized = false; |
---|
.. | .. |
---|
15363 | 15466 | targetLookAt.set(manipCamera.lookAt); |
---|
15364 | 15467 | repaint(); |
---|
15365 | 15468 | break; |
---|
15366 | | - case 'p': |
---|
| 15469 | + case 'P': // p': |
---|
15367 | 15470 | // c'est quoi ca au juste? spherical ^= true; |
---|
15368 | 15471 | Skinshader ^= true; programInitialized = false; |
---|
15369 | 15472 | repaint(); |
---|
.. | .. |
---|
16123 | 16226 | { |
---|
16124 | 16227 | switch (hitSomething) |
---|
16125 | 16228 | { |
---|
16126 | | - case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 16229 | + case Object3D.hitCenter: gr.setColor(Color.white); |
---|
16127 | 16230 | gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
16128 | 16231 | break; |
---|
16129 | 16232 | case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
.. | .. |
---|
16149 | 16252 | if (hasMarquee) |
---|
16150 | 16253 | { |
---|
16151 | 16254 | gr.setXORMode(Color.white); |
---|
16152 | | - gr.setColor(Color.red); |
---|
| 16255 | + gr.setColor(Color.white); |
---|
16153 | 16256 | if (!firstime) |
---|
16154 | 16257 | { |
---|
16155 | 16258 | gr.drawRect(prevmarqX, prevmarqY, prevmarqW, prevmarqH); |
---|
.. | .. |
---|
16788 | 16891 | gl.glDisable(GL.GL_TEXTURE_GEN_R); |
---|
16789 | 16892 | |
---|
16790 | 16893 | cubemap.disable(); |
---|
16791 | | - ////cubemap.unbind(); |
---|
| 16894 | + //cubemap.dispose(); |
---|
| 16895 | + |
---|
16792 | 16896 | if (CULLFACE) |
---|
16793 | 16897 | { |
---|
16794 | 16898 | gl.glEnable(gl.GL_CULL_FACE); |
---|
.. | .. |
---|
16844 | 16948 | gl.glScalef(1.0f, -1.0f, 1.0f); |
---|
16845 | 16949 | } |
---|
16846 | 16950 | |
---|
16847 | | - gl.glNormal3f(0.0f, 0.0f, 1.0f); |
---|
| 16951 | + SetGLNormal(gl, 0.0f, 0.0f, 1.0f); |
---|
16848 | 16952 | |
---|
16849 | 16953 | float step = 2; // 0.1666f; //0.25f; |
---|
16850 | 16954 | float stepv = 2; // step * 1652 / 998; |
---|
.. | .. |
---|
17324 | 17428 | |
---|
17325 | 17429 | public void init(GLAutoDrawable drawable) |
---|
17326 | 17430 | { |
---|
| 17431 | + if (Globals.DEBUG) |
---|
17327 | 17432 | System.out.println("shadow buffer init"); |
---|
17328 | 17433 | |
---|
17329 | 17434 | GL gl = drawable.getGL(); |
---|