various cleanups
parent
06c250f0fc
commit
a5d3024a39
|
@ -101,6 +101,7 @@
|
|||
<spectrum name="specularReflectance" value="{number($specularAmount)*number($specularReflectance)}"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:apply-templates select="node()[@name!='specularReflectance' and @name!='diffuseReflectance' and @name!='diffuseAmount' and @name!='specularAmount']"/>
|
||||
</bsdf>
|
||||
</xsl:template>
|
||||
|
||||
|
@ -174,6 +175,14 @@
|
|||
<xsl:attribute name="name">eta</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Update the name of the roughglass plugin -->
|
||||
<xsl:template match="bsdf[@type='roughglass']/@type">
|
||||
<xsl:attribute name="type">roughdielectric</xsl:attribute>
|
||||
</xsl:template>
|
||||
<xsl:template match="bsdf[@type='roughglass']/float[@name='alphaB']/@name">
|
||||
<xsl:attribute name="name">alpha</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Update the name of the composite plugin -->
|
||||
<xsl:template match="bsdf[@type='composite']/@type">
|
||||
<xsl:attribute name="type">mixture</xsl:attribute>
|
||||
|
|
|
@ -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] <One or more scene XML files>
|
||||
Options/Arguments:
|
||||
-h Display this help text
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}
|
||||
|
|
37
doc/main.tex
37
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}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
\newpage
|
||||
\subsection{Participating media}
|
||||
\label{sec:media}
|
||||
TBD
|
|
@ -0,0 +1,5 @@
|
|||
\newpage
|
||||
\subsection{Subsurface scattering}
|
||||
\label{sec:subsurface}
|
||||
TBD
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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'])
|
||||
|
|
|
@ -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; i<numLuminaireSamples; ++i) {
|
||||
for (size_t i=0; i<numLuminaireSamples; ++i) {
|
||||
/* Estimate the direct illumination if this is requested */
|
||||
if (scene->sampleLuminaire(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; i<numBSDFSamples; ++i) {
|
||||
for (size_t i=0; i<numBSDFSamples; ++i) {
|
||||
/* Sample BSDF * cos(theta) */
|
||||
BSDFQueryRecord bRec(its);
|
||||
bRec.sampler = rRec.sampler;
|
||||
|
@ -211,8 +215,8 @@ public:
|
|||
|
||||
void serialize(Stream *stream, InstanceManager *manager) const {
|
||||
SampleIntegrator::serialize(stream, manager);
|
||||
stream->writeInt(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;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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<Random *>(manager->getInstance(stream));
|
||||
|
||||
m_samples1D = new Float*[m_depth];
|
||||
m_samples2D = new Point2*[m_depth];
|
||||
for (int i=0; i<m_depth; i++) {
|
||||
m_samples1D[i] = new Float[(size_t) m_sampleCount];
|
||||
m_samples2D[i] = new Point2[(size_t) m_sampleCount];
|
||||
}
|
||||
}
|
||||
|
||||
LowDiscrepancySampler(const Properties &props) : Sampler(props) {
|
||||
/* Sample count (will be rounded up to the next power of two) */
|
||||
m_sampleCount = props.getSize("sampleCount", 4);
|
||||
|
@ -49,8 +36,8 @@ public:
|
|||
/* Depth, up to which which low discrepancy samples are guaranteed to be available. */
|
||||
m_depth = props.getInteger("depth", 3);
|
||||
|
||||
if (!isPow2(m_sampleCount)) {
|
||||
m_sampleCount = (size_t) roundToPow2(m_sampleCount);
|
||||
if (!isPowerOfTwo(m_sampleCount)) {
|
||||
m_sampleCount = roundToPowerOfTwo(m_sampleCount);
|
||||
Log(EWarn, "Sample count should be a power of two -- rounding to "
|
||||
SIZE_T_FMT, m_sampleCount);
|
||||
}
|
||||
|
@ -66,6 +53,19 @@ public:
|
|||
m_random = new Random();
|
||||
}
|
||||
|
||||
LowDiscrepancySampler(Stream *stream, InstanceManager *manager)
|
||||
: Sampler(stream, manager) {
|
||||
m_random = static_cast<Random *>(manager->getInstance(stream));
|
||||
m_depth = stream->readInt();
|
||||
|
||||
m_samples1D = new Float*[m_depth];
|
||||
m_samples2D = new Point2*[m_depth];
|
||||
for (int i=0; i<m_depth; i++) {
|
||||
m_samples1D[i] = new Float[(size_t) m_sampleCount];
|
||||
m_samples2D[i] = new Point2[(size_t) m_sampleCount];
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~LowDiscrepancySampler() {
|
||||
for (int i=0; i<m_depth; i++) {
|
||||
delete[] m_samples1D[i];
|
||||
|
@ -77,8 +77,8 @@ public:
|
|||
|
||||
void serialize(Stream *stream, InstanceManager *manager) const {
|
||||
Sampler::serialize(stream, manager);
|
||||
stream->writeInt(m_depth);
|
||||
manager->serialize(stream, m_random.get());
|
||||
stream->writeInt(m_depth);
|
||||
}
|
||||
|
||||
ref<Sampler> 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<Random> m_random;
|
||||
int m_depth;
|
||||
int m_sampleDepth1D, m_sampleDepth2D;
|
||||
int m_sampleDepth1D;
|
||||
int m_sampleDepth2D;
|
||||
Float **m_samples1D;
|
||||
Point2 **m_samples2D;
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue