Show
Ignore:
Timestamp:
11/09/05 18:06:12 (8 years ago)
Author:
robert
Message:

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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgautotransform/osgautotransform.cpp

    r3245 r4717  
    2626#include <osgText/Text> 
    2727 
    28 osg::Node* createLabel(const osg::Vec3& pos, float size, const std::string& label) 
     28osg::Node* createLabel(const osg::Vec3& pos, float size, const std::string& label, osgText::Text::AxisAlignment axisAlignment) 
    2929{ 
    3030    osg::Geode* geode = new osg::Geode(); 
     
    3939        text->setPosition(pos); 
    4040        text->setCharacterSize(size); 
     41        text->setAxisAlignment(axisAlignment); 
    4142        text->setAlignment(osgText::Text::CENTER_CENTER); 
    4243        text->setText(label); 
     
    7273} 
    7374 
    74 osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps, osg::AutoTransform::AutoRotateMode autoRotateMode, const std::string& str) 
     75osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps, osg::AutoTransform::AutoRotateMode autoRotateMode, osgText::Text::AxisAlignment axisAlignment, const std::string& str) 
    7576{ 
    7677    osg::Group* group = new osg::Group; 
     
    9192            at->setPosition(pos); 
    9293            at->setAutoRotateMode(autoRotateMode); 
    93             at->addChild(createLabel(osg::Vec3(0.0f,0.0f,0.0f),dv.length()*0.2f,str)); 
     94            at->addChild(createLabel(osg::Vec3(0.0f,0.0f,0.0f),dv.length()*0.2f,str, axisAlignment)); 
    9495            vertices->push_back(pos); 
    9596            pos += dv; 
     
    148149//    int numReps = 3333; 
    149150    int numReps = 10; 
    150     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")); 
    151     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")); 
    152     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"));     
     151    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")); 
     152    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")); 
     153    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"));     
    153154     
    154155    return root;