| 249 | } |
| 250 | |
| 251 | bool ParseCamera(std::string &configString, Camera &camera, InputInfo &input, std::ofstream &log) |
| 252 | { |
| 253 | std::string line; |
| 254 | std::stringstream stream; |
| 255 | |
| 256 | size_t index = configString.find("#[camera]"); |
| 257 | if (index == std::string::npos) return true; |
| 258 | |
| 259 | stream.str(configString.substr(index)); |
| 260 | |
| 261 | bool status = true; |
| 262 | while (!stream.eof()) |
| 263 | { |
| 264 | getline(stream, line, '\n'); |
| 265 | if (line.find_first_of("#") == 0) continue; // commented line, skip it |
| 266 | |
| 267 | if (ParseIfExists("cameraPosition=", camera.position, line, status, log)) continue; |
| 268 | if (ParseIfExists("cameraYaw=", input.yaw, line, status, log)) |
| 269 | { |
| 270 | input.initialized = true; |
| 271 | continue; |
| 272 | } |
| 273 | if (ParseIfExists("cameraPitch=", input.pitch, line, status, log)) |
| 274 | { |
| 275 | input.initialized = true; |
| 276 | continue; |
| 277 | } |
| 278 | if (ParseIfExists("cameraFov=", camera.fov, line, status, log)) |
| 279 | { |
| 280 | camera.tanHalfFovY = tanf(camera.fov * (XM_PI / 180.f) * 0.5f); |
| 281 | continue; |
| 282 | } |
| 283 | |
| 284 | if (!status) return false; |
| 285 | } |
| 286 | return true; |
| 287 | } |
| 288 | |
| 289 | bool ParseVolumes(std::string &configString, std::vector<DDGIVolumeDesc> &descs, std::ofstream &log) |
| 290 | { |
no test coverage detected