From 59ff88d45adc102639e9b70fa5843660ec943cb4 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Tue, 14 Sep 2010 00:51:09 +0200 Subject: [PATCH] initialization-related bugfixes --- src/converter/converter.cpp | 2 +- src/integrators/photonmapper/ppm.cpp | 2 +- src/integrators/photonmapper/sppm.cpp | 11 ++++------- src/librender/irrcache.cpp | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/converter/converter.cpp b/src/converter/converter.cpp index bb82f401..83fe9709 100644 --- a/src/converter/converter.cpp +++ b/src/converter/converter.cpp @@ -162,7 +162,7 @@ void GeometryConverter::convert(const fs::path &inputFile, SLog(EError, "Unknown input format (must end in either .DAE, .ZAE or .OBJ)"); } - if (adjustmentFile.empty()) { + if (!adjustmentFile.empty()) { SLog(EInfo, "Applying adjustments .."); static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull }; DOMImplementationLS *impl = DOMImplementationRegistry::getDOMImplementation(gLS); diff --git a/src/integrators/photonmapper/ppm.cpp b/src/integrators/photonmapper/ppm.cpp index 553e5941..871aa8f3 100644 --- a/src/integrators/photonmapper/ppm.cpp +++ b/src/integrators/photonmapper/ppm.cpp @@ -39,7 +39,7 @@ public: Float N; int depth; - inline GatherPoint() : N(0) { + inline GatherPoint() : weight(0.0f), flux(0.0f), emission(0.0f), N(0.0f) { } }; diff --git a/src/integrators/photonmapper/sppm.cpp b/src/integrators/photonmapper/sppm.cpp index 1bde91b0..0ab42b92 100644 --- a/src/integrators/photonmapper/sppm.cpp +++ b/src/integrators/photonmapper/sppm.cpp @@ -40,13 +40,13 @@ public: int depth; Point2i pos; - inline GatherPoint() : N(0) { + inline GatherPoint() : weight(0.0f), flux(0.0f), emission(0.0f), N(0.0f) { } }; StochasticProgressivePhotonMapIntegrator(const Properties &props) : Integrator(props) { /* Initial photon query radius (0 = infer based on scene size and camera resolution) */ - m_initialRadius = props.getFloat("initialRadius", .2); + m_initialRadius = props.getFloat("initialRadius", 0); /* Alpha parameter from the paper (influences the speed, at which the photon radius is reduced) */ m_alpha = props.getFloat("alpha", .7); /* Number of photons to shoot in each iteration */ @@ -265,12 +265,12 @@ public: #pragma omp parallel for schedule(dynamic) for (int blockIdx = 0; blockIdx<(int) m_gatherBlocks.size(); ++blockIdx) { std::vector &gatherPoints = m_gatherBlocks[blockIdx]; - Spectrum flux, contrib; float *target = m_bitmap->getFloatData(); for (size_t i=0; iestimateRadianceRaw( @@ -288,11 +288,8 @@ public: gp.emission * proc->getShotPhotons() * M_PI * gp.radius*gp.radius)) * ratio; gp.radius = gp.radius * std::sqrt(ratio); gp.N = N + m_alpha * M; + contrib = gp.flux / ((Float) m_totalEmitted * gp.radius*gp.radius * M_PI); } - contrib = gp.flux / ((Float) m_totalEmitted * gp.radius*gp.radius * M_PI); - - - Float r, g, b; contrib.toLinearRGB(r, g, b); diff --git a/src/librender/irrcache.cpp b/src/librender/irrcache.cpp index cc2c8147..c78a7192 100644 --- a/src/librender/irrcache.cpp +++ b/src/librender/irrcache.cpp @@ -181,7 +181,7 @@ struct clamp_neighbors_functor { /* Irradiance interpolation functor */ struct irr_interp_functor { irr_interp_functor(const Intersection &its, Float kappa, bool gradients) : its(its), - kappa(kappa), weightSum(0), gradients(gradients) { + kappa(kappa), weightSum(0), gradients(gradients), E(0.0f) { } void operator()(const IrradianceCache::Record *sample) {