From c9294d81f75c9faef944ecf4a74bec6a6c20c49a Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Mon, 8 Oct 2012 22:17:23 -0400 Subject: [PATCH] be a bit more strict about negative values in textures/environment maps --- src/emitters/envmap.cpp | 4 ++++ src/textures/bitmap.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/emitters/envmap.cpp b/src/emitters/envmap.cpp index 09af7b6e..0e579e29 100644 --- a/src/emitters/envmap.cpp +++ b/src/emitters/envmap.cpp @@ -181,6 +181,10 @@ public: std::numeric_limits::infinity(), Spectrum::EIlluminant); } + if (m_mipmap->getMinimum().min() < 0) + Log(EError, "\"%s\": The environment map contains negative pixel values! This is not allowed.", + m_filename.string().c_str()); + if (props.hasProperty("intensityScale")) Log(EError, "The 'intensityScale' parameter has been deprecated and is now called scale."); diff --git a/src/textures/bitmap.cpp b/src/textures/bitmap.cpp index e27e9410..a473b6e8 100644 --- a/src/textures/bitmap.cpp +++ b/src/textures/bitmap.cpp @@ -277,6 +277,11 @@ public: rfilter, m_wrapModeU, m_wrapModeV, m_filterType, m_maxAnisotropy, createCache ? cacheFile : fs::path(), timestamp); } + + if ((m_mipmap1 && m_mipmap1->getMinimum().min() < 0) || + (m_mipmap3 && m_mipmap3->getMinimum().min() < 0)) + Log(EError, "\"%s\": The texture map contains negative pixel values! This is not allowed.", + m_filename.string().c_str()); } inline ReconstructionFilter::EBoundaryCondition parseWrapMode(const std::string &wrapMode) {