|
|
请问这个应怎样写着色器代码。
// 下面这是个已有的代码,但是没有看懂,哪位高人可以帮忙解释一下。。
在vp中
oPos = mul(worldViewProjMatrix, pos);
// Projective texture coordinates, adjust for mapping
float4x4 scalemat = float4x4( 0.5, 0, 0, 0.5,
0,-0.5, 0, 0.5, 0, 0, 0.5, 0.5,
0, 0, 0, 1);
projectionCoord = mul(scalemat, oPos);
//在fp中
// Do the tex projection manually so we can distort _after_
float2 final = projectionCoord.xy / projectionCoord.w;
此时final中保存的就是屏幕坐标了,不过是0-1空间的。
哪位帮忙解释一下为什么要这样写.. |
|