From dd7ef85f17affbd6ce210904f0ae6f4d6a6afa29 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Mon, 30 May 2011 12:17:46 +0200 Subject: [PATCH] gizmo removal --- doc/compiling.tex | 67 ++++++++-------- doc/introduction.tex | 4 +- include/mitsuba/core/ray.h | 33 ++++---- include/mitsuba/hw/gizmo.h | 92 ---------------------- include/mitsuba/hw/glrenderer.h | 7 -- include/mitsuba/hw/renderer.h | 8 -- src/cameras/perspective.cpp | 43 +++++------ src/libhw/SConscript | 2 +- src/libhw/gizmo.cpp | 113 --------------------------- src/libhw/glrenderer.cpp | 45 ----------- src/librender/camera.cpp | 8 +- src/librender/intersection.cpp | 11 +-- src/librender/irrcache.cpp | 11 +-- src/librender/util.cpp | 1 - src/medium/SConscript | 1 - src/qtgui/glwidget.cpp | 10 +-- src/qtgui/glwidget.h | 2 - src/qtgui/mainwindow.cpp | 6 -- src/qtgui/mainwindow.h | 1 - src/qtgui/mainwindow.ui | 10 --- src/qtgui/navdlg.cpp | 41 ---------- src/qtgui/navdlg.h | 39 ---------- src/qtgui/navdlg.ui | 133 -------------------------------- 23 files changed, 97 insertions(+), 591 deletions(-) delete mode 100644 include/mitsuba/hw/gizmo.h delete mode 100644 src/libhw/gizmo.cpp delete mode 100644 src/qtgui/navdlg.cpp delete mode 100644 src/qtgui/navdlg.h delete mode 100644 src/qtgui/navdlg.ui diff --git a/doc/compiling.tex b/doc/compiling.tex index fb572221..692de0e8 100644 --- a/doc/compiling.tex +++ b/doc/compiling.tex @@ -1,20 +1,22 @@ \section{Compiling the renderer} To compile Mitsuba, you will need a recent C++ compiler (e.g. GCC 4.1+ or Visual Studio 2008+) and some additional libraries, which Mitsuba uses internally. -Builds on all three supported platforms are done using a unified system -based on SCons (\url{http://www.scons.org}), a flexible python-based +Builds on all supported platforms are done using a unified system +based on SCons (\url{http://www.scons.org}), which is a Python-based software construction tool. There are some minor differences between operating systems though: for more details, please refer to one of the next sections depending on which one you use. \subsection{Common steps} -To get started, you will need to download a recent version of Mitsuba: make sure that you have the Mercurial (\url{http://mercurial.selenic.com/}) -versioning system installed and enter the following at the command prompt: +To get started, you will need to download a recent version of Mitsuba. Make sure that you have the Mercurial (\url{http://mercurial.selenic.com/}) versioning system installed\footnote{On Windows, you might also want the convenient TortoiseHG shell extension (\url{http://tortoisehg.bitbucket.org/}) to run the subsequent steps directly from the Explorer.} and enter the following at the command prompt: \begin{shell} $\texttt{\$}$ hg clone https://www.mitsuba-renderer.org/hg/mitsuba \end{shell} -On Windows, you can instead use the more convenient TortoiseHG shell extension (\url{http://tortoisehg.bitbucket.org/}) -to do this directly from the Explorer. - +Afterwards, you will need to download the precompiled dependencies into the +subdirectory \code{mitsuba/dependencies}: +\begin{shell} +$\texttt{\$}$ cd mitsuba +$\texttt{\$}$ hg clone https://www.mitsuba-renderer.org/hg/dependencies +\end{shell} Common to all platforms is that a build configuration file must be chosen: amongst the following, please copy the best matching file into a new file to the root of the Mitsuba directory and rename it into \code{config.py}. @@ -31,10 +33,13 @@ config/config-msvc2010-win32.py config/config-msvc2010-win64.py \end{shell} -Some minor adjustments may have to be made to this file based on your configuration. -You may also set adjust certain compilation flags here: +Usually, you will not have to make any modification to this fine, but sometimes a few minor +edits may be necessary. In particular, you might want to add or remove certain +compilation flags from the \code{CXXFLAGS} parameter. The following settings +affect the behavior of Mitsuba: \begin{description} -\item[\texttt{MTS\_DEBUG}] Enable assertions etc. Usually a good idea. +\item[\texttt{MTS\_DEBUG}] Enable assertions etc. Usually a good idea, and +enabled by default. \item[\texttt{MTS\_KD\_DEBUG}] Enable additional checks in the kd-Tree. This is quite slow and mainly useful to track down bugs when they are suspected. \item[\texttt{MTS\_KD\_CONSERVE\_MEMORY}] Use less memory for storing geometry (at the cost of speed). @@ -44,14 +49,14 @@ Off by default. \texttt{MTS\_SSE}, \texttt{MTS\_HAS\_COHERENT\_RT}, and \texttt{MTS\_DEBUG\_FP}. \item[\texttt{MTS\_SSE}]Activate optimized SSE routines. \item[\texttt{MTS\_HAS\_COHERENT\_RT}]Include coherent ray tracing support (depends on \texttt{MTS\_SSE}). -\item[\texttt{MTS\_DEBUG\_FP}]Generated NaNs will cause floating point exceptions, which can be caught in a debugger. Warning: This is slow! +\item[\texttt{MTS\_DEBUG\_FP}]Generated NaNs and overflows will cause floating point exceptions, which can be caught in a debugger. This is slow and mainly meant as a debugging tool for developers. \item[\texttt{MTS\_GUI\_SOFTWARE\_FALLBACK}]Forces the GUI to use a software fallback mode, which is considerably slower and removes the realtime preview. This is useful when running the interface on a remote machine accessed via the Remote Desktop Protocol (RDP). \end{description} -All default configurations use the flags \code{MTS\_DEBUG}, \code{SINGLE\_PRECISION}, \code{MTS\_SSE}, \code{MTS\_HAS\_COHERENT\_RT}. -Initially, it is a good idea to just leave the configuration the way it is. +All default configurations use the flags \code{MTS\_DEBUG}, \code{SINGLE\_PRECISION}, \code{MTS\_SSE}, +as well as \code{MTS\_HAS\_COHERENT\_RT}. \subsection{Building on Ubuntu Linux} You'll first need to install a number of dependencies. It is assumed here @@ -62,9 +67,9 @@ First, run \begin{shell} $\text{\$}$ sudo apt-get install build-essential scons qt4-dev-tools scons libpng12-dev libjpeg62-dev libilmbase-dev libopenexr-dev libxerces-c-dev libboost-dev libglewmx1.5-dev libxxf86vm-dev libboost-system-dev libboost-filesystem-dev \end{shell} -To get COLLADA support, you will also need to install the \texttt{collada-dom} packages or build them from scratch. Here, we install the \code{x86\_64} binaries and development headers included with Mitsuba: +To get COLLADA support, you will also need to install the \texttt{collada-dom} packages or build them from scratch. Here, we install the \code{x86\_64} binaries and development headers available on the Mitsuba website: \begin{shell} -$\text{\$}$ sudo dpkg --install tools/linux/collada-dom2.2_2.2-1_amd64.deb tools/linux/collada-dom-dev_2.2-1_amd64.deb +$\text{\$}$ sudo dpkg --install collada-dom2.2_2.2-2_amd64.deb collada-dom-dev_2.2-2_amd64.deb \end{shell} Afterwards, simply run \begin{shell} @@ -165,30 +170,30 @@ After installing you will be able to run the renderer from the command line. If for some reason you are unable access the Aur files, they are also hosted at (\url{https://www.mitsuba-renderer.org/releases/contrib/archlinux/}) - \subsection{Building on Windows} -This section assumes that Visual Studio 2008 is installed, but the instructions should work analogously for other versions. On the Windows platform, Mitsuba already includes most of the dependencies in precompiled form. You will still need to set up a few things though: first, you need to install Python -(\url{www.python.org}) and SCons (\url{http://www.scons.org}) and ensure that they are contained -in the \code{\%PATH\%} environment variable so that entering \code{scons} on the command prompt -(\code{cmd.exe}) launches the build system (it will complain about not finding a project file though). +(\url{www.python.org}) and SCons\footnote{Note that on some Windows machines, the SCons installer generates a warning about not finding Python in the registry. In this case, you can instead run \code{python setup.py install} within the source release of SCons.} (\url{http://www.scons.org}) and ensure that they are contained in the \code{\%PATH\%} environment variable so that entering \code{scons} on the command prompt (\code{cmd.exe}) launches the build system. + +Next, you will either need to compile Qt 4.$x$ (where $x\ge 7$) from source or grab pre-built binaries from the following page: \url{http://code.google.com/p/qt-msvc-installer}. It is crucial that the build configuration is identical: for instance, when you are compiling Mitsuba using the 64-bit compiler in Visual Studio 2010, you will need Qt binaries made with that same compiler. When compiling Qt from source, +start the correct Visual Studio command prompt, and enter \begin{shell} -C:\Users\Wenzel>scons -scons: ** No SConstruct file found. +C:\Qt>configure.exe -release -no-webkit -no-phonon -no-phonon-backend -no-script + -no-scripttools -no-qt3support -no-multimedia -no-ltcg +..(configuration messages).. +C:\Qt>nmake \end{shell} -\emph{Note: }On some setups, the SCons installer generates a warning about not finding Python in the registry. In this case, you can instead run \code{python setup.py install} within the source release of SCons. -Next, install Qt (\url{http://qt.nokia.com/downloads/windows-cpp-vs2008} -- you should get the release for Visual Studio 2008). Again, you need to make sure that the -Qt utilities are reachable through the \code{\%PATH\%} environment variable so that you can for example launch \code{moc.exe} from the command line. +inside the Qt directory. -Note that since the official release of Qt currently only contains 32-bit binaries, you will accordingly have to -build Mitsuba in 32-bit mode (i.e. you should use the configuration file \code{config-msvc2008-win32.py}). If you would rather like compile it in 64-bit mode, -you can either compile your own 64-bit Qt binaries or use the prebuilt -packages available here: \url{http://code.google.com/p/qt-msvc-installer}. - -Having installed these dependencies, run the ``Visual Studio 2008 Command +Having installed these dependencies, run the ``Visual Studio \emph{2008/2010} Command Prompt'' from the Start Menu (\code{x86} for 32-bit or \code{x64} for 64bit). Afterwards, navigate to the Mitsuba directory and run \code{scons}. +Depending on whether or not the Qt binaries are on the \code{\%PATH\%} +environment variable, you may also have to enter +\begin{shell} +set QTDIR=C:\Qt +\end{shell} +where \code{C:$\backslash$Qt} is the path to your Qt installation. In the case that you have multiple processors, you might want to parallelize the build by appending \code{-j }\emph{core count} to the \code{scons} command. If all goes well, the build process will finish successfully after a few diff --git a/doc/introduction.tex b/doc/introduction.tex index 27f0becf..9ef36861 100644 --- a/doc/introduction.tex +++ b/doc/introduction.tex @@ -7,8 +7,8 @@ Mitsuba is an extensible rendering framework written in portable C++. It impleme as well as biased techniques and contains heavy optimizations targeted towards current CPU architectures. -In comparison to other open renderers, it is more focused on ``researchy'' rendering -techniques, such as path-based formulations of Metropolis Light Transport and volumetric +In comparison to other open source renderers, Mitsuba places an emphasis on recent research-oriented +rendering techniques, such as path-based formulations of Metropolis Light Transport and volumetric modeling approaches. \subsection{License} diff --git a/include/mitsuba/core/ray.h b/include/mitsuba/core/ray.h index fad8dcd9..54b2b04f 100644 --- a/include/mitsuba/core/ray.h +++ b/include/mitsuba/core/ray.h @@ -113,7 +113,7 @@ struct Ray { /// Return a string representation of this ray inline std::string toString() const { std::ostringstream oss; - oss << "Ray[orig=" << o.toString() << ", dir=" + oss << "Ray[origin=" << o.toString() << ", direction=" << d.toString() << ", mint=" << mint << ", maxt=" << maxt << ", time=" << time << "]"; return oss.str(); @@ -125,8 +125,9 @@ struct Ray { \ingroup libcore */ struct RayDifferential : public Ray { + Point rxOrigin, ryOrigin; + Vector rxDirection, ryDirection; bool hasDifferentials; - Ray rx, ry; inline RayDifferential() : hasDifferentials(false) { @@ -141,14 +142,16 @@ struct RayDifferential : public Ray { } inline RayDifferential(const RayDifferential &ray) - : Ray(ray), hasDifferentials(ray.hasDifferentials), rx(ray.rx), ry(ray.ry) { + : Ray(ray), rxOrigin(ray.rxOrigin), ryOrigin(ray.ryOrigin), + rxDirection(ray.rxDirection), ryDirection(ray.ryDirection), + hasDifferentials(ray.hasDifferentials) { } void scaleDifferential(Float amount) { - rx.setOrigin(o + (rx.o - o) * amount); - ry.setOrigin(o + (ry.o - o) * amount); - rx.setDirection(d + (rx.d - d) * amount); - ry.setDirection(d + (ry.d - d) * amount); + rxOrigin = o + (rxOrigin - o) * amount; + ryOrigin = o + (ryOrigin - o) * amount; + rxDirection = d + (rxDirection - d) * amount; + ryDirection = d + (ryDirection - d) * amount; } inline void operator=(const RayDifferential &ray) { @@ -164,8 +167,10 @@ struct RayDifferential : public Ray { restoreFPExceptions(state); #endif hasDifferentials = ray.hasDifferentials; - rx = ray.rx; - ry = ray.ry; + rxOrigin = ray.rxOrigin; + ryOrigin = ray.ryOrigin; + rxDirection = ray.rxDirection; + ryDirection = ray.ryDirection; } inline void operator=(const Ray &ray) { @@ -187,13 +192,15 @@ struct RayDifferential : public Ray { inline std::string toString() const { std::ostringstream oss; oss << "RayDifferential[" << endl - << " orig = " << o.toString() << "," << endl - << " dir = " << d.toString() << "," << endl + << " origin = " << o.toString() << "," << endl + << " direction = " << d.toString() << "," << endl << " mint = " << mint << "," << endl << " maxt = " << maxt << "," << endl << " time = " << time << "," << endl - << " rx = " << indent(rx.toString()) << "," << endl - << " ry = " << indent(ry.toString()) << endl + << " rxOrigin = " << rxOrigin.toString() << "," << endl + << " ryOrigin = " << ryOrigin.toString() << "," << endl + << " rxDirection = " << rxDirection.toString() << "," << endl + << " ryDirection = " << ryDirection.toString() << endl << "]" << endl; return oss.str(); } diff --git a/include/mitsuba/hw/gizmo.h b/include/mitsuba/hw/gizmo.h deleted file mode 100644 index 7dbab0a0..00000000 --- a/include/mitsuba/hw/gizmo.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - This file is part of Mitsuba, a physically based rendering system. - - Copyright (c) 2007-2011 by Wenzel Jakob and others. - - Mitsuba is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License Version 3 - as published by the Free Software Foundation. - - Mitsuba is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#if !defined(__GIZMO_H) -#define __GIZMO_H - -#include - -MTS_NAMESPACE_BEGIN - -/** - * This class is responsible for rendering `gizmos', which are - * intuitive controls for navigating through 3D space. - */ -class MTS_EXPORT_HW Gizmo : public Object { -public: - Gizmo(); - - /// Initialize the gizmo for the specified bounding sphere - void init(const BSphere &bsphere); - - /// Start a new drag operation - void startDrag(const Ray &ray); - - //// Perform a drag to the specified ray - void dragTo(const Ray &ray, const Camera *camera); - - /// Check whether the gizmo is currently active - inline bool isActive() const { return m_active; } - - /// Check whether the drag starting point has been set - inline bool canDrag() const { return m_drag; } - - /// Check whether the gizmo is currently used in a drag operation - inline bool isDragging() const { return m_drag && (m_dragStart != m_dragEnd); } - - /// Check whether a certain ray intersects the gizmo - inline void rayIntersect(const Ray &ray, Float &t) const { - Float farT; - if (!m_active || !m_bsphere.rayIntersect(ray, t, farT)) { - t = std::numeric_limits::infinity(); - } else { - if (t <= 0) - t = farT; - if (t <= 0) - t = std::numeric_limits::infinity(); - } - } - - /// Draw the gizmo - void draw(Renderer *renderer, const Camera *camera); - - /// Return the transformation associated with the gizmo - Transform getTransform() const; - - /// Reset the gizmo - inline void reset() { m_active = m_drag = false; } - - /// Stop dragging - inline void stopDrag() { m_dragStart = m_dragEnd; } - - /// Return the bounding sphere associated with the gizmo - inline const BSphere &getBSphere() const { return m_bsphere; } - - MTS_DECLARE_CLASS() -protected: - /// Virtual destructor - virtual ~Gizmo(); -private: - BSphere m_bsphere; - Point m_dragStart, m_dragEnd; - bool m_active, m_drag; -}; - -MTS_NAMESPACE_END - -#endif /* __GIZMO_H */ diff --git a/include/mitsuba/hw/glrenderer.h b/include/mitsuba/hw/glrenderer.h index 27523fe5..6bfabe11 100644 --- a/include/mitsuba/hw/glrenderer.h +++ b/include/mitsuba/hw/glrenderer.h @@ -102,13 +102,6 @@ public: bool centerHoriz = true, bool centerVert = true, const Vector2i &offset = Vector2i(0, 0)); - /// Draw a planar circle with the specified center, normal and radius - void drawCircle(const Point ¢er, const Normal &normal, Float radius); - - /// Draw a 3D arc connecting \c p1 and \c p2 - void drawArc(const Point ¢er, - const Point &p1, const Point &p2, bool shorterPiece); - /// Clean up the renderer after drawing triangle geometry void endDrawingMeshes(); diff --git a/include/mitsuba/hw/renderer.h b/include/mitsuba/hw/renderer.h index 622e9fc7..1477404c 100644 --- a/include/mitsuba/hw/renderer.h +++ b/include/mitsuba/hw/renderer.h @@ -162,14 +162,6 @@ public: bool centerHoriz = true, bool centerVert = true, const Vector2i &offset = Vector2i(0, 0)) = 0; - /// Draw a planar circle with the specified center, normal and radius - virtual void drawCircle(const Point ¢er, - const Normal &normal, Float radius) = 0; - - /// Draw a 3D arc connecting \c p1 and \c p2 - virtual void drawArc(const Point ¢er, - const Point &p1, const Point &p2, bool shorterPiece) = 0; - /// Blit a screen-sized quad virtual void blitQuad(bool flipVertically) = 0; diff --git a/src/cameras/perspective.cpp b/src/cameras/perspective.cpp index ca6b60eb..072da2cd 100644 --- a/src/cameras/perspective.cpp +++ b/src/cameras/perspective.cpp @@ -31,16 +31,15 @@ static StatsCounter cameraRays("General", "Camera ray generations"); */ class PerspectiveCamera : public PinholeCamera { public: - PerspectiveCamera(const Properties &props) - : PinholeCamera(props) { + PerspectiveCamera(const Properties &props) : PinholeCamera(props) { /* Distance to the focal plane */ - m_focalDistance = props.getFloat("focalDistance", m_farClip); - /* World-space lens radius */ - m_lensRadius = props.getFloat("lensRadius", 0.0f); + focusDistance = props.getFloat("focusDistance", m_farClip); + /* World-space aperture radius */ + m_apertureRadius = props.getFloat("apertureRadius", 0.0f); if (m_cameraToWorld.hasScale()) Log(EError, "Mitsuba's perspective camera does not allow scale " "factors in the camera-to-world transformation! Please remove those factors, " - "since they will cause inconsistencies in various parts of the renderer."); + "since they can cause inconsistencies in some parts of the renderer."); } PerspectiveCamera(Stream *stream, InstanceManager *manager) @@ -50,27 +49,21 @@ public: m_cameraToRaster = Transform(stream); m_rasterToScreen = Transform(stream); m_screenToRaster = Transform(stream); - m_lensRadius = stream->readFloat(); - m_focalDistance = stream->readFloat(); + m_apertureRadius = stream->readFloat(); + focusDistance = stream->readFloat(); configure(); } void configure() { PinholeCamera::configure(); - bool mapYToNDC01 = (m_aspect >= 1.0f); - if (!m_mapSmallerSide) - mapYToNDC01 = !mapYToNDC01; - /* Maps from the image plane space to raster space. The smaller 2D coordinate axis on the film will have normalized device coordinates in [0, 1] (unless the flag mapSmallerSide is specified) . Also inverts the Y coordinate */ - m_cameraToScreen = Transform::perspective(m_fov, m_nearClip, m_farClip); - - if (mapYToNDC01) { + if ((m_aspect >= 1.0f) ^ !m_mapSmallerSide) { m_screenToRaster = Transform::scale(Vector((Float) m_film->getSize().x, (Float) m_film->getSize().y, 1.0f)) * Transform::scale(Vector(1/(2*m_aspect), -0.5f, 1.0f)) @@ -82,11 +75,11 @@ public: * Transform::translate(Vector(1.0f, - 1 / m_aspect, 0)); } + m_cameraToScreen = Transform::perspective(m_fov, m_nearClip, m_farClip); m_cameraToScreenGL = Transform::glPerspective(m_yfov, m_nearClip, m_farClip) * Transform::scale(Vector(1/m_aspect, 1.0f, 1.0f)); m_rasterToScreen = m_screenToRaster.inverse(); - m_worldToScreen = m_cameraToScreen * m_worldToCamera; m_rasterToCamera = m_cameraToScreen.inverse() * m_rasterToScreen; m_cameraToRaster = m_rasterToCamera.inverse(); @@ -100,12 +93,12 @@ public: m_cameraToRaster.serialize(stream); m_rasterToScreen.serialize(stream); m_screenToRaster.serialize(stream); - stream->writeFloat(m_lensRadius); - stream->writeFloat(m_focalDistance); + stream->writeFloat(m_apertureRadius); + stream->writeFloat(focusDistance); } bool needsLensSample() const { - return m_lensRadius > 0.0f; + return m_apertureRadius > 0.0f; } void generateRay(const Point2 &dirSample, const Point2 &lensSample, @@ -121,14 +114,14 @@ public: Ray localRay(Point(0, 0, 0), Vector(imageCoords), m_shutterOpen + m_shutterOpenTime * timeSample); - if (m_lensRadius > 0.0f) { + if (m_apertureRadius > 0.0f) { /* Sample a point on the aperture */ Point2 lensPos = squareToDiskConcentric(lensSample) - * m_lensRadius; + * m_apertureRadius; /* Calculate the intersection with the focal plane */ Point itsFocal = - localRay(m_focalDistance / localRay.d.z); + localRay(focusDistance / localRay.d.z); /* Perturb the ray accordingly */ localRay.o.x += lensPos.x; @@ -188,8 +181,8 @@ public: << " farClip = " << m_farClip << "," << std::endl << " shutterOpen = " << m_shutterOpen << "," << std::endl << " shutterClose = " << m_shutterClose << "," << std::endl - << " lensRadius = " << m_lensRadius << "," << std::endl - << " focalDistance = " << m_focalDistance << "," << std::endl + << " apertureRadius = " << m_apertureRadius << "," << std::endl + << " focusDistance = " << focusDistance << "," << std::endl << " cameraToWorld = " << indent(m_cameraToWorld.toString()) << "," << std::endl << " cameraToScreen = " << indent(m_cameraToScreen.toString()) << "," << std::endl << " rasterToCamera = " << indent(m_rasterToCamera.toString()) << std::endl @@ -202,7 +195,7 @@ private: Transform m_worldToScreen; Transform m_rasterToCamera, m_cameraToRaster; Transform m_rasterToScreen, m_screenToRaster; - Float m_lensRadius, m_focalDistance; + Float m_apertureRadius, focusDistance; }; diff --git a/src/libhw/SConscript b/src/libhw/SConscript index c6cd89e9..7670efb8 100644 --- a/src/libhw/SConscript +++ b/src/libhw/SConscript @@ -4,7 +4,7 @@ libhw_objects = [ 'session.cpp', 'device.cpp', 'gputexture.cpp', 'gpugeometry.cpp', 'gpuprogram.cpp', 'renderer.cpp', 'glrenderer.cpp', 'glprogram.cpp', 'glgeometry.cpp', 'gltexture.cpp', 'gpusync.cpp', 'glsync.cpp', - 'vpl.cpp', 'font.cpp', 'viewer.cpp', 'gizmo.cpp'] + 'vpl.cpp', 'font.cpp', 'viewer.cpp'] if sys.platform == 'win32': libhw_objects += ['wglsession.cpp', diff --git a/src/libhw/gizmo.cpp b/src/libhw/gizmo.cpp deleted file mode 100644 index 82ae0d00..00000000 --- a/src/libhw/gizmo.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - This file is part of Mitsuba, a physically based rendering system. - - Copyright (c) 2007-2011 by Wenzel Jakob and others. - - Mitsuba is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License Version 3 - as published by the Free Software Foundation. - - Mitsuba is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include - -MTS_NAMESPACE_BEGIN - -Gizmo::Gizmo() : m_active(false), m_drag(false) { } - -Gizmo::~Gizmo() { } - -void Gizmo::init(const BSphere &bsphere) { - m_bsphere = bsphere; - m_active = true; - m_drag = false; -} - -Transform Gizmo::getTransform() const { - Vector leg1 = normalize(m_dragStart - m_bsphere.center); - Vector leg2 = normalize(m_dragEnd - m_bsphere.center); - Vector rotAxis = normalize(cross(leg1, leg2)); - Float angle = unitAngle(leg1, leg2) * 180/M_PI; - - return Transform::translate(Vector(m_bsphere.center)) * - Transform::rotate(rotAxis, angle) * - Transform::translate(-Vector(m_bsphere.center)); -} - -void Gizmo::startDrag(const Ray &ray) { - Float nearT, farT; - if (!m_bsphere.rayIntersect(ray, nearT, farT) - || (nearT < 0 && farT < 0)) { - Log(EWarn, "Gizmo::init(): Internal error (no intersection found)!"); - return; - } else if (nearT < 0) { - m_dragStart = ray(farT); - } else { - m_dragStart = ray(nearT); - } - m_dragEnd = m_dragStart; - m_drag = true; -} - -void Gizmo::dragTo(const Ray &ray, const Camera *camera) { - Float nearT, farT; - if (m_bsphere.rayIntersect(ray, nearT, farT)) { - if (nearT < 0) - m_dragEnd = ray(farT); - else - m_dragEnd = ray(nearT); - } else { - Normal n(normalize(m_bsphere.center - camera->getPosition())); - Float t = (dot(n, Vector(m_bsphere.center)) - dot(n, Vector(ray.o)))/dot(n, ray.d); - Point closest = ray(t); - m_dragEnd = m_bsphere.center + normalize(closest - - m_bsphere.center) * m_bsphere.radius; - } -} - -void Gizmo::draw(Renderer *renderer, const Camera *camera) { - if (m_bsphere.isEmpty()) - return; - - /* Compute the tangent circle */ - Vector camToSphere(m_bsphere.center - camera->getPosition()); - const Float length = camToSphere.length(), radius = m_bsphere.radius; - camToSphere /= length; - - Float tcRadius = std::sqrt(length*length - radius*radius)*radius/length; - Float tcDist = std::sqrt(radius*radius - tcRadius*tcRadius); - - renderer->setDepthTest(false); - renderer->drawCircle(m_bsphere.center - camToSphere * tcDist, - camToSphere, tcRadius); - renderer->setDepthTest(true); - - if (m_drag && m_dragStart != m_dragEnd) { - Spectrum color1, color2; - color1.fromLinearRGB(0.7f, 0.7f, 1.0f); - color2.fromLinearRGB(0.3f, 0.3f, 0.3f); - Transform trafo = getTransform().inverse(); - Point dragEnd = trafo(trafo(m_dragEnd)); - - renderer->setColor(color1); - renderer->drawArc(m_bsphere.center, m_dragStart, dragEnd, true); - renderer->setColor(color2); - renderer->drawArc(m_bsphere.center, m_dragStart, dragEnd, false); - - Vector rotAxis = normalize(cross(m_dragStart-m_bsphere.center, - dragEnd-m_bsphere.center)); - Vector circle2Axis = cross(normalize(m_dragStart-m_bsphere.center), rotAxis); - renderer->drawCircle(m_bsphere.center, Normal(circle2Axis), radius); - renderer->setColor(Spectrum(1.0f)); - } -} - -MTS_IMPLEMENT_CLASS(Gizmo, false, Object) -MTS_NAMESPACE_END diff --git a/src/libhw/glrenderer.cpp b/src/libhw/glrenderer.cpp index 12b9b843..f0fc8ff7 100644 --- a/src/libhw/glrenderer.cpp +++ b/src/libhw/glrenderer.cpp @@ -756,51 +756,6 @@ void GLRenderer::blitQuad(bool flipVertically) { glEnd(); } -void GLRenderer::drawCircle(const Point ¢er, - const Normal &normal, Float radius) { - int nDiscr = 80; - Vector X, Y; - Float stepSize = 2*M_PI/nDiscr; - coordinateSystem(normal, X, Y); - - glBegin(GL_LINE_LOOP); - for (int i=0; i Utility::loadScene(const std::string &filename, parser->setExternalNoNamespaceSchemaLocation(schemaPath.file_string().c_str()); parser->setCalculateSrcOfs(true); - std::map parameters; SceneHandler *handler = new SceneHandler(parser, params); parser->setDoNamespaces(true); parser->setDocumentHandler(handler); diff --git a/src/medium/SConscript b/src/medium/SConscript index 520604e1..92224582 100644 --- a/src/medium/SConscript +++ b/src/medium/SConscript @@ -2,6 +2,5 @@ Import('env', 'plugins') plugins += env.SharedLibrary('#plugins/homogeneous', ['homogeneous.cpp']) plugins += env.SharedLibrary('#plugins/heterogeneous', ['heterogeneous.cpp']) -#plugins += env.SharedLibrary('#plugins/heterogeneous-flake', ['heterogeneous-flake.cpp']) Export('plugins') diff --git a/src/qtgui/glwidget.cpp b/src/qtgui/glwidget.cpp index b7b271b7..057bd8b6 100644 --- a/src/qtgui/glwidget.cpp +++ b/src/qtgui/glwidget.cpp @@ -46,7 +46,6 @@ GLWidget::GLWidget(QWidget *parent) : connect(m_redrawTimer, SIGNAL(timeout()), this, SLOT(updateGL())); m_renderer = Renderer::create(NULL); m_device = new QtDevice(this); - m_gizmo = new Gizmo(); m_preview = new PreviewThread(m_device, m_renderer); connect(m_preview, SIGNAL(caughtException(const QString &)), this, SLOT(onException(const QString &)), Qt::QueuedConnection); @@ -79,11 +78,9 @@ void GLWidget::shutdown() { void GLWidget::onException(const QString &what) { QString errorString("A critical exception occurred in the preview rendering thread. " "Please make sure that you are using the most recent graphics drivers. " - "Mitsuba will now switch " - "to a slow software fallback mode, which only supports " - "the rendering preview but no tonemapping and no " - "real-time preview/navigation. " - "The encountered error was:\n\n%1"); + "Mitsuba will now switch to a slow software fallback mode, which only " + "supports the rendering preview but no tonemapping and no real-time " + "preview/navigation. The encountered error was:\n\n%1"); QMessageBox::critical(this, tr("Critical exception"), errorString.arg(what), QMessageBox::Ok); m_softwareFallback = true; @@ -319,7 +316,6 @@ void GLWidget::setScene(SceneContext *context) { m_framebufferChanged = true; m_mouseButtonDown = m_animation = false; m_leftKeyDown = m_rightKeyDown = m_upKeyDown = m_downKeyDown = false; - m_gizmo->reset(); updateGeometry(); updateScrollBars(); updateGL(); diff --git a/src/qtgui/glwidget.h b/src/qtgui/glwidget.h index a0e2decf..27273221 100644 --- a/src/qtgui/glwidget.h +++ b/src/qtgui/glwidget.h @@ -28,7 +28,6 @@ #include #include #include -#include #if defined(WIN32) #include #endif @@ -136,7 +135,6 @@ private: ref m_downsamplingProgram, m_luminanceProgram; ref m_device; ref m_font; - ref m_gizmo; SceneContext *m_context; bool m_framebufferChanged, m_mouseButtonDown; bool m_leftKeyDown, m_rightKeyDown; diff --git a/src/qtgui/mainwindow.cpp b/src/qtgui/mainwindow.cpp index 2a9f5fb5..d7cfa953 100644 --- a/src/qtgui/mainwindow.cpp +++ b/src/qtgui/mainwindow.cpp @@ -24,7 +24,6 @@ #include "sceneinfodlg.h" #include "sceneloader.h" #include "logwidget.h" -#include "navdlg.h" #include "aboutdlg.h" #include "importdlg.h" #include "loaddlg.h" @@ -1406,11 +1405,6 @@ void MainWindow::onSaveAsDialogClose(int reason) { } } -void MainWindow::on_actionNavigationControls_triggered() { - NavigationDialog nav(this); - nav.exec(); -} - void MainWindow::on_actionReferenceManual_triggered() { QDesktopServices::openUrl(QUrl("http://www.mitsuba-renderer.org/docs.html")); } diff --git a/src/qtgui/mainwindow.h b/src/qtgui/mainwindow.h index cb6acec4..a467b5fd 100644 --- a/src/qtgui/mainwindow.h +++ b/src/qtgui/mainwindow.h @@ -119,7 +119,6 @@ private slots: void on_actionSave_triggered(); void on_actionSaveAs_triggered(); void on_actionExportImage_triggered(); - void on_actionNavigationControls_triggered(); void on_actionReferenceManual_triggered(); void on_actionImport_triggered(); void on_actionDuplicateTab_triggered(); diff --git a/src/qtgui/mainwindow.ui b/src/qtgui/mainwindow.ui index 273bf985..07b7326f 100644 --- a/src/qtgui/mainwindow.ui +++ b/src/qtgui/mainwindow.ui @@ -135,7 +135,6 @@ false - @@ -381,15 +380,6 @@ Check for &Updates .. - - - - :/resources/controls.png:/resources/controls.png - - - &Navigation Controls - - diff --git a/src/qtgui/navdlg.cpp b/src/qtgui/navdlg.cpp deleted file mode 100644 index a242532f..00000000 --- a/src/qtgui/navdlg.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - This file is part of Mitsuba, a physically based rendering system. - - Copyright (c) 2007-2011 by Wenzel Jakob and others. - - Mitsuba is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License Version 3 - as published by the Free Software Foundation. - - Mitsuba is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include "ui_navdlg.h" -#include "navdlg.h" - -NavigationDialog::NavigationDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::NavigationDialog) { - ui->setupUi(this); -} - -NavigationDialog::~NavigationDialog() { - delete ui; -} - -void NavigationDialog::changeEvent(QEvent *e) { - QDialog::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} diff --git a/src/qtgui/navdlg.h b/src/qtgui/navdlg.h deleted file mode 100644 index da1e55d2..00000000 --- a/src/qtgui/navdlg.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - This file is part of Mitsuba, a physically based rendering system. - - Copyright (c) 2007-2011 by Wenzel Jakob and others. - - Mitsuba is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License Version 3 - as published by the Free Software Foundation. - - Mitsuba is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#if !defined(__NAVIGATIONDLG_H) -#define __NAVIGATIONDLG_H - -#include "common.h" - -namespace Ui { - class NavigationDialog; -} - -class NavigationDialog : public QDialog { - Q_OBJECT -public: - NavigationDialog(QWidget *parent); - virtual ~NavigationDialog(); -protected: - void changeEvent(QEvent *e); -private: - Ui::NavigationDialog *ui; -}; - -#endif // __NAVIGATIONDLG_H diff --git a/src/qtgui/navdlg.ui b/src/qtgui/navdlg.ui deleted file mode 100644 index b42a5fb6..00000000 --- a/src/qtgui/navdlg.ui +++ /dev/null @@ -1,133 +0,0 @@ - - - NavigationDialog - - - - 0 - 0 - 638 - 395 - - - - - 0 - 0 - - - - Navigation Controls - - - - QLayout::SetFixedSize - - - - - - 0 - 0 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Lucida Grande'; font-weight:400; font-style:normal;"> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Navigation Controls</span></p> -<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> -<table border="0" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;" cellspacing="10" cellpadding="0"> -<tr> -<td> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Look around:</span></p></td> -<td> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Drag the mouse while holding the </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">left button.</p></td></tr> -<tr> -<td> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Roll:</span></p></td> -<td> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Drag the mouse horizontally while </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">holding the right button.</p></td></tr> -<tr> -<td> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Change the field of view:</span></p></td> -<td> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Drag the mouse vertically while </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">holding the right button.</p></td></tr> -<tr> -<td> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Move around:</span></p></td> -<td> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Use the arrow or WASD keys.</p></td></tr> -<tr> -<td> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Change the motion speed:</span></p></td> -<td> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">PageUp/PageDown</p></td></tr> -<tr> -<td> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Start rendering:</span></p></td> -<td> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">R</p></td></tr> -<tr> -<td> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Leave the program</span></p></td> -<td> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">ESC</p></td></tr></table></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - NavigationDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - NavigationDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - -