Changed the NO_ROTATION label so it is aligned with the XZ plane to make it easier to see.

This commit is contained in:
Robert Osfield 2005-11-09 17:06:12 +00:00
parent cde01da803
commit 38103c588b

View File

@ -25,7 +25,7 @@
#include <osgText/Text>
osg::Node* createLabel(const osg::Vec3& pos, float size, const std::string& label)
osg::Node* createLabel(const osg::Vec3& pos, float size, const std::string& label, osgText::Text::AxisAlignment axisAlignment)
{
osg::Geode* geode = new osg::Geode();
@ -38,6 +38,7 @@ osg::Node* createLabel(const osg::Vec3& pos, float size, const std::string& labe
text->setFont(timesFont);
text->setPosition(pos);
text->setCharacterSize(size);
text->setAxisAlignment(axisAlignment);
text->setAlignment(osgText::Text::CENTER_CENTER);
text->setText(label);
@ -71,7 +72,7 @@ osg::Node* createLabel3(const osg::Vec3& pos, float size, const std::string& lab
return geode;
}
osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps, osg::AutoTransform::AutoRotateMode autoRotateMode, const std::string& str)
osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps, osg::AutoTransform::AutoRotateMode autoRotateMode, osgText::Text::AxisAlignment axisAlignment, const std::string& str)
{
osg::Group* group = new osg::Group;
@ -90,7 +91,7 @@ osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps, osg::
osg::AutoTransform* at = new osg::AutoTransform;
at->setPosition(pos);
at->setAutoRotateMode(autoRotateMode);
at->addChild(createLabel(osg::Vec3(0.0f,0.0f,0.0f),dv.length()*0.2f,str));
at->addChild(createLabel(osg::Vec3(0.0f,0.0f,0.0f),dv.length()*0.2f,str, axisAlignment));
vertices->push_back(pos);
pos += dv;
@ -147,9 +148,9 @@ osg::Node* createScene()
// int numReps = 3333;
int numReps = 10;
root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(1000.0,0.0,0.0),numReps,osg::AutoTransform::ROTATE_TO_CAMERA,"ROTATE_TO_CAMERA"));
root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(0.0,1000.0,0.0),numReps,osg::AutoTransform::ROTATE_TO_SCREEN,"ROTATE_TO_SCREEN"));
root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(0.0,0.0,1000.0),numReps,osg::AutoTransform::NO_ROTATION,"NO_ROTATION"));
root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(1000.0,0.0,0.0),numReps,osg::AutoTransform::ROTATE_TO_CAMERA,osgText::Text::XY_PLANE, "ROTATE_TO_CAMERA"));
root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(0.0,1000.0,0.0),numReps,osg::AutoTransform::ROTATE_TO_SCREEN,osgText::Text::XY_PLANE, "ROTATE_TO_SCREEN"));
root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(0.0,0.0,1000.0),numReps,osg::AutoTransform::NO_ROTATION,osgText::Text::XZ_PLANE, "NO_ROTATION"));
return root;
}