Rewrote the Text3D bevel implementation to automatically adjust bevel thickness to avoid overalapping and erronous tesselation.

Added osgText::Bevel::s/getRoundedConcaveJunctions(bool) to control how the bevel should be tessellated around concave junctions on the glyph boundary.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14871 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2015-05-26 10:05:47 +00:00
parent 05841d7c00
commit 820166b49d
7 changed files with 481 additions and 47 deletions

View File

@@ -183,9 +183,7 @@ void TextTechnique::addCharacter(const osg::Vec3& position, const osg::Vec3& siz
if (bevel)
{
float thickness = bevel->getBevelThickness();
osg::ref_ptr<osg::Geometry> glyphGeometry = osgText::computeGlyphGeometry(glyph, thickness, width);
osg::ref_ptr<osg::Geometry> glyphGeometry = osgText::computeGlyphGeometry(glyph, *bevel, width);
osg::ref_ptr<osg::Geometry> textGeometry = osgText::computeTextGeometry(glyphGeometry.get(), *bevel, width);
osg::ref_ptr<osg::Geometry> shellGeometry = outline ? osgText::computeShellGeometry(glyphGeometry.get(), *bevel, width) : 0;
if (textGeometry.valid()) geode->addDrawable(textGeometry.get());

View File

@@ -62,7 +62,17 @@ int main(int argc, char** argv)
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); }
if (bevel.valid())
{
while(arguments.read("--smooth-concave-Junctions") || arguments.read("--scj"))
{
bevel->setSmoothConcaveJunctions(true);
}
}
style->setBevel(bevel.get());
// set up outline.