34 template<
typename VolumeType,
typename IsVoxelTransparentCallback>
37 typename VolumeType::Sampler m_sampVolume(volInput);
39 uint16_t uRandomUnitVectorIndex = 0;
40 uint16_t uRandomVectorIndex = 0;
41 uint16_t uIndexIncreament;
44 assert(volInput->getWidth() % arrayResult->
getDimension(0) == 0);
45 assert(volInput->getHeight() % arrayResult->
getDimension(1) == 0);
46 assert(volInput->getDepth() % arrayResult->
getDimension(2) == 0);
57 const int iRatioX = volInput->getWidth() / arrayResult->
getDimension(0);
58 const int iRatioY = volInput->getHeight() / arrayResult->
getDimension(1);
59 const int iRatioZ = volInput->getDepth() / arrayResult->
getDimension(2);
61 const float fRatioX = iRatioX;
62 const float fRatioY = iRatioY;
63 const float fRatioZ = iRatioZ;
66 const float fHalfRatioX = fRatioX * 0.5f;
67 const float fHalfRatioY = fRatioY * 0.5f;
68 const float fHalfRatioZ = fRatioZ * 0.5f;
69 const Vector3DFloat v3dHalfRatio(fHalfRatioX, fHalfRatioY, fHalfRatioZ);
83 v3dStart -= v3dOffset;
84 v3dStart += v3dHalfRatio;
87 uint8_t uVisibleDirections = 0;
89 for(
int ct = 0; ct < uNoOfSamplesPerOutputElement; ct++)
94 v3dJitter *= v3dHalfRatio;
98 v3dRayDirection *= fRayLength;
105 ++uVisibleDirections;
110 if(uNoOfSamplesPerOutputElement == 0)
118 fVisibility =
static_cast<float>(uVisibleDirections) / static_cast<float>(uNoOfSamplesPerOutputElement);
119 assert((fVisibility >= 0.0f) && (fVisibility <= 1.0f));
122 (*arrayResult)[z / iRatioZ][y / iRatioY][x / iRatioX] =
static_cast<uint8_t
>(255.0f * fVisibility);