Added support for osgText::Style into osgText::Text3D.

Refactored Text3D implementation to use new GlyphGeometry class.
Implemented GlyphGeometry backend and cleaned up Glyph3D interface.
This commit is contained in:
Robert Osfield
2010-09-27 16:18:20 +00:00
parent 759749eb0c
commit f8b44c3b33
8 changed files with 195 additions and 130 deletions

View File

@@ -82,8 +82,14 @@ osg::Group* create3DText(const osg::Vec3& center,float radius)
text3->setText("XZ_PLANE");
geode->addDrawable(text3);
osg::ref_ptr<osgText::Style> style = new osgText::Style;
osg::ref_ptr<osgText::Bevel> bevel = new osgText::Bevel;
bevel->roundedBevel2(0.25);
style->setBevel(bevel.get());
osgText::Text3D* text7 = new osgText::Text3D;
text7->setFont("fonts/times.ttf");
text7->setStyle(style.get());
text7->setCharacterSize(characterSize);
text7->setCharacterDepth(characterSize*0.2f);
text7->setPosition(center - osg::Vec3(0.0, 0.0, 0.6));

View File

@@ -44,6 +44,9 @@ public:
Glyph(Font* font, unsigned int glyphCode);
Font* getFont() { return _font; }
const Font* getFont() const { return _font; }
unsigned int getGlyphCode() const { return _glyphCode; }
void setHorizontalBearing(const osg::Vec2& bearing);
@@ -104,7 +107,7 @@ class OSGTEXT_EXPORT GlyphGeometry : public osg::Referenced
GlyphGeometry();
void setup(const Glyph* glyph, const Style* style);
void setup(const Glyph3D* glyph, const Style* style);
bool match(const Style* style) const;
@@ -128,6 +131,9 @@ class OSGTEXT_EXPORT GlyphGeometry : public osg::Referenced
/** Get et the PrimitiveSetList for the back face. */
osg::Geometry::PrimitiveSetList& getBackPrimitiveSetList() { return _backPrimitiveSetList; }
/** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
virtual void setThreadSafeRefUnref(bool threadSafe);
protected:
osg::ref_ptr<Style> _style;
@@ -148,6 +154,9 @@ public:
Glyph3D(Font* font, unsigned int glyphCode);
Font* getFont() { return _font; }
const Font* getFont() const { return _font; }
unsigned int getGlyphCode() const { return _glyphCode; }
void setHorizontalBearing(const osg::Vec2& bearing) { _horizontalBearing=bearing; }
@@ -172,29 +181,11 @@ public:
void setRawVertexArray(osg::Vec3Array* vertices) { _rawVertexArray = vertices; }
osg::Vec3Array* getRawVertexArray() { return _rawVertexArray.get(); }
const osg::Vec3Array* getRawVertexArray() const { return _rawVertexArray.get(); }
/** Get the PrimitiveSetList for the raw face which hasn't been tessellated. */
osg::Geometry::PrimitiveSetList & getRawFacePrimitiveSetList() { return _rawFacePrimitiveSetList; }
/** deprecated feature.*/
void computeText3DGeometryData();
/** Get the PrimitiveSetList for the front face. */
osg::Geometry::PrimitiveSetList & getFrontPrimitiveSetList() { return _frontPrimitiveSetList; }
/** Get the PrimitiveSetList for the wall face. */
osg::Geometry::PrimitiveSetList & getWallPrimitiveSetList() { return _wallPrimitiveSetList; }
/** Get et the PrimitiveSetList for the back face. */
osg::Geometry::PrimitiveSetList & getBackPrimitiveSetList() { return _backPrimitiveSetList; }
/** Set the VertexArray of the glyph. */
void setVertexArray(osg::Vec3Array * va) { _vertexArray = va; }
/** Get the VertexArray of the glyph. */
osg::Vec3Array * getVertexArray() { return _vertexArray.get(); }
/** Set the VertexArray of the glyph. */
void setNormalArray(osg::Vec3Array * na) { _normalArray = na; }
/** Get the NormalArray for the wall face. */
osg::Vec3Array * getNormalArray() { return _normalArray.get(); }
const osg::Geometry::PrimitiveSetList & getRawFacePrimitiveSetList() const { return _rawFacePrimitiveSetList; }
float getHorizontalWidth() const { return (-_horizontalBearing.x() + _horizontalAdvance); }
@@ -208,7 +199,7 @@ public:
void setHeight(float height) { _height = height; }
float getHeight() const { return _height; }
GlyphGeometry* getGlyphGeometry(Style* style);
GlyphGeometry* getGlyphGeometry(const Style* style);
protected:
@@ -229,15 +220,6 @@ protected:
float _width;
float _height;
osg::ref_ptr<osg::Vec3Array> _vertexArray;
osg::ref_ptr<osg::Vec3Array> _normalArray;
osg::Geometry::PrimitiveSetList _frontPrimitiveSetList;
osg::Geometry::PrimitiveSetList _wallPrimitiveSetList;
osg::Geometry::PrimitiveSetList _backPrimitiveSetList;
osg::ref_ptr<osg::Vec3Array> _rawVertexArray;
osg::Geometry::PrimitiveSetList _rawFacePrimitiveSetList;

