OSX-specific python plugin improvements; minor cleanups

metadata
Wenzel Jakob 2012-10-20 17:59:38 -04:00
parent 36d762db0a
commit 131ae05f3e
9 changed files with 22 additions and 4 deletions

View File

@ -425,11 +425,11 @@ protected:
its.hasUVPartials = false; its.hasUVPartials = false;
its.primIndex = cache->primIndex; its.primIndex = cache->primIndex;
its.instance = NULL; its.instance = NULL;
its.time = ray.time;
} else { } else {
shape->fillIntersectionRecord(ray, shape->fillIntersectionRecord(ray,
reinterpret_cast<const uint8_t*>(temp) + 8, its); reinterpret_cast<const uint8_t*>(temp) + 8, its);
} }
its.time = ray.time;
} }
/// Plain shadow ray query (used by the 'instance' plugin) /// Plain shadow ray query (used by the 'instance' plugin)

View File

@ -26,7 +26,9 @@ FileResolver::FileResolver() {
} }
#elif defined(__OSX__) #elif defined(__OSX__)
MTS_AUTORELEASE_BEGIN() MTS_AUTORELEASE_BEGIN()
prependPath(__mts_bundlepath()); fs::path path = __mts_bundlepath();
if (path.filename() != fs::path("Python.app"))
prependPath(path);
MTS_AUTORELEASE_END() MTS_AUTORELEASE_END()
#elif defined(__WINDOWS__) #elif defined(__WINDOWS__)
std::vector<WCHAR> lpFilename(MAX_PATH); std::vector<WCHAR> lpFilename(MAX_PATH);

View File

@ -19,12 +19,15 @@
#include <mitsuba/core/sshstream.h> #include <mitsuba/core/sshstream.h>
#include <mitsuba/render/scenehandler.h> #include <mitsuba/render/scenehandler.h>
#include <mitsuba/render/scene.h> #include <mitsuba/render/scene.h>
#include <boost/algorithm/string.hpp>
#if defined(__LINUX__) #if defined(__LINUX__)
# if !defined(_GNU_SOURCE) # if !defined(_GNU_SOURCE)
# define _GNU_SOURCE # define _GNU_SOURCE
# endif # endif
# include <dlfcn.h> # include <dlfcn.h>
#elif defined(__OSX__)
# include <mach-o/dyld.h>
#endif #endif
using namespace mitsuba; using namespace mitsuba;
@ -53,8 +56,17 @@ void initializeFramework() {
if (info.dli_fname) if (info.dli_fname)
sharedLibraryPath = fs::path(info.dli_fname); sharedLibraryPath = fs::path(info.dli_fname);
#elif defined(__OSX__) #elif defined(__OSX__)
uint32_t imageCount = _dyld_image_count();
for (uint32_t i=0; i<imageCount; ++i) {
const char *imageName = _dyld_get_image_name(i);
if (boost::ends_with(imageName, "mitsuba.so"))
sharedLibraryPath = fs::path(imageName);
}
#endif #endif
if (!sharedLibraryPath.empty())
Thread::getThread()->getFileResolver()->prependPath(
sharedLibraryPath.parent_path().parent_path().parent_path());
} }
void shutdownFramework() { void shutdownFramework() {

View File

@ -738,7 +738,6 @@ bool Scene::rayIntersectAll(const Ray &ray, Intersection &its) const {
const Shape *shape = m_specialShapes[i].get(); const Shape *shape = m_specialShapes[i].get();
if (shape->rayIntersect(ray, mint, maxt, tempT, buffer)) { if (shape->rayIntersect(ray, mint, maxt, tempT, buffer)) {
its.time = ray.time;
its.t = tempT; its.t = tempT;
shape->fillIntersectionRecord(ray, buffer, its); shape->fillIntersectionRecord(ray, buffer, its);
result = true; result = true;

View File

@ -222,6 +222,7 @@ public:
its.wi = its.toLocal(-ray.d); its.wi = its.toLocal(-ray.d);
its.hasUVPartials = false; its.hasUVPartials = false;
its.instance = NULL; its.instance = NULL;
its.time = ray.time;
} }
void samplePosition(PositionSamplingRecord &pRec, const Point2 &sample) const { void samplePosition(PositionSamplingRecord &pRec, const Point2 &sample) const {

View File

@ -190,6 +190,7 @@ public:
its.wi = its.toLocal(-ray.d); its.wi = its.toLocal(-ray.d);
its.hasUVPartials = false; its.hasUVPartials = false;
its.instance = NULL; its.instance = NULL;
its.time = ray.time;
} }
ref<TriMesh> createTriMesh() { ref<TriMesh> createTriMesh() {

View File

@ -843,6 +843,7 @@ void HairShape::fillIntersectionRecord(const Ray &ray,
its.wi = its.toLocal(-ray.d); its.wi = its.toLocal(-ray.d);
its.hasUVPartials = false; its.hasUVPartials = false;
its.instance = this; its.instance = this;
its.time = ray.time;
} }
ref<TriMesh> HairShape::createTriMesh() { ref<TriMesh> HairShape::createTriMesh() {

View File

@ -164,6 +164,7 @@ public:
its.wi = its.toLocal(-ray.d); its.wi = its.toLocal(-ray.d);
its.hasUVPartials = false; its.hasUVPartials = false;
its.instance = NULL; its.instance = NULL;
its.time = ray.time;
} }
ref<TriMesh> createTriMesh() { ref<TriMesh> createTriMesh() {

View File

@ -251,6 +251,7 @@ public:
its.wi = its.toLocal(-ray.d); its.wi = its.toLocal(-ray.d);
its.hasUVPartials = false; its.hasUVPartials = false;
its.instance = NULL; its.instance = NULL;
its.time = ray.time;
} }
void samplePosition(PositionSamplingRecord &pRec, const Point2 &sample) const { void samplePosition(PositionSamplingRecord &pRec, const Point2 &sample) const {