StelToneReproducer.cpp   StelToneReproducer.cpp 
skipping to change at line 20 skipping to change at line 20
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "StelToneReproducer.hpp" #include "StelToneReproducer.hpp"
#include "StelUtils.hpp"
#include <cmath> #include <cmath>
/********************************************************************* /*********************************************************************
Constructor: Set some default values to prevent bugs in case of bad use Constructor: Set some default values to prevent bugs in case of bad use
*********************************************************************/ *********************************************************************/
StelToneReproducer::StelToneReproducer() : Lda(50.f), Lwa(40000.f), oneOver MaxdL(1.f/100.f), lnOneOverMaxdL(std::log(1.f/100.f)), oneOverGamma(1.f/2.2 222f) StelToneReproducer::StelToneReproducer() : Lda(50.f), Lwa(40000.f), oneOver MaxdL(1.f/100.f), lnOneOverMaxdL(std::log(1.f/100.f)), oneOverGamma(1.f/2.2 222f)
{ {
// Initialize sensor // Initialize sensor
setInputScale(); setInputScale();
skipping to change at line 70 skipping to change at line 70
{ {
Lda = _Lda; Lda = _Lda;
// Update alphaDa and betaDa values // Update alphaDa and betaDa values
float log10Lda = std::log10(Lda); float log10Lda = std::log10(Lda);
alphaDa = 0.4f * log10Lda + 1.619f; alphaDa = 0.4f * log10Lda + 1.619f;
betaDa = -0.4f * log10Lda*log10Lda + 0.218f * log10Lda + 6.1642f; betaDa = -0.4f * log10Lda*log10Lda + 0.218f * log10Lda + 6.1642f;
// Update terms // Update terms
alphaWaOverAlphaDa = alphaWa/alphaDa; alphaWaOverAlphaDa = alphaWa/alphaDa;
term2 = (float) (pow10((betaWa-betaDa)/alphaDa) / (M_PI*0.0001f)); term2 = (float) (stelpow10f((betaWa-betaDa)/alphaDa) / (M_PI*0.0001f));
lnTerm2 = std::log(term2); lnTerm2 = std::log(term2);
term2TimesOneOverMaxdLpOneOverGamma = std::pow(term2*oneOverMaxdL, o neOverGamma); term2TimesOneOverMaxdLpOneOverGamma = std::pow(term2*oneOverMaxdL, o neOverGamma);
} }
/********************************************************************* /*********************************************************************
Set the eye adaptation luminance for the world (and precompute what can be ) Set the eye adaptation luminance for the world (and precompute what can be )
*********************************************************************/ *********************************************************************/
void StelToneReproducer::setWorldAdaptationLuminance(float _Lwa) void StelToneReproducer::setWorldAdaptationLuminance(float _Lwa)
{ {
Lwa = _Lwa; Lwa = _Lwa;
// Update alphaDa and betaDa values // Update alphaDa and betaDa values
float log10Lwa = std::log10(Lwa); float log10Lwa = std::log10(Lwa);
alphaWa = 0.4f * log10Lwa + 1.619f; alphaWa = 0.4f * log10Lwa + 1.619f;
betaWa = -0.4f * log10Lwa*log10Lwa + 0.218f * log10Lwa + 6.1642f; betaWa = -0.4f * log10Lwa*log10Lwa + 0.218f * log10Lwa + 6.1642f;
// Update terms // Update terms
alphaWaOverAlphaDa = alphaWa/alphaDa; alphaWaOverAlphaDa = alphaWa/alphaDa;
term2 = (float) (pow10((betaWa-betaDa)/alphaDa) / (M_PI*0.0001f)); term2 = (float) (stelpow10f((betaWa-betaDa)/alphaDa) / (M_PI*0.0001f));
lnTerm2 = std::log(term2); lnTerm2 = std::log(term2);
term2TimesOneOverMaxdLpOneOverGamma = std::pow(term2*oneOverMaxdL, o neOverGamma); term2TimesOneOverMaxdLpOneOverGamma = std::pow(term2*oneOverMaxdL, o neOverGamma);
} }
/********************************************************************* /*********************************************************************
Convert from xyY color system to RGB according to the adaptation Convert from xyY color system to RGB according to the adaptation
The Y component is in cd/m^2 The Y component is in cd/m^2
*********************************************************************/ *********************************************************************/
void StelToneReproducer::xyYToRGB(float* color) const void StelToneReproducer::xyYToRGB(float* color) const
{ {
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/