Gui: Placement/DatumCS view provider changes
* Add always zoom invariant and always on top rendering to ViewProviderDatumCS * Add a new utility class AxisOrigin for more efficient axis rendering. Also exposed to python. * Change ViewProviderPlacement to use AxisOrigin for rendering. A single instance of AxisOrigin is shared by all ViewProviderPlacement. Selection context is used to distinguish among different instances.
This commit is contained in:
@@ -73,16 +73,20 @@ void SoAutoZoomTranslation::initClass()
|
||||
|
||||
float SoAutoZoomTranslation::getScaleFactor(SoAction* action) const
|
||||
{
|
||||
float scale = scaleFactor.getValue();
|
||||
if(!scale)
|
||||
return 1.0;
|
||||
// Dividing by 5 seems to work well
|
||||
SbViewVolume vv = SoViewVolumeElement::get(action->getState());
|
||||
float aspectRatio = SoViewportRegionElement::get(action->getState()).getViewportAspectRatio();
|
||||
float scale = vv.getWorldToScreenScale(SbVec3f(0.f, 0.f, 0.f), 0.1f) / (5*aspectRatio);
|
||||
scale *= vv.getWorldToScreenScale(SbVec3f(0.f, 0.f, 0.f), 0.1f) / (5*aspectRatio);
|
||||
return scale;
|
||||
}
|
||||
|
||||
SoAutoZoomTranslation::SoAutoZoomTranslation()
|
||||
{
|
||||
SO_NODE_CONSTRUCTOR(SoAutoZoomTranslation);
|
||||
SO_NODE_ADD_FIELD(scaleFactor, (1.0f));
|
||||
//SO_NODE_ADD_FIELD(abPos, (SbVec3f(0.f,0.f,0.f)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user