From d509e5a43fa5b5144bf9299399254c45a3fca211 Mon Sep 17 00:00:00 2001 From: kgv Date: Mon, 1 Aug 2016 17:15:52 +0300 Subject: [PATCH] 0027731: Visualization, OpenGl_AspectMarker - handle fractional marker Scale when sharing resources OpenGl_AspectMarker::Resources::SpriteKeys() now encodes decimal number of marker scale into resource key, since built-in markers are defined with 0.5 scale step. --- samples/tcl/markers.tcl | 6 ++++-- src/OpenGl/OpenGl_AspectMarker.cxx | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/samples/tcl/markers.tcl b/samples/tcl/markers.tcl index b2d44b52eb..af18729426 100644 --- a/samples/tcl/markers.tcl +++ b/samples/tcl/markers.tcl @@ -31,7 +31,8 @@ set aCustom2 [locate_data_file images/marker_box2.png] set aCustom3 [locate_data_file images/marker_kr.png] set aCustom4 [locate_data_file images/marker_dot.png] -set aFontFile [locate_data_file DejaVuSans.ttf] +set aFontFile "" +catch { set aFontFile [locate_data_file DejaVuSans.ttf] } set aLabelFont "Arial" if { "$aFontFile" != "" } { vfont add "$aFontFile" SansFont @@ -55,7 +56,8 @@ for { set aMarkerType 0 } { $aMarkerType <= 13 } { incr aMarkerType } { set aRow [expr $aMarkerType - 7] set aCol 5 set aName [lindex $aMarkerTypeNames $aMarkerType] - vdrawtext "$aName" "$aName" -pos 0 [expr $aRow + 0.5] 0 -color 0.5 1.0 1.0 -halign center -valign center -angle 000 -zoom 0 -height 12 -aspect bold -font $aLabelFont + vdrawtext "$aName" "$aName" -pos 0 [expr $aRow + 0.5] 0 -color 0.5 1.0 1.0 -halign center -valign center -angle 000 -zoom 0 -height 12 -aspect bold -font $aLabelFont -noupdate + vdisplay -top -noupdate "$aName" if { $aMarkerType == 13 } { vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 PointsOnSide=1 FileName=$aCustom1 set aCol [expr $aCol - 1] diff --git a/src/OpenGl/OpenGl_AspectMarker.cxx b/src/OpenGl/OpenGl_AspectMarker.cxx index 047eb093d3..f90ced06bd 100644 --- a/src/OpenGl/OpenGl_AspectMarker.cxx +++ b/src/OpenGl/OpenGl_AspectMarker.cxx @@ -1950,8 +1950,8 @@ void OpenGl_AspectMarker::Resources::SpriteKeys (const Handle(Graphic3d_MarkerIm } else if (theType != Aspect_TOM_POINT) { - // predefined markers - const Standard_Integer aScale = Standard_Integer(theScale + 0.5f); + // predefined markers are defined with 0.5 step + const Standard_Integer aScale = Standard_Integer(theScale * 10.0f + 0.5f); theKey = TCollection_AsciiString ("OpenGl_AspectMarker") + theType + "_" + aScale; theKeyA = theKey + "A"; if (theType == Aspect_TOM_BALL)