python improvements

metadata
Wenzel Jakob 2011-08-14 23:56:47 -04:00
parent 1b47d02583
commit bdf44fc85b
6 changed files with 15 additions and 15 deletions

View File

@ -34,6 +34,8 @@ build('src/librender/SConscript')
build('src/libhw/SConscript') build('src/libhw/SConscript')
# Bidirectional support library # Bidirectional support library
build('src/libbidir/SConscript') build('src/libbidir/SConscript')
# Python binding library
build('src/libpython/SConscript')
# ===== Build the applications ===== # ===== Build the applications =====
env = env.Clone() env = env.Clone()
@ -49,9 +51,6 @@ build('src/mtsgui/SConscript', ['mainEnv', 'converter_objects'], duplicate=True)
env['SHLIBPREFIX']='' env['SHLIBPREFIX']=''
# Python binding library
build('src/mtspy/SConscript')
# ===== Build the plugins ===== # ===== Build the plugins =====
Export('env') Export('env')

View File

@ -43,7 +43,7 @@ if sys.platform == 'linux2':
install(distDir, ['libcore/libmitsuba-core.so', 'libhw/libmitsuba-hw.so', install(distDir, ['libcore/libmitsuba-core.so', 'libhw/libmitsuba-hw.so',
'librender/libmitsuba-render.so', 'libbidir/libmitsuba-bidir.so']) 'librender/libmitsuba-render.so', 'libbidir/libmitsuba-bidir.so'])
if hasPython: if hasPython:
install(distDir, ['mtspy/mtspy.so']) install(os.path.join(distDir, 'mitsuba.so'), ['libpython/mitsuba.so'])
install(distDir, ['mitsuba/mitsuba', 'mitsuba/mtssrv', 'mitsuba/mtsutil', 'mtsgui/mtsgui']) install(distDir, ['mitsuba/mitsuba', 'mitsuba/mtssrv', 'mitsuba/mtsutil', 'mtsgui/mtsgui'])
if hasCollada: if hasCollada:
install(distDir, ['converter/mtsimport']) install(distDir, ['converter/mtsimport'])
@ -70,7 +70,7 @@ if sys.platform == 'win32':
install(distDir, ['libcore/libmitsuba-core.dll', 'libhw/libmitsuba-hw.dll', install(distDir, ['libcore/libmitsuba-core.dll', 'libhw/libmitsuba-hw.dll',
'librender/libmitsuba-render.dll', 'libbidir/libmitsuba-bidir.dll']) 'librender/libmitsuba-render.dll', 'libbidir/libmitsuba-bidir.dll'])
if hasPython: if hasPython:
installAs(os.path.join(distDir, 'mtspy.pyd'), 'mtspy/mtspy.dylib') installAs(os.path.join(distDir, 'python/mitsuba.pyd'), 'libpython/mitsuba.dll')
install(distDir, ['Iex.dll', 'Half.dll','IlmThread.dll', 'Imath.dll','IlmImf.dll','zlib1.dll', install(distDir, ['Iex.dll', 'Half.dll','IlmThread.dll', 'Imath.dll','IlmImf.dll','zlib1.dll',
'libpng13.dll', 'jpeg62.dll', 'pthreadVCE2.dll', 'xerces-c_3_0.dll', 'glew32mx.dll'], 'libpng13.dll', 'jpeg62.dll', 'pthreadVCE2.dll', 'xerces-c_3_0.dll', 'glew32mx.dll'],
prefix=dllprefix) prefix=dllprefix)
@ -115,7 +115,7 @@ elif sys.platform == 'darwin':
install(frameworkDir, ['libcore/libmitsuba-core.dylib', 'libhw/libmitsuba-hw.dylib', install(frameworkDir, ['libcore/libmitsuba-core.dylib', 'libhw/libmitsuba-hw.dylib',
'librender/libmitsuba-render.dylib', 'libbidir/libmitsuba-bidir.dylib']) 'librender/libmitsuba-render.dylib', 'libbidir/libmitsuba-bidir.dylib'])
if hasPython: if hasPython:
installAs(os.path.join(frameworkDir, 'mtspy.so'), 'mtspy/mtspy.dylib') installAs(os.path.join(distDir, 'python/mitsuba.so'), 'libpython/mitsuba.dylib')
install(frameworkDir, [ install(frameworkDir, [
'GLEW.framework/Resources/libs/libGLEW.dylib', 'OpenEXR.framework/Resources/lib/libHalf.6.dylib', 'GLEW.framework/Resources/libs/libGLEW.dylib', 'OpenEXR.framework/Resources/lib/libHalf.6.dylib',
'OpenEXR.framework/Resources/lib/libIex.6.dylib', 'OpenEXR.framework/Resources/lib/libImath.6.dylib', 'OpenEXR.framework/Resources/lib/libIex.6.dylib', 'OpenEXR.framework/Resources/lib/libImath.6.dylib',

View File

@ -187,6 +187,14 @@ public:
return *this; return *this;
} }
/// Matrix-scalar addition
inline const Matrix &operator-=(T value) {
for (int i=0; i<M; ++i)
for (int j=0; j<N; ++j)
m[i][j] -= value;
return *this;
}
/// Component-wise negation /// Component-wise negation
inline Matrix operator-() const { inline Matrix operator-() const {
Matrix result; Matrix result;

View File

@ -11,8 +11,4 @@ if pythonEnv.has_key('PYTHONLIB'):
pythonEnv.Prepend(LIBS=pythonEnv['PYTHONLIB']) pythonEnv.Prepend(LIBS=pythonEnv['PYTHONLIB'])
if hasPython: if hasPython:
mtspy_plugin = pythonEnv.SharedLibrary('mtspy', ['base.cpp']); libpython = pythonEnv.SharedLibrary('mitsuba', ['base.cpp']);
#mtspy_app = pythonEnv.SharedLibrary('mtspy', ['base.cpp']);
if sys.platform == "darwin":
pythonEnv.AddPostAction(mtspy_plugin, 'install_name_tool -id @loader_path/mtspy.dylib $TARGET')

View File

@ -90,9 +90,7 @@ void export_core() {
.def("getRefCount", &Object::getRefCount) .def("getRefCount", &Object::getRefCount)
.def("__str__", &Object::toString); .def("__str__", &Object::toString);
bp::class_<Stream, ref<Object>, bp::bases<Object>, boost::noncopyable>("Stream", bp::no_init) bp::class_<Stream, ref<Stream>, bp::bases<Object>, boost::noncopyable>("Stream", bp::no_init);
.def("getRefCount", &Object::getRefCount)
.def("__str__", &Object::toString);
bp::enum_<Stream::EByteOrder>("EByteOrder") bp::enum_<Stream::EByteOrder>("EByteOrder")
.value("EBigEndian", Stream::EBigEndian) .value("EBigEndian", Stream::EBigEndian)
@ -341,7 +339,6 @@ void export_core() {
.def("__setitem__", &Matrix4x4_setItem) .def("__setitem__", &Matrix4x4_setItem)
.def("__getitem__", &Matrix4x4_getItem) .def("__getitem__", &Matrix4x4_getItem)
.def("setIdentity", &Matrix4x4::setIdentity) .def("setIdentity", &Matrix4x4::setIdentity)
.def("setZero", &Matrix4x4::setZero)
.def("isZero", &Matrix4x4::isZero) .def("isZero", &Matrix4x4::isZero)
.def("trace", &Matrix4x4::trace) .def("trace", &Matrix4x4::trace)
.def("det", &Matrix4x4::det) .def("det", &Matrix4x4::det)