| 611 | } |
| 612 | |
| 613 | void GuiShapeEdPreview::setMountNode(S32 mountSlot, const char* nodeName) |
| 614 | { |
| 615 | if ( mountSlot < mMounts.size() ) |
| 616 | { |
| 617 | MountedShape* mount = mMounts[mountSlot]; |
| 618 | |
| 619 | mount->mNode = mModel ? mModel->getShape()->findNode( nodeName ) : -1; |
| 620 | mount->mTransform.identity(); |
| 621 | |
| 622 | switch ( mount->mType ) |
| 623 | { |
| 624 | case MountedShape::Image: |
| 625 | { |
| 626 | // Mount point is either the node called 'mountPoint' or the origin |
| 627 | S32 node = mount->mShape->getShape()->findNode( "mountPoint" ); |
| 628 | if ( node != -1 ) |
| 629 | { |
| 630 | mount->mShape->getShape()->getNodeWorldTransform( node, &mount->mTransform ); |
| 631 | mount->mTransform.inverse(); |
| 632 | } |
| 633 | } |
| 634 | break; |
| 635 | |
| 636 | case MountedShape::Wheel: |
| 637 | // Rotate shape according to node's x position (left or right) |
| 638 | { |
| 639 | F32 rotAngle = M_PI_F/2; |
| 640 | if ( mount->mNode != -1 ) |
| 641 | { |
| 642 | MatrixF hubMat; |
| 643 | mModel->getShape()->getNodeWorldTransform( mount->mNode, &hubMat ); |
| 644 | if ( hubMat.getPosition().x < 0 ) |
| 645 | rotAngle = -M_PI_F/2; |
| 646 | } |
| 647 | mount->mTransform.set( EulerF( 0, 0, rotAngle ) ); |
| 648 | } |
| 649 | break; |
| 650 | |
| 651 | default: |
| 652 | // No mount transform (use origin) |
| 653 | break; |
| 654 | } |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | const char* GuiShapeEdPreview::getMountThreadSequence(S32 mountSlot) const |
| 659 | { |
no test coverage detected