| 297 | } |
| 298 | |
| 299 | void createCaps(const IPatch& patch, const scene::INodePtr& parent, CapType type, const std::string& shader) |
| 300 | { |
| 301 | if ((type == CapType::EndCap || type == CapType::InvertedEndCap) && patch.getWidth() != 5) |
| 302 | { |
| 303 | throw cmd::ExecutionFailure(_("Cannot create end-cap, patch must have a width of 5.")); |
| 304 | } |
| 305 | |
| 306 | if ((type == CapType::Bevel || type == CapType::InvertedBevel) && patch.getWidth() != 3) |
| 307 | { |
| 308 | throw cmd::ExecutionFailure(_("Cannot create bevel-cap, patch must have a width of 3.")); |
| 309 | } |
| 310 | |
| 311 | if (type == CapType::Cylinder && patch.getWidth() != 9) |
| 312 | { |
| 313 | throw cmd::ExecutionFailure(_("Cannot create cylinder-cap, patch must have a width of 9.")); |
| 314 | } |
| 315 | |
| 316 | assert(parent); |
| 317 | |
| 318 | // We do this once for the front and once for the back patch |
| 319 | for (auto front : { true, false }) |
| 320 | { |
| 321 | auto cap = constructCap(patch, type, front, shader); |
| 322 | |
| 323 | if (cap) |
| 324 | { |
| 325 | parent->addChildNode(cap); |
| 326 | Node_setSelected(cap, true); |
| 327 | } |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | } |
| 332 |
no test coverage detected