| 1620 | } |
| 1621 | |
| 1622 | void Gizmo::_renderAxisCircles() |
| 1623 | { |
| 1624 | if ( mProfile->hideDisabledAxes && !( mProfile->flags & GizmoProfile::CanRotate ) ) |
| 1625 | return; |
| 1626 | |
| 1627 | // Setup the WorldMatrix for rendering in camera space. |
| 1628 | // Honestly not sure exactly why this works but it does... |
| 1629 | GFX->pushWorldMatrix(); |
| 1630 | MatrixF cameraXfm = GFX->getWorldMatrix(); |
| 1631 | cameraXfm.inverse(); |
| 1632 | const Point3F cameraPos = cameraXfm.getPosition(); |
| 1633 | cameraXfm.setPosition( mOrigin ); |
| 1634 | GFX->multWorld(cameraXfm); |
| 1635 | |
| 1636 | // Render the ScreenSpace rotation circle... |
| 1637 | if ( !( mProfile->hideDisabledAxes && !mScreenRotateHandleEnabled ) ) |
| 1638 | { |
| 1639 | F32 radius = mProjLen * 0.7f; |
| 1640 | U32 segments = 40; |
| 1641 | F32 step = mDegToRad(360.0f)/ segments; |
| 1642 | Point3F pnt; |
| 1643 | |
| 1644 | PrimBuild::color( ( mHighlightAll || mSelectionIdx == Custom1 ) ? mProfile->activeColor : mProfile->inActiveColor ); |
| 1645 | PrimBuild::begin( GFXLineStrip, segments+1 ); |
| 1646 | |
| 1647 | for(U32 i = 0; i <= segments; i++) |
| 1648 | { |
| 1649 | F32 angle = i * step; |
| 1650 | |
| 1651 | pnt.x = mCos(angle) * radius; |
| 1652 | pnt.y = 0.0f; |
| 1653 | pnt.z = mSin(angle) * radius; |
| 1654 | |
| 1655 | PrimBuild::vertex3fv( pnt ); |
| 1656 | } |
| 1657 | |
| 1658 | PrimBuild::end(); |
| 1659 | } |
| 1660 | |
| 1661 | // Render the gizmo/sphere bounding circle... |
| 1662 | { |
| 1663 | F32 radius = mProjLen * 0.5f; |
| 1664 | U32 segments = 40; |
| 1665 | F32 step = mDegToRad(360.0f) / segments; |
| 1666 | Point3F pnt; |
| 1667 | |
| 1668 | // Render as solid (with transparency) when the sphere is selected |
| 1669 | if ( mSelectionIdx == Custom2 ) |
| 1670 | { |
| 1671 | ColorI color = mProfile->inActiveColor; |
| 1672 | color.alpha = 100; |
| 1673 | PrimBuild::color( color ); |
| 1674 | PrimBuild::begin( GFXTriangleStrip, segments+2 ); |
| 1675 | |
| 1676 | PrimBuild::vertex3fv( Point3F(0,0,0) ); |
| 1677 | |
| 1678 | for(U32 i = 0; i <= segments; i++) |
| 1679 | { |
nothing calls this directly
no test coverage detected