.. | .. |
---|
168 | 168 | |
---|
169 | 169 | |
---|
170 | 170 | // OPTIONS |
---|
171 | | - boolean Skinshader = true; |
---|
| 171 | + boolean Skinshader = false; // true; |
---|
172 | 172 | boolean cameraLight = false; |
---|
173 | 173 | boolean UVdebug = false; |
---|
174 | 174 | boolean Udebug = false; |
---|
.. | .. |
---|
1819 | 1819 | |
---|
1820 | 1820 | display.modelParams7[0] = 0; |
---|
1821 | 1821 | display.modelParams7[1] = 1000; |
---|
1822 | | - display.modelParams7[2] = 0; |
---|
| 1822 | + display.modelParams7[2] = material.parallax; |
---|
1823 | 1823 | display.modelParams7[3] = 0; |
---|
1824 | 1824 | |
---|
1825 | 1825 | //display.modelParams6[0] = 100; // criss de bug de bump |
---|
.. | .. |
---|
2052 | 2052 | switch(viewcode) |
---|
2053 | 2053 | { |
---|
2054 | 2054 | case 0: return "main"; |
---|
2055 | | - case 1: return "one"; |
---|
2056 | | - case 2: return "two"; |
---|
2057 | | - case 3: return "three"; |
---|
| 2055 | + case 1: return "Red"; |
---|
| 2056 | + case 2: return "Green"; |
---|
| 2057 | + case 3: return "Blue"; |
---|
2058 | 2058 | case 4: return "light"; |
---|
2059 | 2059 | } |
---|
2060 | 2060 | |
---|
.. | .. |
---|
10690 | 10690 | static boolean init = false; |
---|
10691 | 10691 | |
---|
10692 | 10692 | double[][] matrix = LA.newMatrix(); |
---|
| 10693 | + |
---|
| 10694 | + // This is to refresh the UI of the material panel. |
---|
| 10695 | + ObjEditor patchMaterial; |
---|
10693 | 10696 | |
---|
10694 | 10697 | public void display(GLAutoDrawable drawable) |
---|
10695 | 10698 | { |
---|
| 10699 | + if (patchMaterial.patchMaterial) |
---|
| 10700 | + { |
---|
| 10701 | + patchMaterial.patchMaterial = false; |
---|
| 10702 | + patchMaterial.objectPanel.setSelectedIndex(1); |
---|
| 10703 | + } |
---|
| 10704 | + |
---|
10696 | 10705 | if (Grafreed.savesound && Grafreed.hassound) |
---|
10697 | 10706 | { |
---|
10698 | 10707 | Grafreed.wav.save(); |
---|
.. | .. |
---|
11088 | 11097 | { |
---|
11089 | 11098 | if (cubemaprgb == null) |
---|
11090 | 11099 | { |
---|
11091 | | - cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb" + "/", "jpg", false); |
---|
| 11100 | + cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb2" + "/", "jpg", false); |
---|
11092 | 11101 | } |
---|
11093 | 11102 | |
---|
11094 | 11103 | cubemap = cubemaprgb; |
---|
.. | .. |
---|
12584 | 12593 | "PARAM params4 = program.env[4];" + // anisoV, cameralight, selfshadow, shadow |
---|
12585 | 12594 | "PARAM params5 = program.env[5];" + // texture, opacity, fakedepth, shadowbias |
---|
12586 | 12595 | "PARAM params6 = program.env[6];" + // bump, noise, borderfade, fog punchthrough |
---|
12587 | | - "PARAM params7 = program.env[7];" + // noise power, opacity power |
---|
| 12596 | + "PARAM params7 = program.env[7];" + // noise power, opacity power, parallax |
---|
12588 | 12597 | "PARAM options0 = program.env[63];" + // fog density, intensity, elevation |
---|
12589 | 12598 | "PARAM options1 = program.env[62];" + // fog rgb color |
---|
12590 | 12599 | "PARAM options2 = program.env[61];" + // image intensity, subsurface, lightsheen |
---|
.. | .. |
---|
12829 | 12838 | "POW texSamp.a, texSamp.a, params6.w;" + // fog punch through shortcut |
---|
12830 | 12839 | // mar 2013 ??? "KIL alpha.a;" + |
---|
12831 | 12840 | "MOV alpha, texSamp.aaaa;" + // y;" + |
---|
12832 | | - "KIL alpha.a;" + |
---|
| 12841 | + "KIL alpha.a;" + // not sure with parallax mapping |
---|
12833 | 12842 | /* |
---|
12834 | 12843 | "MUL temp.xy, temp, two;" + |
---|
12835 | 12844 | "TXB bump, temp, texture[0], 2D;" + |
---|
.. | .. |
---|
12915 | 12924 | "SUB bump0, bump0, half;" + |
---|
12916 | 12925 | "ADD bump, bump, bump0;" + |
---|
12917 | 12926 | |
---|
12918 | | - "MOV temp.x, texSamp.a;" + |
---|
12919 | | - "LRP texSamp, params5.x, texSamp, one;" + // texture proportion |
---|
12920 | | - //"LRP texSamp0, params5.x, texSamp0, one;" + |
---|
12921 | | - "MOV texSamp.a, temp.x;" + |
---|
12922 | | - |
---|
12923 | 12927 | // double-sided |
---|
12924 | 12928 | /**/ |
---|
12925 | 12929 | (doublesided?"DP3 temp.z, normal, eye;" + |
---|
.. | .. |
---|
12949 | 12953 | Normalize("U") + |
---|
12950 | 12954 | |
---|
12951 | 12955 | // parallax mapping |
---|
| 12956 | + |
---|
| 12957 | + "DP3 temp2.x, V, eye;" + |
---|
| 12958 | + "DP3 temp2.y, U, eye;" + |
---|
| 12959 | + "DP3 temp2.z, normal, eye;" + |
---|
| 12960 | + "RCP temp2.z, temp2.z;" + |
---|
| 12961 | + |
---|
| 12962 | + "DP3 temp2.w, texSamp, texSamp;" + // Height |
---|
| 12963 | + "RSQ temp2.w, temp2.w;" + |
---|
| 12964 | + "RCP temp2.w, temp2.w;" + |
---|
| 12965 | + |
---|
| 12966 | + "SUB temp2.w, temp2.w, half;" + |
---|
| 12967 | +// "SGE temp.x, temp2.w, eps.x;" + |
---|
| 12968 | +// "MUL temp2.w, temp2.w, temp.x;" + |
---|
| 12969 | + |
---|
| 12970 | + //"MOV texSamp, U;" + |
---|
| 12971 | + |
---|
| 12972 | + "MUL temp2.z, temp2.z, temp2.w;" + |
---|
| 12973 | + "MUL temp2.z, temp2.z, params7.z;" + // parallax |
---|
| 12974 | + |
---|
| 12975 | + "MUL temp2, temp2, temp2.z;" + |
---|
| 12976 | + |
---|
| 12977 | + "MOV temp, fragment.texcoord[0];" + |
---|
| 12978 | + |
---|
| 12979 | + "SUB temp, temp, temp2;" + |
---|
| 12980 | + |
---|
| 12981 | + "TEX texSamp, temp, texture[0], 2D;" + |
---|
| 12982 | + "POW texSamp.a, texSamp.a, params6.w;" + // punch through |
---|
| 12983 | + "MOV alpha, texSamp.aaaa;" + |
---|
| 12984 | + |
---|
| 12985 | +// parallax mapping |
---|
| 12986 | + |
---|
| 12987 | + "MOV temp.x, texSamp.a;" + |
---|
| 12988 | + "LRP texSamp, params5.x, texSamp, one;" + // texture proportion |
---|
| 12989 | + //"LRP texSamp0, params5.x, texSamp0, one;" + |
---|
| 12990 | + "MOV texSamp.a, temp.x;" + |
---|
12952 | 12991 | |
---|
12953 | 12992 | //"MOV temp, fragment.texcoord[0];" + |
---|
12954 | 12993 | // |
---|
.. | .. |
---|
13419 | 13458 | program = programmin; |
---|
13420 | 13459 | } |
---|
13421 | 13460 | |
---|
13422 | | - System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
13423 | | - System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
| 13461 | + if (Globals.DEBUG) |
---|
| 13462 | + { |
---|
| 13463 | + System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
| 13464 | + System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
| 13465 | + } |
---|
| 13466 | + |
---|
13424 | 13467 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
13425 | 13468 | |
---|
13426 | 13469 | //gl.glNewList(displayListID, GL.GL_COMPILE); |
---|
.. | .. |
---|
13467 | 13510 | "\n" + |
---|
13468 | 13511 | "END\n"; |
---|
13469 | 13512 | |
---|
13470 | | - System.out.println("Program shadow #" + 0 + "; length = " + program.length()); |
---|
| 13513 | + if (Globals.DEBUG) |
---|
| 13514 | + System.out.println("Program shadow #" + 0 + "; length = " + program.length()); |
---|
13471 | 13515 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
13472 | 13516 | |
---|
13473 | 13517 | //gl.glNewList(displayListID, GL.GL_COMPILE); |
---|
.. | .. |
---|
13725 | 13769 | /*static*/ float[] modelParams4 = new float[]{0, 0, 0, 0}; // anisoV, cameralight, selfshadow, shadow |
---|
13726 | 13770 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13727 | 13771 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13728 | | - /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
| 13772 | + /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power, parallax |
---|
13729 | 13773 | |
---|
13730 | 13774 | //Object3D.cVector2[] vector2buffer; |
---|
13731 | 13775 | |
---|
.. | .. |
---|
14666 | 14710 | void GoDown(int mod) |
---|
14667 | 14711 | { |
---|
14668 | 14712 | MODIFIERS |= COMMAND; |
---|
| 14713 | + boolean isVR = (mouseMode&VR)!=0; |
---|
14669 | 14714 | /**/ |
---|
14670 | 14715 | if((mod&SHIFT) == SHIFT) |
---|
14671 | | - manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14716 | + { |
---|
| 14717 | + if (isVR) |
---|
| 14718 | + manipCamera.RotateInterest(0, -speed); |
---|
| 14719 | + else |
---|
| 14720 | + manipCamera.RotatePosition(0, -speed); |
---|
| 14721 | + } |
---|
14672 | 14722 | else |
---|
14673 | | - manipCamera.RotatePosition(0, -speed); |
---|
| 14723 | + manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth()); |
---|
14674 | 14724 | /**/ |
---|
14675 | 14725 | if ((mod & SHIFT) == SHIFT) |
---|
14676 | 14726 | { |
---|
.. | .. |
---|
14680 | 14730 | mouseMode |= BACKFORTH; |
---|
14681 | 14731 | } |
---|
14682 | 14732 | |
---|
| 14733 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14734 | + |
---|
14683 | 14735 | //prevX = X = anchorX; |
---|
14684 | 14736 | prevY = Y = anchorY - (int) (renderCamera.Distance()); |
---|
14685 | 14737 | } |
---|
.. | .. |
---|
14688 | 14740 | { |
---|
14689 | 14741 | MODIFIERS |= COMMAND; |
---|
14690 | 14742 | /**/ |
---|
| 14743 | + boolean isVR = (mouseMode&VR)!=0; |
---|
| 14744 | + |
---|
14691 | 14745 | if((mod&SHIFT) == SHIFT) |
---|
14692 | | - manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14746 | + { |
---|
| 14747 | + if (isVR) |
---|
| 14748 | + manipCamera.RotateInterest(0, speed); |
---|
| 14749 | + else |
---|
| 14750 | + manipCamera.RotatePosition(0, speed); |
---|
| 14751 | + } |
---|
14693 | 14752 | else |
---|
14694 | | - manipCamera.RotatePosition(0, speed); |
---|
| 14753 | + manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth()); |
---|
14695 | 14754 | /**/ |
---|
14696 | 14755 | if ((mod & SHIFT) == SHIFT) |
---|
14697 | 14756 | { |
---|
.. | .. |
---|
14701 | 14760 | mouseMode |= BACKFORTH; |
---|
14702 | 14761 | } |
---|
14703 | 14762 | |
---|
| 14763 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14764 | + |
---|
14704 | 14765 | //prevX = X = anchorX; |
---|
14705 | 14766 | prevY = Y = anchorY + (int) (renderCamera.Distance()); |
---|
14706 | 14767 | } |
---|
.. | .. |
---|
14710 | 14771 | MODIFIERS |= COMMAND; |
---|
14711 | 14772 | /**/ |
---|
14712 | 14773 | if((mod&SHIFT) == SHIFT) |
---|
14713 | | - manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
| 14774 | + manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14714 | 14775 | else |
---|
14715 | | - manipCamera.RotatePosition(speed, 0); |
---|
| 14776 | + { |
---|
| 14777 | + if ((mouseMode&VR)!=0) |
---|
| 14778 | + manipCamera.RotateInterest(-speed, 0); |
---|
| 14779 | + else |
---|
| 14780 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14781 | + } |
---|
14716 | 14782 | /**/ |
---|
14717 | 14783 | if ((mod & SHIFT) == SHIFT) |
---|
14718 | 14784 | { |
---|
.. | .. |
---|
14722 | 14788 | mouseMode |= ROTATE; |
---|
14723 | 14789 | } // TRANSLATE; |
---|
14724 | 14790 | |
---|
| 14791 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14792 | + |
---|
14725 | 14793 | prevX = X = anchorX - 10; // (int)(10*renderCamera.Distance()); |
---|
14726 | 14794 | prevY = Y = anchorY; |
---|
14727 | 14795 | } |
---|
.. | .. |
---|
14731 | 14799 | MODIFIERS |= COMMAND; |
---|
14732 | 14800 | /**/ |
---|
14733 | 14801 | if((mod&SHIFT) == SHIFT) |
---|
14734 | | - manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
| 14802 | + manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14735 | 14803 | else |
---|
14736 | | - manipCamera.RotatePosition(-speed, 0); |
---|
| 14804 | + { |
---|
| 14805 | + if ((mouseMode&VR)!=0) |
---|
| 14806 | + manipCamera.RotateInterest(speed, 0); |
---|
| 14807 | + else |
---|
| 14808 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14809 | + } |
---|
| 14810 | + |
---|
14737 | 14811 | /**/ |
---|
14738 | 14812 | if ((mod & SHIFT) == SHIFT) |
---|
14739 | 14813 | { |
---|
.. | .. |
---|
14743 | 14817 | mouseMode |= ROTATE; |
---|
14744 | 14818 | } // TRANSLATE; |
---|
14745 | 14819 | |
---|
| 14820 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14821 | + |
---|
14746 | 14822 | prevX = X = anchorX + 10; // (int)(10*renderCamera.Distance()); |
---|
14747 | 14823 | prevY = Y = anchorY; |
---|
14748 | 14824 | } |
---|
.. | .. |
---|
15245 | 15321 | case 'K': |
---|
15246 | 15322 | KOMPACTTEXTURE ^= true; |
---|
15247 | 15323 | //textures.clear(); |
---|
15248 | | - break; |
---|
15249 | | - case 'P': // Texture Projection macros |
---|
| 15324 | + // break; |
---|
| 15325 | + //case 'P': // Texture Projection macros |
---|
15250 | 15326 | // SAVETEXTURE ^= true; |
---|
15251 | 15327 | macromode = true; |
---|
15252 | 15328 | Udebug = Vdebug = NORMALdebug = false; programInitialized = false; |
---|
.. | .. |
---|
15367 | 15443 | targetLookAt.set(manipCamera.lookAt); |
---|
15368 | 15444 | repaint(); |
---|
15369 | 15445 | break; |
---|
15370 | | - case 'p': |
---|
| 15446 | + case 'P': // p': |
---|
15371 | 15447 | // c'est quoi ca au juste? spherical ^= true; |
---|
15372 | 15448 | Skinshader ^= true; programInitialized = false; |
---|
15373 | 15449 | repaint(); |
---|
.. | .. |
---|
16127 | 16203 | { |
---|
16128 | 16204 | switch (hitSomething) |
---|
16129 | 16205 | { |
---|
16130 | | - case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 16206 | + case Object3D.hitCenter: gr.setColor(Color.white); |
---|
16131 | 16207 | gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
16132 | 16208 | break; |
---|
16133 | 16209 | case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
.. | .. |
---|
16153 | 16229 | if (hasMarquee) |
---|
16154 | 16230 | { |
---|
16155 | 16231 | gr.setXORMode(Color.white); |
---|
16156 | | - gr.setColor(Color.red); |
---|
| 16232 | + gr.setColor(Color.white); |
---|
16157 | 16233 | if (!firstime) |
---|
16158 | 16234 | { |
---|
16159 | 16235 | gr.drawRect(prevmarqX, prevmarqY, prevmarqW, prevmarqH); |
---|
.. | .. |
---|
17329 | 17405 | |
---|
17330 | 17406 | public void init(GLAutoDrawable drawable) |
---|
17331 | 17407 | { |
---|
| 17408 | + if (Globals.DEBUG) |
---|
17332 | 17409 | System.out.println("shadow buffer init"); |
---|
17333 | 17410 | |
---|
17334 | 17411 | GL gl = drawable.getGL(); |
---|