View File

@@ -17,6 +17,7 @@
#include <osgText/TextBase>
#include <osgText/Font>
#include <osgText/Style>
namespace osgText {
@@ -43,10 +44,19 @@ public:
META_Object(osgText,Text3D)
/** Set the text style.*/
void setStyle(Style* style) { _style = style; }
/** Get the text style.*/
Style* getStyle() { return _style.get(); }
/** Get the const text style.*/
const Style* getStyle() const { return _style.get(); }
/** Get the Charactere Depth of text. */
float getCharacterDepth() const { return _characterDepth; }
float getCharacterDepth() const;
/** Set the Charactere Depth of text. */
void setCharacterDepth(float characterDepth) { _characterDepth = characterDepth; computeGlyphRepresentation(); }
void setCharacterDepth(float characterDepth);
/** Get the render mode used to render the text. */
RenderMode getRenderMode() const { return _renderMode; }
@@ -139,10 +149,11 @@ protected:
// ** glyph and other information to render the glyph
struct GlyphRenderInfo
{
GlyphRenderInfo(Glyph3D * glyph, osg::Vec3 & pos) :
_glyph(glyph), _position(pos) {}
GlyphRenderInfo(GlyphGeometry* glyphGeometry, osg::Vec3 & pos):
_glyphGeometry(glyphGeometry),
_position(pos) {}
osg::ref_ptr<Glyph3D> _glyph;
osg::ref_ptr<GlyphGeometry> _glyphGeometry;
osg::Vec3 _position;
};
@@ -151,7 +162,8 @@ protected:
TextRenderInfo _textRenderInfo;
osg::ref_ptr<Font> _font;
osg::ref_ptr<Font> _font;
osg::ref_ptr<Style> _style;
float _characterDepth;

View File

@@ -553,9 +553,6 @@ osgText::Glyph3D * FreeTypeFont::getGlyph3D(unsigned int charcode)
glyph3D->setBoundingBox(bb);
glyph3D->computeText3DGeometryData();
return glyph3D.release();
}

View File

