| 273 | } |
| 274 | |
| 275 | void ProtectedNode::visit(Renderer* renderer, const Mat4& parentTransform, uint32_t parentFlags) |
| 276 | { |
| 277 | // quick return if not visible. children won't be drawn. |
| 278 | if (!_visible) |
| 279 | { |
| 280 | return; |
| 281 | } |
| 282 | |
| 283 | uint32_t flags = processParentFlags(parentTransform, parentFlags); |
| 284 | |
| 285 | // IMPORTANT: |
| 286 | // To ease the migration to v3.0, we still support the Mat4 stack, |
| 287 | // but it is deprecated and your code should not rely on it |
| 288 | _director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); |
| 289 | _director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform); |
| 290 | |
| 291 | int i = 0; // used by _children |
| 292 | int j = 0; // used by _protectedChildren |
| 293 | |
| 294 | sortAllChildren(); |
| 295 | sortAllProtectedChildren(); |
| 296 | |
| 297 | // |
| 298 | // draw children and protectedChildren zOrder < 0 |
| 299 | // |
| 300 | for (auto size = _children.size(); i < size; ++i) |
| 301 | { |
| 302 | auto node = _children.at(i); |
| 303 | |
| 304 | if (node && node->getLocalZOrder() < 0) |
| 305 | node->visit(renderer, _modelViewTransform, flags); |
| 306 | else |
| 307 | break; |
| 308 | } |
| 309 | |
| 310 | for (auto size = _protectedChildren.size(); j < size; ++j) |
| 311 | { |
| 312 | auto node = _protectedChildren.at(j); |
| 313 | |
| 314 | if (node && node->getLocalZOrder() < 0) |
| 315 | node->visit(renderer, _modelViewTransform, flags); |
| 316 | else |
| 317 | break; |
| 318 | } |
| 319 | |
| 320 | // |
| 321 | // draw self |
| 322 | // |
| 323 | if (isVisitableByVisitingCamera()) |
| 324 | this->draw(renderer, _modelViewTransform, flags); |
| 325 | |
| 326 | // |
| 327 | // draw children and protectedChildren zOrder >= 0 |
| 328 | // |
| 329 | for (auto it = _protectedChildren.cbegin() + j, itCend = _protectedChildren.cend(); it != itCend; ++it) |
| 330 | (*it)->visit(renderer, _modelViewTransform, flags); |
| 331 | |
| 332 | for (auto it = _children.cbegin() + i, itCend = _children.cend(); it != itCend; ++it) |
nothing calls this directly
no test coverage detected