etqw-sdk/base/renderprogs/shadow.rprog

172 lines
4.0 KiB
Plaintext

renderProgram shadow {
coverageVersion shadow_coverage
program vertex arb { <%
TEMP R0;
TEMP R1;
TEMP R2;
SLT R2.x, 0, $positionAttrib.w;
TEMP FARPOS;
SUB FARPOS.xyz, $positionAttrib, $lightOrigin;
MOV FARPOS.w, 0;
PARAM mvp[4] = { state.matrix.mvp };
DP4 R0.x, FARPOS, mvp[0];
DP4 R0.y, FARPOS, mvp[1];
DP4 R0.z, FARPOS, mvp[2];
DP4 R0.w, FARPOS, mvp[3];
DP4 R1.x, mvp[0], $positionAttrib;
DP4 R1.y, mvp[1], $positionAttrib;
DP4 R1.z, mvp[2], $positionAttrib;
DP4 R1.w, mvp[3], $positionAttrib;
SGE R2.x, 0, R2;
SUB R0, R0, R1;
MAD result.position, R0, R2.x, R1;
#if r_showShadows
MOV result.color, vertex.color;
#endif
%> }
/*program vertex arb { <%
TEMP R0;
# RO = OPOS - light, assumes light.w = 0
SUB R0, $positionAttrib, $lightOrigin;
# RO -= OPOS.w * light
MAD R0, R0.wwww, $lightOrigin, R0;
# normal transform
DP4 result.position.x, R0, state.matrix.mvp.row[0];
DP4 result.position.y, R0, state.matrix.mvp.row[1];
DP4 result.position.z, R0, state.matrix.mvp.row[2];
DP4 result.position.w, R0, state.matrix.mvp.row[3];
#if r_showShadows
MOV result.color, vertex.color;
#endif
%> }*/
program fragment arb { <%
OPTION ARB_precision_hint_fastest;
#if r_showShadows
MOV result.color, fragment.color;
#endif
%> }
}
renderProgram shadow_invariant {
program vertex arb { <%
OPTION ARB_position_invariant;
#if r_showShadows
MOV result.color, vertex.color;
#endif
%> }
program fragment reference shadow
}
renderProgram shadow_coverage {
program vertex reference shadow
program fragment arb { <%
OPTION ARB_precision_hint_fastest;
# coverage dither mask
TEMP _R1, _R0;
MUL _R1.xy, fragment.position, 0.015625;
TEX _R0.r, _R1, $dithermask, 2D;
SUB _R0.a, 0.5, _R0.r;
KIL _R0.a;
#if r_showShadows
MOV result.color, fragment.color;
#endif
%> }
}
renderProgram shadowParallel {
coverageVersion shadowParallel_coverage
program vertex arb { <%
TEMP R0, R1;
ADD R1, -$positionAttrib.wwww, 1;
MUL R0, $positionAttrib.w, $positionAttrib;
MAD R0.xyz, R1, $lightDirection, R0;
# normal transform
DP4 result.position.x, R0, state.matrix.mvp.row[0];
DP4 result.position.y, R0, state.matrix.mvp.row[1];
DP4 result.position.z, R0, state.matrix.mvp.row[2];
DP4 result.position.w, R0, state.matrix.mvp.row[3];
#if r_showShadows
MOV result.color, vertex.color;
#endif
%> }
program fragment reference shadow
}
renderProgram shadowParallel_coverage {
program vertex reference shadowParallel
program fragment reference shadow_coverage
}
renderProgram shadowParallelNotInfinite {
program vertex arb { <%
TEMP R0, R1;
ADD R1, -$positionAttrib.wwww, 1;
MUL R1, R1, $lightDirection.w;
MAD R0.xyz, R1, $lightDirection, $positionAttrib;
MOV R0.w, 1;
# normal transform
DP4 result.position.x, R0, state.matrix.mvp.row[0];
DP4 result.position.y, R0, state.matrix.mvp.row[1];
DP4 result.position.z, R0, state.matrix.mvp.row[2];
DP4 result.position.w, R0, state.matrix.mvp.row[3];
#if r_showShadows
MOV result.color, vertex.color;
#endif
%> }
program fragment reference shadow
}
renderProgram shadowParallelProject {
program vertex arb { <%
TEMP R0, R1;
ADD R1, -$positionAttrib.wwww, 1;
TEMP LIGHTDIR;
SUB LIGHTDIR.xyz, $positionAttrib, $lightOrigin;
DP3 LIGHTDIR.w, LIGHTDIR, LIGHTDIR;
RSQ LIGHTDIR.w, LIGHTDIR.w;
MUL LIGHTDIR.xyz, LIGHTDIR, LIGHTDIR.w;
MUL R1, R1, $lightDirection.w;
MAD R0.xyz, R1, LIGHTDIR, $positionAttrib;
MOV R0.w, 1;
# normal transform
DP4 result.position.x, R0, state.matrix.mvp.row[0];
DP4 result.position.y, R0, state.matrix.mvp.row[1];
DP4 result.position.z, R0, state.matrix.mvp.row[2];
DP4 result.position.w, R0, state.matrix.mvp.row[3];
#if r_showShadows
MOV result.color, vertex.color;
#endif
%> }
program fragment reference shadow
}