From 1941daa60daa3ec181db4004e85b316a57d4ef92 Mon Sep 17 00:00:00 2001 From: tatsy Date: Tue, 22 Mar 2016 10:46:46 +0900 Subject: [PATCH] Module export setting is updated. --- include/spica.h | 1 + sources/core/parallel.cc | 1 + sources/core/parallel.h | 10 ++++++---- sources/integrator/hierarchical.cc | 17 ++++++++++------- sources/integrator/photon_map.cc | 2 ++ sources/integrator/spica_integrator.h | 1 + sources/shape/spica_shape.h | 1 + 7 files changed, 22 insertions(+), 11 deletions(-) diff --git a/include/spica.h b/include/spica.h index 475ec77..fe4ff53 100644 --- a/include/spica.h +++ b/include/spica.h @@ -6,6 +6,7 @@ #define _SPICA_H_ #include "../sources/core/common.h" +#include "../sources/core/parallel.h" #include "../sources/core/engine.h" #include "../sources/core/path.h" #include "../sources/core/timer.h" diff --git a/sources/core/parallel.cc b/sources/core/parallel.cc index e0f1ce4..00bbad4 100644 --- a/sources/core/parallel.cc +++ b/sources/core/parallel.cc @@ -1,3 +1,4 @@ +#define SPICA_API_EXPORT #include "parallel.h" #include diff --git a/sources/core/parallel.h b/sources/core/parallel.h index c31960d..22a0c6c 100644 --- a/sources/core/parallel.h +++ b/sources/core/parallel.h @@ -8,6 +8,8 @@ #include #include +#include "common.h" + namespace spica { class AtomicDouble { @@ -28,10 +30,10 @@ enum class ParallelSchedule { Dynamic = 0x02 }; -void parallel_for(int start, int end, const std::function& func, - ParallelSchedule schedule = ParallelSchedule::Dynamic); +SPICA_EXPORTS void parallel_for(int start, int end, const std::function& func, + ParallelSchedule schedule = ParallelSchedule::Dynamic); -int numSystemThreads(); -int getThreadID(); +SPICA_EXPORTS int numSystemThreads(); +SPICA_EXPORTS int getThreadID(); #endif // _SPICA_PARALLEL_H_ diff --git a/sources/integrator/hierarchical.cc b/sources/integrator/hierarchical.cc index d12c1fa..260d534 100644 --- a/sources/integrator/hierarchical.cc +++ b/sources/integrator/hierarchical.cc @@ -85,8 +85,7 @@ class HierarchicalIntegrator::Octree : public Uncopyable { } } - void construct(HierarchicalIntegrator* parent, - const std::vector& ipoints) { + void construct(const std::vector& ipoints) { release(); Bounds3d bounds; @@ -285,16 +284,18 @@ void HierarchicalIntegrator::initialize(const Scene& scene, Bounds3d bounds = scene.worldBound(); radius_ = (bounds.posMax() - bounds.posMin()).norm() * 0.001; dA_ = (0.5 * radius_) * (0.5 * radius_) * PI; +} +void HierarchicalIntegrator::loopStarted(const Scene& scene, + const RenderParameters& params, + Sampler& sampler) { // Sample points with dart throwing + points_.clear(); + octree_->release(); Point3d pCamera = camera_->cameraToWorld().apply(Point3d(0.0, 0.0, 0.0)); samplePoissonDisk(scene, pCamera, radius_, &points_); MsgInfo("%zu points sampled with PDS.", points_.size()); -} -void HierarchicalIntegrator::loopStarted(const Scene& scene, - const RenderParameters& params, - Sampler& sampler) { // Compute irradiance at sample points buildOctree(scene, params, sampler); } @@ -359,12 +360,14 @@ void HierarchicalIntegrator::buildOctree(const Scene& scene, iradPoints[i].area = dA_; iradPoints[i].E = irads[i]; } - octree_->construct(this, iradPoints); + octree_->construct(iradPoints); std::cout << "Octree constructed !!" << std::endl; } Spectrum HierarchicalIntegrator::irradiance(const SurfaceInteraction& po) const { Assertion(po.bssrdf(), "BSSRDF not found!!"); + if (!octree_) return Spectrum(0.0); + auto Rd = static_cast(po.bssrdf())->Rd(); const Spectrum Mo = octree_->Mo(po, Rd); return (INV_PI * (1.0 - Rd->Fdr())) * Mo; diff --git a/sources/integrator/photon_map.cc b/sources/integrator/photon_map.cc index a284283..ea76c59 100644 --- a/sources/integrator/photon_map.cc +++ b/sources/integrator/photon_map.cc @@ -281,6 +281,8 @@ void PhotonMap::tracePhoton(const Scene& scene, // Account for BSSRDF if (isect.bssrdf() && (sampledType & BxDFType::Transmission) != BxDFType::None) { + break; + SurfaceInteraction pi; Spectrum S = isect.bssrdf()->sample(scene, sampler.get1D(), sampler.get2D(), arena, &pi, &pdf); diff --git a/sources/integrator/spica_integrator.h b/sources/integrator/spica_integrator.h index 6ccb9d4..3b4ec93 100644 --- a/sources/integrator/spica_integrator.h +++ b/sources/integrator/spica_integrator.h @@ -5,6 +5,7 @@ #ifndef _SPICA_RENDERER_H_ #define _SPICA_RENDERER_H_ +#include "mis.h" #include "pathtrace.h" #include "volpath.h" #include "directlighting.h" diff --git a/sources/shape/spica_shape.h b/sources/shape/spica_shape.h index a19cddb..1f76733 100644 --- a/sources/shape/spica_shape.h +++ b/sources/shape/spica_shape.h @@ -11,5 +11,6 @@ #include "sphere.h" #include "meshio.h" +#include "visibility_tester.h" #endif // _SPICA_SHAPE_HEADERS_H_