.. | .. |
---|
12400 | 12400 | //gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 127, lightParams, 0); |
---|
12401 | 12401 | |
---|
12402 | 12402 | String program = |
---|
| 12403 | + // Min shader |
---|
12403 | 12404 | "!!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 | + |
---|
12404 | 12448 | //"OPTION ARB_fragment_program_shadow;" + |
---|
12405 | 12449 | "PARAM light2cam0 = program.env[10];" + |
---|
12406 | 12450 | "PARAM light2cam1 = program.env[11];" + |
---|
.. | .. |
---|
12515 | 12559 | "TEMP shininess;" + |
---|
12516 | 12560 | "\n" + |
---|
12517 | 12561 | "MOV texSamp, one;" + |
---|
12518 | | - //"TEX texSamp, fragment.texcoord[0], texture[0], 2D;" + |
---|
12519 | | - |
---|
| 12562 | + |
---|
12520 | 12563 | "MOV mapgrid.x, one2048th.x;" + |
---|
12521 | 12564 | "MOV temp, fragment.texcoord[1];" + |
---|
12522 | 12565 | /* |
---|
.. | .. |
---|
12921 | 12964 | "MAD shadow.x, buffer.x, frac.y, shadow.x;" + |
---|
12922 | 12965 | "") + |
---|
12923 | 12966 | |
---|
12924 | | - // display shadow only (bump == 0) |
---|
| 12967 | + // display shadow only (fakedepth == 0) |
---|
12925 | 12968 | "SUB temp.x, half.x, shadow.x;" + |
---|
12926 | 12969 | "MOV temp.y, -params5.z;" + // params6.x;" + |
---|
12927 | 12970 | "SLT temp.z, temp.y, -one2048th.x;" + |
---|
.. | .. |
---|
13413 | 13456 | "SLT temp.x, temp.x, zero.x;" + // shadoweps |
---|
13414 | 13457 | "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
13415 | 13458 | |
---|
13416 | | - // No shadow when out of frustrum |
---|
| 13459 | + // No shadow when out of frustum |
---|
13417 | 13460 | "SGE temp.x, " + depth + ".z, one.z;" + |
---|
13418 | 13461 | "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
13419 | 13462 | ""; |
---|