   float3 d;
 };
 
-template<int bpc>
+template<int t_bpc>
 __device__ float volume(const float x, const float y, const float z)
 {
-  if (bpc == 1)
+  if (t_bpc == 1)
   {
     return tex3D(volTexture8, x, y, z);
   }
-  else if (bpc == 2)
+  else if (t_bpc == 2)
   {
     return tex3D(volTexture16, x, y, z);
   }

  float3 sample1;
  float3 sample2;

  sample1.x = volume<bpc>(pos - make_float3(DELTA, 0.0f, 0.0f));
  sample2.x = volume<bpc>(pos + make_float3(DELTA, 0.0f, 0.0f));
  sample1.y = volume<bpc>(pos - make_float3(0.0f, DELTA, 0.0f));
  sample2.y = volume<bpc>(pos + make_float3(0.0f, DELTA, 0.0f));
  sample1.z = volume<bpc>(pos - make_float3(0.0f, 0.0f, DELTA));
  sample2.z = volume<bpc>(pos + make_float3(0.0f, 0.0f, DELTA));

  return sample2 - sample1;
}

template<int bpc>
__device__ float4 blinnPhong(const float4& classification, const float3& pos,
                             const float3& L, const float3& H,
                             const float3& Ka, const float3& Kd, const float3& Ks,
                             const float shininess,
                             const float3* normal = NULL)
{
  float3 N = normalize(gradient<bpc>(pos));

  if (normal != NULL)
  {

    src.y *= src.w;
    src.z *= src.w;

    if (t_frontToBack && (t_mipMode == 0))
    {
      dst = dst + src * (1.0f - dst.w);
    }
    else if (!t_frontToBack && (t_mipMode == 0))
    {
      //dst = dst * src.w + src * (1.0f - src.w);
    }

    if (t_earlyRayTermination && (dst.w > opacityThreshold))
    {
      break;
    }
