.. | .. |
---|
2000 | 2000 | */ |
---|
2001 | 2001 | TextureData ReduceTexture(TextureData texturedata, int resolution) // String name) |
---|
2002 | 2002 | { |
---|
| 2003 | + int pixelformat = texturedata.getPixelFormat(); |
---|
| 2004 | + |
---|
2003 | 2005 | int stride = 1; |
---|
2004 | | - if (texturedata.getPixelFormat() == GetGL().GL_RGB || texturedata.getPixelFormat() == GetGL().GL_BGR) // || texturedata.getPixelFormat() == GL.GL_LUMINANCE) |
---|
| 2006 | + if (pixelformat == GetGL().GL_RGB || pixelformat == GetGL().GL_BGR) // || texturedata.getPixelFormat() == GL.GL_LUMINANCE) |
---|
2005 | 2007 | stride = 3; |
---|
2006 | | - if (texturedata.getPixelFormat() == GetGL().GL_RGBA || texturedata.getPixelFormat() == GetGL().GL_BGRA) // || texturedata.getPixelFormat() == GL.GL_LUMINANCE_ALPHA) |
---|
| 2008 | + if (pixelformat == GetGL().GL_RGBA || pixelformat == GetGL().GL_BGRA) // || texturedata.getPixelFormat() == GL.GL_LUMINANCE_ALPHA) |
---|
2007 | 2009 | stride = 4; |
---|
2008 | 2010 | |
---|
2009 | 2011 | int width = texturedata.getWidth(); |
---|
.. | .. |
---|
7590 | 7592 | |
---|
7591 | 7593 | float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV |
---|
7592 | 7594 | float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation |
---|
7593 | | - float[] options3 = new float[]{1, 1, 1, 1}; // fog color. image intensity |
---|
| 7595 | + float[] options3 = new float[]{1, 1, 1, 0}; // fog color |
---|
| 7596 | + float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen |
---|
7594 | 7597 | |
---|
7595 | 7598 | static int imagecount = 0; // movie generation |
---|
7596 | 7599 | |
---|
.. | .. |
---|
7690 | 7693 | |
---|
7691 | 7694 | if (renderCamera != lightCamera) |
---|
7692 | 7695 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
7693 | | - LA.matConcat(parentcam.toParent, matrix, matrix); |
---|
| 7696 | + LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
7694 | 7697 | |
---|
7695 | 7698 | // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix); |
---|
7696 | 7699 | |
---|
.. | .. |
---|
7706 | 7709 | |
---|
7707 | 7710 | if (renderCamera != lightCamera) |
---|
7708 | 7711 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
7709 | | - LA.matConcat(matrix, parentcam.fromParent, matrix); |
---|
| 7712 | + LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
7710 | 7713 | |
---|
7711 | 7714 | // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix); |
---|
7712 | 7715 | |
---|
.. | .. |
---|
8784 | 8787 | if (!IsFrozen()) |
---|
8785 | 8788 | { |
---|
8786 | 8789 | // dec 2012 |
---|
8787 | | - if (!(!flash && !lightMode && drawMode == DEFAULT && ANTIALIAS > 0)) |
---|
| 8790 | + if (!ambientOcclusion && !(!flash && !lightMode && drawMode == DEFAULT && ANTIALIAS > 0)) |
---|
8788 | 8791 | { |
---|
8789 | 8792 | framecount++; |
---|
8790 | 8793 | shadowbuffer.display(); |
---|
.. | .. |
---|
8912 | 8915 | // if (parentcam != renderCamera) // not a light |
---|
8913 | 8916 | if (cam != lightCamera) |
---|
8914 | 8917 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
8915 | | - LA.matConcat(parentcam.toParent, matrix, matrix); |
---|
| 8918 | + LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
8916 | 8919 | |
---|
8917 | 8920 | for (int j = 0; j < 4; j++) |
---|
8918 | 8921 | { |
---|
.. | .. |
---|
8927 | 8930 | // if (parentcam != renderCamera) // not a light |
---|
8928 | 8931 | if (cam != lightCamera) |
---|
8929 | 8932 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
8930 | | - LA.matConcat(matrix, parentcam.fromParent, matrix); |
---|
| 8933 | + LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
8931 | 8934 | |
---|
8932 | 8935 | //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix); |
---|
8933 | 8936 | |
---|
.. | .. |
---|
9379 | 9382 | |
---|
9380 | 9383 | gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 63, options2, 0); |
---|
9381 | 9384 | gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 62, options3, 0); |
---|
| 9385 | + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 61, options4, 0); |
---|
9382 | 9386 | |
---|
9383 | 9387 | options2[0] *= renderCamera.Distance(); |
---|
9384 | 9388 | |
---|
.. | .. |
---|
9750 | 9754 | selectedpoint.radius = radius; |
---|
9751 | 9755 | selectedpoint.recalculate(); |
---|
9752 | 9756 | selectedpoint.material = new cMaterial(); |
---|
9753 | | - selectedpoint.material.color = 0.25f; |
---|
| 9757 | + selectedpoint.material.color = 0.15f; |
---|
9754 | 9758 | selectedpoint.material.modulation = 0.75f; |
---|
9755 | 9759 | |
---|
9756 | 9760 | debugpoint.radius = radius; |
---|
.. | .. |
---|
10357 | 10361 | "PARAM params6 = program.env[6];" + // bump, noise, borderfade, fog punchthrough |
---|
10358 | 10362 | "PARAM params7 = program.env[7];" + // noise power, opacity power |
---|
10359 | 10363 | "PARAM options0 = program.env[63];" + // fog density, intensity, elevation |
---|
10360 | | - "PARAM options1 = program.env[62];" + // fog rgb color, image intensity |
---|
| 10364 | + "PARAM options1 = program.env[62];" + // fog rgb color |
---|
| 10365 | + "PARAM options2 = program.env[61];" + // image intensity, subsurface, lightsheen |
---|
10361 | 10366 | "PARAM pointlight = program.env[127];" + // ... |
---|
10362 | 10367 | "PARAM zero = { 0.0, 0.0, 0.0, 0.0 };" + |
---|
10363 | 10368 | "PARAM halfhalf = { 0.25, 0.25, 0.25, 1.0 };" + |
---|
10364 | 10369 | "PARAM half = { 0.5, 0.5, 0.5, 1.0 };" + |
---|
| 10370 | + "PARAM threequarter = { 0.75, 0.75, 0.75, 1.0 };" + |
---|
10365 | 10371 | "PARAM two = { 2.0, 2.0, 2.0, 1.0 };" + |
---|
10366 | 10372 | "PARAM ten = { 10, 10, 10, 1.0 };" + |
---|
10367 | 10373 | "PARAM one3rd = { 0.5, 0.33333333333, 0.333333333, 1.0 };" + |
---|
.. | .. |
---|
10422 | 10428 | "TEMP R1;" + |
---|
10423 | 10429 | "TEMP R2;" + |
---|
10424 | 10430 | "TEMP R3;" + |
---|
| 10431 | + "TEMP min;" + |
---|
| 10432 | + "TEMP max;" + |
---|
| 10433 | + "TEMP average;" + |
---|
| 10434 | + "TEMP saturation;" + |
---|
10425 | 10435 | "TEMP keep1;" + |
---|
10426 | 10436 | "TEMP keep2;" + |
---|
10427 | 10437 | "TEMP keep3;" + |
---|
.. | .. |
---|
10952 | 10962 | |
---|
10953 | 10963 | // skin? |
---|
10954 | 10964 | // Saturation for skin |
---|
10955 | | - /**/ // c'est ici |
---|
10956 | | - (Skinshader? "DP3 temp.x, final,one;" + |
---|
| 10965 | + /**/ |
---|
| 10966 | + (Skinshader? |
---|
| 10967 | + "DP3 average.x, final,one;" + |
---|
| 10968 | + "MUL average, one3rd.xxxx,average.xxxx;" + |
---|
| 10969 | + |
---|
| 10970 | + "MIN min.x, final.x,final.y;" + |
---|
| 10971 | + "MIN min.x, min.x,final.z;" + |
---|
| 10972 | + |
---|
| 10973 | + "MAX max.x, final.x,final.y;" + |
---|
| 10974 | + "MAX max.x, max.x,final.z;" + |
---|
| 10975 | + "MOV max, max.xxxx;" + |
---|
| 10976 | + |
---|
| 10977 | + "SUB saturation, max, final;" + |
---|
| 10978 | + |
---|
| 10979 | + "ADD temp.x, max.x, one10th.x;" + |
---|
| 10980 | + "RCP temp.x, temp.x;" + |
---|
| 10981 | + "MUL temp.x, temp.x, half.x;" + |
---|
| 10982 | + "MUL saturation, saturation, temp.xxxx;" + |
---|
| 10983 | + |
---|
| 10984 | + "DP3 ndotl.x, normald, light;" + |
---|
| 10985 | + "MAX ndotl.x, ndotl.x, -ndotl.x;" + |
---|
| 10986 | + |
---|
| 10987 | + "SUB temp.x, one.x, ndotl.x;" + |
---|
| 10988 | + "ADD temp.x, temp.x, options2.z;" + // lightsheen |
---|
| 10989 | + "ADD temp.y, one.y, options2.y;" + // sursurface |
---|
| 10990 | + "MUL temp.x, temp.x, temp.y;" + |
---|
| 10991 | + |
---|
| 10992 | + "MUL saturation, saturation, temp.xxxx;" + |
---|
| 10993 | + "SUB_SAT temp, max, saturation;" + |
---|
| 10994 | +/** |
---|
| 10995 | + "DP3 temp.x, final,one;" + |
---|
10957 | 10996 | "MUL R2, one3rd.xxxx,temp.xxxx;" + |
---|
10958 | | - "SUB temp, final,R2;" + |
---|
| 10997 | + "SUB temp, final, R2;" + |
---|
| 10998 | + |
---|
10959 | 10999 | // using light angle |
---|
10960 | 11000 | "DP3 ndotl.x, normald,light;" + |
---|
10961 | 11001 | //"SLT ndotl.y, ndotl.x, zero.x;" + |
---|
.. | .. |
---|
10968 | 11008 | // using light intensity |
---|
10969 | 11009 | "MOV ndotl.z, R2.x;" + |
---|
10970 | 11010 | "MUL ndotl.z, ndotl.z, ndotl.z;" + // tuning... |
---|
10971 | | - |
---|
10972 | 11011 | // june 2014 |
---|
10973 | 11012 | "MAD R1.x, ndotl.z,slope.y,one.x;" + |
---|
10974 | 11013 | // "SUB ndotl.x, one.x, ndotl.x;" + |
---|
.. | .. |
---|
10980 | 11019 | //"MUL R2.y, shadow.x,R2.y;" + // avril 2014 |
---|
10981 | 11020 | |
---|
10982 | 11021 | "MAD temp.x, R2.y, ndotl.y, temp.x;" + // red shift (skin) |
---|
| 11022 | +/**/ |
---|
10983 | 11023 | |
---|
10984 | 11024 | // "ADD final, R2,temp;" + |
---|
10985 | 11025 | "MOV final, temp;" |
---|
.. | .. |
---|
11069 | 11109 | /**/ |
---|
11070 | 11110 | // HDR |
---|
11071 | 11111 | "MOV temp.z, final.a;" + |
---|
11072 | | - "MUL final, final,options1.w;" + |
---|
| 11112 | + "MUL final, final,options2.x;" + |
---|
11073 | 11113 | "MOV final.a, temp.z;" + |
---|
11074 | 11114 | /**/ |
---|
11075 | 11115 | |
---|
.. | .. |
---|
12814 | 12854 | { |
---|
12815 | 12855 | mouseMode |= ZOOM; |
---|
12816 | 12856 | } |
---|
12817 | | - if ((modifiers & META) == META) |
---|
| 12857 | + |
---|
| 12858 | + boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
| 12859 | + if (capsLocked || (modifiers & META) == META) |
---|
12818 | 12860 | { |
---|
12819 | 12861 | mouseMode |= VR; // BACKFORTH; |
---|
12820 | 12862 | } |
---|
.. | .. |
---|
12828 | 12870 | } |
---|
12829 | 12871 | if ((modifiers & SHIFT) == SHIFT || forcetranslate) |
---|
12830 | 12872 | { |
---|
| 12873 | + mouseMode &= ~VR; |
---|
12831 | 12874 | mouseMode |= TRANSLATE; |
---|
12832 | 12875 | } |
---|
12833 | 12876 | // if ((modifiers & SHIFT_META) == SHIFT_META) |
---|
.. | .. |
---|
13217 | 13260 | FlipTransform(); |
---|
13218 | 13261 | break; |
---|
13219 | 13262 | case ENTER: |
---|
13220 | | - object.editWindow.ScreenFit(); // Edit(); |
---|
| 13263 | + // object.editWindow.ScreenFit(); // Edit(); |
---|
| 13264 | + ToggleLive(); |
---|
13221 | 13265 | break; |
---|
13222 | 13266 | case DELETE: |
---|
13223 | 13267 | ClearSelection(); |
---|
.. | .. |
---|
14678 | 14722 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
14679 | 14723 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
14680 | 14724 | |
---|
| 14725 | + // Will fit the mesh !!! |
---|
| 14726 | + selectedpoint.toParent[0][0] = 0.0001; |
---|
| 14727 | + selectedpoint.toParent[1][1] = 0.0001; |
---|
| 14728 | + selectedpoint.toParent[2][2] = 0.0001; |
---|
| 14729 | + |
---|
14681 | 14730 | glu.gluUnProject(x,y,depth,view,0,tempmat2,0,viewport,0,selectedpoint.toParent[3],0); |
---|
14682 | 14731 | |
---|
14683 | 14732 | // if (object.selection != null && object.selection.Size() > 0) |
---|
.. | .. |
---|
15300 | 15349 | int AAbuffersize = 0; |
---|
15301 | 15350 | |
---|
15302 | 15351 | //double[] selectedpoint = new double[3]; |
---|
15303 | | - static Sphere selectedpoint = new Sphere(); |
---|
| 15352 | + static Superellipsoid selectedpoint = new Superellipsoid(); |
---|
15304 | 15353 | static Sphere previousselectedpoint = null; |
---|
15305 | 15354 | static Sphere debugpoint = new Sphere(); |
---|
15306 | 15355 | static Sphere debugpoint2 = new Sphere(); |
---|