Moved text color into TextBase, added support for colour into Text3D
This commit is contained in:
@@ -30,7 +30,6 @@ using namespace osgText;
|
||||
//#define TREES_CODE_FOR_MAKING_SPACES_EDITABLE
|
||||
|
||||
Text::Text():
|
||||
_color(1.0f,1.0f,1.0f,1.0f),
|
||||
_enableDepthWrites(true),
|
||||
_backdropType(NONE),
|
||||
_backdropImplementation(DELAYED_DEPTH_WRITES),
|
||||
@@ -46,7 +45,6 @@ Text::Text():
|
||||
|
||||
Text::Text(const Text& text,const osg::CopyOp& copyop):
|
||||
osgText::TextBase(text,copyop),
|
||||
_color(text._color),
|
||||
_enableDepthWrites(text._enableDepthWrites),
|
||||
_backdropType(text._backdropType),
|
||||
_backdropImplementation(text._backdropImplementation),
|
||||
@@ -67,12 +65,6 @@ Text::~Text()
|
||||
}
|
||||
|
||||
|
||||
void Text::setColor(const osg::Vec4& color)
|
||||
{
|
||||
_color = color;
|
||||
}
|
||||
|
||||
|
||||
Font* Text::getActiveFont()
|
||||
{
|
||||
return _font.valid() ? _font.get() : Font::getDefaultFont().get();
|
||||
|
||||
@@ -534,6 +534,8 @@ void Text3D::drawImplementation(osg::RenderInfo& renderInfo) const
|
||||
osg::State & state = *renderInfo.getState();
|
||||
unsigned int contextID = state.getContextID();
|
||||
|
||||
state.disableColorPointer();
|
||||
state.Color(_color.r(),_color.g(),_color.b(),_color.a());
|
||||
|
||||
// ** save the previous modelview matrix
|
||||
osg::Matrix previous(state.getModelViewMatrix());
|
||||
|
||||
@@ -31,6 +31,7 @@ using namespace osgText;
|
||||
//#define TREES_CODE_FOR_MAKING_SPACES_EDITABLE
|
||||
|
||||
TextBase::TextBase():
|
||||
_color(1.0f,1.0f,1.0f,1.0f),
|
||||
_fontSize(32,32),
|
||||
_characterHeight(32),
|
||||
_characterSizeMode(OBJECT_COORDS),
|
||||
@@ -54,6 +55,7 @@ TextBase::TextBase():
|
||||
|
||||
TextBase::TextBase(const TextBase& textBase,const osg::CopyOp& copyop):
|
||||
osg::Drawable(textBase,copyop),
|
||||
_color(textBase._color),
|
||||
_font(textBase._font),
|
||||
_style(textBase._style),
|
||||
_fontSize(textBase._fontSize),
|
||||
@@ -81,6 +83,12 @@ TextBase::~TextBase()
|
||||
{
|
||||
}
|
||||
|
||||
void TextBase::setColor(const osg::Vec4& color)
|
||||
{
|
||||
_color = color;
|
||||
}
|
||||
|
||||
|
||||
void TextBase::setFont(osg::ref_ptr<Font> font)
|
||||
{
|
||||
if (_font==font) return;
|
||||
|
||||
Reference in New Issue
Block a user