Further work on new 3D text support

This commit is contained in:
Robert Osfield
2010-09-06 15:43:59 +00:00
parent 32db4d6a98
commit a6abbb545e
10 changed files with 109 additions and 179 deletions

View File

@@ -74,7 +74,7 @@ int main_experimental(osg::ArgumentParser& arguments)
OSG_NOTICE<<"creaseAngle="<<creaseAngle<<std::endl;
osgText::BevelProfile profile;
osgText::Bevel profile;
float ratio = 0.5;
while(arguments.read("--rounded",ratio)) { profile.roundedBevel(ratio); }
while(arguments.read("--rounded2",ratio)) { profile.roundedBevel2(ratio); }
@@ -169,10 +169,21 @@ int main(int argc, char** argv)
osg::ref_ptr<osgText::Style> style = new osgText::Style;
float thickness = 0.0f;
float thickness = 0.1f;
while(arguments.read("--thickness",thickness)) {}
style->setThicknessRatio(thickness);
// set up any bevel if required
float r;
osg::ref_ptr<osgText::Bevel> bevel;
while(arguments.read("--rounded",r)) { bevel = new osgText::Bevel; bevel->roundedBevel2(r); }
while(arguments.read("--rounded")) { bevel = new osgText::Bevel; bevel->roundedBevel2(0.25); }
while(arguments.read("--flat",r)) { bevel = new osgText::Bevel; bevel->flatBevel(r); }
while(arguments.read("--flat")) { bevel = new osgText::Bevel; bevel->flatBevel(0.25); }
while(arguments.read("--bevel-thickness",r)) { if (bevel.valid()) bevel->setBevelThickness(r); }
style->setBevel(bevel);
osgText::TextNode* text = new osgText::TextNode;
text->setText(word);
text->setFont(font.get());
@@ -180,6 +191,8 @@ int main(int argc, char** argv)
text->setTextTechnique(new osgText::TextTechnique);
text->update();
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
viewer.addEventHandler(new osgViewer::StatsHandler);
viewer.setSceneData(text);
return viewer.run();