gizmo removal

metadata
Wenzel Jakob 2011-05-30 12:17:46 +02:00
parent c1f1d5ee64
commit dd7ef85f17
23 changed files with 97 additions and 591 deletions

View File

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

View File

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

View File

@ -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();
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#if !defined(__GIZMO_H)
#define __GIZMO_H
#include <mitsuba/hw/renderer.h>
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<Float>::infinity();
} else {
if (t <= 0)
t = farT;
if (t <= 0)
t = std::numeric_limits<Float>::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 */

View File

@ -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 &center, const Normal &normal, Float radius);
/// Draw a 3D arc connecting \c p1 and \c p2
void drawArc(const Point &center,
const Point &p1, const Point &p2, bool shorterPiece);
/// Clean up the renderer after drawing triangle geometry
void endDrawingMeshes();

View File

@ -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 &center,
const Normal &normal, Float radius) = 0;
/// Draw a 3D arc connecting \c p1 and \c p2
virtual void drawArc(const Point &center,
const Point &p1, const Point &p2, bool shorterPiece) = 0;
/// Blit a screen-sized quad
virtual void blitQuad(bool flipVertically) = 0;

View File

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

View File

@ -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',

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include <mitsuba/hw/gizmo.h>
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

View File

@ -756,51 +756,6 @@ void GLRenderer::blitQuad(bool flipVertically) {
glEnd();
}
void GLRenderer::drawCircle(const Point &center,
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<nDiscr; ++i) {
Float sinTheta = std::sin(i * stepSize) * radius;
Float cosTheta = std::cos(i * stepSize) * radius;
Point p = center + X*cosTheta + Y*sinTheta;
glVertex3f(p.x, p.y, p.z);
}
glEnd();
}
void GLRenderer::drawArc(const Point &center,
const Point &p1, const Point &p2, bool shorterPiece) {
if (p1 == p2 || p1 == center || p2 == center)
return;
Vector X = normalize(p1 - center), Y = p2 - center;
Float radius = Y.length(); Y /= radius;
Float angle = unitAngle(X, Y);
Y = normalize(Y - dot(Y, X) * X);
if (!shorterPiece) {
angle = 2*M_PI - angle;
Y = -Y;
}
int nDiscr = 80;
Float stepSize = angle/(nDiscr-1);
glBegin(GL_LINE_STRIP);
for (int i=0; i<nDiscr; ++i) {
Float sinTheta = std::sin(i * stepSize) * radius;
Float cosTheta = std::cos(i * stepSize) * radius;
Point p = center + X*cosTheta + Y*sinTheta;
glVertex3f(p.x, p.y, p.z);
}
glEnd();
}
void GLRenderer::drawText(const Point2i &_pos,
const Font *font, const std::string &text) {
int viewport[4];

View File

@ -78,12 +78,14 @@ void Camera::serialize(Stream *stream, InstanceManager *manager) const {
void Camera::generateRayDifferential(const Point2 &sample,
const Point2 &lensSample, Float timeSample, RayDifferential &ray) const {
Ray tempRay;
generateRay(sample, lensSample, timeSample, ray);
Point2 temp = sample; temp.x += 1;
generateRay(temp, lensSample, timeSample, ray.rx);
generateRay(temp, lensSample, timeSample, tempRay);
ray.rxOrigin = tempRay.o; ray.rxDirection = tempRay.d;
temp = sample; temp.y += 1;
generateRay(temp, lensSample, timeSample, ray.ry);
generateRay(temp, lensSample, timeSample, tempRay);
ray.ryOrigin = tempRay.o; ray.ryDirection = tempRay.d;
ray.hasDifferentials = true;
}

View File

@ -20,8 +20,8 @@ void Intersection::computePartials(const RayDifferential &ray) {
/* Offset of the plane passing through the surface */
const Float d = -dot(geoFrame.n, Vector(p));
const Float txRecip = dot(geoFrame.n, ray.rx.d),
tyRecip = dot(geoFrame.n, ray.ry.d);
const Float txRecip = dot(geoFrame.n, ray.rxDirection),
tyRecip = dot(geoFrame.n, ray.ryDirection);
if (EXPECT_NOT_TAKEN(txRecip == 0 || tyRecip == 0)) {
dudx = dvdx = dudy = dvdy = 0.0f;
@ -29,9 +29,9 @@ void Intersection::computePartials(const RayDifferential &ray) {
}
/* Ray distances traveled */
const Float tx = -(dot(geoFrame.n, Vector(ray.rx.o)) + d) /
const Float tx = -(dot(geoFrame.n, Vector(ray.rxOrigin)) + d) /
txRecip;
const Float ty = -(dot(geoFrame.n, Vector(ray.ry.o)) + d) /
const Float ty = -(dot(geoFrame.n, Vector(ray.ryOrigin)) + d) /
tyRecip;
/* Calculate the U and V partials by solving two out
@ -54,7 +54,8 @@ void Intersection::computePartials(const RayDifferential &ray) {
A[1][1] = dpdv[axes[1]];
/* Auxilary intersection point of the adjacent rays */
Point px = ray.rx(tx), py = ray.ry(ty);
Point px = ray.rxOrigin + ray.rxDirection * tx,
py = ray.ryOrigin + ray.ryDirection * ty;
Bx[0] = px[axes[0]] - p[axes[0]];
Bx[1] = px[axes[1]] - p[axes[1]];
By[0] = py[axes[0]] - p[axes[0]];

View File

@ -288,15 +288,16 @@ IrradianceCache::Record *IrradianceCache::put(const RayDifferential &ray, const
Illumination System for Computer Generated Films") */
if (m_clampScreen && ray.hasDifferentials) {
const Float d = -dot(its.geoFrame.n, Vector(its.p));
const Float txRecip = dot(its.geoFrame.n, ray.rx.d),
tyRecip = dot(its.geoFrame.n, ray.ry.d);
const Float txRecip = dot(its.geoFrame.n, ray.rxDirection),
tyRecip = dot(its.geoFrame.n, ray.ryDirection);
if (txRecip != 0 && tyRecip != 0) {
// Ray distances traveled
const Float tx = -(dot(its.geoFrame.n, Vector(ray.rx.o)) + d) /
const Float tx = -(dot(its.geoFrame.n, Vector(ray.rxOrigin)) + d) /
txRecip;
const Float ty = -(dot(its.geoFrame.n, Vector(ray.ry.o)) + d) /
const Float ty = -(dot(its.geoFrame.n, Vector(ray.ryOrigin)) + d) /
tyRecip;
Point px = ray.rx(tx), py = ray.ry(ty);
Point px = ray.rxOrigin + ray.rxDirection * tx,
py = ray.ryOrigin + ray.ryDirection * ty;
Float sqrtArea = std::sqrt(cross(px-its.p, py-its.p).length())*2;
R0_min = 3.0f*sqrtArea;

View File

@ -38,7 +38,6 @@ ref<Scene> Utility::loadScene(const std::string &filename,
parser->setExternalNoNamespaceSchemaLocation(schemaPath.file_string().c_str());
parser->setCalculateSrcOfs(true);
std::map<std::string, std::string> parameters;
SceneHandler *handler = new SceneHandler(parser, params);
parser->setDoNamespaces(true);
parser->setDocumentHandler(handler);

View File

@ -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')

View File

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

View File

@ -28,7 +28,6 @@
#include <mitsuba/hw/gpuprogram.h>
#include <mitsuba/hw/gpusync.h>
#include <mitsuba/hw/vpl.h>
#include <mitsuba/hw/gizmo.h>
#if defined(WIN32)
#include <mitsuba/hw/wgldevice.h>
#endif
@ -136,7 +135,6 @@ private:
ref<GPUProgram> m_downsamplingProgram, m_luminanceProgram;
ref<QtDevice> m_device;
ref<Font> m_font;
ref<Gizmo> m_gizmo;
SceneContext *m_context;
bool m_framebufferChanged, m_mouseButtonDown;
bool m_leftKeyDown, m_rightKeyDown;

View File

@ -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"));
}

View File

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

View File

@ -135,7 +135,6 @@
<bool>false</bool>
</property>
<addaction name="actionReferenceManual"/>
<addaction name="actionNavigationControls"/>
<addaction name="separator"/>
<addaction name="actionFeedback"/>
<addaction name="actionReportBug"/>
@ -381,15 +380,6 @@
<string>Check for &amp;Updates ..</string>
</property>
</action>
<action name="actionNavigationControls">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/resources/controls.png</normaloff>:/resources/controls.png</iconset>
</property>
<property name="text">
<string>&amp;Navigation Controls</string>
</property>
</action>
<action name="actionReferenceManual">
<property name="icon">
<iconset resource="resources.qrc">

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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;
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View File

@ -1,133 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NavigationDialog</class>
<widget class="QDialog" name="NavigationDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>638</width>
<height>395</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Navigation Controls</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Navigation Controls&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;table border=&quot;0&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;&quot; cellspacing=&quot;10&quot; cellpadding=&quot;0&quot;&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Look around:&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Drag the mouse while holding the &lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;left button.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Roll:&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Drag the mouse horizontally while &lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;holding the right button.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Change the field of view:&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Drag the mouse vertically while &lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;holding the right button.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Move around:&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Use the arrow or WASD keys.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Change the motion speed:&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;PageUp/PageDown&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Start rendering:&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;R&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Leave the program&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;ESC&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>NavigationDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>NavigationDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>