| 553 | } |
| 554 | |
| 555 | void GuiShapeEdPreview::setMountNode(S32 mountSlot, const char* nodeName) |
| 556 | { |
| 557 | if ( mountSlot < mMounts.size() ) |
| 558 | { |
| 559 | MountedShape* mount = mMounts[mountSlot]; |
| 560 | |
| 561 | mount->mNode = mModel ? mModel->getShape()->findNode( nodeName ) : -1; |
| 562 | mount->mTransform.identity(); |
| 563 | |
| 564 | switch ( mount->mType ) |
| 565 | { |
| 566 | case MountedShape::Image: |
| 567 | { |
| 568 | // Mount point is either the node called 'mountPoint' or the origin |
| 569 | S32 node = mount->mShape->getShape()->findNode( "mountPoint" ); |
| 570 | if ( node != -1 ) |
| 571 | { |
| 572 | mount->mShape->getShape()->getNodeWorldTransform( node, &mount->mTransform ); |
| 573 | mount->mTransform.inverse(); |
| 574 | } |
| 575 | } |
| 576 | break; |
| 577 | |
| 578 | case MountedShape::Wheel: |
| 579 | // Rotate shape according to node's x position (left or right) |
| 580 | { |
| 581 | F32 rotAngle = M_PI_F/2; |
| 582 | if ( mount->mNode != -1 ) |
| 583 | { |
| 584 | MatrixF hubMat; |
| 585 | mModel->getShape()->getNodeWorldTransform( mount->mNode, &hubMat ); |
| 586 | if ( hubMat.getPosition().x < 0 ) |
| 587 | rotAngle = -M_PI_F/2; |
| 588 | } |
| 589 | mount->mTransform.set( EulerF( 0, 0, rotAngle ) ); |
| 590 | } |
| 591 | break; |
| 592 | |
| 593 | default: |
| 594 | // No mount transform (use origin) |
| 595 | break; |
| 596 | } |
| 597 | } |
| 598 | } |
| 599 | |
| 600 | const char* GuiShapeEdPreview::getMountThreadSequence(S32 mountSlot) const |
| 601 | { |
no test coverage detected