
440 VI Compute
1 // Plane equation from three points , simplified
2 // for the case where the f i rst point is the origin .
3 // N is normalized so that the plane equation can
4 // be used to compute signed distance .
5 float4 CreatePlaneEquation ( float3 Q , float3 R)
6 {
7 // N = normalize(cross(Q−P,R−P) ) ,
8 // except we know P is the origin
9 float3 N = normalize( cross ( Q , R ));
10 // D = −(N dot P) , except we know P is the origin
11 return float4( N ,0) ;
12 }
13
14 // Convert a point from postprojection space into view space
15 float3 ConvertProjToView ( float4 p)
16 {
17 p = mul ( p , g_mProjectionInv );
18 return ( p / p . w ).xyz ;
19 }
20
21 void ...