Show
Ignore:
Timestamp:
09/06/10 17:43:59 (4 years ago)
Author:
robert
Message:

Further work on new 3D text support

Files:
1 modified

Legend:

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

    r11734 r11735  
    7575    OSG_NOTICE<<"creaseAngle="<<creaseAngle<<std::endl; 
    7676 
    77     osgText::BevelProfile profile; 
     77    osgText::Bevel profile; 
    7878    float ratio = 0.5; 
    7979    while(arguments.read("--rounded",ratio)) { profile.roundedBevel(ratio); } 
     
    170170    osg::ref_ptr<osgText::Style> style = new osgText::Style; 
    171171 
    172     float thickness = 0.0f; 
     172    float thickness = 0.1f; 
    173173    while(arguments.read("--thickness",thickness)) {} 
    174174    style->setThicknessRatio(thickness); 
     175 
     176    // set up any bevel if required 
     177    float r; 
     178    osg::ref_ptr<osgText::Bevel> bevel; 
     179    while(arguments.read("--rounded",r)) { bevel = new osgText::Bevel; bevel->roundedBevel2(r); } 
     180    while(arguments.read("--rounded")) { bevel = new osgText::Bevel; bevel->roundedBevel2(0.25); } 
     181    while(arguments.read("--flat",r)) { bevel = new osgText::Bevel; bevel->flatBevel(r); } 
     182    while(arguments.read("--flat")) { bevel = new osgText::Bevel; bevel->flatBevel(0.25); } 
     183    while(arguments.read("--bevel-thickness",r)) { if (bevel.valid()) bevel->setBevelThickness(r); } 
     184 
     185    style->setBevel(bevel); 
    175186 
    176187    osgText::TextNode* text = new osgText::TextNode; 
     
    181192    text->update(); 
    182193 
     194    viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) ); 
     195    viewer.addEventHandler(new osgViewer::StatsHandler); 
    183196    viewer.setSceneData(text); 
    184197