Added support for automatic scaling of text to screen coords. Optimized
the text implementation to provide better speed, especially by using the alignement to screen option. Deprecated the Text::setFontSize(,) method, which is now being replaced by setFontResolution(,) Fixed typos in Texture*.cpp. Removed old deprecated methods from osg headers.
This commit is contained in:
@@ -210,7 +210,7 @@ bool GliderManipulator::calcMovement()
|
||||
osg::Vec3 sv = _camera->getSideVector();
|
||||
osg::Vec3 lv = _camera->getLookVector();
|
||||
|
||||
float pitch = inDegrees(dy*70.0f*dt);
|
||||
float pitch = inDegrees(-dy*70.0f*dt);
|
||||
float roll = inDegrees(dx*60.0f*dt);
|
||||
|
||||
osg::Matrix mat;
|
||||
|
||||
@@ -44,8 +44,8 @@ osg::Node* createHUD()
|
||||
geode->addDrawable( text );
|
||||
|
||||
text->setFont(timesFont);
|
||||
text->setPosition(position);
|
||||
text->setText("Head Up Displays are simple :-)");
|
||||
text->setPosition(position);
|
||||
|
||||
position += delta;
|
||||
}
|
||||
@@ -56,8 +56,9 @@ osg::Node* createHUD()
|
||||
geode->addDrawable( text );
|
||||
|
||||
text->setFont(timesFont);
|
||||
text->setAutoScaleToScreen(true);
|
||||
text->setPosition(position);
|
||||
text->setText("All you need to do is create your text in a subgraph.");
|
||||
text->setPosition(position);
|
||||
|
||||
position += delta;
|
||||
}
|
||||
@@ -68,8 +69,8 @@ osg::Node* createHUD()
|
||||
geode->addDrawable( text );
|
||||
|
||||
text->setFont(timesFont);
|
||||
text->setPosition(position);
|
||||
text->setText("Disable depth test in this subgraph to ensure its always ontop.");
|
||||
text->setPosition(position);
|
||||
|
||||
position += delta;
|
||||
}
|
||||
@@ -79,8 +80,8 @@ osg::Node* createHUD()
|
||||
geode->addDrawable( text );
|
||||
|
||||
text->setFont(timesFont);
|
||||
text->setPosition(position);
|
||||
text->setText("Then place an osg::Projection node above the subgraph\nto create an orthographic projection.");
|
||||
text->setPosition(position);
|
||||
|
||||
position += delta;
|
||||
}
|
||||
@@ -90,8 +91,8 @@ osg::Node* createHUD()
|
||||
geode->addDrawable( text );
|
||||
|
||||
text->setFont(timesFont);
|
||||
text->setText("And add an osg::ModelViewMatrix set to ABSOLUTE to ensure\nit remains independent from any external model view matrices.");
|
||||
text->setPosition(position);
|
||||
text->setText("And add an osg::ModelViewMatrix set to ABSOLUTE to ensure\nit remains independent from any external model view matrices.");
|
||||
|
||||
position += delta;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ osg:: Node* createTextBelow(const osg::BoundingBox& bb)
|
||||
osgText::Text* text = new osgText::Text;
|
||||
|
||||
text->setFont(font);
|
||||
text->setFontSize(64,64);
|
||||
text->setFontResolution(64,64);
|
||||
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())));
|
||||
@@ -157,7 +157,7 @@ osg:: Node* createTextLeft(const osg::BoundingBox& bb)
|
||||
osgText::Text* text = new osgText::Text;
|
||||
|
||||
text->setFont(font);
|
||||
text->setFontSize(110,120);
|
||||
text->setFontResolution(110,120);
|
||||
text->setAlignment(osgText::Text::RIGHT_CENTER);
|
||||
text->setAxisAlignment(osgText::Text::XZ_PLANE);
|
||||
text->setCharacterSize((bb.zMax()-bb.zMin())*1.0f);
|
||||
|
||||
@@ -114,9 +114,9 @@ osg::Group* createHUDText()
|
||||
text->setPosition(cursor);
|
||||
|
||||
// use text that uses 10 by 10 texels as a target resolution for fonts.
|
||||
text->setFontSize(10,10); // blocky but small texture memory usage
|
||||
text->setFontResolution(10,10); // blocky but small texture memory usage
|
||||
|
||||
text->setText("text->setFontSize(10,10); // blocky but small texture memory usage");
|
||||
text->setText("text->setFontResolution(10,10); // blocky but small texture memory usage");
|
||||
geode->addDrawable(text);
|
||||
}
|
||||
|
||||
@@ -129,9 +129,9 @@ osg::Group* createHUDText()
|
||||
text->setPosition(cursor);
|
||||
|
||||
// use text that uses 10 by 10 texels as a target resolution for fonts.
|
||||
text->setFontSize(20,20); // smoother but higher texture memory usage (but still quite low).
|
||||
text->setFontResolution(20,20); // smoother but higher texture memory usage (but still quite low).
|
||||
|
||||
text->setText("text->setFontSize(20,20); // smoother but higher texture memory usage (but still quite low).");
|
||||
text->setText("text->setFontResolution(20,20); // smoother but higher texture memory usage (but still quite low).");
|
||||
geode->addDrawable(text);
|
||||
}
|
||||
|
||||
@@ -144,9 +144,9 @@ osg::Group* createHUDText()
|
||||
text->setPosition(cursor);
|
||||
|
||||
// use text that uses 10 by 10 texels as a target resolution for fonts.
|
||||
text->setFontSize(40,40); // even smoother but again higher texture memory usage.
|
||||
text->setFontResolution(40,40); // even smoother but again higher texture memory usage.
|
||||
|
||||
text->setText("text->setFontSize(40,40); // even smoother but again higher texture memory usage.");
|
||||
text->setText("text->setFontResolution(40,40); // even smoother but again higher texture memory usage.");
|
||||
geode->addDrawable(text);
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ osg::Group* createHUDText()
|
||||
osgText::Text* text = new osgText::Text;
|
||||
text->setFont(font);
|
||||
text->setColor(characterSizeColor);
|
||||
text->setFontSize(20,20);
|
||||
text->setFontResolution(20,20);
|
||||
text->setPosition(cursor);
|
||||
|
||||
// use text that 20 units high.
|
||||
@@ -179,7 +179,7 @@ osg::Group* createHUDText()
|
||||
osgText::Text* text = new osgText::Text;
|
||||
text->setFont(font);
|
||||
text->setColor(characterSizeColor);
|
||||
text->setFontSize(30,30);
|
||||
text->setFontResolution(30,30);
|
||||
text->setPosition(cursor);
|
||||
|
||||
// use text that 20 units high.
|
||||
@@ -194,7 +194,7 @@ osg::Group* createHUDText()
|
||||
osgText::Text* text = new osgText::Text;
|
||||
text->setFont(font);
|
||||
text->setColor(characterSizeColor);
|
||||
text->setFontSize(40,40);
|
||||
text->setFontResolution(40,40);
|
||||
text->setPosition(cursor);
|
||||
|
||||
// use text that uses 10 by 10 texels as a target resolution for fonts.
|
||||
|
||||
Reference in New Issue
Block a user