Normand Briere
2018-07-03 02e145cb923d601395acc7f15ae9e13f85ef2fbb
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
....@@ -7590,7 +7592,8 @@
75907592
75917593 float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
75927594 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
75947597
75957598 static int imagecount = 0; // movie generation
75967599
....@@ -7628,14 +7631,14 @@
76287631
76297632 //System.out.println("start frame");
76307633 gl.glClear(gl.GL_ACCUM_BUFFER_BIT);
7631
- for (jitter = 0; jitter < ACSIZE; jitter++) //, GraphreeD.wav.cursor += LIVE ? 735 : 0)
7634
+ for (jitter = 0; jitter < ACSIZE; jitter++) //, GrafreeD.wav.cursor += LIVE ? 735 : 0)
76327635 {
76337636 framecount++;
76347637
76357638 if (CameraPane.tickcount > 0)
76367639 CameraPane.tickcount--;
76377640
7638
-// GraphreeD.wav.cursor += 735; // 44100 Hz / 120 Hz * 2 (for 16 bits)
7641
+// GrafreeD.wav.cursor += 735; // 44100 Hz / 120 Hz * 2 (for 16 bits)
76397642 // restartframe = true;
76407643 if (options1[2] > 100 && (jitter%2==0))
76417644 {
....@@ -7690,7 +7693,7 @@
76907693
76917694 if (renderCamera != lightCamera)
76927695 for (int count = parentcam.GetTransformCount(); --count>=0;)
7693
- LA.matConcat(parentcam.toParent, matrix, matrix);
7696
+ LA.matConcat(matrix, parentcam.toParent, matrix);
76947697
76957698 // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix);
76967699
....@@ -7706,7 +7709,7 @@
77067709
77077710 if (renderCamera != lightCamera)
77087711 for (int count = parentcam.GetTransformCount(); --count>=0;)
7709
- LA.matConcat(matrix, parentcam.fromParent, matrix);
7712
+ LA.matConcat(parentcam.fromParent, matrix, matrix);
77107713
77117714 // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix);
77127715
....@@ -7923,7 +7926,7 @@
79237926
79247927 if (!BOXMODE)
79257928 {
7926
- System.out.println("image: " + fullname + " (" + (GraphreeD.wav.cursor / 735 / 4) + ")");
7929
+ System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")");
79277930 }
79287931
79297932 if (!BOXMODE)
....@@ -7951,7 +7954,7 @@
79517954 {
79527955 if (ACSIZE > 1)
79537956 {
7954
- // System.err.println("image #" + (GraphreeD.wav.cursor / 735 / 4));
7957
+ // System.err.println("image #" + (GrafreeD.wav.cursor / 735 / 4));
79557958 }
79567959 }
79577960
....@@ -7961,7 +7964,7 @@
79617964 ABORTED = false;
79627965 }
79637966 else
7964
- GraphreeD.wav.cursor += 735 * ACSIZE;
7967
+ GrafreeD.wav.cursor += 735 * ACSIZE;
79657968
79667969 if (false)
79677970 {
....@@ -8631,11 +8634,11 @@
86318634
86328635 public void display(GLAutoDrawable drawable)
86338636 {
8634
- if (GraphreeD.savesound && GraphreeD.hassound)
8637
+ if (GrafreeD.savesound && GrafreeD.hassound)
86358638 {
8636
- GraphreeD.wav.save();
8637
- GraphreeD.savesound = false;
8638
- GraphreeD.hassound = false;
8639
+ GrafreeD.wav.save();
8640
+ GrafreeD.savesound = false;
8641
+ GrafreeD.hassound = false;
86398642 }
86408643 // if (DEBUG_SELECTION)
86418644 // {
....@@ -8765,7 +8768,7 @@
87658768 Object3D theobject = object;
87668769 Object3D theparent = object.parent;
87678770 object.parent = null;
8768
- object = (Object3D)GraphreeD.clone(object);
8771
+ object = (Object3D)GrafreeD.clone(object);
87698772 object.Stripify();
87708773 if (theobject.selection == null || theobject.selection.Size() == 0)
87718774 theobject.PreprocessOcclusion(this);
....@@ -8784,7 +8787,7 @@
87848787 if (!IsFrozen())
87858788 {
87868789 // dec 2012
8787
- if (!(!flash && !lightMode && drawMode == DEFAULT && ANTIALIAS > 0))
8790
+ if (!ambientOcclusion && !(!flash && !lightMode && drawMode == DEFAULT && ANTIALIAS > 0))
87888791 {
87898792 framecount++;
87908793 shadowbuffer.display();
....@@ -8912,7 +8915,7 @@
89128915 // if (parentcam != renderCamera) // not a light
89138916 if (cam != lightCamera)
89148917 for (int count = parentcam.GetTransformCount(); --count>=0;)
8915
- LA.matConcat(parentcam.toParent, matrix, matrix);
8918
+ LA.matConcat(matrix, parentcam.toParent, matrix);
89168919
89178920 for (int j = 0; j < 4; j++)
89188921 {
....@@ -8927,7 +8930,7 @@
89278930 // if (parentcam != renderCamera) // not a light
89288931 if (cam != lightCamera)
89298932 for (int count = parentcam.GetTransformCount(); --count>=0;)
8930
- LA.matConcat(matrix, parentcam.fromParent, matrix);
8933
+ LA.matConcat(parentcam.fromParent, matrix, matrix);
89318934
89328935 //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix);
89338936
....@@ -9379,6 +9382,7 @@
93799382
93809383 gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 63, options2, 0);
93819384 gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 62, options3, 0);
9385
+ gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 61, options4, 0);
93829386
93839387 options2[0] *= renderCamera.Distance();
93849388
....@@ -9660,8 +9664,8 @@
96609664 e.printStackTrace();
96619665 }
96629666
9663
- if (GraphreeD.RENDERME > 0)
9664
- GraphreeD.RENDERME--; // mechante magouille
9667
+ if (GrafreeD.RENDERME > 0)
9668
+ GrafreeD.RENDERME--; // mechante magouille
96659669
96669670 ONESTEP = false;
96679671 }
....@@ -9734,7 +9738,7 @@
97349738 BindTextures(DEFAULT_TEXTURES, 2);
97359739 }
97369740 //System.out.println("--> " + stackdepth);
9737
-// GraphreeD.traceon();
9741
+// GrafreeD.traceon();
97389742
97399743 // DRAW
97409744 object.draw(this, /*(Composite)*/ object, false, false);
....@@ -9750,7 +9754,7 @@
97509754 selectedpoint.radius = radius;
97519755 selectedpoint.recalculate();
97529756 selectedpoint.material = new cMaterial();
9753
- selectedpoint.material.color = 0.25f;
9757
+ selectedpoint.material.color = 0.15f;
97549758 selectedpoint.material.modulation = 0.75f;
97559759
97569760 debugpoint.radius = radius;
....@@ -9765,17 +9769,31 @@
97659769 debugpoint2.material.color = 0.75f;
97669770 debugpoint2.material.modulation = 0.75f;
97679771
9772
+ debugpoint3.radius = radius;
9773
+ debugpoint3.recalculate();
9774
+ debugpoint3.material = new cMaterial();
9775
+ debugpoint3.material.color = 0.5f;
9776
+ debugpoint3.material.modulation = 0.75f;
9777
+
9778
+ debugpoint4.radius = radius;
9779
+ debugpoint4.recalculate();
9780
+ debugpoint4.material = new cMaterial();
9781
+ debugpoint4.material.color = 0f;
9782
+ debugpoint4.material.modulation = 0.75f;
9783
+
97689784 InitPoints(radius);
97699785 }
97709786 selectedpoint.draw(this, /*(Composite)*/ null, false, false);
9771
- //debugpoint.draw(this, /*(Composite)*/ null, false);
9772
- //debugpoint2.draw(this, /*(Composite)*/ null, false);
9773
- DrawPoints(this);
9787
+ debugpoint.draw(this, /*(Composite)*/ null, false,false);
9788
+ debugpoint2.draw(this, /*(Composite)*/ null, false,false);
9789
+ debugpoint3.draw(this, /*(Composite)*/ null, false,false);
9790
+ debugpoint4.draw(this, /*(Composite)*/ null, false,false);
9791
+ // DrawPoints(this);
97749792 }
97759793
97769794 // debugstuff.draw(this, /*(Composite)*/ null, false);
97779795 }
9778
-// GraphreeD.traceoff();
9796
+// GrafreeD.traceoff();
97799797 //System.out.println(stackdepth);
97809798 if (drawMode == 0)
97819799 {
....@@ -10343,11 +10361,13 @@
1034310361 "PARAM params6 = program.env[6];" + // bump, noise, borderfade, fog punchthrough
1034410362 "PARAM params7 = program.env[7];" + // noise power, opacity power
1034510363 "PARAM options0 = program.env[63];" + // fog density, intensity, elevation
10346
- "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
1034710366 "PARAM pointlight = program.env[127];" + // ...
1034810367 "PARAM zero = { 0.0, 0.0, 0.0, 0.0 };" +
1034910368 "PARAM halfhalf = { 0.25, 0.25, 0.25, 1.0 };" +
1035010369 "PARAM half = { 0.5, 0.5, 0.5, 1.0 };" +
10370
+ "PARAM threequarter = { 0.75, 0.75, 0.75, 1.0 };" +
1035110371 "PARAM two = { 2.0, 2.0, 2.0, 1.0 };" +
1035210372 "PARAM ten = { 10, 10, 10, 1.0 };" +
1035310373 "PARAM one3rd = { 0.5, 0.33333333333, 0.333333333, 1.0 };" +
....@@ -10408,6 +10428,10 @@
1040810428 "TEMP R1;" +
1040910429 "TEMP R2;" +
1041010430 "TEMP R3;" +
10431
+ "TEMP min;" +
10432
+ "TEMP max;" +
10433
+ "TEMP average;" +
10434
+ "TEMP saturation;" +
1041110435 "TEMP keep1;" +
1041210436 "TEMP keep2;" +
1041310437 "TEMP keep3;" +
....@@ -10938,10 +10962,40 @@
1093810962
1093910963 // skin?
1094010964 // Saturation for skin
10941
- /**/ // c'est ici
10942
- (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;" +
1094310996 "MUL R2, one3rd.xxxx,temp.xxxx;" +
10944
- "SUB temp, final,R2;" +
10997
+ "SUB temp, final, R2;" +
10998
+
1094510999 // using light angle
1094611000 "DP3 ndotl.x, normald,light;" +
1094711001 //"SLT ndotl.y, ndotl.x, zero.x;" +
....@@ -10954,7 +11008,6 @@
1095411008 // using light intensity
1095511009 "MOV ndotl.z, R2.x;" +
1095611010 "MUL ndotl.z, ndotl.z, ndotl.z;" + // tuning...
10957
-
1095811011 // june 2014
1095911012 "MAD R1.x, ndotl.z,slope.y,one.x;" +
1096011013 // "SUB ndotl.x, one.x, ndotl.x;" +
....@@ -10966,6 +11019,7 @@
1096611019 //"MUL R2.y, shadow.x,R2.y;" + // avril 2014
1096711020
1096811021 "MAD temp.x, R2.y, ndotl.y, temp.x;" + // red shift (skin)
11022
+/**/
1096911023
1097011024 // "ADD final, R2,temp;" +
1097111025 "MOV final, temp;"
....@@ -11055,7 +11109,7 @@
1105511109 /**/
1105611110 // HDR
1105711111 "MOV temp.z, final.a;" +
11058
- "MUL final, final,options1.w;" +
11112
+ "MUL final, final,options2.x;" +
1105911113 "MOV final.a, temp.z;" +
1106011114 /**/
1106111115
....@@ -11092,10 +11146,17 @@
1109211146 "MOV final.z, zero.x;" +
1109311147 "MOV final.a, one.w;":""
1109411148 ) +
11149
+ /*
1109511150 (NORMALdebug?"MOV final.x, normal.x;" +
1109611151 "MOV final.y, normal.y;" +
1109711152 "MOV final.z, normal.z;" +
1109811153 "MOV final.a, one.w;":""
11154
+ ) +
11155
+ */
11156
+ (NORMALdebug?"SUB final.x, one.x, final.x;" +
11157
+ "SUB final.y, one.x, final.y;" +
11158
+ "SUB final.z, one.x, final.z;" +
11159
+ "MOV final.a, final.a;":""
1109911160 ) +
1110011161 // "MOV final, bumpmap;" +
1110111162 "MOV result.color, final;" +
....@@ -12793,7 +12854,9 @@
1279312854 {
1279412855 mouseMode |= ZOOM;
1279512856 }
12796
- if ((modifiers & META) == META)
12857
+
12858
+ boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
12859
+ if (capsLocked || (modifiers & META) == META)
1279712860 {
1279812861 mouseMode |= VR; // BACKFORTH;
1279912862 }
....@@ -12807,6 +12870,7 @@
1280712870 }
1280812871 if ((modifiers & SHIFT) == SHIFT || forcetranslate)
1280912872 {
12873
+ mouseMode &= ~VR;
1281012874 mouseMode |= TRANSLATE;
1281112875 }
1281212876 // if ((modifiers & SHIFT_META) == SHIFT_META)
....@@ -13196,7 +13260,8 @@
1319613260 FlipTransform();
1319713261 break;
1319813262 case ENTER:
13199
- object.editWindow.ScreenFit(); // Edit();
13263
+ // object.editWindow.ScreenFit(); // Edit();
13264
+ ToggleLive();
1320013265 break;
1320113266 case DELETE:
1320213267 ClearSelection();
....@@ -14657,6 +14722,11 @@
1465714722 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1465814723 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
1465914724
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
+
1466014730 glu.gluUnProject(x,y,depth,view,0,tempmat2,0,viewport,0,selectedpoint.toParent[3],0);
1466114731
1466214732 // if (object.selection != null && object.selection.Size() > 0)
....@@ -14700,16 +14770,16 @@
1470014770 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]));
1470114771 }
1470214772
14703
- previousselectedpoint = (Sphere) GraphreeD.clone(selectedpoint);
14773
+ previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
1470414774 }
1470514775 }
1470614776
1470714777 if (!movingcamera && !PAINTMODE)
1470814778 object.editWindow.ScreenFitPoint(); // fev 2014
1470914779
14710
- if (PAINTMODE && GraphreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
14780
+ if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1471114781 {
14712
- Object3D paintobj = GraphreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
14782
+ Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1471314783
1471414784 Object3D group = new Object3D("inst" + paintcount++);
1471514785
....@@ -15279,10 +15349,12 @@
1527915349 int AAbuffersize = 0;
1528015350
1528115351 //double[] selectedpoint = new double[3];
15282
- static Sphere selectedpoint = new Sphere();
15352
+ static Superellipsoid selectedpoint = new Superellipsoid();
1528315353 static Sphere previousselectedpoint = null;
1528415354 static Sphere debugpoint = new Sphere();
1528515355 static Sphere debugpoint2 = new Sphere();
15356
+ static Sphere debugpoint3 = new Sphere();
15357
+ static Sphere debugpoint4 = new Sphere();
1528615358
1528715359 static Sphere debugpoints[] = new Sphere[8];
1528815360