From 131ae05f3ea30becd74648960f2bfd62c49831cf Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Sat, 20 Oct 2012 17:59:38 -0400 Subject: [PATCH] OSX-specific python plugin improvements; minor cleanups --- include/mitsuba/render/skdtree.h | 2 +- src/libcore/fresolver.cpp | 4 +++- src/libpython/core.cpp | 14 +++++++++++++- src/librender/scene.cpp | 1 - src/shapes/cylinder.cpp | 1 + src/shapes/disk.cpp | 1 + src/shapes/hair.cpp | 1 + src/shapes/rectangle.cpp | 1 + src/shapes/sphere.cpp | 1 + 9 files changed, 22 insertions(+), 4 deletions(-) diff --git a/include/mitsuba/render/skdtree.h b/include/mitsuba/render/skdtree.h index bdc790bf..efc302dd 100644 --- a/include/mitsuba/render/skdtree.h +++ b/include/mitsuba/render/skdtree.h @@ -425,11 +425,11 @@ protected: its.hasUVPartials = false; its.primIndex = cache->primIndex; its.instance = NULL; + its.time = ray.time; } else { shape->fillIntersectionRecord(ray, reinterpret_cast(temp) + 8, its); } - its.time = ray.time; } /// Plain shadow ray query (used by the 'instance' plugin) diff --git a/src/libcore/fresolver.cpp b/src/libcore/fresolver.cpp index bd94bd10..d66444f8 100644 --- a/src/libcore/fresolver.cpp +++ b/src/libcore/fresolver.cpp @@ -26,7 +26,9 @@ FileResolver::FileResolver() { } #elif defined(__OSX__) MTS_AUTORELEASE_BEGIN() - prependPath(__mts_bundlepath()); + fs::path path = __mts_bundlepath(); + if (path.filename() != fs::path("Python.app")) + prependPath(path); MTS_AUTORELEASE_END() #elif defined(__WINDOWS__) std::vector lpFilename(MAX_PATH); diff --git a/src/libpython/core.cpp b/src/libpython/core.cpp index 247afd60..8c0ad7c9 100644 --- a/src/libpython/core.cpp +++ b/src/libpython/core.cpp @@ -19,12 +19,15 @@ #include #include #include +#include #if defined(__LINUX__) # if !defined(_GNU_SOURCE) # define _GNU_SOURCE # endif # include +#elif defined(__OSX__) +# include #endif using namespace mitsuba; @@ -53,8 +56,17 @@ void initializeFramework() { if (info.dli_fname) sharedLibraryPath = fs::path(info.dli_fname); #elif defined(__OSX__) - + uint32_t imageCount = _dyld_image_count(); + for (uint32_t i=0; igetFileResolver()->prependPath( + sharedLibraryPath.parent_path().parent_path().parent_path()); } void shutdownFramework() { diff --git a/src/librender/scene.cpp b/src/librender/scene.cpp index eae1ca87..60fb21f8 100644 --- a/src/librender/scene.cpp +++ b/src/librender/scene.cpp @@ -738,7 +738,6 @@ bool Scene::rayIntersectAll(const Ray &ray, Intersection &its) const { const Shape *shape = m_specialShapes[i].get(); if (shape->rayIntersect(ray, mint, maxt, tempT, buffer)) { - its.time = ray.time; its.t = tempT; shape->fillIntersectionRecord(ray, buffer, its); result = true; diff --git a/src/shapes/cylinder.cpp b/src/shapes/cylinder.cpp index d66f471f..577d96cb 100644 --- a/src/shapes/cylinder.cpp +++ b/src/shapes/cylinder.cpp @@ -222,6 +222,7 @@ public: its.wi = its.toLocal(-ray.d); its.hasUVPartials = false; its.instance = NULL; + its.time = ray.time; } void samplePosition(PositionSamplingRecord &pRec, const Point2 &sample) const { diff --git a/src/shapes/disk.cpp b/src/shapes/disk.cpp index 93c389b7..9808672f 100644 --- a/src/shapes/disk.cpp +++ b/src/shapes/disk.cpp @@ -190,6 +190,7 @@ public: its.wi = its.toLocal(-ray.d); its.hasUVPartials = false; its.instance = NULL; + its.time = ray.time; } ref createTriMesh() { diff --git a/src/shapes/hair.cpp b/src/shapes/hair.cpp index daa52646..b98b0eae 100644 --- a/src/shapes/hair.cpp +++ b/src/shapes/hair.cpp @@ -843,6 +843,7 @@ void HairShape::fillIntersectionRecord(const Ray &ray, its.wi = its.toLocal(-ray.d); its.hasUVPartials = false; its.instance = this; + its.time = ray.time; } ref HairShape::createTriMesh() { diff --git a/src/shapes/rectangle.cpp b/src/shapes/rectangle.cpp index 97a67e29..a2a384b6 100644 --- a/src/shapes/rectangle.cpp +++ b/src/shapes/rectangle.cpp @@ -164,6 +164,7 @@ public: its.wi = its.toLocal(-ray.d); its.hasUVPartials = false; its.instance = NULL; + its.time = ray.time; } ref createTriMesh() { diff --git a/src/shapes/sphere.cpp b/src/shapes/sphere.cpp index 1d1de05d..b85ea304 100644 --- a/src/shapes/sphere.cpp +++ b/src/shapes/sphere.cpp @@ -251,6 +251,7 @@ public: its.wi = its.toLocal(-ray.d); its.hasUVPartials = false; its.instance = NULL; + its.time = ray.time; } void samplePosition(PositionSamplingRecord &pRec, const Point2 &sample) const {