|
|
|
|
|
|
float d = length(normal); |
|
|
|
float l1rcpD = l1 * rcp(d); |
|
|
|
float l2rcpD = l2 * rcp(d); |
|
|
|
float tLDDL1 = l1rcpD * rcp(sq(d) + sq(l1)); |
|
|
|
float tLDDL2 = l2rcpD * rcp(sq(d) + sq(l2)); |
|
|
|
float tLDDL1 = l1rcpD / (sq(d) + sq(l1)); |
|
|
|
float tLDDL2 = l2rcpD / (sq(d) + sq(l2)); |
|
|
|
float intWt = LineFwt(tLDDL2, l2) - LineFwt(tLDDL1, l1); |
|
|
|
float intP0 = LineFpo(tLDDL2, l2rcpD, rcp(d)) - LineFpo(tLDDL1, l1rcpD, rcp(d)); |
|
|
|
return intP0 * normal.z + intWt * tangent.z; |
|
|
|