Removed debug info

This commit is contained in:
Robert Osfield
2017-09-21 15:41:21 +01:00
parent 957a7d4e92
commit a1f519cbec
5 changed files with 28 additions and 37 deletions

View File

@@ -41,6 +41,9 @@
#include <iostream>
static bool s_useSDF = false;
class MyBillboardTransform : public osg::PositionAttitudeTransform
{
public:
@@ -147,6 +150,13 @@ osg:: Node* createTextBelow(const osg::BoundingBox& bb, const std::string& label
text->setFont(font);
text->setFontResolution(64,64);
if (s_useSDF)
{
text->getFont()->setGyphTextureFeatures(osgText::GlyphTexture::ALL_FEATURES);
text->setBackdropImplementation(osgText::Text::USE_SHADERS);
}
text->setAlignment(osgText::Text::CENTER_CENTER);
text->setAxisAlignment(osgText::Text::XZ_PLANE);
text->setPosition(bb.center()-osg::Vec3(0.0f,0.0f,(bb.zMax()-bb.zMin())));
@@ -174,48 +184,36 @@ osg:: Node* createTextLeft(const osg::BoundingBox& bb, const std::string& label,
text->setFont(font);
text->setFontResolution(110,120);
if (s_useSDF)
{
text->getFont()->setGyphTextureFeatures(osgText::GlyphTexture::ALL_FEATURES);
text->setBackdropImplementation(osgText::Text::USE_SHADERS);
}
text->setAlignment(osgText::Text::RIGHT_CENTER);
text->setAxisAlignment(osgText::Text::XZ_PLANE);
text->setCharacterSize((bb.zMax()-bb.zMin())*1.0f);
text->setPosition(bb.center()-osg::Vec3((bb.xMax()-bb.xMin()),-(bb.yMax()-bb.yMin())*0.5f,(bb.zMax()-bb.zMin())*0.1f));
//text->setColor(osg::Vec4(0.37f,0.48f,0.67f,1.0f)); // Neil's original OSG colour
text->setColor(osg::Vec4(0.20f,0.45f,0.60f,1.0f)); // OGL logo colour
text->setText(label);
#if 1
text->setBackdropType(osgText::Text::OUTLINE);
// text->setBackdropType(osgText::Text::DROP_SHADOW_BOTTOM_RIGHT);
text->setBackdropImplementation(osgText::Text::POLYGON_OFFSET);
// text->setBackdropImplementation(osgText::Text::NO_DEPTH_BUFFER);
// text->setBackdropImplementation(osgText::Text::DEPTH_RANGE);
// text->setBackdropImplementation(osgText::Text::STENCIL_BUFFER);
text->setBackdropOffset(0.05f);
text->setBackdropOffset(0.03f);
text->setBackdropColor(osg::Vec4(0.0f, 0.0f, 0.5f, 1.0f));
#endif
#if 1
text->setColorGradientMode(osgText::Text::OVERALL);
osg::Vec4 lightblue(0.30f,0.6f,0.90f,1.0f);
osg::Vec4 blue(0.10f,0.30f,0.40f,1.0f);
text->setColorGradientCorners(lightblue, blue, blue, lightblue);
#else
text->setColorGradientMode(osgText::Text::OVERALL);
osg::Vec4 light = osg::Vec4(0.0f, 1.0f, 1.0f, 1.0f);
osg::Vec4 dark = osg::Vec4(0.0f, 0.0f, 0.5f, 1.0f);
text->setColorGradientCorners(light, dark, dark, light);
// text->setColorGradientCorners(dark, light, light, dark);
#endif
geode->addDrawable( text );
if (!subscript.empty())
{
//osgText::Text* subscript = new osgText::Text(new osgText::TextureFont(font,45));
osgText::Text* subscriptText = new osgText::Text;
subscriptText->setFont(font);
subscriptText->setText(subscript);
@@ -353,9 +351,6 @@ osg:: Node* createBoxNo5No2(const osg::BoundingBox& bb,float chordRatio)
osg:: Node* createBackdrop(const osg::Vec3& corner,const osg::Vec3& top,const osg::Vec3& right)
{
osg::Geometry* geom = new osg::Geometry;
osg::Vec3 normal = (corner-top)^(right-corner);
@@ -475,6 +470,9 @@ int main( int argc, char **argv )
return 1;
}
while(arguments.read("--sdf")) { s_useSDF = true; }
std::string label = "OpenSceneGraph";
std::string subscript = "";

View File

@@ -53,6 +53,9 @@ public:
virtual void setFont(const std::string& fontfile);
/** Get the font. Return 0 if default is being used.*/
Font* getFont() { return _font.get(); }
/** Get the const font. Return 0 if default is being used.*/
const Font* getFont() const { return _font.get(); }

View File

@@ -1155,7 +1155,7 @@ bool DisplaySettings::getValue(const std::string& name, std::string& value, bool
if (itr!=_valueMap.end())
{
value = itr->second;
OSG_NOTICE<<"DisplaySettings::getValue("<<name<<") found existing value = ["<<value<<"]"<<std::endl;
OSG_INFO<<"DisplaySettings::getValue("<<name<<") found existing value = ["<<value<<"]"<<std::endl;
return true;
}
@@ -1164,7 +1164,7 @@ bool DisplaySettings::getValue(const std::string& name, std::string& value, bool
const char* str = getenv(name.c_str());
if (str)
{
OSG_NOTICE<<"DisplaySettings::getValue("<<name<<") found getenv value = ["<<value<<"]"<<std::endl;
OSG_INFO<<"DisplaySettings::getValue("<<name<<") found getenv value = ["<<value<<"]"<<std::endl;
_valueMap[name] = value = str;
return true;

View File

@@ -1221,15 +1221,12 @@ namespace State_Utils
{
std::string var_str(str.substr(start_pos+1, num_chars-1));
std::string value;
OSG_NOTICE<<" Need to replace : ["<<var_str<<"] ds="<<state.getDisplaySettings()<< std::endl;
if (state.getActiveDisplaySettings()->getValue(var_str, value))
{
OSG_NOTICE<<" Value : "<<value<<std::endl;
str.replace(start_pos, num_chars, value);
}
else
{
OSG_NOTICE<<" No value assignd, ereasing "<<std::endl;
str.erase(start_pos, num_chars);
}
}
@@ -1237,14 +1234,11 @@ namespace State_Utils
void substitudeEnvVars(const osg::State& state, std::string& str)
{
OSG_NOTICE<<"substitudeEnvVars()"<<std::endl;
std::string::size_type pos = 0;
while (pos<str.size() && ((pos=str.find_first_of("$'\"", pos)) != std::string::npos))
{
if (pos==str.size())
{
OSG_NOTICE<<" Found "<<str[pos]<<" but it's the last character"<<std::endl;
break;
}
@@ -1253,8 +1247,6 @@ namespace State_Utils
std::string::size_type start_quote = pos;
++pos;
pos = str.find(str[start_quote], pos);
if (pos != std::string::npos) { OSG_NOTICE<<" Found ending string : "<<str.substr(start_quote, pos-start_quote+1)<<std::endl; ++pos; }
else { OSG_NOTICE<<" Found middle string : "<<str.substr(start_quote, std::string::npos)<<std::endl; break; }
}
else
{
@@ -1265,13 +1257,11 @@ namespace State_Utils
if (pos != std::string::npos)
{
OSG_NOTICE<<" Found $ : "<<str.substr(start_var, pos-start_var)<<" "<<pos<<std::endl;
replaceVar(state, str, start_var, pos-start_var);
pos = start_var;
}
else
{
OSG_NOTICE<<" Found $ at end of string : "<<str.substr(start_var, std::string::npos)<<" "<<pos<<std::endl;
replaceVar(state, str, start_var, str.size()-start_var);
pos = start_var;
}

View File

@@ -131,7 +131,7 @@ osg::StateSet* Text::createStateSet()
OSG_NOTICE<<"Disabling SDF support _fontSize.second="<<_fontSize.second<<std::endl;
}
#if 0
#if 1
OSG_NOTICE<<"Text::createStateSet() _backdropType="<<_backdropType<<", _backdropImplementation="<<_backdropImplementation<<std::endl;
OSG_NOTICE<<"Text::createStateSet() defines:"<<defineList.size()<<std::endl;
for(osg::StateSet::DefineList::iterator itr = defineList.begin();