Normand Briere
2019-07-23 0f4fa9dc4191aaee9661c1e6d73725436ae64ac2
CameraPane.java
....@@ -12400,7 +12400,52 @@
1240012400 //gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 127, lightParams, 0);
1240112401
1240212402 String program =
12403
+ // Min shader
1240312404 "!!ARBfp1.0\n" +
12405
+ "PARAM zero123 = { 0.0, 1.0, 2.0, 1.25 };" +
12406
+ "PARAM pow2 = { 0.5, 0.25, 0.125, 0.0 };" +
12407
+ "PARAM one = { 1.0, 1.0, 1.0, 1.0 };" +
12408
+ "PARAM eps = { 0.001, 0.001, 0.001, 1.0 };" +
12409
+ "PARAM infinity = { 100000000, 100000000, 100000000, 1.0 };" +
12410
+ "TEMP temp;" +
12411
+ "TEMP light;" +
12412
+ "TEMP ndotl;" +
12413
+ "TEMP normal;" +
12414
+ "TEMP depth;" +
12415
+
12416
+ "MAD normal, fragment.color, zero123.z, -zero123.y;" +
12417
+
12418
+ "MOV light, state.light[0].position;" +
12419
+ "DP3 ndotl.x, light, normal;" +
12420
+
12421
+ // shadow
12422
+ "MOV temp, fragment.texcoord[1];" +
12423
+ TextureFetch("depth", "temp", "1") +
12424
+ //"TEX depth, fragment.texcoord[1], texture[1], 2D;" +
12425
+ "SLT temp.x, fragment.texcoord[1].z, depth.z;" +
12426
+
12427
+
12428
+ // No shadow when out of frustum
12429
+ //"SGE temp.y, depth.z, zero123.y;" +
12430
+ //"LRP temp.x, temp.y, zero123.y, temp.x;" +
12431
+
12432
+ "MUL ndotl.x, ndotl.x, temp.x;" +
12433
+ "MAX ndotl.x, ndotl.x, pow2.y;" +
12434
+
12435
+ "TEX temp, fragment.texcoord[0], texture[0], 2D;" +
12436
+ "LRP temp, zero123.w, temp, one;" + // texture proportion
12437
+ "MUL temp, temp, ndotl.x;" +
12438
+
12439
+ "MUL temp, temp, zero123.z;" +
12440
+
12441
+ "MOV temp.w, zero123.y;" + // reset alpha
12442
+
12443
+ "MOV result.color, temp;" +
12444
+ "END";
12445
+
12446
+ String program2 =
12447
+ "!!ARBfp1.0\n" +
12448
+
1240412449 //"OPTION ARB_fragment_program_shadow;" +
1240512450 "PARAM light2cam0 = program.env[10];" +
1240612451 "PARAM light2cam1 = program.env[11];" +
....@@ -12515,8 +12560,7 @@
1251512560 "TEMP shininess;" +
1251612561 "\n" +
1251712562 "MOV texSamp, one;" +
12518
- //"TEX texSamp, fragment.texcoord[0], texture[0], 2D;" +
12519
-
12563
+
1252012564 "MOV mapgrid.x, one2048th.x;" +
1252112565 "MOV temp, fragment.texcoord[1];" +
1252212566 /*
....@@ -12921,7 +12965,7 @@
1292112965 "MAD shadow.x, buffer.x, frac.y, shadow.x;" +
1292212966 "") +
1292312967
12924
- // display shadow only (bump == 0)
12968
+ // display shadow only (fakedepth == 0)
1292512969 "SUB temp.x, half.x, shadow.x;" +
1292612970 "MOV temp.y, -params5.z;" + // params6.x;" +
1292712971 "SLT temp.z, temp.y, -one2048th.x;" +
....@@ -13353,20 +13397,20 @@
1335313397 return "TEX " + dest + ", " + src + ", texture[" + unit + "], 2D;" +
1335413398 "SGE " + src + ".w, " + src + ".x, eps.x;" +
1335513399 "SGE " + src + ".z, " + src + ".y, eps.x;" +
13400
+ "SLT " + dest + ".x, " + src + ".x, one.x;" +
13401
+ "SLT " + dest + ".y, " + src + ".y, one.x;" +
1335613402 "MUL " + src + ".w, " + src + ".z, " + src + ".w;" +
13357
- "SLT " + src + ".z, " + src + ".x, one.x;" +
13358
- "MUL " + src + ".w, " + src + ".z, " + src + ".w;" +
13359
- "SLT " + src + ".z, " + src + ".y, one.x;" +
13360
- "MUL " + src + ".w, " + src + ".z, " + src + ".w;" +
13403
+ "MUL " + src + ".w, " + dest + ".x, " + src + ".w;" +
13404
+ "MUL " + src + ".w, " + dest + ".y, " + src + ".w;" +
1336113405 //"SWZ buffer, temp, w,w,w,w;";
13362
- "MUL " + dest + ".z, " + dest + ".z, " + src + ".w;" +
13406
+ //"MUL " + dest + ".z, " + dest + ".z, " + src + ".w;" +
1336313407 "SUB " + src + ".z, " + "one.x, " + src + ".w;" +
1336413408 //"MUL " + src + ".z, " + src + ".z, infinity.x;" +
1336513409 //"ADD " + dest + ".z, " + dest + ".z, " + src + ".z;";
13366
- "MAD " + dest + ".z, " + src + ".z, infinity.x," + dest + ".z;";
13410
+ //"MAD " + dest + ".z, " + src + ".z, infinity.x," + dest + ".z;";
1336713411
13368
- //"LRP " + dest + ".z, " + src + ".w," + dest + ".z, infinity.x;";
13369
- //"LRP " + dest + ".z" + ", " + src + ".w, infinity.x," + dest + ".z;";
13412
+ //?? "LRP " + dest + ".z, " + src + ".w," + dest + ".z, infinity.x;";
13413
+ "LRP " + dest + ".z, " + src + ".z, infinity.x," + dest + ".z;";
1337013414 }
1337113415
1337213416 String Shadow(String depth, String shadow)
....@@ -13413,7 +13457,7 @@
1341313457 "SLT temp.x, temp.x, zero.x;" + // shadoweps
1341413458 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1341513459
13416
- // No shadow when out of frustrum
13460
+ // No shadow when out of frustum
1341713461 "SGE temp.x, " + depth + ".z, one.z;" +
1341813462 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1341913463 "";