Show
Ignore:
Timestamp:
08/06/04 10:22:58 (10 years ago)
Author:
robert
Message:

Added support for osg::AutoTransform::setAutoRotateMode(AutoRotateMode?) deprecating
the previous setAutoRotateToScreen(). Added support for ROTATE_TO_CAMERA mode.

Cleaned up the autotransform demo to use a sensible number of labels

Files:
1 modified

Legend:

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

    r2022 r3245  
    7272} 
    7373 
    74 osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps) 
     74osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps, osg::AutoTransform::AutoRotateMode autoRotateMode, const std::string& str) 
    7575{ 
    7676    osg::Group* group = new osg::Group; 
     
    8181    osg::Vec3 pos = s; 
    8282 
    83     bool useAuto = false; 
     83    bool useAuto = true; 
    8484    if (useAuto) 
    8585    { 
     
    9090            osg::AutoTransform* at = new osg::AutoTransform; 
    9191            at->setPosition(pos); 
    92             at->setAutoRotateToScreen(true); 
    93             at->setAutoScaleToScreen(true); 
    94             at->addChild(createLabel(osg::Vec3(0.0f,0.0f,0.0f),40.0f,"Test 2")); 
     92            at->setAutoRotateMode(autoRotateMode); 
     93            at->addChild(createLabel(osg::Vec3(0.0f,0.0f,0.0f),dv.length()*0.2f,str)); 
    9594            vertices->push_back(pos); 
    9695            pos += dv; 
     
    119118        for(int i=0;i<numReps;++i) 
    120119        { 
    121             group->addChild(createLabel3(osg::Vec3(pos),dv.length()*0.5f,"Test 2")); 
     120            group->addChild(createLabel3(osg::Vec3(pos),dv.length()*0.5f,str)); 
    122121            vertices->push_back(pos); 
    123122            pos += dv; 
     
    147146    osg::Group* root = new osg::Group; 
    148147     
    149     int numReps = 3333; 
    150 //    int numReps = 10; 
    151     root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(1000.0,0.0,0.0),numReps)); 
    152     root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(0.0,1000.0,0.0),numReps)); 
    153     root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(0.0,0.0,1000.0),numReps));     
     148//    int numReps = 3333; 
     149    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"));     
    154153     
    155154    return root;