Normand Briere
2019-08-20 564f4d12d93813b5d680fc24d4f118c3886d96ed
CameraPane.java
....@@ -168,7 +168,7 @@
168168
169169
170170 // OPTIONS
171
- boolean Skinshader = true;
171
+ boolean Skinshader = false; // true;
172172 boolean cameraLight = false;
173173 boolean UVdebug = false;
174174 boolean Udebug = false;
....@@ -1819,7 +1819,7 @@
18191819
18201820 display.modelParams7[0] = 0;
18211821 display.modelParams7[1] = 1000;
1822
- display.modelParams7[2] = 0;
1822
+ display.modelParams7[2] = material.parallax;
18231823 display.modelParams7[3] = 0;
18241824
18251825 //display.modelParams6[0] = 100; // criss de bug de bump
....@@ -2052,9 +2052,9 @@
20522052 switch(viewcode)
20532053 {
20542054 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";
20582058 case 4: return "light";
20592059 }
20602060
....@@ -10690,9 +10690,18 @@
1069010690 static boolean init = false;
1069110691
1069210692 double[][] matrix = LA.newMatrix();
10693
+
10694
+ // This is to refresh the UI of the material panel.
10695
+ ObjEditor patchMaterial;
1069310696
1069410697 public void display(GLAutoDrawable drawable)
1069510698 {
10699
+ if (patchMaterial.patchMaterial)
10700
+ {
10701
+ patchMaterial.patchMaterial = false;
10702
+ patchMaterial.objectPanel.setSelectedIndex(1);
10703
+ }
10704
+
1069610705 if (Grafreed.savesound && Grafreed.hassound)
1069710706 {
1069810707 Grafreed.wav.save();
....@@ -11088,7 +11097,7 @@
1108811097 {
1108911098 if (cubemaprgb == null)
1109011099 {
11091
- cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb" + "/", "jpg", false);
11100
+ cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb2" + "/", "jpg", false);
1109211101 }
1109311102
1109411103 cubemap = cubemaprgb;
....@@ -12584,7 +12593,7 @@
1258412593 "PARAM params4 = program.env[4];" + // anisoV, cameralight, selfshadow, shadow
1258512594 "PARAM params5 = program.env[5];" + // texture, opacity, fakedepth, shadowbias
1258612595 "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
1258812597 "PARAM options0 = program.env[63];" + // fog density, intensity, elevation
1258912598 "PARAM options1 = program.env[62];" + // fog rgb color
1259012599 "PARAM options2 = program.env[61];" + // image intensity, subsurface, lightsheen
....@@ -12829,7 +12838,7 @@
1282912838 "POW texSamp.a, texSamp.a, params6.w;" + // fog punch through shortcut
1283012839 // mar 2013 ??? "KIL alpha.a;" +
1283112840 "MOV alpha, texSamp.aaaa;" + // y;" +
12832
- "KIL alpha.a;" +
12841
+ "KIL alpha.a;" + // not sure with parallax mapping
1283312842 /*
1283412843 "MUL temp.xy, temp, two;" +
1283512844 "TXB bump, temp, texture[0], 2D;" +
....@@ -12915,11 +12924,6 @@
1291512924 "SUB bump0, bump0, half;" +
1291612925 "ADD bump, bump, bump0;" +
1291712926
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
-
1292312927 // double-sided
1292412928 /**/
1292512929 (doublesided?"DP3 temp.z, normal, eye;" +
....@@ -12949,6 +12953,41 @@
1294912953 Normalize("U") +
1295012954
1295112955 // 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;" +
1295212991
1295312992 //"MOV temp, fragment.texcoord[0];" +
1295412993 //
....@@ -13419,8 +13458,12 @@
1341913458 program = programmin;
1342013459 }
1342113460
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
+
1342413467 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1342513468
1342613469 //gl.glNewList(displayListID, GL.GL_COMPILE);
....@@ -13467,7 +13510,8 @@
1346713510 "\n" +
1346813511 "END\n";
1346913512
13470
- System.out.println("Program shadow #" + 0 + "; length = " + program.length());
13513
+ if (Globals.DEBUG)
13514
+ System.out.println("Program shadow #" + 0 + "; length = " + program.length());
1347113515 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1347213516
1347313517 //gl.glNewList(displayListID, GL.GL_COMPILE);
....@@ -13725,7 +13769,7 @@
1372513769 /*static*/ float[] modelParams4 = new float[]{0, 0, 0, 0}; // anisoV, cameralight, selfshadow, shadow
1372613770 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1372713771 /*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
1372913773
1373013774 //Object3D.cVector2[] vector2buffer;
1373113775
....@@ -14666,11 +14710,17 @@
1466614710 void GoDown(int mod)
1466714711 {
1466814712 MODIFIERS |= COMMAND;
14713
+ boolean isVR = (mouseMode&VR)!=0;
1466914714 /**/
1467014715 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
+ }
1467214722 else
14673
- manipCamera.RotatePosition(0, -speed);
14723
+ manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth());
1467414724 /**/
1467514725 if ((mod & SHIFT) == SHIFT)
1467614726 {
....@@ -14680,6 +14730,8 @@
1468014730 mouseMode |= BACKFORTH;
1468114731 }
1468214732
14733
+ targetLookAt.set(manipCamera.lookAt);
14734
+
1468314735 //prevX = X = anchorX;
1468414736 prevY = Y = anchorY - (int) (renderCamera.Distance());
1468514737 }
....@@ -14688,10 +14740,17 @@
1468814740 {
1468914741 MODIFIERS |= COMMAND;
1469014742 /**/
14743
+ boolean isVR = (mouseMode&VR)!=0;
14744
+
1469114745 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
+ }
1469314752 else
14694
- manipCamera.RotatePosition(0, speed);
14753
+ manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth());
1469514754 /**/
1469614755 if ((mod & SHIFT) == SHIFT)
1469714756 {
....@@ -14701,6 +14760,8 @@
1470114760 mouseMode |= BACKFORTH;
1470214761 }
1470314762
14763
+ targetLookAt.set(manipCamera.lookAt);
14764
+
1470414765 //prevX = X = anchorX;
1470514766 prevY = Y = anchorY + (int) (renderCamera.Distance());
1470614767 }
....@@ -14710,9 +14771,14 @@
1471014771 MODIFIERS |= COMMAND;
1471114772 /**/
1471214773 if((mod&SHIFT) == SHIFT)
14713
- manipCamera.Translate(speed*delta, 0, getWidth());
14774
+ manipCamera.Translate(speed*delta, 0, getWidth());
1471414775 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
+ }
1471614782 /**/
1471714783 if ((mod & SHIFT) == SHIFT)
1471814784 {
....@@ -14722,6 +14788,8 @@
1472214788 mouseMode |= ROTATE;
1472314789 } // TRANSLATE;
1472414790
14791
+ targetLookAt.set(manipCamera.lookAt);
14792
+
1472514793 prevX = X = anchorX - 10; // (int)(10*renderCamera.Distance());
1472614794 prevY = Y = anchorY;
1472714795 }
....@@ -14731,9 +14799,15 @@
1473114799 MODIFIERS |= COMMAND;
1473214800 /**/
1473314801 if((mod&SHIFT) == SHIFT)
14734
- manipCamera.Translate(-speed*delta, 0, getWidth());
14802
+ manipCamera.Translate(-speed*delta, 0, getWidth());
1473514803 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
+
1473714811 /**/
1473814812 if ((mod & SHIFT) == SHIFT)
1473914813 {
....@@ -14743,6 +14817,8 @@
1474314817 mouseMode |= ROTATE;
1474414818 } // TRANSLATE;
1474514819
14820
+ targetLookAt.set(manipCamera.lookAt);
14821
+
1474614822 prevX = X = anchorX + 10; // (int)(10*renderCamera.Distance());
1474714823 prevY = Y = anchorY;
1474814824 }
....@@ -15245,8 +15321,8 @@
1524515321 case 'K':
1524615322 KOMPACTTEXTURE ^= true;
1524715323 //textures.clear();
15248
- break;
15249
- case 'P': // Texture Projection macros
15324
+ // break;
15325
+ //case 'P': // Texture Projection macros
1525015326 // SAVETEXTURE ^= true;
1525115327 macromode = true;
1525215328 Udebug = Vdebug = NORMALdebug = false; programInitialized = false;
....@@ -15367,7 +15443,7 @@
1536715443 targetLookAt.set(manipCamera.lookAt);
1536815444 repaint();
1536915445 break;
15370
- case 'p':
15446
+ case 'P': // p':
1537115447 // c'est quoi ca au juste? spherical ^= true;
1537215448 Skinshader ^= true; programInitialized = false;
1537315449 repaint();
....@@ -16127,7 +16203,7 @@
1612716203 {
1612816204 switch (hitSomething)
1612916205 {
16130
- case Object3D.hitCenter: gr.setColor(Color.pink);
16206
+ case Object3D.hitCenter: gr.setColor(Color.white);
1613116207 gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
1613216208 break;
1613316209 case Object3D.hitRotate: gr.setColor(Color.yellow);
....@@ -16153,7 +16229,7 @@
1615316229 if (hasMarquee)
1615416230 {
1615516231 gr.setXORMode(Color.white);
16156
- gr.setColor(Color.red);
16232
+ gr.setColor(Color.white);
1615716233 if (!firstime)
1615816234 {
1615916235 gr.drawRect(prevmarqX, prevmarqY, prevmarqW, prevmarqH);
....@@ -17329,6 +17405,7 @@
1732917405
1733017406 public void init(GLAutoDrawable drawable)
1733117407 {
17408
+ if (Globals.DEBUG)
1733217409 System.out.println("shadow buffer init");
1733317410
1733417411 GL gl = drawable.getGL();