00001 /*************************************************************************** 00002 * Copyright (C) 1998-2009 by authors (see AUTHORS.txt ) * 00003 * * 00004 * This file is part of LuxRender. * 00005 * * 00006 * Lux Renderer is free software; you can redistribute it and/or modify * 00007 * it under the terms of the GNU General Public License as published by * 00008 * the Free Software Foundation; either version 3 of the License, or * 00009 * (at your option) any later version. * 00010 * * 00011 * Lux Renderer is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 00018 * * 00019 * This project is based on PBRT ; see http://www.pbrt.org * 00020 * Lux Renderer website : http://www.luxrender.net * 00021 ***************************************************************************/ 00022 00023 #ifndef LUX_PHOTOMETRICDATAIES_H 00024 #define LUX_PHOTOMETRICDATAIES_H 00025 00026 #include "lux.h" 00027 #include <fstream> 00028 #include <map> 00029 00030 namespace lux { 00031 00032 class PhotometricDataIES { 00033 public: 00034 PhotometricDataIES(); 00035 PhotometricDataIES( const char * ); 00036 00037 ~PhotometricDataIES(); 00038 00040 // Methods. 00041 00042 bool IsValid() { return m_bValid; } 00043 void Reset(); 00044 bool Load( const char* ); 00045 00046 void inline ReadLine( std::string & sLine ) 00047 { 00048 memset( &sLine[0], 0, sLine.size() ); 00049 m_fsIES.getline( &sLine[0], 256, 0x0A ); 00050 } 00051 00053 // Keywords and light descriptions. 00054 00055 std::string m_Version; 00056 std::map<std::string,std::string> m_Keywords; 00057 00059 // Light data. 00060 00061 enum PhotometricType { 00062 PHOTOMETRIC_TYPE_C = 1, 00063 PHOTOMETRIC_TYPE_B = 2, 00064 PHOTOMETRIC_TYPE_A = 3 00065 }; 00066 00067 unsigned int m_NumberOfLamps; 00068 double m_LumensPerLamp; 00069 double m_CandelaMultiplier; 00070 unsigned int m_NumberOfVerticalAngles; 00071 unsigned int m_NumberOfHorizontalAngles; 00072 PhotometricType m_PhotometricType; 00073 unsigned int m_UnitsType; 00074 double m_LuminaireWidth; 00075 double m_LuminaireLength; 00076 double m_LuminaireHeight; 00077 00078 double BallastFactor; 00079 double BallastLampPhotometricFactor; 00080 double InputWatts; 00081 00082 std::vector<double> m_VerticalAngles; 00083 std::vector<double> m_HorizontalAngles; 00084 00085 std::vector< std::vector<double> > m_CandelaValues; 00086 00087 private: 00088 bool PrivateLoad( const char* ); 00089 00090 bool BuildKeywordList(); 00091 void BuildDataLine( unsigned int, std::vector<double>& ); 00092 bool BuildLightData(); 00093 00094 bool m_bValid; 00095 std::ifstream m_fsIES; 00096 }; 00097 00098 } //namespace lux 00099 00100 #endif // LUX_PHOTOMETRICDATAIES_H