.. | .. |
---|
12502 | 12502 | |
---|
12503 | 12503 | // display shadow only (bump == 0) |
---|
12504 | 12504 | "SUB temp.x, half.x, shadow.x;" + |
---|
12505 | | - "MOV temp.y, -params6.x;" + |
---|
12506 | | - "SLT temp.z, temp.y, zero.x;" + |
---|
| 12505 | + "MOV temp.y, -params5.z;" + // params6.x;" + |
---|
| 12506 | + "SLT temp.z, temp.y, -one2048th.x;" + |
---|
12507 | 12507 | "SUB temp.y, one.x, temp.z;" + |
---|
12508 | 12508 | "MUL temp.x, temp.x, temp.y;" + |
---|
12509 | 12509 | "KIL temp.x;" + |
---|
.. | .. |
---|
12834 | 12834 | //once = true; |
---|
12835 | 12835 | } |
---|
12836 | 12836 | |
---|
12837 | | - System.out.print("Program #" + mode + "; length = " + program.length()); |
---|
| 12837 | + System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
12838 | 12838 | System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
12839 | 12839 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
12840 | 12840 | |
---|
.. | .. |
---|
12967 | 12967 | |
---|
12968 | 12968 | "ADD " + depth + ".z, " + depth + ".z, temp.x;" + |
---|
12969 | 12969 | //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing! |
---|
| 12970 | + |
---|
| 12971 | + // Compare fragment depth in light space with shadowmap. |
---|
12970 | 12972 | "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
12971 | 12973 | "SGE temp.y, temp.x, zero.x;" + |
---|
12972 | | - "SUB " + shadow + ".y, one.x, temp.y;" + |
---|
| 12974 | + "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded |
---|
| 12975 | + |
---|
| 12976 | + // Reverse comparison |
---|
12973 | 12977 | "SUB temp.x, one.x, temp.x;" + |
---|
12974 | 12978 | "MUL " + shadow + ".x, temp.x, temp.y;" + |
---|
12975 | | - "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded |
---|
| 12979 | + "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse |
---|
12976 | 12980 | "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth |
---|
12977 | 12981 | |
---|
12978 | 12982 | "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
.. | .. |
---|
12987 | 12991 | "DP3 temp.x, normal, lightd;" + |
---|
12988 | 12992 | "SLT temp.x, temp.x, zero.x;" + // shadoweps |
---|
12989 | 12993 | "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
| 12994 | + |
---|
| 12995 | + // No shadow when out of frustrum |
---|
| 12996 | + "SGE temp.x, " + depth + ".z, one.z;" + |
---|
| 12997 | + "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
12990 | 12998 | ""; |
---|
12991 | 12999 | } |
---|
12992 | 13000 | |
---|