.. | .. |
---|
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(); |
---|
.. | .. |
---|
7442 | 7444 | //gl.glFrustum(-0.5*scale, 0.5*scale, -0.5*scale, 0.5*scale, 1, 100); |
---|
7443 | 7445 | //glu.gluPerspective(lightshaper_fovy, 1, lightshaper_zNear, lightshaper_zFar); |
---|
7444 | 7446 | double scale = lightCamera.SCALE / lightCamera.Distance(); |
---|
| 7447 | +// PATCH FILLE AUX JEANS |
---|
| 7448 | + //scale *= lightCamera.shaper_fovy / 25; |
---|
7445 | 7449 | gl.glScaled(2 * scale, 2 * scale, -scale); |
---|
7446 | 7450 | gl.glTranslated(0, 0, lightCamera.DECAL); |
---|
7447 | 7451 | |
---|
.. | .. |
---|
7590 | 7594 | |
---|
7591 | 7595 | float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV |
---|
7592 | 7596 | 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 |
---|
| 7597 | + float[] options3 = new float[]{1, 1, 1, 0}; // fog color |
---|
| 7598 | + float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen |
---|
7594 | 7599 | |
---|
7595 | 7600 | static int imagecount = 0; // movie generation |
---|
7596 | 7601 | |
---|
.. | .. |
---|
7690 | 7695 | |
---|
7691 | 7696 | if (renderCamera != lightCamera) |
---|
7692 | 7697 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
7693 | | - LA.matConcat(parentcam.toParent, matrix, matrix); |
---|
| 7698 | + LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
7694 | 7699 | |
---|
7695 | 7700 | // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix); |
---|
7696 | 7701 | |
---|
.. | .. |
---|
7706 | 7711 | |
---|
7707 | 7712 | if (renderCamera != lightCamera) |
---|
7708 | 7713 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
7709 | | - LA.matConcat(matrix, parentcam.fromParent, matrix); |
---|
| 7714 | + LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
7710 | 7715 | |
---|
7711 | 7716 | // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix); |
---|
7712 | 7717 | |
---|
.. | .. |
---|
8784 | 8789 | if (!IsFrozen()) |
---|
8785 | 8790 | { |
---|
8786 | 8791 | // dec 2012 |
---|
8787 | | - if (!(!flash && !lightMode && drawMode == DEFAULT && ANTIALIAS > 0)) |
---|
| 8792 | + if (!ambientOcclusion && !(!flash && !lightMode && drawMode == DEFAULT && ANTIALIAS > 0)) |
---|
8788 | 8793 | { |
---|
8789 | 8794 | framecount++; |
---|
8790 | 8795 | shadowbuffer.display(); |
---|
.. | .. |
---|
8912 | 8917 | // if (parentcam != renderCamera) // not a light |
---|
8913 | 8918 | if (cam != lightCamera) |
---|
8914 | 8919 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
8915 | | - LA.matConcat(parentcam.toParent, matrix, matrix); |
---|
| 8920 | + LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
8916 | 8921 | |
---|
8917 | 8922 | for (int j = 0; j < 4; j++) |
---|
8918 | 8923 | { |
---|
.. | .. |
---|
8927 | 8932 | // if (parentcam != renderCamera) // not a light |
---|
8928 | 8933 | if (cam != lightCamera) |
---|
8929 | 8934 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
8930 | | - LA.matConcat(matrix, parentcam.fromParent, matrix); |
---|
| 8935 | + LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
8931 | 8936 | |
---|
8932 | 8937 | //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix); |
---|
8933 | 8938 | |
---|
.. | .. |
---|
9089 | 9094 | //gl.glFrustum(-0.5*scale, 0.5*scale, -0.5*scale, 0.5*scale, 1, 100); |
---|
9090 | 9095 | //glu.gluPerspective(lightshaper_fovy, 1, lightshaper_zNear, lightshaper_zFar); |
---|
9091 | 9096 | double scale = lightCamera.SCALE / lightCamera.Distance(); |
---|
| 9097 | +// PATCH FILLE AUX JEANS |
---|
| 9098 | + //scale *= lightCamera.shaper_fovy / 25; |
---|
9092 | 9099 | gl.glScaled(2 * scale, 2 * scale, -scale); |
---|
9093 | 9100 | gl.glTranslated(0, 0, lightCamera.DECAL); |
---|
9094 | 9101 | |
---|
.. | .. |
---|
9228 | 9235 | { |
---|
9229 | 9236 | //glu.gluPerspective(lightshaper_fovy, 1, lightshaper_zNear, lightshaper_zFar); |
---|
9230 | 9237 | double scale = lightCamera.SCALE / lightCamera.Distance(); |
---|
| 9238 | +// PATCH FILLE AUX JEANS |
---|
| 9239 | + //scale *= lightCamera.shaper_fovy / 25; |
---|
9231 | 9240 | gl.glScaled(2 * scale, 2 * scale, -scale); |
---|
9232 | 9241 | gl.glTranslated(0, 0, lightCamera.DECAL); |
---|
9233 | 9242 | //System.out.println("DECAL = " + LIGHTDECAL + "; SCALE = " + LIGHTSCALE); |
---|
.. | .. |
---|
9379 | 9388 | |
---|
9380 | 9389 | gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 63, options2, 0); |
---|
9381 | 9390 | gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 62, options3, 0); |
---|
| 9391 | + gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 61, options4, 0); |
---|
9382 | 9392 | |
---|
9383 | 9393 | options2[0] *= renderCamera.Distance(); |
---|
9384 | 9394 | |
---|
.. | .. |
---|
9750 | 9760 | selectedpoint.radius = radius; |
---|
9751 | 9761 | selectedpoint.recalculate(); |
---|
9752 | 9762 | selectedpoint.material = new cMaterial(); |
---|
9753 | | - selectedpoint.material.color = 0.25f; |
---|
| 9763 | + selectedpoint.material.color = 0.15f; // Yellow |
---|
9754 | 9764 | selectedpoint.material.modulation = 0.75f; |
---|
9755 | 9765 | |
---|
9756 | | - debugpoint.radius = radius; |
---|
9757 | | - debugpoint.recalculate(); |
---|
9758 | | - debugpoint.material = new cMaterial(); |
---|
9759 | | - debugpoint.material.color = 0.25f; |
---|
9760 | | - debugpoint.material.modulation = 0.75f; |
---|
| 9766 | + debugpointG.radius = radius; |
---|
| 9767 | + debugpointG.recalculate(); |
---|
| 9768 | + debugpointG.material = new cMaterial(); |
---|
| 9769 | + debugpointG.material.color = 0.25f; // Green |
---|
| 9770 | + debugpointG.material.modulation = 0.75f; |
---|
9761 | 9771 | |
---|
9762 | | - debugpoint2.radius = radius; |
---|
9763 | | - debugpoint2.recalculate(); |
---|
9764 | | - debugpoint2.material = new cMaterial(); |
---|
9765 | | - debugpoint2.material.color = 0.75f; |
---|
9766 | | - debugpoint2.material.modulation = 0.75f; |
---|
| 9772 | + debugpointP.radius = radius; |
---|
| 9773 | + debugpointP.recalculate(); |
---|
| 9774 | + debugpointP.material = new cMaterial(); |
---|
| 9775 | + debugpointP.material.color = 0.75f; // Purple |
---|
| 9776 | + debugpointP.material.modulation = 0.75f; |
---|
9767 | 9777 | |
---|
9768 | | - debugpoint3.radius = radius; |
---|
9769 | | - debugpoint3.recalculate(); |
---|
9770 | | - debugpoint3.material = new cMaterial(); |
---|
9771 | | - debugpoint3.material.color = 0.5f; |
---|
9772 | | - debugpoint3.material.modulation = 0.75f; |
---|
| 9778 | + debugpointC.radius = radius; |
---|
| 9779 | + debugpointC.recalculate(); |
---|
| 9780 | + debugpointC.material = new cMaterial(); |
---|
| 9781 | + debugpointC.material.color = 0.5f; // Cyan |
---|
| 9782 | + debugpointC.material.modulation = 0.75f; |
---|
9773 | 9783 | |
---|
9774 | | - debugpoint4.radius = radius; |
---|
9775 | | - debugpoint4.recalculate(); |
---|
9776 | | - debugpoint4.material = new cMaterial(); |
---|
9777 | | - debugpoint4.material.color = 0f; |
---|
9778 | | - debugpoint4.material.modulation = 0.75f; |
---|
| 9784 | + debugpointR.radius = radius; |
---|
| 9785 | + debugpointR.recalculate(); |
---|
| 9786 | + debugpointR.material = new cMaterial(); |
---|
| 9787 | + debugpointR.material.color = 0f; // Red |
---|
| 9788 | + debugpointR.material.modulation = 0.75f; |
---|
9779 | 9789 | |
---|
9780 | 9790 | InitPoints(radius); |
---|
9781 | 9791 | } |
---|
9782 | 9792 | selectedpoint.draw(this, /*(Composite)*/ null, false, false); |
---|
9783 | | - debugpoint.draw(this, /*(Composite)*/ null, false,false); |
---|
9784 | | - debugpoint2.draw(this, /*(Composite)*/ null, false,false); |
---|
9785 | | - debugpoint3.draw(this, /*(Composite)*/ null, false,false); |
---|
9786 | | - debugpoint4.draw(this, /*(Composite)*/ null, false,false); |
---|
| 9793 | + debugpointG.draw(this, /*(Composite)*/ null, false,false); |
---|
| 9794 | + debugpointP.draw(this, /*(Composite)*/ null, false,false); |
---|
| 9795 | + debugpointC.draw(this, /*(Composite)*/ null, false,false); |
---|
| 9796 | + debugpointR.draw(this, /*(Composite)*/ null, false,false); |
---|
9787 | 9797 | // DrawPoints(this); |
---|
9788 | 9798 | } |
---|
9789 | 9799 | |
---|
.. | .. |
---|
9821 | 9831 | |
---|
9822 | 9832 | if (checker != null && drawMode == DEFAULT) |
---|
9823 | 9833 | { |
---|
9824 | | - // BindTexture(IMMORTAL_TEXTURE); |
---|
| 9834 | + //BindTexture(IMMORTAL_TEXTURE); |
---|
| 9835 | + BindTextures(checker.GetTextures(), checker.texres); |
---|
9825 | 9836 | // NEAREST |
---|
9826 | 9837 | GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR); |
---|
9827 | 9838 | DrawChecker(gl); |
---|
9828 | 9839 | //checker.Draw(this, null, false); |
---|
9829 | 9840 | // ReleaseTexture(IMMORTAL_TEXTURE); |
---|
| 9841 | + ReleaseTextures(checker.GetTextures()); |
---|
9830 | 9842 | } |
---|
9831 | 9843 | |
---|
9832 | 9844 | if (object.parent != null) |
---|
.. | .. |
---|
10357 | 10369 | "PARAM params6 = program.env[6];" + // bump, noise, borderfade, fog punchthrough |
---|
10358 | 10370 | "PARAM params7 = program.env[7];" + // noise power, opacity power |
---|
10359 | 10371 | "PARAM options0 = program.env[63];" + // fog density, intensity, elevation |
---|
10360 | | - "PARAM options1 = program.env[62];" + // fog rgb color, image intensity |
---|
| 10372 | + "PARAM options1 = program.env[62];" + // fog rgb color |
---|
| 10373 | + "PARAM options2 = program.env[61];" + // image intensity, subsurface, lightsheen |
---|
10361 | 10374 | "PARAM pointlight = program.env[127];" + // ... |
---|
10362 | 10375 | "PARAM zero = { 0.0, 0.0, 0.0, 0.0 };" + |
---|
10363 | 10376 | "PARAM halfhalf = { 0.25, 0.25, 0.25, 1.0 };" + |
---|
10364 | 10377 | "PARAM half = { 0.5, 0.5, 0.5, 1.0 };" + |
---|
| 10378 | + "PARAM threequarter = { 0.75, 0.75, 0.75, 1.0 };" + |
---|
10365 | 10379 | "PARAM two = { 2.0, 2.0, 2.0, 1.0 };" + |
---|
10366 | 10380 | "PARAM ten = { 10, 10, 10, 1.0 };" + |
---|
10367 | 10381 | "PARAM one3rd = { 0.5, 0.33333333333, 0.333333333, 1.0 };" + |
---|
.. | .. |
---|
10382 | 10396 | "PARAM lodbias = { 10,10,10,10 };" + // 20, -2, -20, 1.0 };" + |
---|
10383 | 10397 | "PARAM infinity = { 100000000, 100000000, 100000000, 1.0 };" + |
---|
10384 | 10398 | "PARAM one2048th = { 0.00048828125, 0.00048828125, 0.00048828125, 1.0 };" + |
---|
| 10399 | + "PARAM ninetenth = { 0.9, 0.9, 0.9, 1.0 };" + |
---|
10385 | 10400 | "PARAM almostone = { 0.999, 0.999, 0.999, 1.0 };" + |
---|
10386 | 10401 | "PARAM c256 = { 256, 256, 256, 1.0 };" + |
---|
10387 | 10402 | "PARAM c256i = { 0.00390625, 0.00390625, 0.00390625, 1.0 };" + |
---|
.. | .. |
---|
10422 | 10437 | "TEMP R1;" + |
---|
10423 | 10438 | "TEMP R2;" + |
---|
10424 | 10439 | "TEMP R3;" + |
---|
| 10440 | + "TEMP min;" + |
---|
| 10441 | + "TEMP max;" + |
---|
| 10442 | + "TEMP average;" + |
---|
| 10443 | + "TEMP saturation;" + |
---|
10425 | 10444 | "TEMP keep1;" + |
---|
10426 | 10445 | "TEMP keep2;" + |
---|
10427 | 10446 | "TEMP keep3;" + |
---|
.. | .. |
---|
10952 | 10971 | |
---|
10953 | 10972 | // skin? |
---|
10954 | 10973 | // Saturation for skin |
---|
10955 | | - /**/ // c'est ici |
---|
10956 | | - (Skinshader? "DP3 temp.x, final,one;" + |
---|
| 10974 | + /**/ |
---|
| 10975 | + (Skinshader? |
---|
| 10976 | + "DP3 average.x, final,one;" + |
---|
| 10977 | + "MUL average, one3rd.xxxx,average.xxxx;" + |
---|
| 10978 | + |
---|
| 10979 | + "MIN min.x, final.x,final.y;" + |
---|
| 10980 | + "MIN min.x, min.x,final.z;" + |
---|
| 10981 | + |
---|
| 10982 | + "MAX max.x, final.x,final.y;" + |
---|
| 10983 | + "MAX max.x, max.x,final.z;" + |
---|
| 10984 | + "MOV max, max.xxxx;" + |
---|
| 10985 | + |
---|
| 10986 | + "SUB saturation, max, final;" + |
---|
| 10987 | + |
---|
| 10988 | + "ADD temp.x, max.x, one10th.x;" + |
---|
| 10989 | + "RCP temp.x, temp.x;" + |
---|
| 10990 | + "MUL temp.x, temp.x, half.x;" + |
---|
| 10991 | + "MUL saturation, saturation, temp.xxxx;" + |
---|
| 10992 | + |
---|
| 10993 | + "DP3 ndotl.x, normald, light;" + |
---|
| 10994 | + "MAX ndotl.x, ndotl.x, -ndotl.x;" + |
---|
| 10995 | + |
---|
| 10996 | + "SUB temp.x, one.x, ndotl.x;" + |
---|
| 10997 | + "ADD temp.x, temp.x, options2.z;" + // lightsheen |
---|
| 10998 | + "ADD temp.y, one.y, options2.y;" + // sursurface |
---|
| 10999 | + "MUL temp.x, temp.x, temp.y;" + |
---|
| 11000 | + |
---|
| 11001 | + "MUL saturation, saturation, temp.xxxx;" + |
---|
| 11002 | + "SUB_SAT temp, max, saturation;" + |
---|
| 11003 | +/** |
---|
| 11004 | + "DP3 temp.x, final,one;" + |
---|
10957 | 11005 | "MUL R2, one3rd.xxxx,temp.xxxx;" + |
---|
10958 | | - "SUB temp, final,R2;" + |
---|
| 11006 | + "SUB temp, final, R2;" + |
---|
| 11007 | + |
---|
10959 | 11008 | // using light angle |
---|
10960 | 11009 | "DP3 ndotl.x, normald,light;" + |
---|
10961 | 11010 | //"SLT ndotl.y, ndotl.x, zero.x;" + |
---|
.. | .. |
---|
10968 | 11017 | // using light intensity |
---|
10969 | 11018 | "MOV ndotl.z, R2.x;" + |
---|
10970 | 11019 | "MUL ndotl.z, ndotl.z, ndotl.z;" + // tuning... |
---|
10971 | | - |
---|
10972 | 11020 | // june 2014 |
---|
10973 | 11021 | "MAD R1.x, ndotl.z,slope.y,one.x;" + |
---|
10974 | 11022 | // "SUB ndotl.x, one.x, ndotl.x;" + |
---|
.. | .. |
---|
10980 | 11028 | //"MUL R2.y, shadow.x,R2.y;" + // avril 2014 |
---|
10981 | 11029 | |
---|
10982 | 11030 | "MAD temp.x, R2.y, ndotl.y, temp.x;" + // red shift (skin) |
---|
| 11031 | +/**/ |
---|
10983 | 11032 | |
---|
10984 | 11033 | // "ADD final, R2,temp;" + |
---|
10985 | 11034 | "MOV final, temp;" |
---|
.. | .. |
---|
11069 | 11118 | /**/ |
---|
11070 | 11119 | // HDR |
---|
11071 | 11120 | "MOV temp.z, final.a;" + |
---|
11072 | | - "MUL final, final,options1.w;" + |
---|
| 11121 | + "MUL final, final,options2.x;" + |
---|
11073 | 11122 | "MOV final.a, temp.z;" + |
---|
11074 | 11123 | /**/ |
---|
11075 | 11124 | |
---|
.. | .. |
---|
11262 | 11311 | String Shadow(String depth, String shadow) |
---|
11263 | 11312 | { |
---|
11264 | 11313 | return "MAX temp.x, ndotl.x, one64th.x;" + |
---|
| 11314 | + "MIN temp.x, temp.x, ninetenth.x;" + |
---|
11265 | 11315 | /**/ |
---|
11266 | 11316 | // Sine |
---|
11267 | 11317 | "MUL temp.y, temp.x, temp.x;" + |
---|
.. | .. |
---|
12814 | 12864 | { |
---|
12815 | 12865 | mouseMode |= ZOOM; |
---|
12816 | 12866 | } |
---|
12817 | | - if ((modifiers & META) == META) |
---|
| 12867 | + |
---|
| 12868 | + boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
| 12869 | + if (capsLocked || (modifiers & META) == META) |
---|
12818 | 12870 | { |
---|
12819 | 12871 | mouseMode |= VR; // BACKFORTH; |
---|
12820 | 12872 | } |
---|
.. | .. |
---|
12828 | 12880 | } |
---|
12829 | 12881 | if ((modifiers & SHIFT) == SHIFT || forcetranslate) |
---|
12830 | 12882 | { |
---|
| 12883 | + mouseMode &= ~VR; |
---|
12831 | 12884 | mouseMode |= TRANSLATE; |
---|
12832 | 12885 | } |
---|
12833 | 12886 | // if ((modifiers & SHIFT_META) == SHIFT_META) |
---|
.. | .. |
---|
13217 | 13270 | FlipTransform(); |
---|
13218 | 13271 | break; |
---|
13219 | 13272 | case ENTER: |
---|
13220 | | - object.editWindow.ScreenFit(); // Edit(); |
---|
| 13273 | + // object.editWindow.ScreenFit(); // Edit(); |
---|
| 13274 | + ToggleLive(); |
---|
13221 | 13275 | break; |
---|
13222 | 13276 | case DELETE: |
---|
13223 | 13277 | ClearSelection(); |
---|
.. | .. |
---|
14394 | 14448 | gl.glPushAttrib(GL.GL_ALL_ATTRIB_BITS); |
---|
14395 | 14449 | gl.glPushMatrix(); |
---|
14396 | 14450 | gl.glLoadIdentity(); |
---|
14397 | | - PushMatrix(checker.toParent); |
---|
| 14451 | + //PushMatrix(checker.toParent); |
---|
14398 | 14452 | |
---|
14399 | 14453 | gl.glMatrixMode(GL.GL_TEXTURE); |
---|
14400 | 14454 | gl.glPushMatrix(); |
---|
.. | .. |
---|
14417 | 14471 | |
---|
14418 | 14472 | gl.glNormal3f(0.0f, 0.0f, 1.0f); |
---|
14419 | 14473 | |
---|
14420 | | - float step = 0.1666f; //0.25f; |
---|
14421 | | - float stepv = step * 1652 / 998; |
---|
| 14474 | + float step = 2; // 0.1666f; //0.25f; |
---|
| 14475 | + float stepv = 2; // step * 1652 / 998; |
---|
14422 | 14476 | |
---|
14423 | 14477 | int i0 = 0; |
---|
14424 | 14478 | /* |
---|
.. | .. |
---|
14488 | 14542 | |
---|
14489 | 14543 | //float u = (i+1)/2; |
---|
14490 | 14544 | //float v = (j+1)/2; |
---|
14491 | | - gl.glTexCoord2f((i + 1) / 2, (j + 1) / 2); // (1,0) // (i+1+step)/2,(j+1)/2); |
---|
| 14545 | + if (checker.flipV) |
---|
| 14546 | + gl.glTexCoord2f((i + 1) / 2, 1 - (j + 1) / 2); |
---|
| 14547 | + else |
---|
| 14548 | + gl.glTexCoord2f((i + 1) / 2, (j + 1) / 2); // (1,0) // (i+1+step)/2,(j+1)/2); |
---|
14492 | 14549 | gl.glVertex3f(i, j, -0.5f); |
---|
14493 | 14550 | |
---|
| 14551 | + if (checker.flipV) |
---|
| 14552 | + gl.glTexCoord2f((i + 1 + step) / 2, 1 - (j + 1) / 2); // (1,1) // (i+1+step)/2,(j+1+step)/2); |
---|
| 14553 | + else |
---|
14494 | 14554 | gl.glTexCoord2f((i + 1 + step) / 2, (j + 1) / 2); // (1,1) // (i+1+step)/2,(j+1+step)/2); |
---|
14495 | 14555 | gl.glVertex3f(i + step, j, -0.5f); |
---|
14496 | 14556 | |
---|
| 14557 | + if (checker.flipV) |
---|
| 14558 | + gl.glTexCoord2f((i + 1 + step) / 2, 1 - (j + 1 + stepv) / 2); // (0,1) //(i+1)/2,(j+1+step)/2); |
---|
| 14559 | + else |
---|
14497 | 14560 | gl.glTexCoord2f((i + 1 + step) / 2, (j + 1 + stepv) / 2); // (0,1) //(i+1)/2,(j+1+step)/2); |
---|
14498 | 14561 | gl.glVertex3f(i + step, j + stepv, -0.5f); |
---|
14499 | 14562 | |
---|
| 14563 | + if (checker.flipV) |
---|
| 14564 | + gl.glTexCoord2f((i + 1) / 2, 1 - (j + 1 + stepv) / 2); // (0,0) //(i+1)/2,(j+1)/2); |
---|
| 14565 | + else |
---|
14500 | 14566 | gl.glTexCoord2f((i + 1) / 2, (j + 1 + stepv) / 2); // (0,0) //(i+1)/2,(j+1)/2); |
---|
14501 | 14567 | gl.glVertex3f(i, j + stepv, -0.5f); |
---|
14502 | 14568 | } |
---|
.. | .. |
---|
14508 | 14574 | gl.glMatrixMode(GL.GL_PROJECTION); |
---|
14509 | 14575 | gl.glPopMatrix(); |
---|
14510 | 14576 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
14511 | | - PopMatrix(null); // checker.toParent); // null); |
---|
| 14577 | + //PopMatrix(null); // checker.toParent); // null); |
---|
14512 | 14578 | gl.glPopMatrix(); |
---|
14513 | 14579 | PopTextureMatrix(checker.toParent); |
---|
14514 | 14580 | gl.glMatrixMode(GL.GL_TEXTURE); |
---|
.. | .. |
---|
14677 | 14743 | // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]); |
---|
14678 | 14744 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
14679 | 14745 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
| 14746 | + |
---|
| 14747 | + // Will fit the mesh !!! |
---|
| 14748 | + selectedpoint.toParent[0][0] = 0.0001; |
---|
| 14749 | + selectedpoint.toParent[1][1] = 0.0001; |
---|
| 14750 | + selectedpoint.toParent[2][2] = 0.0001; |
---|
14680 | 14751 | |
---|
14681 | 14752 | glu.gluUnProject(x,y,depth,view,0,tempmat2,0,viewport,0,selectedpoint.toParent[3],0); |
---|
14682 | 14753 | |
---|
.. | .. |
---|
15066 | 15137 | gl.glFlush(); |
---|
15067 | 15138 | |
---|
15068 | 15139 | /**/ |
---|
15069 | | - gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_BGRA, GL.GL_UNSIGNED_INT_8_8_8_8_REV, occlusionsizebuffer); |
---|
| 15140 | + gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusionsizebuffer); |
---|
15070 | 15141 | |
---|
15071 | | - int[] pixels = occlusionsizebuffer.array(); |
---|
| 15142 | + float[] pixels = occlusionsizebuffer.array(); |
---|
15072 | 15143 | |
---|
15073 | 15144 | double r = 0, g = 0, b = 0; |
---|
15074 | 15145 | |
---|
15075 | 15146 | double count = 0; |
---|
| 15147 | + |
---|
| 15148 | + gl.glGetDoublev(gl.GL_PROJECTION_MATRIX, tempmat2, 0); |
---|
| 15149 | + |
---|
| 15150 | + float mindepth = 1; |
---|
| 15151 | + |
---|
| 15152 | + double FACTOR = 1; |
---|
15076 | 15153 | |
---|
15077 | 15154 | for (int i = 0; i < pixels.length; i++) |
---|
15078 | 15155 | { |
---|
.. | .. |
---|
15157 | 15234 | |
---|
15158 | 15235 | double scale = ray.z; // 1; // cos |
---|
15159 | 15236 | |
---|
15160 | | - int p = pixels[newindex]; |
---|
| 15237 | + float depth = pixels[newindex]; |
---|
15161 | 15238 | |
---|
15162 | 15239 | /* |
---|
15163 | 15240 | int newindex2 = (x + 1) * OCCLUSION_SIZE + y; |
---|
.. | .. |
---|
15181 | 15258 | scale = (1 - modu) * modv; |
---|
15182 | 15259 | */ |
---|
15183 | 15260 | |
---|
15184 | | - r += ((p >> 16) & 0xFF) * scale / 255; |
---|
15185 | | - g += ((p >> 8) & 0xFF) * scale / 255; |
---|
15186 | | - b += (p & 0xFF) * scale / 255; |
---|
| 15261 | + //r += ((p >> 16) & 0xFF) * scale / 255; |
---|
| 15262 | + //g += ((p >> 8) & 0xFF) * scale / 255; |
---|
| 15263 | + //b += (p & 0xFF) * scale / 255; |
---|
| 15264 | + |
---|
| 15265 | + if (mindepth > depth) |
---|
| 15266 | + { |
---|
| 15267 | + mindepth = depth; |
---|
| 15268 | + } |
---|
15187 | 15269 | |
---|
| 15270 | + double z_eye = tempmat2[3*4 + 2] / (depth * -2.0 + 1.0 - tempmat2[2*4 + 2]); |
---|
| 15271 | + |
---|
| 15272 | + double factor = 1 - Math.exp(-z_eye * z_eye / FACTOR); |
---|
| 15273 | + |
---|
| 15274 | + r += factor * scale; |
---|
| 15275 | + g += factor * scale; |
---|
| 15276 | + b += factor * scale; |
---|
| 15277 | + |
---|
15188 | 15278 | count += scale; |
---|
15189 | 15279 | } |
---|
15190 | 15280 | |
---|
.. | .. |
---|
15300 | 15390 | int AAbuffersize = 0; |
---|
15301 | 15391 | |
---|
15302 | 15392 | //double[] selectedpoint = new double[3]; |
---|
15303 | | - static Sphere selectedpoint = new Sphere(); |
---|
| 15393 | + static Superellipsoid selectedpoint = new Superellipsoid(); |
---|
15304 | 15394 | static Sphere previousselectedpoint = null; |
---|
15305 | | - static Sphere debugpoint = new Sphere(); |
---|
15306 | | - static Sphere debugpoint2 = new Sphere(); |
---|
15307 | | - static Sphere debugpoint3 = new Sphere(); |
---|
15308 | | - static Sphere debugpoint4 = new Sphere(); |
---|
| 15395 | + static Sphere debugpointG = new Sphere(); |
---|
| 15396 | + static Sphere debugpointP = new Sphere(); |
---|
| 15397 | + static Sphere debugpointC = new Sphere(); |
---|
| 15398 | + static Sphere debugpointR = new Sphere(); |
---|
15309 | 15399 | |
---|
15310 | 15400 | static Sphere debugpoints[] = new Sphere[8]; |
---|
15311 | 15401 | |
---|
.. | .. |
---|
15358 | 15448 | static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE); |
---|
15359 | 15449 | static IntBuffer selectsizebuffer = IntBuffer.allocate(SELECT_SIZE * SELECT_SIZE); |
---|
15360 | 15450 | static java.nio.FloatBuffer pointselectsizebuffer = java.nio.FloatBuffer.allocate(SELECT_SIZE * SELECT_SIZE); |
---|
15361 | | - static IntBuffer occlusionsizebuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); |
---|
| 15451 | + //static IntBuffer occlusionsizebuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); |
---|
| 15452 | + static java.nio.FloatBuffer occlusionsizebuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); |
---|
15362 | 15453 | static BufferedImage bufimage = new BufferedImage(TEX_SIZE, TEX_SIZE, BufferedImage.TYPE_INT_RGB); |
---|
15363 | 15454 | static BufferedImage textest = new cBufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); |
---|
15364 | 15455 | static java.util.Vector<BufferedImage> billboards = new java.util.Vector<BufferedImage>(); |
---|