| 1595 | } |
| 1596 | |
| 1597 | void WorldEditor::renderScreenObj( SceneObject *obj, const Point3F& projPos, const Point3F& wPos ) |
| 1598 | { |
| 1599 | // Do not render control objects, hidden objects, |
| 1600 | // or objects that are within a prefab. |
| 1601 | if(obj == getControlObject() || obj->isHidden() || Prefab::getPrefabByChild(obj)) |
| 1602 | return; |
| 1603 | |
| 1604 | GFXDrawUtil *drawer = GFX->getDrawUtil(); |
| 1605 | |
| 1606 | // Lookup the ClassIcon - TextureHandle |
| 1607 | GFXTexHandle classIcon = gEditorIcons.findIcon( obj ); |
| 1608 | |
| 1609 | if ( classIcon.isNull() ) |
| 1610 | classIcon = mDefaultClassEntry.mDefaultHandle; |
| 1611 | |
| 1612 | U32 iconWidth = classIcon->getWidth(); |
| 1613 | U32 iconHeight = classIcon->getHeight(); |
| 1614 | |
| 1615 | bool isHighlight = ( obj == mHitObject || mDragSelected->objInSet(obj) ); |
| 1616 | |
| 1617 | if ( isHighlight ) |
| 1618 | { |
| 1619 | iconWidth += 0; |
| 1620 | iconHeight += 0; |
| 1621 | } |
| 1622 | |
| 1623 | Point2I sPos( (S32)projPos.x, (S32)projPos.y ); |
| 1624 | //if ( obj->isSelected() ) |
| 1625 | // sPos.y += 4; |
| 1626 | Point2I renderPos = sPos; |
| 1627 | renderPos.x -= iconWidth / 2; |
| 1628 | renderPos.y -= iconHeight / 2; |
| 1629 | |
| 1630 | Point2I iconSize( iconWidth, iconHeight ); |
| 1631 | |
| 1632 | RectI renderRect( renderPos, iconSize ); |
| 1633 | |
| 1634 | // Render object icon, except if the object is the |
| 1635 | // only selected object. Do render the icon when there are |
| 1636 | // multiple selection as otherwise, objects like lights are |
| 1637 | // difficult to place. |
| 1638 | |
| 1639 | if( mRenderObjHandle && ( !obj->isSelected() || getSelectionSize() > 1 ) ) |
| 1640 | { |
| 1641 | // Compute icon fade. |
| 1642 | |
| 1643 | S32 iconAlpha = 255; |
| 1644 | if( mFadeIcons && getDisplayType() == DisplayTypePerspective ) |
| 1645 | { |
| 1646 | Point3F objDist = smCamPos - wPos; |
| 1647 | F32 dist = objDist.len(); |
| 1648 | |
| 1649 | if( dist > mFadeIconsDist ) |
| 1650 | { |
| 1651 | F32 iconDist = dist - mFadeIconsDist; |
| 1652 | iconAlpha = mClampF( 255 - ( 255 * ( iconDist / 10.f ) ), 0.f, 255.f ); |
| 1653 | } |
| 1654 | } |
nothing calls this directly
no test coverage detected