UPdated from OpenSceneGraph-Data with handling of non textured text decoration

This commit is contained in:
Robert Osfield
2017-09-26 15:32:41 +01:00
parent 6ec9f0a3d3
commit 8c575c0cea
3 changed files with 90 additions and 20 deletions

View File

@@ -243,7 +243,7 @@ Font::Font(FontImplementation* implementation):
setImplementation(implementation);
char *ptr;
if( (ptr = getenv("OSG_MAX_TEXTURE_SIZE")) != 0)
if ((ptr = getenv("OSG_MAX_TEXTURE_SIZE")) != 0)
{
unsigned int osg_max_size = atoi(ptr);
@@ -251,6 +251,14 @@ Font::Font(FontImplementation* implementation):
if (osg_max_size<_textureHeightHint) _textureHeightHint = osg_max_size;
}
if ((ptr = getenv("OSG_SDF_TEXT")) != 0)
{
_glyphTextureFeatures = GlyphTexture::ALL_FEATURES;
}
else if ((ptr = getenv("OSG_GREYSCALE_TEXT")) != 0)
{
_glyphTextureFeatures = GlyphTexture::GREYSCALE;
}
}
Font::~Font()

View File

@@ -104,6 +104,13 @@ char text_sdf_frag[] = "$OSG_GLSL_VERSION\n"
"\n"
"void main(void)\n"
"{\n"
" if (texCoord.x<0.0 && texCoord.y<0.0)\n"
" {\n"
" osg_FragColor = vertexColor;\n"
" return;\n"
" }\n"
"\n"
"\n"
" float near_fade_away = 2.0;\n"
" float far_fade_away = near_fade_away+5.0;\n"
"\n"