Moved osgText::GlyphTechnique::Features enum to osgText::ShaderTechinque enum to make it's roll clearer
This commit is contained in:
@@ -32,7 +32,7 @@ DefaultFont::DefaultFont()
|
||||
char *ptr;
|
||||
if ((ptr = getenv("OSG_SDF_TEXT")) != 0)
|
||||
{
|
||||
_glyphTextureFeatures = osgText::GlyphTexture::ALL_FEATURES;
|
||||
_shaderTechnique = osgText::ALL_FEATURES;
|
||||
}
|
||||
|
||||
constructGlyphs();
|
||||
|
||||
@@ -225,9 +225,9 @@ osg::ref_ptr<Font> osgText::readRefFontStream(std::istream& stream, const osgDB:
|
||||
Font::Font(FontImplementation* implementation):
|
||||
osg::Object(true),
|
||||
#if 0
|
||||
_glyphTextureFeatures(GlyphTexture::ALL_FEATURES),
|
||||
_shaderTechnique(ALL_FEATURES),
|
||||
#else
|
||||
_glyphTextureFeatures(GlyphTexture::GREYSCALE),
|
||||
_shaderTechnique(GREYSCALE),
|
||||
#endif
|
||||
_textureWidthHint(1024),
|
||||
_textureHeightHint(1024),
|
||||
@@ -250,11 +250,11 @@ Font::Font(FontImplementation* implementation):
|
||||
|
||||
if ((ptr = getenv("OSG_SDF_TEXT")) != 0)
|
||||
{
|
||||
_glyphTextureFeatures = GlyphTexture::ALL_FEATURES;
|
||||
_shaderTechnique = ALL_FEATURES;
|
||||
}
|
||||
else if ((ptr = getenv("OSG_GREYSCALE_TEXT")) != 0)
|
||||
{
|
||||
_glyphTextureFeatures = GlyphTexture::GREYSCALE;
|
||||
_shaderTechnique = GREYSCALE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,7 +485,7 @@ void Font::addGlyph(const FontResolution& fontRes, unsigned int charcode, Glyph*
|
||||
OSG_INFO<< " Font " << this<< ", numberOfTexturesAllocated "<<numberOfTexturesAllocated<<std::endl;
|
||||
|
||||
// reserve enough space for the glyphs.
|
||||
glyphTexture->setGlyphTextureFeatures(_glyphTextureFeatures);
|
||||
glyphTexture->setShaderTechnique(_shaderTechnique);
|
||||
glyphTexture->setTextureSize(_textureWidthHint,_textureHeightHint);
|
||||
glyphTexture->setFilter(osg::Texture::MIN_FILTER,_minFilterHint);
|
||||
glyphTexture->setFilter(osg::Texture::MAG_FILTER,_magFilterHint);
|
||||
|
||||
@@ -75,7 +75,7 @@ int GlyphTexture::compare(const osg::StateAttribute& rhs) const
|
||||
|
||||
int GlyphTexture::getEffectMargin(const Glyph* glyph)
|
||||
{
|
||||
if (_glyphTextureFeatures==GREYSCALE) return 0;
|
||||
if (_shaderTechnique==GREYSCALE) return 0;
|
||||
else return osg::maximum(glyph->getFontResolution().second/6, 2u);
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ void GlyphTexture::copyGlyphImage(Glyph* glyph)
|
||||
{
|
||||
_image->dirty();
|
||||
|
||||
if (_glyphTextureFeatures==GREYSCALE)
|
||||
if (_shaderTechnique==GREYSCALE)
|
||||
{
|
||||
// OSG_NOTICE<<"GlyphTexture::copyGlyphImage() greyscale copying. glyphTexture="<<this<<", glyph="<<glyph->getGlyphCode()<<std::endl;
|
||||
// make sure the glyph image settings and the target image are consisent before copying.
|
||||
@@ -414,8 +414,8 @@ osg::Image* GlyphTexture::createImage()
|
||||
|
||||
_image = new osg::Image;
|
||||
|
||||
GLenum imageFormat = (_glyphTextureFeatures==GREYSCALE) ? OSGTEXT_GLYPH_ALPHA_FORMAT : OSGTEXT_GLYPH_SDF_FORMAT;
|
||||
GLenum internalFormat = (_glyphTextureFeatures==GREYSCALE) ? OSGTEXT_GLYPH_ALPHA_INTERNALFORMAT : OSGTEXT_GLYPH_SDF_INTERNALFORMAT;
|
||||
GLenum imageFormat = (_shaderTechnique==GREYSCALE) ? OSGTEXT_GLYPH_ALPHA_FORMAT : OSGTEXT_GLYPH_SDF_FORMAT;
|
||||
GLenum internalFormat = (_shaderTechnique==GREYSCALE) ? OSGTEXT_GLYPH_ALPHA_INTERNALFORMAT : OSGTEXT_GLYPH_SDF_INTERNALFORMAT;
|
||||
|
||||
_image->allocateImage(getTextureWidth(), getTextureHeight(), 1, imageFormat, GL_UNSIGNED_BYTE);
|
||||
_image->setInternalTextureFormat(internalFormat);
|
||||
|
||||
@@ -116,7 +116,7 @@ osg::StateSet* Text::createStateSet()
|
||||
}
|
||||
}
|
||||
|
||||
if (activeFont->getGlyphTextureFeatures()!=GlyphTexture::GREYSCALE)
|
||||
if (activeFont->getShaderTechnique()!=GREYSCALE)
|
||||
{
|
||||
ss<<std::fixed<<std::setprecision(1);
|
||||
|
||||
@@ -172,12 +172,12 @@ osg::StateSet* Text::createStateSet()
|
||||
stateset->setMode(GL_BLEND, osg::StateAttribute::ON);
|
||||
|
||||
|
||||
OSG_NOTICE<<"Text::createStateSet() activeFont->getGlyphTextureFeatures()="<<activeFont->getGlyphTextureFeatures()<<std::endl;
|
||||
OSG_NOTICE<<"Text::createStateSet() activeFont->getShaderTechnique()="<<activeFont->getShaderTechnique()<<std::endl;
|
||||
|
||||
|
||||
#if defined(OSG_GL_FIXED_FUNCTION_AVAILABLE)
|
||||
osg::DisplaySettings::ShaderHint shaderHint = osg::DisplaySettings::instance()->getShaderHint();
|
||||
if (activeFont->getGlyphTextureFeatures()==GlyphTexture::GREYSCALE && shaderHint==osg::DisplaySettings::SHADER_NONE)
|
||||
if (activeFont->getShaderTechnique()==GREYSCALE && shaderHint==osg::DisplaySettings::SHADER_NONE)
|
||||
{
|
||||
OSG_NOTICE<<"Font::Font() Fixed function pipeline"<<std::endl;
|
||||
|
||||
@@ -199,7 +199,7 @@ osg::StateSet* Text::createStateSet()
|
||||
program->addShader(osgDB::readRefShaderFileWithFallback(osg::Shader::VERTEX, "shaders/text.vert", text_vert));
|
||||
}
|
||||
|
||||
if (activeFont->getGlyphTextureFeatures()==GlyphTexture::GREYSCALE)
|
||||
if (activeFont->getShaderTechnique()==GREYSCALE)
|
||||
{
|
||||
OSG_NOTICE<<"Using shaders/text_greyscale.frag"<<std::endl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user