| 87 | #define PARSE_INT(x) int32 x; if (!ReadLine(bufferPos, x)) { return true; } |
| 88 | |
| 89 | bool ImportIES::Load(const byte* buffer) |
| 90 | { |
| 91 | // Referenced IES file format: |
| 92 | // http://www.ltblight.com/English.lproj/LTBLhelp/pages/iesformat.html |
| 93 | |
| 94 | const uint8* bufferPos = buffer; |
| 95 | const char* version; |
| 96 | { |
| 97 | char line[MAX_LINE]; |
| 98 | ReadLine(bufferPos, line, false); |
| 99 | if (StringUtils::CompareIgnoreCase(line, "IESNA:LM-63-1995") == 0) |
| 100 | { |
| 101 | version = "EIESV_1995"; |
| 102 | } |
| 103 | else if (StringUtils::CompareIgnoreCase(line, "IESNA91") == 0) |
| 104 | { |
| 105 | version = "EIESV_1991"; |
| 106 | } |
| 107 | else if (StringUtils::CompareIgnoreCase(line, "IESNA:LM-63-2002") == 0) |
| 108 | { |
| 109 | version = "EIESV_2002"; |
| 110 | } |
| 111 | else |
| 112 | { |
| 113 | version = "EIESV_1986"; |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | while (*bufferPos) |
| 118 | { |
| 119 | char line[MAX_LINE]; |
| 120 | ReadLine(bufferPos, line, false); |
| 121 | if (StringUtils::Compare(line, "TILT=NONE") == 0) |
| 122 | { |
| 123 | break; |
| 124 | } |
| 125 | if (StringUtils::Compare(line, "TILT=", 5) == 0) |
| 126 | { |
| 127 | return true; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | PARSE_INT(lights); |
| 132 | PARSE_FLOAT(lumensPerLight); |
| 133 | PARSE_FLOAT(candalaScale); |
| 134 | PARSE_INT(vAnglesCount); |
| 135 | PARSE_INT(hAnglesCount); |
| 136 | PARSE_INT(photometricType); |
| 137 | PARSE_INT(unitType); |
| 138 | PARSE_FLOAT(width); |
| 139 | PARSE_FLOAT(length); |
| 140 | PARSE_FLOAT(height); |
| 141 | PARSE_FLOAT(ballastWeight); |
| 142 | PARSE_FLOAT(dummy); |
| 143 | PARSE_FLOAT(watts); |
| 144 | |
| 145 | if (lights < 1) |
| 146 | { |
no test coverage detected