| 297 | } |
| 298 | |
| 299 | osg::Vec3f Manager::getVector3(std::string_view setting, std::string_view category) |
| 300 | { |
| 301 | const std::string& value = getString(setting, category); |
| 302 | |
| 303 | std::vector<std::string> components; |
| 304 | Misc::StringUtils::split(value, components); |
| 305 | |
| 306 | if (components.size() == 3) |
| 307 | { |
| 308 | auto x = Misc::StringUtils::toNumeric<float>(components[0]); |
| 309 | auto y = Misc::StringUtils::toNumeric<float>(components[1]); |
| 310 | auto z = Misc::StringUtils::toNumeric<float>(components[2]); |
| 311 | |
| 312 | if (x && y && z) |
| 313 | { |
| 314 | return { x.value(), y.value(), z.value() }; |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | throw std::runtime_error(std::string("Can't parse 3d vector: " + value)); |
| 319 | } |
| 320 | |
| 321 | void Manager::setString(std::string_view setting, std::string_view category, const std::string& value) |
| 322 | { |
nothing calls this directly
no test coverage detected