Cleaned up debug info, and changed Text3D across to using GL_NORMALIZE instead of GL_RESCALE_NORMAL.
This commit is contained in:
@@ -80,7 +80,6 @@ struct Char3DInfo
|
||||
if (!(_currentPrimitiveSet->empty()) &&
|
||||
(*_verts)[(*_currentPrimitiveSet)[0]] == pos)
|
||||
{
|
||||
OSG_NOTICE<<"Repeating first index "<<(*_currentPrimitiveSet)[0]<<", "<<(*_verts)[(*_currentPrimitiveSet)[0]]<<", pos="<<pos<<std::endl;
|
||||
_currentPrimitiveSet->push_back( (*_currentPrimitiveSet)[0] );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -342,8 +342,6 @@ osg::Texture::FilterMode Font::getMagFilterHint() const
|
||||
|
||||
Glyph* Font::getGlyph(const FontResolution& fontRes, unsigned int charcode)
|
||||
{
|
||||
OSG_NOTICE<<"Font::getGlyph("<<charcode<<")"<<std::endl;
|
||||
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_glyphMapMutex);
|
||||
FontSizeGlyphMap::iterator itr = _sizeGlyphMap.find(fontRes);
|
||||
@@ -366,8 +364,6 @@ Glyph* Font::getGlyph(const FontResolution& fontRes, unsigned int charcode)
|
||||
|
||||
Glyph3D* Font::getGlyph3D(unsigned int charcode)
|
||||
{
|
||||
OSG_NOTICE<<"Font::getGlyph3D("<<charcode<<")"<<std::endl;
|
||||
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_glyphMapMutex);
|
||||
Glyph3DMap::iterator itr = _glyph3DMap.find(charcode);
|
||||
|
||||
@@ -498,8 +498,6 @@ void Glyph3D::setThreadSafeRefUnref(bool threadSafe)
|
||||
|
||||
void Glyph3D::computeText3DGeometryData()
|
||||
{
|
||||
OSG_NOTICE<<"Glyph3D::computeText3DGeometryData()"<<std::endl;
|
||||
|
||||
float creaseAngle = 30.0f;
|
||||
float width = _font->getFontDepth();
|
||||
bool smooth = true;
|
||||
@@ -510,7 +508,7 @@ void Glyph3D::computeText3DGeometryData()
|
||||
// create the normals
|
||||
if (smooth && textGeometry.valid())
|
||||
{
|
||||
osgUtil::SmoothingVisitor::smooth(*textGeometry);
|
||||
osgUtil::SmoothingVisitor::smooth(*textGeometry, osg::DegreesToRadians(creaseAngle));
|
||||
}
|
||||
|
||||
_vertexArray = dynamic_cast<osg::Vec3Array*>(textGeometry->getVertexArray());
|
||||
@@ -525,10 +523,4 @@ void Glyph3D::computeText3DGeometryData()
|
||||
else if (prim->getName()=="back") _backPrimitiveSetList.push_back(prim);
|
||||
else if (prim->getName()=="wall") _wallPrimitiveSetList.push_back(prim);
|
||||
}
|
||||
|
||||
OSG_NOTICE<<" _frontPrimitiveSetList.size()=="<<_frontPrimitiveSetList.size()<<std::endl;
|
||||
OSG_NOTICE<<" _backPrimitiveSetList.size()=="<<_backPrimitiveSetList.size()<<std::endl;
|
||||
OSG_NOTICE<<" _wallPrimitiveSetList.size()=="<<_wallPrimitiveSetList.size()<<std::endl;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -59,9 +59,9 @@ void Text3D::accept(osg::PrimitiveFunctor& pf) const
|
||||
LineRenderInfo::const_iterator it, end = itLine->end();
|
||||
for (it = itLine->begin(); it!=end; ++it)
|
||||
{
|
||||
osg::ref_ptr<osg::Vec3Array> vertices = it->_glyph->getVertexArray();
|
||||
osg::Vec3Array* vertices = it->_glyph->getVertexArray();
|
||||
|
||||
if (vertices->empty())
|
||||
if (!vertices || vertices->empty())
|
||||
continue; //skip over spaces
|
||||
|
||||
//pf.setVertexArray(it->_glyph->getVertexArray()->size(),&(it->_glyph->getVertexArray()->front()));
|
||||
@@ -69,7 +69,7 @@ void Text3D::accept(osg::PrimitiveFunctor& pf) const
|
||||
// now apply matrix to the glyphs.
|
||||
osg::ref_ptr<osg::Vec3Array> transformedVertices = new osg::Vec3Array;
|
||||
osg::Matrix matrix = _autoTransformCache[0]._matrix;//osg::Matrix();
|
||||
matrix.postMultTranslate(matrix*it->_position);
|
||||
matrix.preMultTranslate(it->_position);
|
||||
transformedVertices->reserve(vertices->size());
|
||||
for (osg::Vec3Array::iterator itr=vertices->begin(); itr!=vertices->end(); itr++)
|
||||
{
|
||||
@@ -602,8 +602,7 @@ void Text3D::drawImplementation(osg::RenderInfo& renderInfo) const
|
||||
renderInfo.getState()->disableAllVertexArrays();
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
glPushAttrib(GL_TRANSFORM_BIT);
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
renderInfo.getState()->applyMode(GL_NORMALIZE, true);
|
||||
#endif
|
||||
|
||||
switch(_renderMode)
|
||||
@@ -612,10 +611,6 @@ void Text3D::drawImplementation(osg::RenderInfo& renderInfo) const
|
||||
case PER_GLYPH:
|
||||
default: renderPerGlyph(*renderInfo.getState()); break;
|
||||
}
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
glPopAttrib();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -640,11 +635,19 @@ void Text3D::renderPerGlyph(osg::State & state) const
|
||||
matrix.preMultTranslate(osg::Vec3d(it->_position.x(), it->_position.y(), it->_position.z()));
|
||||
state.applyModelViewMatrix(matrix);
|
||||
|
||||
state.lazyDisablingOfVertexAttributes();
|
||||
|
||||
// ** apply the vertex array
|
||||
state.setVertexPointer(it->_glyph->getVertexArray());
|
||||
|
||||
#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();
|
||||
for(osg::Geometry::PrimitiveSetList::const_iterator itr=pslFront.begin(), end = pslFront.end(); itr!=end; ++itr)
|
||||
@@ -653,17 +656,20 @@ void Text3D::renderPerGlyph(osg::State & state) const
|
||||
}
|
||||
|
||||
// ** render the wall face of the glyph
|
||||
#if 0
|
||||
state.setNormalPointer(it->_glyph->getNormalArray());
|
||||
#endif
|
||||
osg::Geometry::PrimitiveSetList & pslWall = it->_glyph->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();
|
||||
for(osg::Geometry::PrimitiveSetList::const_iterator itr=pslBack.begin(), end=pslBack.end(); itr!=end; ++itr)
|
||||
{
|
||||
@@ -676,9 +682,10 @@ void Text3D::renderPerGlyph(osg::State & state) const
|
||||
void Text3D::renderPerFace(osg::State & state) const
|
||||
{
|
||||
osg::Matrix original_modelview = state.getModelViewMatrix();
|
||||
|
||||
#if 0
|
||||
// ** render all front faces
|
||||
state.Normal(0.0f,0.0f,1.0f);
|
||||
#endif
|
||||
|
||||
TextRenderInfo::const_iterator itLine, endLine = _textRenderInfo.end();
|
||||
for (itLine = _textRenderInfo.begin(); itLine!=endLine; ++itLine)
|
||||
@@ -692,6 +699,7 @@ void Text3D::renderPerFace(osg::State & state) const
|
||||
state.applyModelViewMatrix(matrix);
|
||||
|
||||
state.setVertexPointer(it->_glyph->getVertexArray());
|
||||
state.setNormalPointer(it->_glyph->getNormalArray());
|
||||
|
||||
// ** render the front face of the glyph
|
||||
osg::Geometry::PrimitiveSetList & psl = it->_glyph->getFrontPrimitiveSetList();
|
||||
@@ -724,11 +732,12 @@ void Text3D::renderPerFace(osg::State & state) const
|
||||
}
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
state.disableNormalPointer();
|
||||
|
||||
// ** render all back face of the text
|
||||
state.Normal(0.0f,0.0f,-1.0f);
|
||||
|
||||
#endif
|
||||
for (itLine = _textRenderInfo.begin(); itLine!=endLine; ++itLine)
|
||||
{
|
||||
// ** for each glyph in the line, do ...
|
||||
@@ -740,6 +749,7 @@ void Text3D::renderPerFace(osg::State & state) const
|
||||
state.applyModelViewMatrix(matrix);
|
||||
|
||||
state.setVertexPointer(it->_glyph->getVertexArray());
|
||||
state.setNormalPointer(it->_glyph->getNormalArray());
|
||||
|
||||
// ** render the back face of the glyph
|
||||
osg::Geometry::PrimitiveSetList & psl = it->_glyph->getBackPrimitiveSetList();
|
||||
|
||||
@@ -614,7 +614,7 @@ struct FindSharpEdgesFunctor
|
||||
|
||||
static void smooth_new(osg::Geometry& geom, double creaseAngle)
|
||||
{
|
||||
OSG_NOTICE<<"smooth_new("<<&geom<<", "<<osg::RadiansToDegrees(creaseAngle)<<")"<<std::endl;
|
||||
OSG_INFO<<"smooth_new("<<&geom<<", "<<osg::RadiansToDegrees(creaseAngle)<<")"<<std::endl;
|
||||
|
||||
osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(geom.getVertexArray());
|
||||
if (!vertices) return;
|
||||
|
||||
Reference in New Issue
Block a user