From Kristofer Tingdahl, "the vertical bar is upside down, and hence not as the documentation says it should be. This is corrected with this patch"
From Robert Osfield, changed the example so that the vertical and horizon scalar bars are rotated to the XZ plane so you can see them with the default viewer's camera orientation. Tweaked the positioning of title text of vertic scalar bar to avoid overlap of text.
This commit is contained in:
@@ -98,7 +98,7 @@ osg::Node* createScalarBar(bool vertical)
|
||||
|
||||
if ( !vertical )
|
||||
{
|
||||
sb->setPosition( osg::Vec3(0.5f,-0.5f,0));
|
||||
sb->setPosition( osg::Vec3(0.5f,0.5f,0));
|
||||
}
|
||||
|
||||
return sb;
|
||||
@@ -145,10 +145,16 @@ int main(int , char **)
|
||||
osgViewer::Viewer viewer;
|
||||
|
||||
osg::Group* group = new osg::Group;
|
||||
group->addChild(createScalarBar(true));
|
||||
group->addChild(createScalarBar(false));
|
||||
|
||||
group->addChild(createScalarBar_HUD());
|
||||
|
||||
// rotate the scalar from XY plane to XZ so we see them viewing it with the default camera manipulators that look along the Y axis, with Z up.
|
||||
osg::MatrixTransform* transform = new osg::MatrixTransform;
|
||||
group->addChild(transform);
|
||||
transform->setMatrix(osg::Matrix::rotate(osg::inDegrees(90.0),1.0,0.0,0.0));
|
||||
transform->addChild(createScalarBar(true));
|
||||
transform->addChild(createScalarBar(false));
|
||||
|
||||
// add model to viewer.
|
||||
viewer.setSceneData( group );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user