CUDA_zbuffer_math.h

Go to the documentation of this file.
00001 #ifndef __CUDA_ZBUFFER_MATH_H__
00002 #define __CUDA_ZBUFFER_MATH_H__
00003 
00004 __device__ void CalculateZBuffer(const cudaRendererInformation renInfo, float *out, float clipPointMin, float clipPointMax, float currentPoint)
00005 {
00006   if(renInfo.projectionMethod==0){
00007     float ratio = (currentPoint-clipPointMin)/(clipPointMax-clipPointMin);
00008     float zRange = ratio*(renInfo.ClippingRange.y-renInfo.ClippingRange.x)+renInfo.ClippingRange.x;
00009     
00010     *out =  renInfo.ZBufferA + renInfo.ZBufferB/zRange;
00011   }else{
00012     float ratio = (currentPoint-clipPointMin)/(clipPointMax-clipPointMin);
00013     *out = ratio;
00014   }
00015 }
00016 
00017 __device__ void CalculateReverseZBuffer(const cudaRendererInformation renInfo, float *out, float clipPointMin, float clipPointMax, float zBuffer)
00018 {
00019   if(renInfo.projectionMethod==0){
00020     float zRange = renInfo.ZBufferB/(zBuffer-renInfo.ZBufferA);
00021     float ratio = (zRange - renInfo.ClippingRange.x)/(renInfo.ClippingRange.y-renInfo.ClippingRange.x);
00022     
00023     *out = ratio*(clipPointMax-clipPointMin)+clipPointMin;
00024 
00025   }else{
00026     *out = zBuffer*(clipPointMax-clipPointMin)+clipPointMin;
00027   }
00028 }
00029 
00030 #endif /* __CUDA_ZBUFFER_MATH_H__ */

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1