From 1fe405ec2378d8759e7636bbef8956be3d233cb8 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Fri, 8 Jul 2011 16:17:11 +0200 Subject: [PATCH] OSX build fixes --- include/mitsuba/hw/basicshader.h | 172 ++++++++++++++++++++++++++++++ include/mitsuba/render/fwd.h | 1 - include/mitsuba/render/texture.h | 127 ---------------------- src/bsdfs/conductor.cpp | 3 +- src/bsdfs/dielectric.cpp | 2 +- src/bsdfs/difftrans.cpp | 2 +- src/bsdfs/diffuse.cpp | 2 +- src/bsdfs/plastic.cpp | 2 +- src/bsdfs/roughconductor.cpp | 3 +- src/bsdfs/roughdielectric.cpp | 2 +- src/bsdfs/roughdiffuse.cpp | 3 +- src/libhw/SConscript | 2 +- src/libhw/basicshader.cpp | 177 +++++++++++++++++++++++++++++++ src/librender/bsdf.cpp | 6 +- src/librender/texture.cpp | 157 +-------------------------- src/luminaires/spot.cpp | 3 +- 16 files changed, 365 insertions(+), 299 deletions(-) create mode 100644 include/mitsuba/hw/basicshader.h create mode 100644 src/libhw/basicshader.cpp diff --git a/include/mitsuba/hw/basicshader.h b/include/mitsuba/hw/basicshader.h new file mode 100644 index 00000000..e858e570 --- /dev/null +++ b/include/mitsuba/hw/basicshader.h @@ -0,0 +1,172 @@ +/* + 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(__BASIC_SHADER_H) +#define __BASIC_SHADER_H + +#include +#include + +MTS_NAMESPACE_BEGIN + +/* ============================================================ */ +/* Some vary basic texture and shader definitions */ +/* These classes are in libhw instead of librender, since */ +/* they link to some functions in libhw. */ +/* ============================================================ */ + +/** + * \brief Constant spectrum-valued texture + * + * Includes a \ref Shader implementation for hardware rendering + */ +class MTS_EXPORT_RENDER ConstantSpectrumTexture : public Texture { +public: + inline ConstantSpectrumTexture(const Spectrum &value) + : Texture(Properties()), m_value(value) { + } + + ConstantSpectrumTexture(Stream *stream, InstanceManager *manager); + + inline Spectrum getValue(const Intersection &its) const { + return m_value; + } + + inline Spectrum getAverage() const { + return m_value; + } + + inline Spectrum getMaximum() const { + return m_value; + } + + inline std::string toString() const { + std::ostringstream oss; + oss << "ConstantSpectrumTexture[value=" << m_value.toString() << "]"; + return oss.str(); + } + + inline bool usesRayDifferentials() const { + return false; + } + + Shader *createShader(Renderer *renderer) const; + + void serialize(Stream *stream, InstanceManager *manager) const; + + MTS_DECLARE_CLASS() +protected: + Spectrum m_value; +}; + +/** + * \brief Constant float-valued texture + * + * Includes a \ref Shader implementation for hardware rendering + */ +class MTS_EXPORT_RENDER ConstantFloatTexture : public Texture { +public: + inline ConstantFloatTexture(const Float &value) + : Texture(Properties()), m_value(value) { + } + + ConstantFloatTexture(Stream *stream, InstanceManager *manager); + + inline Spectrum getValue(const Intersection &its) const { + return Spectrum(m_value); + } + + inline Spectrum getAverage() const { + return Spectrum(m_value); + } + + inline Spectrum getMaximum() const { + return Spectrum(m_value); + } + + inline std::string toString() const { + std::ostringstream oss; + oss << "ConstantFloatTexture[value=" << m_value << "]"; + return oss.str(); + } + + inline bool usesRayDifferentials() const { + return false; + } + + Shader *createShader(Renderer *renderer) const; + + void serialize(Stream *stream, InstanceManager *manager) const; + + MTS_DECLARE_CLASS() +protected: + Float m_value; +}; + +/** + * \brief Scaling passthrough texture + * + * Includes a \ref Shader implementation for hardware rendering + */ +class MTS_EXPORT_RENDER ScaleTexture : public Texture { +public: + inline ScaleTexture(const Texture *nested, const Float &scale) + : Texture(Properties()), m_nested(nested), m_scale(scale) { + } + + ScaleTexture(Stream *stream, InstanceManager *manager); + + + inline Spectrum getValue(const Intersection &its) const { + return m_nested->getValue(its) * m_scale; + } + + inline Spectrum getAverage() const { + return m_nested->getAverage() * m_scale; + } + + inline Spectrum getMaximum() const { + return m_nested->getMaximum() * m_scale; + } + + inline std::string toString() const { + std::ostringstream oss; + oss << "ScaleTexture[" << endl + << " nested = " << indent(m_nested->toString()) << "," << endl + << " scale = " << m_scale << endl + << "]"; + return oss.str(); + } + + inline bool usesRayDifferentials() const { + return m_nested->usesRayDifferentials(); + } + + Shader *createShader(Renderer *renderer) const; + + void serialize(Stream *stream, InstanceManager *manager) const; + + MTS_DECLARE_CLASS() +protected: + ref m_nested; + Float m_scale; +}; + +MTS_NAMESPACE_END + +#endif /* __BASIC_SHADER_H */ diff --git a/include/mitsuba/render/fwd.h b/include/mitsuba/render/fwd.h index 39c5de71..22476c57 100644 --- a/include/mitsuba/render/fwd.h +++ b/include/mitsuba/render/fwd.h @@ -34,7 +34,6 @@ class BlockListener; class BSDF; struct BSDFQueryRecord; class Camera; -class ConstantSpectrumTexture; struct EmissionRecord; class Film; class GatherPhotonProcess; diff --git a/include/mitsuba/render/texture.h b/include/mitsuba/render/texture.h index 4e6f154c..f10f052a 100644 --- a/include/mitsuba/render/texture.h +++ b/include/mitsuba/render/texture.h @@ -86,133 +86,6 @@ protected: Vector2 m_uvScale; }; -/* ============================================================ */ -/* Some vary basic texture definitions */ -/* ============================================================ */ - -class MTS_EXPORT_RENDER ConstantSpectrumTexture : public Texture { -public: - inline ConstantSpectrumTexture(const Spectrum &value) - : Texture(Properties()), m_value(value) { - } - - ConstantSpectrumTexture(Stream *stream, InstanceManager *manager); - - inline Spectrum getValue(const Intersection &its) const { - return m_value; - } - - inline Spectrum getAverage() const { - return m_value; - } - - inline Spectrum getMaximum() const { - return m_value; - } - - inline std::string toString() const { - std::ostringstream oss; - oss << "ConstantSpectrumTexture[value=" << m_value.toString() << "]"; - return oss.str(); - } - - inline bool usesRayDifferentials() const { - return false; - } - - Shader *createShader(Renderer *renderer) const; - - void serialize(Stream *stream, InstanceManager *manager) const; - - MTS_DECLARE_CLASS() -protected: - Spectrum m_value; -}; - -class MTS_EXPORT_RENDER ConstantFloatTexture : public Texture { -public: - inline ConstantFloatTexture(const Float &value) - : Texture(Properties()), m_value(value) { - } - - ConstantFloatTexture(Stream *stream, InstanceManager *manager); - - - inline Spectrum getValue(const Intersection &its) const { - return Spectrum(m_value); - } - - inline Spectrum getAverage() const { - return Spectrum(m_value); - } - - inline Spectrum getMaximum() const { - return Spectrum(m_value); - } - - inline std::string toString() const { - std::ostringstream oss; - oss << "ConstantFloatTexture[value=" << m_value << "]"; - return oss.str(); - } - - inline bool usesRayDifferentials() const { - return false; - } - - Shader *createShader(Renderer *renderer) const; - - void serialize(Stream *stream, InstanceManager *manager) const; - - MTS_DECLARE_CLASS() -protected: - Float m_value; -}; - -class MTS_EXPORT_RENDER ScaleTexture : public Texture { -public: - inline ScaleTexture(const Texture *nested, const Float &scale) - : Texture(Properties()), m_nested(nested), m_scale(scale) { - } - - ScaleTexture(Stream *stream, InstanceManager *manager); - - - inline Spectrum getValue(const Intersection &its) const { - return m_nested->getValue(its) * m_scale; - } - - inline Spectrum getAverage() const { - return m_nested->getAverage() * m_scale; - } - - inline Spectrum getMaximum() const { - return m_nested->getMaximum() * m_scale; - } - - inline std::string toString() const { - std::ostringstream oss; - oss << "ScaleTexture[" << endl - << " nested = " << indent(m_nested->toString()) << "," << endl - << " scale = " << m_scale << endl - << "]"; - return oss.str(); - } - - inline bool usesRayDifferentials() const { - return m_nested->usesRayDifferentials(); - } - - Shader *createShader(Renderer *renderer) const; - - void serialize(Stream *stream, InstanceManager *manager) const; - - MTS_DECLARE_CLASS() -protected: - ref m_nested; - Float m_scale; -}; - MTS_NAMESPACE_END #endif /* __TEXTURE_H */ diff --git a/src/bsdfs/conductor.cpp b/src/bsdfs/conductor.cpp index 8907b530..b5632f58 100644 --- a/src/bsdfs/conductor.cpp +++ b/src/bsdfs/conductor.cpp @@ -17,9 +17,8 @@ */ #include -#include #include -#include +#include MTS_NAMESPACE_BEGIN diff --git a/src/bsdfs/dielectric.cpp b/src/bsdfs/dielectric.cpp index b7cc4209..40d86b3b 100644 --- a/src/bsdfs/dielectric.cpp +++ b/src/bsdfs/dielectric.cpp @@ -17,7 +17,7 @@ */ #include -#include +#include #include "ior.h" MTS_NAMESPACE_BEGIN diff --git a/src/bsdfs/difftrans.cpp b/src/bsdfs/difftrans.cpp index 1396f17e..6267f15a 100644 --- a/src/bsdfs/difftrans.cpp +++ b/src/bsdfs/difftrans.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include MTS_NAMESPACE_BEGIN diff --git a/src/bsdfs/diffuse.cpp b/src/bsdfs/diffuse.cpp index 6d041569..f7c169d1 100644 --- a/src/bsdfs/diffuse.cpp +++ b/src/bsdfs/diffuse.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include MTS_NAMESPACE_BEGIN diff --git a/src/bsdfs/plastic.cpp b/src/bsdfs/plastic.cpp index 3fbe6261..9b162bdf 100644 --- a/src/bsdfs/plastic.cpp +++ b/src/bsdfs/plastic.cpp @@ -17,7 +17,7 @@ */ #include -#include +#include #include "ior.h" MTS_NAMESPACE_BEGIN diff --git a/src/bsdfs/roughconductor.cpp b/src/bsdfs/roughconductor.cpp index e6d6ec3c..e22cf0b2 100644 --- a/src/bsdfs/roughconductor.cpp +++ b/src/bsdfs/roughconductor.cpp @@ -19,8 +19,7 @@ #include #include #include -#include -#include +#include #include "microfacet.h" MTS_NAMESPACE_BEGIN diff --git a/src/bsdfs/roughdielectric.cpp b/src/bsdfs/roughdielectric.cpp index 81d515bb..ff4e5510 100644 --- a/src/bsdfs/roughdielectric.cpp +++ b/src/bsdfs/roughdielectric.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include "microfacet.h" #include "ior.h" diff --git a/src/bsdfs/roughdiffuse.cpp b/src/bsdfs/roughdiffuse.cpp index 7fc05bd5..5eb8c1f3 100644 --- a/src/bsdfs/roughdiffuse.cpp +++ b/src/bsdfs/roughdiffuse.cpp @@ -17,8 +17,7 @@ */ #include -#include -#include +#include MTS_NAMESPACE_BEGIN diff --git a/src/libhw/SConscript b/src/libhw/SConscript index fc1a586f..0f3debf9 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'] + 'vpl.cpp', 'font.cpp', 'viewer.cpp', 'basicshader.cpp'] if sys.platform == 'win32': libhw_objects += ['wglsession.cpp', diff --git a/src/libhw/basicshader.cpp b/src/libhw/basicshader.cpp new file mode 100644 index 00000000..ec23f52b --- /dev/null +++ b/src/libhw/basicshader.cpp @@ -0,0 +1,177 @@ +/* + 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 + +ConstantSpectrumTexture::ConstantSpectrumTexture(Stream *stream, InstanceManager *manager) + : Texture(stream, manager) { + m_value = Spectrum(stream); +} + +void ConstantSpectrumTexture::serialize(Stream *stream, InstanceManager *manager) const { + Texture::serialize(stream, manager); + + m_value.serialize(stream); +} + +ConstantFloatTexture::ConstantFloatTexture(Stream *stream, InstanceManager *manager) + : Texture(stream, manager) { + m_value = stream->readFloat(); +} + +void ConstantFloatTexture::serialize(Stream *stream, InstanceManager *manager) const { + Texture::serialize(stream, manager); + stream->writeFloat(m_value); +} + +ScaleTexture::ScaleTexture(Stream *stream, InstanceManager *manager) + : Texture(stream, manager) { + m_nested = static_cast(manager->getInstance(stream)); + m_scale = stream->readFloat(); +} + +void ScaleTexture::serialize(Stream *stream, InstanceManager *manager) const { + Texture::serialize(stream, manager); + manager->serialize(stream, m_nested.get()); + stream->writeFloat(m_scale); +} + +class ConstantSpectrumTextureShader : public Shader { +public: + ConstantSpectrumTextureShader(Renderer *renderer, const Spectrum &value) + : Shader(renderer, ETextureShader), m_value(value) { + } + + void generateCode(std::ostringstream &oss, + const std::string &evalName, + const std::vector &depNames) const { + oss << "uniform vec3 " << evalName << "_value;" << endl + << endl + << "vec3 " << evalName << "(vec2 uv) {" << endl + << " return " << evalName << "_value;" << endl + << "}" << endl; + } + + void resolve(const GPUProgram *program, const std::string &evalName, std::vector ¶meterIDs) const { + parameterIDs.push_back(program->getParameterID(evalName + "_value")); + } + + void bind(GPUProgram *program, const std::vector ¶meterIDs, int &textureUnitOffset) const { + program->setParameter(parameterIDs[0], m_value); + } + + MTS_DECLARE_CLASS() +private: + Spectrum m_value; +}; + +class ConstantFloatTextureShader : public Shader { +public: + ConstantFloatTextureShader(Renderer *renderer, const Float &value) + : Shader(renderer, ETextureShader), m_value(value) { + } + + void generateCode(std::ostringstream &oss, + const std::string &evalName, + const std::vector &depNames) const { + oss << "uniform float " << evalName << "_value;" << endl + << endl + << "vec3 " << evalName << "(vec2 uv) {" << endl + << " return vec3(" << evalName << "_value);" << endl + << "}" << endl; + } + + void resolve(const GPUProgram *program, const std::string &evalName, std::vector ¶meterIDs) const { + parameterIDs.push_back(program->getParameterID(evalName + "_value")); + } + + void bind(GPUProgram *program, const std::vector ¶meterIDs, int &textureUnitOffset) const { + program->setParameter(parameterIDs[0], m_value); + } + + MTS_DECLARE_CLASS() +private: + Float m_value; +}; + +class ScaleTextureShader : public Shader { +public: + ScaleTextureShader(Renderer *renderer, const Texture *nested, const Float &scale) + : Shader(renderer, ETextureShader), m_nested(nested), m_scale(scale) { + m_nestedShader = renderer->registerShaderForResource(m_nested.get()); + } + + bool isComplete() const { + return m_nestedShader.get() != NULL; + } + + void cleanup(Renderer *renderer) { + renderer->unregisterShaderForResource(m_nested.get()); + } + + void putDependencies(std::vector &deps) { + deps.push_back(m_nestedShader.get()); + } + + void generateCode(std::ostringstream &oss, + const std::string &evalName, + const std::vector &depNames) const { + oss << "uniform float " << evalName << "_scale;" << endl + << endl + << "vec3 " << evalName << "(vec2 uv) {" << endl + << " return " << depNames[0] << "(uv) * " << evalName << "_scale;" << endl + << "}" << endl; + } + + void resolve(const GPUProgram *program, const std::string &evalName, std::vector ¶meterIDs) const { + parameterIDs.push_back(program->getParameterID(evalName + "_scale")); + } + + void bind(GPUProgram *program, const std::vector ¶meterIDs, int &nestedUnitOffset) const { + program->setParameter(parameterIDs[0], m_scale); + } + + MTS_DECLARE_CLASS() +private: + ref m_nested; + ref m_nestedShader; + Float m_scale; +}; + +Shader *ConstantSpectrumTexture::createShader(Renderer *renderer) const { + return new ConstantSpectrumTextureShader(renderer, m_value); +} + +Shader *ConstantFloatTexture::createShader(Renderer *renderer) const { + return new ConstantFloatTextureShader(renderer, m_value); +} + +Shader *ScaleTexture::createShader(Renderer *renderer) const { + return new ScaleTextureShader(renderer, m_nested.get(), m_scale); +} + + +MTS_IMPLEMENT_CLASS_S(ConstantSpectrumTexture, false, Texture) +MTS_IMPLEMENT_CLASS(ConstantSpectrumTextureShader, false, Shader) +MTS_IMPLEMENT_CLASS_S(ConstantFloatTexture, false, Texture) +MTS_IMPLEMENT_CLASS(ConstantFloatTextureShader, false, Shader) +MTS_IMPLEMENT_CLASS_S(ScaleTexture, false, Texture) +MTS_IMPLEMENT_CLASS(ScaleTextureShader, false, Shader) +MTS_NAMESPACE_END diff --git a/src/librender/bsdf.cpp b/src/librender/bsdf.cpp index f93034ef..883491fe 100644 --- a/src/librender/bsdf.cpp +++ b/src/librender/bsdf.cpp @@ -18,6 +18,7 @@ #include #include +#include MTS_NAMESPACE_BEGIN @@ -81,7 +82,10 @@ Texture *BSDF::ensureEnergyConservation(Texture *texture, << "issues. Specify the parameter ensureEnergyConservation=false " << "to the BSDF to prevent this from happening."; Log(EWarn, "%s", oss.str().c_str()); - return new ScaleTexture(texture, scale); + Properties props("scale"); + props.setFloat("value", scale); + return static_cast (PluginManager::getInstance()-> + createObject(MTS_CLASS(Texture), props)); } return texture; } diff --git a/src/librender/texture.cpp b/src/librender/texture.cpp index fcf9d422..01efc62b 100644 --- a/src/librender/texture.cpp +++ b/src/librender/texture.cpp @@ -16,8 +16,7 @@ along with this program. If not, see . */ -#include -#include +#include MTS_NAMESPACE_BEGIN @@ -80,160 +79,6 @@ Spectrum Texture2D::getValue(const Intersection &its) const { return getValue(uv); } } - -ConstantSpectrumTexture::ConstantSpectrumTexture(Stream *stream, InstanceManager *manager) - : Texture(stream, manager) { - m_value = Spectrum(stream); -} - -void ConstantSpectrumTexture::serialize(Stream *stream, InstanceManager *manager) const { - Texture::serialize(stream, manager); - - m_value.serialize(stream); -} - -ConstantFloatTexture::ConstantFloatTexture(Stream *stream, InstanceManager *manager) - : Texture(stream, manager) { - m_value = stream->readFloat(); -} - -void ConstantFloatTexture::serialize(Stream *stream, InstanceManager *manager) const { - Texture::serialize(stream, manager); - stream->writeFloat(m_value); -} - -ScaleTexture::ScaleTexture(Stream *stream, InstanceManager *manager) - : Texture(stream, manager) { - m_nested = static_cast(manager->getInstance(stream)); - m_scale = stream->readFloat(); -} - -void ScaleTexture::serialize(Stream *stream, InstanceManager *manager) const { - Texture::serialize(stream, manager); - manager->serialize(stream, m_nested.get()); - stream->writeFloat(m_scale); -} - -class ConstantSpectrumTextureShader : public Shader { -public: - ConstantSpectrumTextureShader(Renderer *renderer, const Spectrum &value) - : Shader(renderer, ETextureShader), m_value(value) { - } - - void generateCode(std::ostringstream &oss, - const std::string &evalName, - const std::vector &depNames) const { - oss << "uniform vec3 " << evalName << "_value;" << endl - << endl - << "vec3 " << evalName << "(vec2 uv) {" << endl - << " return " << evalName << "_value;" << endl - << "}" << endl; - } - - void resolve(const GPUProgram *program, const std::string &evalName, std::vector ¶meterIDs) const { - parameterIDs.push_back(program->getParameterID(evalName + "_value")); - } - - void bind(GPUProgram *program, const std::vector ¶meterIDs, int &textureUnitOffset) const { - program->setParameter(parameterIDs[0], m_value); - } - - MTS_DECLARE_CLASS() -private: - Spectrum m_value; -}; - -class ConstantFloatTextureShader : public Shader { -public: - ConstantFloatTextureShader(Renderer *renderer, const Float &value) - : Shader(renderer, ETextureShader), m_value(value) { - } - - void generateCode(std::ostringstream &oss, - const std::string &evalName, - const std::vector &depNames) const { - oss << "uniform float " << evalName << "_value;" << endl - << endl - << "vec3 " << evalName << "(vec2 uv) {" << endl - << " return vec3(" << evalName << "_value);" << endl - << "}" << endl; - } - - void resolve(const GPUProgram *program, const std::string &evalName, std::vector ¶meterIDs) const { - parameterIDs.push_back(program->getParameterID(evalName + "_value")); - } - - void bind(GPUProgram *program, const std::vector ¶meterIDs, int &textureUnitOffset) const { - program->setParameter(parameterIDs[0], m_value); - } - - MTS_DECLARE_CLASS() -private: - Float m_value; -}; - -class ScaleTextureShader : public Shader { -public: - ScaleTextureShader(Renderer *renderer, const Texture *nested, const Float &scale) - : Shader(renderer, ETextureShader), m_nested(nested), m_scale(scale) { - m_nestedShader = renderer->registerShaderForResource(m_nested.get()); - } - - bool isComplete() const { - return m_nestedShader.get() != NULL; - } - - void cleanup(Renderer *renderer) { - renderer->unregisterShaderForResource(m_nested.get()); - } - - void putDependencies(std::vector &deps) { - deps.push_back(m_nestedShader.get()); - } - - void generateCode(std::ostringstream &oss, - const std::string &evalName, - const std::vector &depNames) const { - oss << "uniform float " << evalName << "_scale;" << endl - << endl - << "vec3 " << evalName << "(vec2 uv) {" << endl - << " return " << depNames[0] << "(uv) * " << evalName << "_scale;" << endl - << "}" << endl; - } - - void resolve(const GPUProgram *program, const std::string &evalName, std::vector ¶meterIDs) const { - parameterIDs.push_back(program->getParameterID(evalName + "_scale")); - } - - void bind(GPUProgram *program, const std::vector ¶meterIDs, int &nestedUnitOffset) const { - program->setParameter(parameterIDs[0], m_scale); - } - - MTS_DECLARE_CLASS() -private: - ref m_nested; - ref m_nestedShader; - Float m_scale; -}; - -Shader *ConstantSpectrumTexture::createShader(Renderer *renderer) const { - return new ConstantSpectrumTextureShader(renderer, m_value); -} - -Shader *ConstantFloatTexture::createShader(Renderer *renderer) const { - return new ConstantFloatTextureShader(renderer, m_value); -} - -Shader *ScaleTexture::createShader(Renderer *renderer) const { - return new ScaleTextureShader(renderer, m_nested.get(), m_scale); -} - MTS_IMPLEMENT_CLASS(Texture, true, ConfigurableObject) MTS_IMPLEMENT_CLASS(Texture2D, true, Texture) -MTS_IMPLEMENT_CLASS_S(ConstantSpectrumTexture, false, Texture) -MTS_IMPLEMENT_CLASS(ConstantSpectrumTextureShader, false, Shader) -MTS_IMPLEMENT_CLASS_S(ConstantFloatTexture, false, Texture) -MTS_IMPLEMENT_CLASS(ConstantFloatTextureShader, false, Shader) -MTS_IMPLEMENT_CLASS_S(ScaleTexture, false, Texture) -MTS_IMPLEMENT_CLASS(ScaleTextureShader, false, Shader) MTS_NAMESPACE_END diff --git a/src/luminaires/spot.cpp b/src/luminaires/spot.cpp index a74bca49..177d6d2e 100644 --- a/src/luminaires/spot.cpp +++ b/src/luminaires/spot.cpp @@ -17,8 +17,7 @@ */ #include -#include -#include +#include MTS_NAMESPACE_BEGIN