bugfix for a few corner-cases

metadata
Wenzel Jakob 2010-11-30 22:22:57 +01:00
parent 052f5f0bb8
commit 828d3d3af9
2 changed files with 4 additions and 5 deletions

View File

@ -395,7 +395,7 @@ public:
} }
Float integrateDensities(Ray ray, Float length) const { Float integrateDensities(Ray ray, Float length) const {
int nParts = (int) std::ceil(length/m_stepSize); int nParts = std::max(1, (int) std::ceil(length/m_stepSize));
nParts += nParts % 2; nParts += nParts % 2;
const Float stepSize = length/nParts; const Float stepSize = length/nParts;
const Vector increment = ray.d * stepSize; const Vector increment = ray.d * stepSize;
@ -422,7 +422,7 @@ public:
Spectrum &currentAlbedo, Spectrum &currentAlbedo,
Float desiredTau) const { Float desiredTau) const {
int nParts = (int) std::ceil(maxDist/m_stepSize); int nParts = std::max(1, (int) std::ceil(maxDist/m_stepSize));
Float stepSize = maxDist/nParts; Float stepSize = maxDist/nParts;
Vector fullIncrement = ray.d * stepSize, Vector fullIncrement = ray.d * stepSize,
halfIncrement = fullIncrement * .5f; halfIncrement = fullIncrement * .5f;

View File

@ -199,7 +199,7 @@ public:
} }
Float integrateDensities(Ray ray, Float length) const { Float integrateDensities(Ray ray, Float length) const {
int nParts = (int) std::ceil(length/m_stepSize); int nParts = std::max(1, (int) std::ceil(length/m_stepSize));
nParts += nParts % 2; nParts += nParts % 2;
const Float stepSize = length/nParts; const Float stepSize = length/nParts;
const Vector increment = ray.d * stepSize; const Vector increment = ray.d * stepSize;
@ -225,8 +225,7 @@ public:
Float &currentSigmaT, Float &currentSigmaT,
Spectrum &currentAlbedo, Spectrum &currentAlbedo,
Float desiredTau) const { Float desiredTau) const {
int nParts = std::max(1, (int) std::ceil(maxDist/m_stepSize));
int nParts = (int) std::ceil(maxDist/m_stepSize);
Float stepSize = maxDist/nParts; Float stepSize = maxDist/nParts;
Vector fullIncrement = ray.d * stepSize, Vector fullIncrement = ray.d * stepSize,
halfIncrement = fullIncrement * .5f; halfIncrement = fullIncrement * .5f;