Normand Briere
2019-07-23 de4f66e0239a736bce24e09c9a0b49b5bb92d84b
CameraPane.java
....@@ -12400,7 +12400,51 @@
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, 3.0 };" +
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
+ "MUL temp, temp, ndotl.x;" +
12437
+
12438
+ "MUL temp, temp, zero123.z;" +
12439
+
12440
+ "MOV temp.w, zero123.y;" + // reset alpha
12441
+
12442
+ "MOV result.color, temp;" +
12443
+ "END";
12444
+
12445
+ String program2 =
12446
+ "!!ARBfp1.0\n" +
12447
+
1240412448 //"OPTION ARB_fragment_program_shadow;" +
1240512449 "PARAM light2cam0 = program.env[10];" +
1240612450 "PARAM light2cam1 = program.env[11];" +
....@@ -12515,8 +12559,7 @@
1251512559 "TEMP shininess;" +
1251612560 "\n" +
1251712561 "MOV texSamp, one;" +
12518
- //"TEX texSamp, fragment.texcoord[0], texture[0], 2D;" +
12519
-
12562
+
1252012563 "MOV mapgrid.x, one2048th.x;" +
1252112564 "MOV temp, fragment.texcoord[1];" +
1252212565 /*
....@@ -12921,7 +12964,7 @@
1292112964 "MAD shadow.x, buffer.x, frac.y, shadow.x;" +
1292212965 "") +
1292312966
12924
- // display shadow only (bump == 0)
12967
+ // display shadow only (fakedepth == 0)
1292512968 "SUB temp.x, half.x, shadow.x;" +
1292612969 "MOV temp.y, -params5.z;" + // params6.x;" +
1292712970 "SLT temp.z, temp.y, -one2048th.x;" +
....@@ -13413,7 +13456,7 @@
1341313456 "SLT temp.x, temp.x, zero.x;" + // shadoweps
1341413457 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1341513458
13416
- // No shadow when out of frustrum
13459
+ // No shadow when out of frustum
1341713460 "SGE temp.x, " + depth + ".z, one.z;" +
1341813461 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1341913462 "";