@@ -492,30 +492,110 @@ Glyph3D::Glyph3D(Font* font, unsigned int glyphCode):
void Glyph3D::setThreadSafeRefUnref(bool threadSafe)
{
if (_vertexArray.valid()) _vertexArray->setThreadSafeRefUnref(threadSafe);
if (_normalArray.valid()) _normalArray->setThreadSafeRefUnref(threadSafe);
GlyphGeometries _glyphGeometries;
for(GlyphGeometries::iterator itr = _glyphGeometries.begin();
itr != _glyphGeometries.end();
++itr)
{
(*itr)->setThreadSafeRefUnref(threadSafe);
}
}
void Glyph3D::computeText3DGeometryData()
GlyphGeometry* Glyph3D::getGlyphGeometry(const Style* style)
{
float creaseAngle = 30.0f;
float width = _font->getFontDepth();
bool smooth = true;
osg::ref_ptr<osg::Geometry> textGeometry = osgText::computeTextGeometry(this, width);
if (!textGeometry) return;
// create the normals
if (smooth && textGeometry.valid())
for(GlyphGeometries::iterator itr = _glyphGeometries.begin();
itr != _glyphGeometries.end();
++itr)
{
osgUtil::SmoothingVisitor::smooth(*textGeometry, osg::DegreesToRadians(creaseAngle));
GlyphGeometry* glyphGeometry = itr->get();
if (glyphGeometry->match(style))
{
OSG_NOTICE<<"Glyph3D::getGlyphGeometry(Style* style) found matching GlyphGeometry."<<std::endl;
return glyphGeometry;
}
}
_vertexArray = dynamic_cast<osg::Vec3Array*>(textGeometry->getVertexArray());
_normalArray = dynamic_cast<osg::Vec3Array*>(textGeometry->getNormalArray());
OSG_NOTICE<<"Glyph3D::getGlyphGeometry(Style* style) could not find matching GlyphGeometry, creating a new one."<<std::endl;
for(osg::Geometry::PrimitiveSetList::iterator itr = textGeometry->getPrimitiveSetList().begin();
itr != textGeometry->getPrimitiveSetList().end();
osg::ref_ptr<GlyphGeometry> glyphGeometry = new GlyphGeometry();
glyphGeometry->setup(this, style);
_glyphGeometries.push_back(glyphGeometry);
return glyphGeometry.get();
}
GlyphGeometry::GlyphGeometry()
{
}
void GlyphGeometry::setThreadSafeRefUnref(bool threadSafe)
{
if (_geode.valid()) _geode->setThreadSafeRefUnref(threadSafe);
}
void GlyphGeometry::setup(const Glyph3D* glyph, const Style* style)
{
float creaseAngle = 30.0f;
bool smooth = true;
osg::ref_ptr<osg::Geometry> shellGeometry;
if (!style)
{
OSG_NOTICE<<"GlyphGeometry::setup(const Glyph* glyph, NULL) creating default glyph geometry."<<std::endl;
float width = glyph->getFont()->getFontDepth();
_geometry = osgText::computeTextGeometry(glyph, width);
}
else
{
OSG_NOTICE<<"GlyphGeometry::setup(const Glyph* glyph, NULL) create glyph geometry with custom Style."<<std::endl;
// record the style
_style = dynamic_cast<Style*>(style->clone(osg::CopyOp::DEEP_COPY_ALL));
const Bevel* bevel = style ? style->getBevel() : 0;
bool outline = style ? style->getOutlineRatio()>0.0f : false;
float width = glyph->getFont()->getFontDepth();//style->getThicknessRatio();
if (bevel)
{
float thickness = bevel->getBevelThickness();
osg::ref_ptr<osg::Geometry> glyphGeometry = osgText::computeGlyphGeometry(glyph, thickness, width);
_geometry = osgText::computeTextGeometry(glyphGeometry.get(), *bevel, width);
shellGeometry = outline ? osgText::computeShellGeometry(glyphGeometry.get(), *bevel, width) : 0;
}
else
{
_geometry = osgText::computeTextGeometry(glyph, width);
}
}
if (!_geometry)
{
OSG_NOTICE<<"Warning: GlyphGeometry::setup(const Glyph* glyph, const Style* style) failed."<<std::endl;
return;
}
_geode = new osg::Geode;
_geode->addDrawable(_geometry.get());
if (shellGeometry.valid()) _geode->addDrawable(shellGeometry.get());
// create the normals
if (smooth)
{
osgUtil::SmoothingVisitor::smooth(*_geometry, osg::DegreesToRadians(creaseAngle));
}
_vertices = dynamic_cast<osg::Vec3Array*>(_geometry->getVertexArray());
_normals = dynamic_cast<osg::Vec3Array*>(_geometry->getNormalArray());
for(osg::Geometry::PrimitiveSetList::iterator itr = _geometry->getPrimitiveSetList().begin();
itr != _geometry->getPrimitiveSetList().end();
++itr)
{
osg::PrimitiveSet* prim = itr->get();
@@ -525,25 +605,10 @@ void Glyph3D::computeText3DGeometryData()
}
}
GlyphGeometry* Glyph3D::getGlyphGeometry(Style* style)
{
OSG_NOTICE<<"Glyph3D::getGlyphGeometry(Style* style) not implementated."<<std::endl;
return 0;
}
GlyphGeometry::GlyphGeometry()
{
OSG_NOTICE<<"GlyphGeometry::GlyphGeometry() not implementated."<<std::endl;
}
void GlyphGeometry::setup(const Glyph* glyph, const Style* style)
{
OSG_NOTICE<<"GlyphGeometry::setup(const Glyph* glyph, const Style* style) not implementated."<<std::endl;
}
bool GlyphGeometry::match(const Style* style) const
{
OSG_NOTICE<<"GlyphGeometry::match(const Style*) not implementated."<<std::endl;
return false;
if (_style == style) return true;
if (!_style || !style) return false;
return (*_style==*style);
}

View File

@@ -34,25 +34,25 @@ public:
typedef std::pair<unsigned int, unsigned int> Segment;
typedef std::vector<Segment> Segments;
osg::ref_ptr<osg::Vec3Array> _vertices;
osg::ref_ptr<osg::DrawElementsUShort> _elements;
osg::ref_ptr<const osg::Vec3Array> _vertices;
osg::ref_ptr<const osg::DrawElementsUShort> _elements;
Segments _segments;
Boundary(osg::Vec3Array* vertices, osg::PrimitiveSet* primitiveSet)
Boundary(const osg::Vec3Array* vertices, const osg::PrimitiveSet* primitiveSet)
{
osg::DrawArrays* drawArrays = dynamic_cast<osg::DrawArrays*>(primitiveSet);
const osg::DrawArrays* drawArrays = dynamic_cast<const osg::DrawArrays*>(primitiveSet);
if (drawArrays)
{
set(vertices, drawArrays->getFirst(), drawArrays->getCount());
}
else
{
osg::DrawElementsUShort* elements = dynamic_cast<osg::DrawElementsUShort*>(primitiveSet);
const osg::DrawElementsUShort* elements = dynamic_cast<const osg::DrawElementsUShort*>(primitiveSet);
if (elements) set(vertices, elements);
}
}
void set(osg::Vec3Array* vertices, unsigned int start, unsigned int count)
void set(const osg::Vec3Array* vertices, unsigned int start, unsigned int count)
{
osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(osg::PrimitiveSet::POLYGON);
for(unsigned int i=start; i<start+count; ++i)
@@ -63,7 +63,7 @@ public:
set(vertices, elements);
}
void set(osg::Vec3Array* vertices, osg::DrawElementsUShort* elements)
void set(const osg::Vec3Array* vertices, const osg::DrawElementsUShort* elements)
{
_vertices = vertices;
_elements = elements;
@@ -240,10 +240,10 @@ public:
{
Segment& seg_before = _segments[ (i+_segments.size()-1) % _segments.size() ];
Segment& seg_target = _segments[ (i) % _segments.size() ];
osg::Vec3& a = (*_vertices)[seg_before.first];
osg::Vec3& b = (*_vertices)[seg_before.second];
osg::Vec3& c = (*_vertices)[seg_target.first];
osg::Vec3& d = (*_vertices)[seg_target.second];
const osg::Vec3& a = (*_vertices)[seg_before.first];
const osg::Vec3& b = (*_vertices)[seg_before.second];
const osg::Vec3& c = (*_vertices)[seg_target.first];
const osg::Vec3& d = (*_vertices)[seg_target.second];
osg::Vec3 intersection_abcd = computeIntersectionPoint(a,b,c,d);
osg::Vec3 bisector_abcd = computeBisectorNormal(a,b,c,d);
osg::Vec3 ab_sidevector(b.y()-a.y(), a.x()-b.x(), 0.0);
@@ -455,14 +455,14 @@ struct CollectTriangleIndicesFunctor
};
osg::Geometry* computeGlyphGeometry(osgText::Glyph3D* glyph, float bevelThickness, float shellThickness)
osg::Geometry* computeGlyphGeometry(const osgText::Glyph3D* glyph, float bevelThickness, float shellThickness)
{
osg::Vec3Array* orig_vertices = glyph->getRawVertexArray();
osg::Geometry::PrimitiveSetList& orig_primitives = glyph->getRawFacePrimitiveSetList();
const osg::Vec3Array* orig_vertices = glyph->getRawVertexArray();
const osg::Geometry::PrimitiveSetList& orig_primitives = glyph->getRawFacePrimitiveSetList();
osg::ref_ptr<osg::Geometry> new_geometry = new osg::Geometry;
for(osg::Geometry::PrimitiveSetList::iterator itr = orig_primitives.begin();
for(osg::Geometry::PrimitiveSetList::const_iterator itr = orig_primitives.begin();
itr != orig_primitives.end();
++itr)
{
@@ -536,10 +536,10 @@ osg::Geometry* computeGlyphGeometry(osgText::Glyph3D* glyph, float bevelThicknes
//
// computeTextGeometry
//
osg::Geometry* computeTextGeometry(osgText::Glyph3D* glyph, float width)
osg::Geometry* computeTextGeometry(const osgText::Glyph3D* glyph, float width)
{
osg::Vec3Array* orig_vertices = glyph->getRawVertexArray();
osg::Geometry::PrimitiveSetList& orig_primitives = glyph->getRawFacePrimitiveSetList();
const osg::Vec3Array* orig_vertices = glyph->getRawVertexArray();
const osg::Geometry::PrimitiveSetList& orig_primitives = glyph->getRawFacePrimitiveSetList();
osg::ref_ptr<osg::Geometry> text_geometry = new osg::Geometry;
osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array((*orig_vertices));
@@ -617,7 +617,7 @@ osg::Geometry* computeTextGeometry(osgText::Glyph3D* glyph, float width)
backedge_indices.resize(orig_size, NULL_VALUE);
for(osg::Geometry::PrimitiveSetList::iterator itr = orig_primitives.begin();
for(osg::Geometry::PrimitiveSetList::const_iterator itr = orig_primitives.begin();
itr != orig_primitives.end();
++itr)
{
@@ -694,6 +694,7 @@ osg::Geometry* computeTextGeometry(osg::Geometry* glyphGeometry, const osgText::
// build up the vertices primitives for the front face, and record the indices
// for later use, and to ensure sharing of vertices in the face primitive set
osg::DrawElementsUShort* frontFace = new osg::DrawElementsUShort(GL_TRIANGLES);
frontFace->setName("front");
text_geometry->addPrimitiveSet(frontFace);
for(unsigned int i=0; i<face->size();)
{
@@ -711,6 +712,7 @@ osg::Geometry* computeTextGeometry(osg::Geometry* glyphGeometry, const osgText::
// for later use, and to ensure sharing of vertices in the face primitive set
// the order of the triangle indices are flipped to make sure that the triangles are back face
osg::DrawElementsUShort* backFace = new osg::DrawElementsUShort(GL_TRIANGLES);
backFace->setName("back");
text_geometry->addPrimitiveSet(backFace);
for(unsigned int i=0; i<face->size()-2;)
{
@@ -807,6 +809,7 @@ osg::Geometry* computeTextGeometry(osg::Geometry* glyphGeometry, const osgText::
}
osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(GL_TRIANGLES);
elements->setName("wall");
unsigned int base, next;
for(unsigned int i = 0; i< no_vertices_on_boundary-1; ++i)
{

View File

@@ -19,9 +19,9 @@
namespace osgText
{
extern osg::Geometry* computeGlyphGeometry(osgText::Glyph3D* glyph, float bevelThickness, float shellThickness);
extern osg::Geometry* computeGlyphGeometry(const osgText::Glyph3D* glyph, float bevelThickness, float shellThickness);
extern osg::Geometry* computeTextGeometry(osgText::Glyph3D* glyph, float width);
extern osg::Geometry* computeTextGeometry(const osgText::Glyph3D* glyph, float width);
extern osg::Geometry* computeTextGeometry(osg::Geometry* glyphGeometry, const Bevel& profile, float width);

View File

@@ -20,6 +20,7 @@ namespace osgText
Text3D::Text3D():
_font(0),
_style(0),
_characterDepth(1),
_renderMode(PER_GLYPH)
{
@@ -28,12 +29,24 @@ Text3D::Text3D():
Text3D::Text3D(const Text3D & text3D, const osg::CopyOp & copyop):
osgText::TextBase(text3D, copyop),
_font(text3D._font),
_style(text3D._style),
_characterDepth(text3D._characterDepth),
_renderMode(text3D._renderMode)
{
computeGlyphRepresentation();
}
float Text3D::getCharacterDepth() const
{
return _characterDepth;
}
void Text3D::setCharacterDepth(float characterDepth)
{
_characterDepth = characterDepth;
computeGlyphRepresentation();
}
void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
{
// ** for each line, do ...
@@ -45,7 +58,7 @@ void Text3D::accept(osg::Drawable::ConstAttributeFunctor& af) const
for (it = itLine->begin(); it!=end; ++it)
{
// ** apply the vertex array
af.apply(osg::Drawable::VERTICES, it->_glyph->getVertexArray()->size(), &(it->_glyph->getVertexArray()->front()));
af.apply(osg::Drawable::VERTICES, it->_glyphGeometry->getVertexArray()->size(), &(it->_glyphGeometry->getVertexArray()->front()));
}
}
}
@@ -59,7 +72,7 @@ void Text3D::accept(osg::PrimitiveFunctor& pf) const
LineRenderInfo::const_iterator it, end = itLine->end();
for (it = itLine->begin(); it!=end; ++it)
{
osg::Vec3Array* vertices = it->_glyph->getVertexArray();
osg::Vec3Array* vertices = it->_glyphGeometry->getVertexArray();
if (!vertices || vertices->empty())
continue; //skip over spaces
@@ -79,21 +92,21 @@ void Text3D::accept(osg::PrimitiveFunctor& pf) const
pf.setVertexArray(transformedVertices->size(),&(transformedVertices->front()));
// ** render the front face of the glyph
osg::Geometry::PrimitiveSetList & pslFront = it->_glyph->getFrontPrimitiveSetList();
osg::Geometry::PrimitiveSetList & pslFront = it->_glyphGeometry->getFrontPrimitiveSetList();
for(osg::Geometry::PrimitiveSetList::const_iterator itr=pslFront.begin(), end = pslFront.end(); itr!=end; ++itr)
{
(*itr)->accept(pf);
}
// ** render the wall face of the glyph
osg::Geometry::PrimitiveSetList & pslWall = it->_glyph->getWallPrimitiveSetList();
osg::Geometry::PrimitiveSetList & pslWall = it->_glyphGeometry->getWallPrimitiveSetList();
for(osg::Geometry::PrimitiveSetList::const_iterator itr=pslWall.begin(), end=pslWall.end(); itr!=end; ++itr)
{
(*itr)->accept(pf);
}
// ** render the back face of the glyph
osg::Geometry::PrimitiveSetList & pslBack = it->_glyph->getBackPrimitiveSetList();
osg::Geometry::PrimitiveSetList & pslBack = it->_glyphGeometry->getBackPrimitiveSetList();
for(osg::Geometry::PrimitiveSetList::const_iterator itr=pslBack.begin(), end=pslBack.end(); itr!=end; ++itr)
{
(*itr)->accept(pf);
@@ -404,8 +417,8 @@ void Text3D::computeGlyphRepresentation()
}
osg::Vec3 pos = osg::Vec3(local.x(), local.y(), 0.0f);
currentLineRenderInfo.push_back(Text3D::GlyphRenderInfo(glyph, pos));
GlyphGeometry* glyphGeometry = glyph->getGlyphGeometry(_style.get());
currentLineRenderInfo.push_back(Text3D::GlyphRenderInfo(glyphGeometry, pos));
previous_charcode = charcode;
}
@@ -639,39 +652,26 @@ void Text3D::renderPerGlyph(osg::State & state) const
state.lazyDisablingOfVertexAttributes();
// ** apply the vertex array
state.setVertexPointer(it->_glyph->getVertexArray());
state.setVertexPointer(it->_glyphGeometry->getVertexArray());
state.setNormalPointer(it->_glyphGeometry->getNormalArray());
#if 1
state.setNormalPointer(it->_glyph->getNormalArray());
#else
// ** render the front face of the glyph
state.Normal(0.0f,0.0f,1.0f);
#endif
state.applyDisablingOfVertexAttributes();
osg::Geometry::PrimitiveSetList & pslFront = it->_glyph->getFrontPrimitiveSetList();
osg::Geometry::PrimitiveSetList & pslFront = it->_glyphGeometry->getFrontPrimitiveSetList();
for(osg::Geometry::PrimitiveSetList::const_iterator itr=pslFront.begin(), end = pslFront.end(); itr!=end; ++itr)
{
(*itr)->draw(state, false);
}
// ** render the wall face of the glyph
#if 0
state.setNormalPointer(it->_glyph->getNormalArray());
#endif
osg::Geometry::PrimitiveSetList & pslWall = it->_glyph->getWallPrimitiveSetList();
osg::Geometry::PrimitiveSetList & pslWall = it->_glyphGeometry->getWallPrimitiveSetList();
for(osg::Geometry::PrimitiveSetList::const_iterator itr=pslWall.begin(), end=pslWall.end(); itr!=end; ++itr)
{
(*itr)->draw(state, false);
}
#if 0
state.disableNormalPointer();
// ** render the back face of the glyph
state.Normal(0.0f,0.0f,-1.0f);
#endif
osg::Geometry::PrimitiveSetList & pslBack = it->_glyph->getBackPrimitiveSetList();
osg::Geometry::PrimitiveSetList & pslBack = it->_glyphGeometry->getBackPrimitiveSetList();
for(osg::Geometry::PrimitiveSetList::const_iterator itr=pslBack.begin(), end=pslBack.end(); itr!=end; ++itr)
{
(*itr)->draw(state, false);
@@ -699,11 +699,11 @@ void Text3D::renderPerFace(osg::State & state) const
matrix.preMultTranslate(osg::Vec3d(it->_position.x(), it->_position.y(), it->_position.z()));
state.applyModelViewMatrix(matrix);
state.setVertexPointer(it->_glyph->getVertexArray());
state.setNormalPointer(it->_glyph->getNormalArray());
state.setVertexPointer(it->_glyphGeometry->getVertexArray());
state.setNormalPointer(it->_glyphGeometry->getNormalArray());
// ** render the front face of the glyph
osg::Geometry::PrimitiveSetList & psl = it->_glyph->getFrontPrimitiveSetList();
osg::Geometry::PrimitiveSetList & psl = it->_glyphGeometry->getFrontPrimitiveSetList();
for(osg::Geometry::PrimitiveSetList::const_iterator itr=psl.begin(), end=psl.end(); itr!=end; ++itr)
{
(*itr)->draw(state, false);
@@ -723,10 +723,10 @@ void Text3D::renderPerFace(osg::State & state) const
matrix.preMultTranslate(osg::Vec3d(it->_position.x(), it->_position.y(), it->_position.z()));
state.applyModelViewMatrix(matrix);
state.setVertexPointer(it->_glyph->getVertexArray());
state.setNormalPointer(it->_glyph->getNormalArray());
state.setVertexPointer(it->_glyphGeometry->getVertexArray());
state.setNormalPointer(it->_glyphGeometry->getNormalArray());
osg::Geometry::PrimitiveSetList & psl = it->_glyph->getWallPrimitiveSetList();
const osg::Geometry::PrimitiveSetList & psl = it->_glyphGeometry->getWallPrimitiveSetList();
for(osg::Geometry::PrimitiveSetList::const_iterator itr=psl.begin(), end=psl.end(); itr!=end; ++itr)
{
(*itr)->draw(state, false);
@@ -749,11 +749,11 @@ void Text3D::renderPerFace(osg::State & state) const
matrix.preMultTranslate(osg::Vec3d(it->_position.x(), it->_position.y(), it->_position.z()));
state.applyModelViewMatrix(matrix);
state.setVertexPointer(it->_glyph->getVertexArray());
state.setNormalPointer(it->_glyph->getNormalArray());
state.setVertexPointer(it->_glyphGeometry->getVertexArray());
state.setNormalPointer(it->_glyphGeometry->getNormalArray());
// ** render the back face of the glyph
osg::Geometry::PrimitiveSetList & psl = it->_glyph->getBackPrimitiveSetList();
const osg::Geometry::PrimitiveSetList & psl = it->_glyphGeometry->getBackPrimitiveSetList();
for(osg::Geometry::PrimitiveSetList::const_iterator itr=psl.begin(), end=psl.end(); itr!=end; ++itr)
{
(*itr)->draw(state, false);