Normand Briere
2018-12-15 6ed65dcb597fb2153cef75bf1845978f1115658c
CameraPane.java
....@@ -228,7 +228,7 @@
228228 void PushMatrix(double[][] matrix, int count)
229229 {
230230 matrixdepth++;
231
- // GraphreeD.tracein(matrix);
231
+ // GrafreeD.tracein(matrix);
232232 if (matrix == null)
233233 return; // Identity
234234
....@@ -253,13 +253,13 @@
253253
254254 void PushMatrix(double[][] matrix)
255255 {
256
- // GraphreeD.tracein(matrix);
256
+ // GrafreeD.tracein(matrix);
257257 PushMatrix(matrix,1);
258258 }
259259
260260 void PushMatrix()
261261 {
262
- // GraphreeD.tracein(null);
262
+ // GrafreeD.tracein(null);
263263 if (matrixdepth++ < MAXSTACK - 1)
264264 {
265265 currentGL.glPushMatrix();
....@@ -274,7 +274,7 @@
274274 {
275275 --matrixdepth;
276276
277
- // GraphreeD.traceout(inverse);
277
+ // GrafreeD.traceout(inverse);
278278 if (inverse == null)
279279 return; // Identity
280280
....@@ -292,7 +292,7 @@
292292
293293 void PopMatrix()
294294 {
295
- // GraphreeD.traceout(null);
295
+ // GrafreeD.traceout(null);
296296 // inverse == null??
297297 if (--matrixdepth < MAXSTACK - 1)
298298 {
....@@ -491,7 +491,7 @@
491491 System.err.println("LIVE = " + isLIVE());
492492
493493 if (!isLIVE()) // save sound
494
- GraphreeD.savesound = true; // wav.save();
494
+ GrafreeD.savesound = true; // wav.save();
495495 // else
496496 repaint(); // start loop // may 2013
497497 }
....@@ -2000,10 +2000,12 @@
20002000 */
20012001 TextureData ReduceTexture(TextureData texturedata, int resolution) // String name)
20022002 {
2003
+ int pixelformat = texturedata.getPixelFormat();
2004
+
20032005 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)
20052007 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)
20072009 stride = 4;
20082010
20092011 int width = texturedata.getWidth();
....@@ -6333,7 +6335,7 @@
63336335 {
63346336 bumpdepth--;
63356337
6336
- // GraphreeD.trace("POP " + tex + "(" + pigmentdepth + ")" + " : " + pigmentstack[pigmentdepth] + " vs " + texture);
6338
+ // GrafreeD.trace("POP " + tex + "(" + pigmentdepth + ")" + " : " + pigmentstack[pigmentdepth] + " vs " + texture);
63376339 if (bumpstack[bumpdepth] != (texture!=null?texture.texture:null))
63386340 {
63396341 // assert (bumpstack[bumpdepth] == texture);
....@@ -6363,7 +6365,7 @@
63636365 {
63646366 pigmentdepth--;
63656367
6366
- // GraphreeD.trace("POP " + tex + "(" + pigmentdepth + ")" + " : " + pigmentstack[pigmentdepth] + " vs " + texture);
6368
+ // GrafreeD.trace("POP " + tex + "(" + pigmentdepth + ")" + " : " + pigmentstack[pigmentdepth] + " vs " + texture);
63676369 if (pigmentstack[pigmentdepth] != (texture!=null?texture.texture:null))
63686370 {
63696371 // assert (pigmentstack[pigmentdepth] == texture);
....@@ -6694,12 +6696,12 @@
66946696
66956697 if (bump)
66966698 {
6697
- // GraphreeD.trace("PUSH BUMP " + tex + "(" + bumpdepth + ")" + " : " + texture);
6699
+ // GrafreeD.trace("PUSH BUMP " + tex + "(" + bumpdepth + ")" + " : " + texture);
66986700 bumpstack[bumpdepth++] = texture!=null?texture.texture:null;
66996701 }
67006702 else
67016703 {
6702
- // GraphreeD.trace("PUSH PIGMENT " + tex + "(" + pigmentdepth + ")" + " : " + texture);
6704
+ // GrafreeD.trace("PUSH PIGMENT " + tex + "(" + pigmentdepth + ")" + " : " + texture);
67036705 pigmentstack[pigmentdepth++] = texture!=null?texture.texture:null;
67046706 }
67056707
....@@ -7442,6 +7444,8 @@
74427444 //gl.glFrustum(-0.5*scale, 0.5*scale, -0.5*scale, 0.5*scale, 1, 100);
74437445 //glu.gluPerspective(lightshaper_fovy, 1, lightshaper_zNear, lightshaper_zFar);
74447446 double scale = lightCamera.SCALE / lightCamera.Distance();
7447
+// PATCH FILLE AUX JEANS
7448
+ //scale *= lightCamera.shaper_fovy / 25;
74457449 gl.glScaled(2 * scale, 2 * scale, -scale);
74467450 gl.glTranslated(0, 0, lightCamera.DECAL);
74477451
....@@ -7590,7 +7594,8 @@
75907594
75917595 float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
75927596 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
75947599
75957600 static int imagecount = 0; // movie generation
75967601
....@@ -7628,14 +7633,14 @@
76287633
76297634 //System.out.println("start frame");
76307635 gl.glClear(gl.GL_ACCUM_BUFFER_BIT);
7631
- for (jitter = 0; jitter < ACSIZE; jitter++) //, GraphreeD.wav.cursor += LIVE ? 735 : 0)
7636
+ for (jitter = 0; jitter < ACSIZE; jitter++) //, GrafreeD.wav.cursor += LIVE ? 735 : 0)
76327637 {
76337638 framecount++;
76347639
76357640 if (CameraPane.tickcount > 0)
76367641 CameraPane.tickcount--;
76377642
7638
-// GraphreeD.wav.cursor += 735; // 44100 Hz / 120 Hz * 2 (for 16 bits)
7643
+// GrafreeD.wav.cursor += 735; // 44100 Hz / 120 Hz * 2 (for 16 bits)
76397644 // restartframe = true;
76407645 if (options1[2] > 100 && (jitter%2==0))
76417646 {
....@@ -7690,7 +7695,7 @@
76907695
76917696 if (renderCamera != lightCamera)
76927697 for (int count = parentcam.GetTransformCount(); --count>=0;)
7693
- LA.matConcat(parentcam.toParent, matrix, matrix);
7698
+ LA.matConcat(matrix, parentcam.toParent, matrix);
76947699
76957700 // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix);
76967701
....@@ -7706,7 +7711,7 @@
77067711
77077712 if (renderCamera != lightCamera)
77087713 for (int count = parentcam.GetTransformCount(); --count>=0;)
7709
- LA.matConcat(matrix, parentcam.fromParent, matrix);
7714
+ LA.matConcat(parentcam.fromParent, matrix, matrix);
77107715
77117716 // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix);
77127717
....@@ -7923,7 +7928,7 @@
79237928
79247929 if (!BOXMODE)
79257930 {
7926
- System.out.println("image: " + fullname + " (" + (GraphreeD.wav.cursor / 735 / 4) + ")");
7931
+ System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")");
79277932 }
79287933
79297934 if (!BOXMODE)
....@@ -7951,7 +7956,7 @@
79517956 {
79527957 if (ACSIZE > 1)
79537958 {
7954
- // System.err.println("image #" + (GraphreeD.wav.cursor / 735 / 4));
7959
+ // System.err.println("image #" + (GrafreeD.wav.cursor / 735 / 4));
79557960 }
79567961 }
79577962
....@@ -7961,7 +7966,7 @@
79617966 ABORTED = false;
79627967 }
79637968 else
7964
- GraphreeD.wav.cursor += 735 * ACSIZE;
7969
+ GrafreeD.wav.cursor += 735 * ACSIZE;
79657970
79667971 if (false)
79677972 {
....@@ -8631,11 +8636,11 @@
86318636
86328637 public void display(GLAutoDrawable drawable)
86338638 {
8634
- if (GraphreeD.savesound && GraphreeD.hassound)
8639
+ if (GrafreeD.savesound && GrafreeD.hassound)
86358640 {
8636
- GraphreeD.wav.save();
8637
- GraphreeD.savesound = false;
8638
- GraphreeD.hassound = false;
8641
+ GrafreeD.wav.save();
8642
+ GrafreeD.savesound = false;
8643
+ GrafreeD.hassound = false;
86398644 }
86408645 // if (DEBUG_SELECTION)
86418646 // {
....@@ -8765,7 +8770,7 @@
87658770 Object3D theobject = object;
87668771 Object3D theparent = object.parent;
87678772 object.parent = null;
8768
- object = (Object3D)GraphreeD.clone(object);
8773
+ object = (Object3D)GrafreeD.clone(object);
87698774 object.Stripify();
87708775 if (theobject.selection == null || theobject.selection.Size() == 0)
87718776 theobject.PreprocessOcclusion(this);
....@@ -8784,7 +8789,7 @@
87848789 if (!IsFrozen())
87858790 {
87868791 // dec 2012
8787
- if (!(!flash && !lightMode && drawMode == DEFAULT && ANTIALIAS > 0))
8792
+ if (!ambientOcclusion && !(!flash && !lightMode && drawMode == DEFAULT && ANTIALIAS > 0))
87888793 {
87898794 framecount++;
87908795 shadowbuffer.display();
....@@ -8912,7 +8917,7 @@
89128917 // if (parentcam != renderCamera) // not a light
89138918 if (cam != lightCamera)
89148919 for (int count = parentcam.GetTransformCount(); --count>=0;)
8915
- LA.matConcat(parentcam.toParent, matrix, matrix);
8920
+ LA.matConcat(matrix, parentcam.toParent, matrix);
89168921
89178922 for (int j = 0; j < 4; j++)
89188923 {
....@@ -8927,7 +8932,7 @@
89278932 // if (parentcam != renderCamera) // not a light
89288933 if (cam != lightCamera)
89298934 for (int count = parentcam.GetTransformCount(); --count>=0;)
8930
- LA.matConcat(matrix, parentcam.fromParent, matrix);
8935
+ LA.matConcat(parentcam.fromParent, matrix, matrix);
89318936
89328937 //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix);
89338938
....@@ -9089,6 +9094,8 @@
90899094 //gl.glFrustum(-0.5*scale, 0.5*scale, -0.5*scale, 0.5*scale, 1, 100);
90909095 //glu.gluPerspective(lightshaper_fovy, 1, lightshaper_zNear, lightshaper_zFar);
90919096 double scale = lightCamera.SCALE / lightCamera.Distance();
9097
+// PATCH FILLE AUX JEANS
9098
+ //scale *= lightCamera.shaper_fovy / 25;
90929099 gl.glScaled(2 * scale, 2 * scale, -scale);
90939100 gl.glTranslated(0, 0, lightCamera.DECAL);
90949101
....@@ -9228,6 +9235,8 @@
92289235 {
92299236 //glu.gluPerspective(lightshaper_fovy, 1, lightshaper_zNear, lightshaper_zFar);
92309237 double scale = lightCamera.SCALE / lightCamera.Distance();
9238
+// PATCH FILLE AUX JEANS
9239
+ //scale *= lightCamera.shaper_fovy / 25;
92319240 gl.glScaled(2 * scale, 2 * scale, -scale);
92329241 gl.glTranslated(0, 0, lightCamera.DECAL);
92339242 //System.out.println("DECAL = " + LIGHTDECAL + "; SCALE = " + LIGHTSCALE);
....@@ -9379,6 +9388,7 @@
93799388
93809389 gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 63, options2, 0);
93819390 gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 62, options3, 0);
9391
+ gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 61, options4, 0);
93829392
93839393 options2[0] *= renderCamera.Distance();
93849394
....@@ -9660,8 +9670,8 @@
96609670 e.printStackTrace();
96619671 }
96629672
9663
- if (GraphreeD.RENDERME > 0)
9664
- GraphreeD.RENDERME--; // mechante magouille
9673
+ if (GrafreeD.RENDERME > 0)
9674
+ GrafreeD.RENDERME--; // mechante magouille
96659675
96669676 ONESTEP = false;
96679677 }
....@@ -9734,7 +9744,7 @@
97349744 BindTextures(DEFAULT_TEXTURES, 2);
97359745 }
97369746 //System.out.println("--> " + stackdepth);
9737
-// GraphreeD.traceon();
9747
+// GrafreeD.traceon();
97389748
97399749 // DRAW
97409750 object.draw(this, /*(Composite)*/ object, false, false);
....@@ -9750,32 +9760,46 @@
97509760 selectedpoint.radius = radius;
97519761 selectedpoint.recalculate();
97529762 selectedpoint.material = new cMaterial();
9753
- selectedpoint.material.color = 0.25f;
9763
+ selectedpoint.material.color = 0.15f; // Yellow
97549764 selectedpoint.material.modulation = 0.75f;
97559765
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;
97619771
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;
9777
+
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;
9783
+
9784
+ debugpointR.radius = radius;
9785
+ debugpointR.recalculate();
9786
+ debugpointR.material = new cMaterial();
9787
+ debugpointR.material.color = 0f; // Red
9788
+ debugpointR.material.modulation = 0.75f;
97679789
97689790 InitPoints(radius);
97699791 }
97709792 selectedpoint.draw(this, /*(Composite)*/ null, false, false);
9771
- //debugpoint.draw(this, /*(Composite)*/ null, false);
9772
- //debugpoint2.draw(this, /*(Composite)*/ null, false);
9773
- DrawPoints(this);
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);
9797
+ // DrawPoints(this);
97749798 }
97759799
97769800 // debugstuff.draw(this, /*(Composite)*/ null, false);
97779801 }
9778
-// GraphreeD.traceoff();
9802
+// GrafreeD.traceoff();
97799803 //System.out.println(stackdepth);
97809804 if (drawMode == 0)
97819805 {
....@@ -9807,12 +9831,14 @@
98079831
98089832 if (checker != null && drawMode == DEFAULT)
98099833 {
9810
- // BindTexture(IMMORTAL_TEXTURE);
9834
+ //BindTexture(IMMORTAL_TEXTURE);
9835
+ BindTextures(checker.GetTextures(), checker.texres);
98119836 // NEAREST
98129837 GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR);
98139838 DrawChecker(gl);
98149839 //checker.Draw(this, null, false);
98159840 // ReleaseTexture(IMMORTAL_TEXTURE);
9841
+ ReleaseTextures(checker.GetTextures());
98169842 }
98179843
98189844 if (object.parent != null)
....@@ -10343,11 +10369,13 @@
1034310369 "PARAM params6 = program.env[6];" + // bump, noise, borderfade, fog punchthrough
1034410370 "PARAM params7 = program.env[7];" + // noise power, opacity power
1034510371 "PARAM options0 = program.env[63];" + // fog density, intensity, elevation
10346
- "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
1034710374 "PARAM pointlight = program.env[127];" + // ...
1034810375 "PARAM zero = { 0.0, 0.0, 0.0, 0.0 };" +
1034910376 "PARAM halfhalf = { 0.25, 0.25, 0.25, 1.0 };" +
1035010377 "PARAM half = { 0.5, 0.5, 0.5, 1.0 };" +
10378
+ "PARAM threequarter = { 0.75, 0.75, 0.75, 1.0 };" +
1035110379 "PARAM two = { 2.0, 2.0, 2.0, 1.0 };" +
1035210380 "PARAM ten = { 10, 10, 10, 1.0 };" +
1035310381 "PARAM one3rd = { 0.5, 0.33333333333, 0.333333333, 1.0 };" +
....@@ -10368,6 +10396,7 @@
1036810396 "PARAM lodbias = { 10,10,10,10 };" + // 20, -2, -20, 1.0 };" +
1036910397 "PARAM infinity = { 100000000, 100000000, 100000000, 1.0 };" +
1037010398 "PARAM one2048th = { 0.00048828125, 0.00048828125, 0.00048828125, 1.0 };" +
10399
+ "PARAM ninetenth = { 0.9, 0.9, 0.9, 1.0 };" +
1037110400 "PARAM almostone = { 0.999, 0.999, 0.999, 1.0 };" +
1037210401 "PARAM c256 = { 256, 256, 256, 1.0 };" +
1037310402 "PARAM c256i = { 0.00390625, 0.00390625, 0.00390625, 1.0 };" +
....@@ -10408,6 +10437,10 @@
1040810437 "TEMP R1;" +
1040910438 "TEMP R2;" +
1041010439 "TEMP R3;" +
10440
+ "TEMP min;" +
10441
+ "TEMP max;" +
10442
+ "TEMP average;" +
10443
+ "TEMP saturation;" +
1041110444 "TEMP keep1;" +
1041210445 "TEMP keep2;" +
1041310446 "TEMP keep3;" +
....@@ -10938,10 +10971,40 @@
1093810971
1093910972 // skin?
1094010973 // Saturation for skin
10941
- /**/ // c'est ici
10942
- (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;" +
1094311005 "MUL R2, one3rd.xxxx,temp.xxxx;" +
10944
- "SUB temp, final,R2;" +
11006
+ "SUB temp, final, R2;" +
11007
+
1094511008 // using light angle
1094611009 "DP3 ndotl.x, normald,light;" +
1094711010 //"SLT ndotl.y, ndotl.x, zero.x;" +
....@@ -10954,7 +11017,6 @@
1095411017 // using light intensity
1095511018 "MOV ndotl.z, R2.x;" +
1095611019 "MUL ndotl.z, ndotl.z, ndotl.z;" + // tuning...
10957
-
1095811020 // june 2014
1095911021 "MAD R1.x, ndotl.z,slope.y,one.x;" +
1096011022 // "SUB ndotl.x, one.x, ndotl.x;" +
....@@ -10966,6 +11028,7 @@
1096611028 //"MUL R2.y, shadow.x,R2.y;" + // avril 2014
1096711029
1096811030 "MAD temp.x, R2.y, ndotl.y, temp.x;" + // red shift (skin)
11031
+/**/
1096911032
1097011033 // "ADD final, R2,temp;" +
1097111034 "MOV final, temp;"
....@@ -11055,7 +11118,7 @@
1105511118 /**/
1105611119 // HDR
1105711120 "MOV temp.z, final.a;" +
11058
- "MUL final, final,options1.w;" +
11121
+ "MUL final, final,options2.x;" +
1105911122 "MOV final.a, temp.z;" +
1106011123 /**/
1106111124
....@@ -11092,10 +11155,17 @@
1109211155 "MOV final.z, zero.x;" +
1109311156 "MOV final.a, one.w;":""
1109411157 ) +
11158
+ /*
1109511159 (NORMALdebug?"MOV final.x, normal.x;" +
1109611160 "MOV final.y, normal.y;" +
1109711161 "MOV final.z, normal.z;" +
1109811162 "MOV final.a, one.w;":""
11163
+ ) +
11164
+ */
11165
+ (NORMALdebug?"SUB final.x, one.x, final.x;" +
11166
+ "SUB final.y, one.x, final.y;" +
11167
+ "SUB final.z, one.x, final.z;" +
11168
+ "MOV final.a, final.a;":""
1109911169 ) +
1110011170 // "MOV final, bumpmap;" +
1110111171 "MOV result.color, final;" +
....@@ -11241,6 +11311,7 @@
1124111311 String Shadow(String depth, String shadow)
1124211312 {
1124311313 return "MAX temp.x, ndotl.x, one64th.x;" +
11314
+ "MIN temp.x, temp.x, ninetenth.x;" +
1124411315 /**/
1124511316 // Sine
1124611317 "MUL temp.y, temp.x, temp.x;" +
....@@ -12793,7 +12864,9 @@
1279312864 {
1279412865 mouseMode |= ZOOM;
1279512866 }
12796
- if ((modifiers & META) == META)
12867
+
12868
+ boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
12869
+ if (capsLocked || (modifiers & META) == META)
1279712870 {
1279812871 mouseMode |= VR; // BACKFORTH;
1279912872 }
....@@ -12807,6 +12880,7 @@
1280712880 }
1280812881 if ((modifiers & SHIFT) == SHIFT || forcetranslate)
1280912882 {
12883
+ mouseMode &= ~VR;
1281012884 mouseMode |= TRANSLATE;
1281112885 }
1281212886 // if ((modifiers & SHIFT_META) == SHIFT_META)
....@@ -13196,7 +13270,8 @@
1319613270 FlipTransform();
1319713271 break;
1319813272 case ENTER:
13199
- object.editWindow.ScreenFit(); // Edit();
13273
+ // object.editWindow.ScreenFit(); // Edit();
13274
+ ToggleLive();
1320013275 break;
1320113276 case DELETE:
1320213277 ClearSelection();
....@@ -14373,7 +14448,7 @@
1437314448 gl.glPushAttrib(GL.GL_ALL_ATTRIB_BITS);
1437414449 gl.glPushMatrix();
1437514450 gl.glLoadIdentity();
14376
- PushMatrix(checker.toParent);
14451
+ //PushMatrix(checker.toParent);
1437714452
1437814453 gl.glMatrixMode(GL.GL_TEXTURE);
1437914454 gl.glPushMatrix();
....@@ -14396,8 +14471,8 @@
1439614471
1439714472 gl.glNormal3f(0.0f, 0.0f, 1.0f);
1439814473
14399
- float step = 0.1666f; //0.25f;
14400
- float stepv = step * 1652 / 998;
14474
+ float step = 2; // 0.1666f; //0.25f;
14475
+ float stepv = 2; // step * 1652 / 998;
1440114476
1440214477 int i0 = 0;
1440314478 /*
....@@ -14467,15 +14542,27 @@
1446714542
1446814543 //float u = (i+1)/2;
1446914544 //float v = (j+1)/2;
14470
- 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);
1447114549 gl.glVertex3f(i, j, -0.5f);
1447214550
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
1447314554 gl.glTexCoord2f((i + 1 + step) / 2, (j + 1) / 2); // (1,1) // (i+1+step)/2,(j+1+step)/2);
1447414555 gl.glVertex3f(i + step, j, -0.5f);
1447514556
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
1447614560 gl.glTexCoord2f((i + 1 + step) / 2, (j + 1 + stepv) / 2); // (0,1) //(i+1)/2,(j+1+step)/2);
1447714561 gl.glVertex3f(i + step, j + stepv, -0.5f);
1447814562
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
1447914566 gl.glTexCoord2f((i + 1) / 2, (j + 1 + stepv) / 2); // (0,0) //(i+1)/2,(j+1)/2);
1448014567 gl.glVertex3f(i, j + stepv, -0.5f);
1448114568 }
....@@ -14487,7 +14574,7 @@
1448714574 gl.glMatrixMode(GL.GL_PROJECTION);
1448814575 gl.glPopMatrix();
1448914576 gl.glMatrixMode(GL.GL_MODELVIEW);
14490
- PopMatrix(null); // checker.toParent); // null);
14577
+ //PopMatrix(null); // checker.toParent); // null);
1449114578 gl.glPopMatrix();
1449214579 PopTextureMatrix(checker.toParent);
1449314580 gl.glMatrixMode(GL.GL_TEXTURE);
....@@ -14657,6 +14744,11 @@
1465714744 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1465814745 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
1465914746
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;
14751
+
1466014752 glu.gluUnProject(x,y,depth,view,0,tempmat2,0,viewport,0,selectedpoint.toParent[3],0);
1466114753
1466214754 // if (object.selection != null && object.selection.Size() > 0)
....@@ -14700,16 +14792,16 @@
1470014792 System.out.println("; fromto " + sel + " " + Trunk(previousselectedpoint.toParent[3][0]) + " " + Trunk(previousselectedpoint.toParent[3][2]) + " " + Trunk(selectedpoint.toParent[3][0]) + " " + Trunk(selectedpoint.toParent[3][2]));
1470114793 }
1470214794
14703
- previousselectedpoint = (Sphere) GraphreeD.clone(selectedpoint);
14795
+ previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
1470414796 }
1470514797 }
1470614798
1470714799 if (!movingcamera && !PAINTMODE)
1470814800 object.editWindow.ScreenFitPoint(); // fev 2014
1470914801
14710
- if (PAINTMODE && GraphreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
14802
+ if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1471114803 {
14712
- Object3D paintobj = GraphreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
14804
+ Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1471314805
1471414806 Object3D group = new Object3D("inst" + paintcount++);
1471514807
....@@ -15045,13 +15137,19 @@
1504515137 gl.glFlush();
1504615138
1504715139 /**/
15048
- 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);
1504915141
15050
- int[] pixels = occlusionsizebuffer.array();
15142
+ float[] pixels = occlusionsizebuffer.array();
1505115143
1505215144 double r = 0, g = 0, b = 0;
1505315145
1505415146 double count = 0;
15147
+
15148
+ gl.glGetDoublev(gl.GL_PROJECTION_MATRIX, tempmat2, 0);
15149
+
15150
+ float mindepth = 1;
15151
+
15152
+ double FACTOR = 1;
1505515153
1505615154 for (int i = 0; i < pixels.length; i++)
1505715155 {
....@@ -15136,7 +15234,7 @@
1513615234
1513715235 double scale = ray.z; // 1; // cos
1513815236
15139
- int p = pixels[newindex];
15237
+ float depth = pixels[newindex];
1514015238
1514115239 /*
1514215240 int newindex2 = (x + 1) * OCCLUSION_SIZE + y;
....@@ -15160,10 +15258,23 @@
1516015258 scale = (1 - modu) * modv;
1516115259 */
1516215260
15163
- r += ((p >> 16) & 0xFF) * scale / 255;
15164
- g += ((p >> 8) & 0xFF) * scale / 255;
15165
- 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
+ }
1516615269
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
+
1516715278 count += scale;
1516815279 }
1516915280
....@@ -15279,10 +15390,12 @@
1527915390 int AAbuffersize = 0;
1528015391
1528115392 //double[] selectedpoint = new double[3];
15282
- static Sphere selectedpoint = new Sphere();
15393
+ static Superellipsoid selectedpoint = new Superellipsoid();
1528315394 static Sphere previousselectedpoint = null;
15284
- static Sphere debugpoint = new Sphere();
15285
- static Sphere debugpoint2 = 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();
1528615399
1528715400 static Sphere debugpoints[] = new Sphere[8];
1528815401
....@@ -15335,7 +15448,8 @@
1533515448 static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE);
1533615449 static IntBuffer selectsizebuffer = IntBuffer.allocate(SELECT_SIZE * SELECT_SIZE);
1533715450 static java.nio.FloatBuffer pointselectsizebuffer = java.nio.FloatBuffer.allocate(SELECT_SIZE * SELECT_SIZE);
15338
- 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);
1533915453 static BufferedImage bufimage = new BufferedImage(TEX_SIZE, TEX_SIZE, BufferedImage.TYPE_INT_RGB);
1534015454 static BufferedImage textest = new cBufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
1534115455 static java.util.Vector<BufferedImage> billboards = new java.util.Vector<BufferedImage>();