Skip to content

Commit

Permalink
Module export setting is updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsy committed Mar 22, 2016
1 parent c66c084 commit 1941daa
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 11 deletions.
1 change: 1 addition & 0 deletions include/spica.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions sources/core/parallel.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define SPICA_API_EXPORT
#include "parallel.h"

#include <cstring>
Expand Down
10 changes: 6 additions & 4 deletions sources/core/parallel.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <atomic>
#include <functional>

#include "common.h"

namespace spica {

class AtomicDouble {
Expand All @@ -28,10 +30,10 @@ enum class ParallelSchedule {
Dynamic = 0x02
};

void parallel_for(int start, int end, const std::function<void(int)>& func,
ParallelSchedule schedule = ParallelSchedule::Dynamic);
SPICA_EXPORTS void parallel_for(int start, int end, const std::function<void(int)>& func,
ParallelSchedule schedule = ParallelSchedule::Dynamic);

int numSystemThreads();
int getThreadID();
SPICA_EXPORTS int numSystemThreads();
SPICA_EXPORTS int getThreadID();

#endif // _SPICA_PARALLEL_H_
17 changes: 10 additions & 7 deletions sources/integrator/hierarchical.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ class HierarchicalIntegrator::Octree : public Uncopyable {
}
}

void construct(HierarchicalIntegrator* parent,
const std::vector<IrradiancePoint>& ipoints) {
void construct(const std::vector<IrradiancePoint>& ipoints) {
release();

Bounds3d bounds;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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<SeparableBSSRDF*>(po.bssrdf())->Rd();
const Spectrum Mo = octree_->Mo(po, Rd);
return (INV_PI * (1.0 - Rd->Fdr())) * Mo;
Expand Down
2 changes: 2 additions & 0 deletions sources/integrator/photon_map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions sources/integrator/spica_integrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef _SPICA_RENDERER_H_
#define _SPICA_RENDERER_H_

#include "mis.h"
#include "pathtrace.h"
#include "volpath.h"
#include "directlighting.h"
Expand Down
1 change: 1 addition & 0 deletions sources/shape/spica_shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
#include "sphere.h"

#include "meshio.h"
#include "visibility_tester.h"

#endif // _SPICA_SHAPE_HEADERS_H_

0 comments on commit 1941daa

Please sign in to comment.