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.primIndex = cache->primIndex;
its.instance = NULL;
its.time = ray.time;
} else {
shape->fillIntersectionRecord(ray,
reinterpret_cast<const uint8_t*>(temp) + 8, its);
}
its.time = ray.time;
}
/// Plain shadow ray query (used by the 'instance' plugin)

View File

@ -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<WCHAR> lpFilename(MAX_PATH);

View File

@ -19,12 +19,15 @@
#include <mitsuba/core/sshstream.h>
#include <mitsuba/render/scenehandler.h>
#include <mitsuba/render/scene.h>
#include <boost/algorithm/string.hpp>
#if defined(__LINUX__)
# if !defined(_GNU_SOURCE)
# define _GNU_SOURCE
# endif
# include <dlfcn.h>
#elif defined(__OSX__)
# include <mach-o/dyld.h>
#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; i<imageCount; ++i) {
const char *imageName = _dyld_get_image_name(i);
if (boost::ends_with(imageName, "mitsuba.so"))
sharedLibraryPath = fs::path(imageName);
}
#endif
if (!sharedLibraryPath.empty())
Thread::getThread()->getFileResolver()->prependPath(
sharedLibraryPath.parent_path().parent_path().parent_path());
}
void shutdownFramework() {

View File

@ -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;

View File

@ -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 {

View File

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

View File

@ -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<TriMesh> HairShape::createTriMesh() {

View File

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

View File

@ -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 {