From a5d3024a39973e32e98d18547e6cd6eb1f90fb04 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Sun, 17 Jul 2011 15:20:55 +0200 Subject: [PATCH] various cleanups --- data/schema/upgrade_0.3.0.xsl | 9 ++++++ doc/basics.tex | 2 +- doc/gendoc.py | 4 +++ doc/macros.sty | 10 +++---- doc/main.bib | 1 - doc/main.tex | 37 +++++++++++++----------- doc/section_media.tex | 4 +++ doc/section_subsurface.tex | 5 ++++ include/mitsuba/core/util.h | 28 +++++++++--------- src/bsdfs/coating.cpp | 2 +- src/bsdfs/roughplastic.cpp | 2 +- src/integrators/SConscript | 2 +- src/integrators/direct/direct.cpp | 47 +++++++++++++++++-------------- src/libcore/util.cpp | 4 +-- src/libcore/wavelet.cpp | 6 ++-- src/libhw/gltexture.cpp | 10 +++---- src/librender/mipmap.cpp | 6 ++-- src/librender/mipmap3d.cpp | 2 +- src/samplers/halton.cpp | 8 +++--- src/samplers/hammersley.cpp | 8 +++--- src/samplers/independent.cpp | 4 +-- src/samplers/ldsampler.cpp | 41 ++++++++++++++------------- src/samplers/stratified.cpp | 15 +++++----- src/volume/volcache.cpp | 2 +- 24 files changed, 144 insertions(+), 115 deletions(-) create mode 100644 doc/section_media.tex create mode 100644 doc/section_subsurface.tex diff --git a/data/schema/upgrade_0.3.0.xsl b/data/schema/upgrade_0.3.0.xsl index b6888bc2..f06acab8 100644 --- a/data/schema/upgrade_0.3.0.xsl +++ b/data/schema/upgrade_0.3.0.xsl @@ -101,6 +101,7 @@ + @@ -174,6 +175,14 @@ eta + + + roughdielectric + + + alpha + + mixture diff --git a/doc/basics.tex b/doc/basics.tex index a454bc7c..99670aad 100644 --- a/doc/basics.tex +++ b/doc/basics.tex @@ -18,7 +18,7 @@ the executable without parameters: $\texttt{\$}$ mitsuba \end{shell} \begin{console}[label=lst:mitsuba-cli,caption=Command line options of the \texttt{mitsuba} binary] -Mitsuba version 0.2.1, Copyright (c) 2011 Wenzel Jakob +Mitsuba version 0.3.0, Copyright (c) 2011 Wenzel Jakob Usage: mitsuba [options] Options/Arguments: -h Display this help text diff --git a/doc/gendoc.py b/doc/gendoc.py index 1be81ab0..30d44f45 100755 --- a/doc/gendoc.py +++ b/doc/gendoc.py @@ -59,6 +59,10 @@ f = open('plugins_generated.tex', 'w') f.write('\section{Plugin reference}\n') f.write('\input{section_bsdf}\n') os.path.walk('../src/bsdfs', traverse, f) +f.write('\input{section_subsurface}\n') +os.path.walk('../src/subsurface', traverse, f) +f.write('\input{section_media}\n') +os.path.walk('../src/media', traverse, f) f.write('\input{section_integrators}\n') os.path.walk('../src/integrators', traverse, f) f.close() diff --git a/doc/macros.sty b/doc/macros.sty index 49ace58e..4467f085 100644 --- a/doc/macros.sty +++ b/doc/macros.sty @@ -55,11 +55,11 @@ \end{figure} } -\newcommand{\rendering}[2]{\subfigure[#1]{\fbox{\includegraphics[width=0.47\textwidth]{images/#2}}}\hfill} -\newcommand{\unframedrendering}[2]{\subfigure[#1]{\includegraphics[width=0.47\textwidth]{images/#2}}\hfill} -\newcommand{\medrendering}[2]{ \subfigure[#1]{\fbox{\includegraphics[width=0.3\textwidth]{images/#2}}}\hfill} -\newcommand{\unframedmedrendering}[2]{\subfigure[#1]{\includegraphics[width=0.3\textwidth]{images/#2}}\hfill} -\newcommand{\smallrendering}[2]{ \subfigure[#1]{\fbox{\includegraphics[width=0.2\textwidth]{images/#2}}}\hfill} +\newcommand{\rendering}[2]{\subfloat[#1]{\fbox{\includegraphics[width=0.47\textwidth]{images/#2}}}\hfill} +\newcommand{\unframedrendering}[2]{\subfloat[#1]{\includegraphics[width=0.47\textwidth]{images/#2}}\hfill} +\newcommand{\medrendering}[2]{ \subfloat[#1]{\fbox{\includegraphics[width=0.3\textwidth]{images/#2}}}\hfill} +\newcommand{\unframedmedrendering}[2]{\subfloat[#1]{\includegraphics[width=0.3\textwidth]{images/#2}}\hfill} +\newcommand{\smallrendering}[2]{ \subfloat[#1]{\fbox{\includegraphics[width=0.2\textwidth]{images/#2}}}\hfill} \newcommand{\parameter}[3]{ \otoprule diff --git a/doc/main.bib b/doc/main.bib index f027bd1f..fab5e951 100644 --- a/doc/main.bib +++ b/doc/main.bib @@ -109,7 +109,6 @@ author = {Geisler-Moroder, D. and D\"ur, A.}, booktitle = {Computer Graphics Forum}, volume = {29}, - number = {4}, pages = {1391--1398}, year = {2010}, organization = {Wiley Online Library} diff --git a/doc/main.tex b/doc/main.tex index 4a204177..97d6e46b 100644 --- a/doc/main.tex +++ b/doc/main.tex @@ -1,4 +1,4 @@ -\documentclass[footexclude,11pt,DIV11]{scrartcl} +\documentclass[footinclude=false,11pt,DIV11]{scrartcl} % Wenzel's standard prelude % ----- 8< ----- 8< ------ @@ -15,11 +15,12 @@ \usepackage{color} \usepackage{colortbl} \usepackage{listings} -\usepackage[hang]{subfigure} \usepackage{enumerate} \usepackage{ragged2e} % Ragged-right columns with hyphenation \usepackage{macros} \usepackage[format=hang,font=small,labelfont=bf]{caption} +\usepackage[expansion=false, babel=true]{microtype} +\usepackage{subfig} % Make sure that ligatures remain searchable in the PDF \input glyphtounicode @@ -32,24 +33,10 @@ \setcounter{secnumdepth}{3} \setcounter{tocdepth}{3} -\newcommand{\MitsubaVersion}{0.2.1} - -\usepackage[ - bookmarks, - bookmarksnumbered, - colorlinks, - linkcolor=myblue, - urlcolor=myblue, - citecolor=myblue, - pdfpagelabels, - pdftitle={Mitsuba \MitsubaVersion\, Documentation}, - pdfauthor={Wenzel Jakob}, - pdfstartview=FitH -]{hyperref} +\newcommand{\MitsubaVersion}{0.3.0} \typearea[current]{last} \raggedbottom -\usepackage[expansion=false, babel=true]{microtype} \renewcommand*\ttdefault{txtt} \usepackage{scrpage2} @@ -65,6 +52,22 @@ \addtokomafont{descriptionlabel}{\rmfamily} \pagestyle{scrheadings} +\usepackage[ + bookmarks, + bookmarksnumbered, + colorlinks, + plainpages=false, + pdfpagelabels, + hypertexnames=false, + linkcolor=myblue, + urlcolor=myblue, + citecolor=myblue, + pdfpagelabels, + pdftitle={Mitsuba \MitsubaVersion\, Documentation}, + pdfauthor={Wenzel Jakob}, + pdfstartview=FitH +]{hyperref} + \definecolor{myblue}{rgb}{0,.1,.6} \definecolor{myred}{rgb}{0.63,.16,.16} \definecolor{lstshade}{gray}{0.95} diff --git a/doc/section_media.tex b/doc/section_media.tex new file mode 100644 index 00000000..aee7d3db --- /dev/null +++ b/doc/section_media.tex @@ -0,0 +1,4 @@ +\newpage +\subsection{Participating media} +\label{sec:media} +TBD diff --git a/doc/section_subsurface.tex b/doc/section_subsurface.tex new file mode 100644 index 00000000..ee302af7 --- /dev/null +++ b/doc/section_subsurface.tex @@ -0,0 +1,5 @@ +\newpage +\subsection{Subsurface scattering} +\label{sec:subsurface} +TBD + diff --git a/include/mitsuba/core/util.h b/include/mitsuba/core/util.h index af0a99e4..d4837d63 100644 --- a/include/mitsuba/core/util.h +++ b/include/mitsuba/core/util.h @@ -226,38 +226,38 @@ inline int log2i(size_t value) { #endif /// Check if an integer is a power of two (unsigned 32 bit version) -inline bool isPow2(uint32_t i) { return (i & (i-1)) == 0; } +inline bool isPowerOfTwo(uint32_t i) { return (i & (i-1)) == 0; } /// Check if an integer is a power of two (signed 32 bit version) -inline bool isPow2(int32_t i) { return i > 0 && (i & (i-1)) == 0; } +inline bool isPowerOfTwo(int32_t i) { return i > 0 && (i & (i-1)) == 0; } /// Check if an integer is a power of two (64 bit version) -inline bool isPow2(uint64_t i) { return (i & (i-1)) == 0; } +inline bool isPowerOfTwo(uint64_t i) { return (i & (i-1)) == 0; } /// Check if an integer is a power of two (signed 64 bit version) -inline bool isPow2(int64_t i) { return i > 0 && (i & (i-1)) == 0; } +inline bool isPowerOfTwo(int64_t i) { return i > 0 && (i & (i-1)) == 0; } #if defined(MTS_AMBIGUOUS_SIZE_T) -inline bool isPow2(size_t value) { - if (sizeof(size_t) == 8) - return isPow2((uint64_t) value); +inline bool isPowerOfTwo(size_t value) { + if (sizeof(size_t) == 8) /// will be optimized away + return isPowerOfTwo((uint64_t) value); else - return isPow2((uint32_t) value); + return isPowerOfTwo((uint32_t) value); } #endif /// Round an integer to the next power of two -extern MTS_EXPORT_CORE uint32_t roundToPow2(uint32_t i); +extern MTS_EXPORT_CORE uint32_t roundToPowerOfTwo(uint32_t i); /// Round an integer to the next power of two (64 bit version) -extern MTS_EXPORT_CORE uint64_t roundToPow2(uint64_t i); +extern MTS_EXPORT_CORE uint64_t roundToPowerOfTwo(uint64_t i); #if defined(MTS_AMBIGUOUS_SIZE_T) -inline size_t roundToPow2(size_t value) { - if (sizeof(size_t) == 8) - return (size_t) roundToPow2((uint64_t) value); +inline size_t roundToPowerOfTwo(size_t value) { + if (sizeof(size_t) == 8) /// will be optimized away + return (size_t) roundToPowerOfTwo((uint64_t) value); else - return (size_t) roundToPow2((uint32_t) value); + return (size_t) roundToPowerOfTwo((uint32_t) value); } #endif diff --git a/src/bsdfs/coating.cpp b/src/bsdfs/coating.cpp index 1f7a4a1b..3beb8b57 100644 --- a/src/bsdfs/coating.cpp +++ b/src/bsdfs/coating.cpp @@ -58,7 +58,7 @@ MTS_NAMESPACE_BEGIN * angle (i.e. diffuse or very rough materials). * Therefore, users are discouraged to use this plugin to coat smooth * diffuse materials, since there is a separately available plugin - * named \pluginref{smoothplastic}, which covers the same case and does not + * named \pluginref{plastic}, which covers the same case and does not * suffer from energy loss. * * Evaluating the internal component of this model entails refracting the diff --git a/src/bsdfs/roughplastic.cpp b/src/bsdfs/roughplastic.cpp index 23e076e6..6589f768 100644 --- a/src/bsdfs/roughplastic.cpp +++ b/src/bsdfs/roughplastic.cpp @@ -60,7 +60,7 @@ MTS_NAMESPACE_BEGIN * factor used to modulate the specular reflectance component\default{1.0}} * \parameter{diffuse\showbreak Reflectance}{\Spectrum\Or\Texture}{Optional * factor used to modulate the diffuse reflectance component\default{0.5}} - * } + * }\vspace{-1mm} * \renderings{ * \rendering{Beckmann, $\alpha=0.1$}{bsdf_roughplastic_beckmann} * \rendering{GGX, $\alpha=0.3$}{bsdf_roughplastic_ggx} diff --git a/src/integrators/SConscript b/src/integrators/SConscript index 120f265a..628167c4 100644 --- a/src/integrators/SConscript +++ b/src/integrators/SConscript @@ -2,8 +2,8 @@ Import('env', 'plugins') plugins += env.SharedLibrary('direct', ['direct/direct.cpp']) plugins += env.SharedLibrary('errctrl', ['misc/errctrl.cpp']) -plugins += env.SharedLibrary('path', ['path/path.cpp']) plugins += env.SharedLibrary('irrcache', ['misc/irrcache.cpp', 'misc/irrcache_proc.cpp']) +plugins += env.SharedLibrary('path', ['path/path.cpp']) plugins += env.SharedLibrary('volpath', ['path/volpath.cpp']) plugins += env.SharedLibrary('volpath_simple', ['path/volpath_simple.cpp']) plugins += env.SharedLibrary('ptracer', ['path/ptracer.cpp', 'path/ptracer_proc.cpp']) diff --git a/src/integrators/direct/direct.cpp b/src/integrators/direct/direct.cpp index da2fa2dd..7e4af160 100644 --- a/src/integrators/direct/direct.cpp +++ b/src/integrators/direct/direct.cpp @@ -30,27 +30,33 @@ MTS_NAMESPACE_BEGIN class MIDirectIntegrator : public SampleIntegrator { public: MIDirectIntegrator(const Properties &props) : SampleIntegrator(props) { - /* Number of samples to take using the luminaire sampling technique */ - m_luminaireSamples = props.getInteger("luminaireSamples", 1); - /* Number of samples to take using the BSDF sampling technique */ - m_bsdfSamples = props.getInteger("bsdfSamples", 1); + /* Number of shading samples -- this parameter is a shorthand notation + to set both 'luminaireSamples' and 'bsdfSamples' at the same time*/ + size_t shadingSamples = props.getSize("shadingSamples", 1); - Assert(m_luminaireSamples + m_bsdfSamples > 0); + /* Number of samples to take using the luminaire sampling technique */ + m_luminaireSamples = props.getSize("luminaireSamples", shadingSamples); + /* Number of samples to take using the BSDF sampling technique */ + m_bsdfSamples = props.getSize("bsdfSamples", shadingSamples); + + Assert(m_luminaireSamples >= 0 && m_bsdfSamples >= 0 && + m_luminaireSamples + m_bsdfSamples > 0); } /// Unserialize from a binary data stream MIDirectIntegrator(Stream *stream, InstanceManager *manager) : SampleIntegrator(stream, manager) { - m_luminaireSamples = stream->readInt(); - m_bsdfSamples = stream->readInt(); + m_luminaireSamples = stream->readSize(); + m_bsdfSamples = stream->readSize(); configure(); } void configure() { + size_t sum = m_luminaireSamples + m_bsdfSamples; m_weightBSDF = 1 / (Float) m_bsdfSamples; m_weightLum = 1 / (Float) m_luminaireSamples; - m_fracBSDF = m_bsdfSamples / (Float) (m_luminaireSamples + m_bsdfSamples); - m_fracLum = m_luminaireSamples / (Float) (m_luminaireSamples + m_bsdfSamples); + m_fracBSDF = m_bsdfSamples / (Float) sum; + m_fracLum = m_luminaireSamples / (Float) sum; } void configureSampler(Sampler *sampler) { @@ -105,13 +111,13 @@ public: /* Luminaire sampling */ /* ==================================================================== */ Point2 *sampleArray; - int numLuminaireSamples = m_luminaireSamples, - numBSDFSamples = m_bsdfSamples; + size_t numLuminaireSamples = m_luminaireSamples, + numBSDFSamples = m_bsdfSamples; Float fracLum = m_fracLum, fracBSDF = m_fracBSDF, weightLum = m_weightLum, weightBSDF = m_weightBSDF; if (rRec.depth > 1) { - /* This integrator is used by another integrator. + /* This integrator is used recursively by another integrator. Be less accurate as this sample will not directly be observed. */ numBSDFSamples = numLuminaireSamples = 1; fracLum = fracBSDF = .5f; @@ -121,11 +127,10 @@ public: if (numLuminaireSamples > 1) { sampleArray = rRec.sampler->next2DArray(numLuminaireSamples); } else { - sample = rRec.nextSample2D(); - sampleArray = &sample; + sample = rRec.nextSample2D(); sampleArray = &sample; } - for (int i=0; isampleLuminaire(its.p, ray.time, lRec, sampleArray[i])) { /* Allocate a record for querying the BSDF */ @@ -157,11 +162,10 @@ public: if (numBSDFSamples > 1) { sampleArray = rRec.sampler->next2DArray(numBSDFSamples); } else { - sample = rRec.nextSample2D(); - sampleArray = &sample; + sample = rRec.nextSample2D(); sampleArray = &sample; } - for (int i=0; iwriteInt(m_luminaireSamples); - stream->writeInt(m_bsdfSamples); + stream->writeSize(m_luminaireSamples); + stream->writeSize(m_bsdfSamples); } std::string toString() const { @@ -226,7 +230,8 @@ public: MTS_DECLARE_CLASS() private: - int m_luminaireSamples, m_bsdfSamples; + size_t m_luminaireSamples; + size_t m_bsdfSamples; Float m_fracBSDF, m_fracLum; Float m_weightBSDF, m_weightLum; }; diff --git a/src/libcore/util.cpp b/src/libcore/util.cpp index b5fc0f32..aabd05f0 100644 --- a/src/libcore/util.cpp +++ b/src/libcore/util.cpp @@ -427,7 +427,7 @@ int modulo(int a, int b) { } /* Fast rounding & power-of-two test algorithms from PBRT */ -uint32_t roundToPow2(uint32_t i) { +uint32_t roundToPowerOfTwo(uint32_t i) { i--; i |= i >> 1; i |= i >> 2; i |= i >> 4; i |= i >> 8; @@ -435,7 +435,7 @@ uint32_t roundToPow2(uint32_t i) { return i+1; } -uint64_t roundToPow2(uint64_t i) { +uint64_t roundToPowerOfTwo(uint64_t i) { i--; i |= i >> 1; i |= i >> 2; i |= i >> 4; i |= i >> 8; diff --git a/src/libcore/wavelet.cpp b/src/libcore/wavelet.cpp index 29b72070..55442421 100644 --- a/src/libcore/wavelet.cpp +++ b/src/libcore/wavelet.cpp @@ -27,7 +27,7 @@ MTS_NAMESPACE_BEGIN Wavelet2D::Wavelet2D(const Bitmap *bitmap, int selectedChannel) { Assert(bitmap->getWidth() == bitmap->getHeight()); - Assert(isPow2(bitmap->getWidth())); + Assert(isPowerOfTwo(bitmap->getWidth())); m_size = bitmap->getWidth(); m_data = new float[m_size * m_size]; @@ -60,7 +60,7 @@ Wavelet2D::Wavelet2D(const Bitmap *bitmap, int selectedChannel) { } Wavelet2D::Wavelet2D(const SparseWavelet2D *sw) { - Assert(isPow2(sw->getSize())); + Assert(isPowerOfTwo(sw->getSize())); m_size = sw->getSize(); m_data = new float[m_size * m_size]; m_temp = new float[m_size]; @@ -467,7 +467,7 @@ std::string SparseWavelet2D::toString() const { /* ==================================================================== */ Wavelet3D::Wavelet3D(const float *data, size_t resolution) { - Assert(isPow2(resolution)); + Assert(isPowerOfTwo(resolution)); m_size = resolution; size_t nEntries = m_size * m_size * m_size; diff --git a/src/libhw/gltexture.cpp b/src/libhw/gltexture.cpp index 2ae35b61..87fac4a6 100644 --- a/src/libhw/gltexture.cpp +++ b/src/libhw/gltexture.cpp @@ -121,7 +121,7 @@ void GLTexture::init() { glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, m_glType, m_id, 0); } else if (m_type == ETextureCubeMap) { - Assert(m_size.x == m_size.y && isPow2(m_size.x)); + Assert(m_size.x == m_size.y && isPowerOfTwo(m_size.x)); Assert(m_fbType == EColorBuffer); Assert(m_samples == 1); @@ -168,7 +168,7 @@ void GLTexture::init() { glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, m_glType, m_id, 0); } else if (m_type == ETextureCubeMap) { - Assert(m_size.x == m_size.y && isPow2(m_size.x)); + Assert(m_size.x == m_size.y && isPowerOfTwo(m_size.x)); for (int i=0; i<6; i++) glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, m_internalFormat, m_size.x, m_size.y, 0, m_format, m_dataFormat, NULL); @@ -227,8 +227,8 @@ void GLTexture::refresh() { glBindTexture(m_glType, m_id); if (m_type == ETexture1D) { - Assert((isPow2(m_size.x) && m_size.y == 1) - || (isPow2(m_size.y) && m_size.x == 1)); + Assert((isPowerOfTwo(m_size.x) && m_size.y == 1) + || (isPowerOfTwo(m_size.y) && m_size.x == 1)); if (isMipMapped()) { /* Let GLU generate mipmaps for us */ @@ -260,7 +260,7 @@ void GLTexture::refresh() { } else if (m_type == ETextureCubeMap) { Assert(bitmap != NULL); Assert(bitmap->getWidth() == bitmap->getHeight()); - Assert(isPow2(bitmap->getWidth())); + Assert(isPowerOfTwo(bitmap->getWidth())); if (isMipMapped()) glTexParameteri(m_glType, GL_GENERATE_MIPMAP, GL_TRUE); diff --git a/src/librender/mipmap.cpp b/src/librender/mipmap.cpp index 42311b30..30ff0e18 100644 --- a/src/librender/mipmap.cpp +++ b/src/librender/mipmap.cpp @@ -31,9 +31,9 @@ MIPMap::MIPMap(int width, int height, Spectrum *pixels, m_wrapMode(wrapMode), m_maxAnisotropy(maxAnisotropy) { Spectrum *texture = pixels; - if (filterType != ENone && (!isPow2(width) || !isPow2(height))) { - m_width = (int) roundToPow2((uint32_t) width); - m_height = (int) roundToPow2((uint32_t) height); + if (filterType != ENone && (!isPowerOfTwo(width) || !isPowerOfTwo(height))) { + m_width = (int) roundToPowerOfTwo((uint32_t) width); + m_height = (int) roundToPowerOfTwo((uint32_t) height); /* The texture needs to be up-sampled */ Spectrum *texture1 = new Spectrum[m_width*height]; diff --git a/src/librender/mipmap3d.cpp b/src/librender/mipmap3d.cpp index 5e4ec1e6..64e2d640 100644 --- a/src/librender/mipmap3d.cpp +++ b/src/librender/mipmap3d.cpp @@ -23,7 +23,7 @@ MTS_NAMESPACE_BEGIN SparseMipmap3D::SparseMipmap3D(const AABB &aabb, size_t size, const float *data, Float maxError, Float offset) : m_aabb(aabb), m_size(size) { - Assert(isPow2(m_size)); + Assert(isPowerOfTwo(m_size)); m_levels = 1 + log2i(m_size); m_aabbSum = Vector(m_aabb.min + m_aabb.max); diff --git a/src/samplers/halton.cpp b/src/samplers/halton.cpp index 99a3f1aa..2f1ee7b2 100644 --- a/src/samplers/halton.cpp +++ b/src/samplers/halton.cpp @@ -105,10 +105,10 @@ public: std::string toString() const { std::ostringstream oss; - oss << "HaltonSequence[" << std::endl - << " sampleCount = " << m_sampleCount << "," << std::endl - << " sampleIndex = " << m_sampleIndex << "," << std::endl - << " sampleDepth = " << m_sampleDepth << std::endl + oss << "HaltonSequence[" << endl + << " sampleCount = " << m_sampleCount << "," << endl + << " sampleIndex = " << m_sampleIndex << "," << endl + << " sampleDepth = " << m_sampleDepth << endl << "]"; return oss.str(); } diff --git a/src/samplers/hammersley.cpp b/src/samplers/hammersley.cpp index 700ab8b5..770ec987 100644 --- a/src/samplers/hammersley.cpp +++ b/src/samplers/hammersley.cpp @@ -115,10 +115,10 @@ public: std::string toString() const { std::ostringstream oss; - oss << "HammersleySequence[" << std::endl - << " sampleCount = " << m_sampleCount << "," << std::endl - << " sampleIndex = " << m_sampleIndex << "," << std::endl - << " sampleDepth = " << m_sampleDepth << std::endl + oss << "HammersleySequence[" << endl + << " sampleCount = " << m_sampleCount << "," << endl + << " sampleIndex = " << m_sampleIndex << "," << endl + << " sampleDepth = " << m_sampleDepth << endl << "]"; return oss.str(); } diff --git a/src/samplers/independent.cpp b/src/samplers/independent.cpp index 97e4f743..06182173 100644 --- a/src/samplers/independent.cpp +++ b/src/samplers/independent.cpp @@ -93,8 +93,8 @@ public: std::string toString() const { std::ostringstream oss; - oss << "IndependentSampler[" << std::endl - << " sampleCount = " << m_sampleCount << std::endl + oss << "IndependentSampler[" << endl + << " sampleCount = " << m_sampleCount << endl << "]"; return oss.str(); } diff --git a/src/samplers/ldsampler.cpp b/src/samplers/ldsampler.cpp index f260423a..0848efba 100644 --- a/src/samplers/ldsampler.cpp +++ b/src/samplers/ldsampler.cpp @@ -29,19 +29,6 @@ class LowDiscrepancySampler : public Sampler { public: LowDiscrepancySampler() : Sampler(Properties()) { } - LowDiscrepancySampler(Stream *stream, InstanceManager *manager) - : Sampler(stream, manager) { - m_depth = stream->readInt(); - m_random = static_cast(manager->getInstance(stream)); - - m_samples1D = new Float*[m_depth]; - m_samples2D = new Point2*[m_depth]; - for (int i=0; i(manager->getInstance(stream)); + m_depth = stream->readInt(); + + m_samples1D = new Float*[m_depth]; + m_samples2D = new Point2*[m_depth]; + for (int i=0; iwriteInt(m_depth); manager->serialize(stream, m_random.get()); + stream->writeInt(m_depth); } ref clone() { @@ -198,9 +198,9 @@ public: std::string toString() const { std::ostringstream oss; - oss << "LowDiscrepancySampler[" << std::endl - << " sampleCount = " << m_sampleCount << "," << std::endl - << " depth = " << m_depth << std::endl + oss << "LowDiscrepancySampler[" << endl + << " sampleCount = " << m_sampleCount << "," << endl + << " depth = " << m_depth << endl << "]"; return oss.str(); } @@ -209,7 +209,8 @@ public: private: ref m_random; int m_depth; - int m_sampleDepth1D, m_sampleDepth2D; + int m_sampleDepth1D; + int m_sampleDepth2D; Float **m_samples1D; Point2 **m_samples2D; }; diff --git a/src/samplers/stratified.cpp b/src/samplers/stratified.cpp index d705f7f0..4b29bb1c 100644 --- a/src/samplers/stratified.cpp +++ b/src/samplers/stratified.cpp @@ -30,8 +30,7 @@ MTS_NAMESPACE_BEGIN */ class StratifiedSampler : public Sampler { public: - StratifiedSampler() : Sampler(Properties()) { - } + StratifiedSampler() : Sampler(Properties()) { } StratifiedSampler(const Properties &props) : Sampler(props) { /* Sample count (will be rounded up to the next perfect square) */ @@ -195,12 +194,12 @@ public: std::string toString() const { std::ostringstream oss; - oss << "StratifiedSampler[" << std::endl - << " resolution = " << m_resolution << "," << std::endl - << " sampleCount = " << m_sampleCount << "," << std::endl - << " depth = " << m_depth << "," << std::endl - << " sampleIndex = " << m_sampleIndex << "," << std::endl - << " sampleDepth = " << m_depth << std::endl + oss << "StratifiedSampler[" << endl + << " resolution = " << m_resolution << "," << endl + << " sampleCount = " << m_sampleCount << "," << endl + << " depth = " << m_depth << "," << endl + << " sampleIndex = " << m_sampleIndex << "," << endl + << " sampleDepth = " << m_depth << endl << "]"; return oss.str(); } diff --git a/src/volume/volcache.cpp b/src/volume/volcache.cpp index 9f68ca26..b85c6325 100644 --- a/src/volume/volcache.cpp +++ b/src/volume/volcache.cpp @@ -57,7 +57,7 @@ public: /// Size of an individual block (must be a power of 2) m_blockSize = props.getInteger("blockSize", 4); - if (!isPow2(m_blockSize)) + if (!isPowerOfTwo(m_blockSize)) Log(EError, "Block size must be a power of two!"); /* Width of an individual voxel. Will use the step size of the