Ran script to remove trailing spaces and tabs
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY{
|
||||
}
|
||||
|
||||
without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -61,9 +61,9 @@ osgText::Glyph* DefaultFont::getGlyph(const FontResolution& fontRes, unsigned in
|
||||
}
|
||||
|
||||
// new find the glyph for the required charcode.
|
||||
GlyphMap& glyphmap = itr->second;
|
||||
GlyphMap& glyphmap = itr->second;
|
||||
GlyphMap::iterator gitr = glyphmap.find(charcode);
|
||||
|
||||
|
||||
if (gitr!=glyphmap.end()) return gitr->second.get();
|
||||
else return 0;
|
||||
}
|
||||
@@ -180,23 +180,23 @@ void DefaultFont::constructGlyphs()
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x49, 0x31, 0x00, 0x00},
|
||||
{0x00, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x00, 0x00}
|
||||
};
|
||||
|
||||
|
||||
unsigned int sourceWidth = 8;
|
||||
unsigned int sourceHeight = 12;
|
||||
|
||||
|
||||
FontResolution fontRes(sourceWidth,sourceHeight);
|
||||
|
||||
// populate the glyph mp
|
||||
for(unsigned int i=32;i<127;i++)
|
||||
{
|
||||
osg::ref_ptr<Glyph> glyph = new Glyph(this, i);
|
||||
|
||||
|
||||
unsigned int dataSize = sourceWidth*sourceHeight;
|
||||
unsigned char* data = new unsigned char[dataSize];
|
||||
|
||||
// clear the image to zeros.
|
||||
for(unsigned char* p=data;p<data+dataSize;) { *p++ = 0; }
|
||||
|
||||
|
||||
glyph->setImage(sourceWidth,sourceHeight,1,
|
||||
GL_ALPHA,
|
||||
GL_ALPHA,GL_UNSIGNED_BYTE,
|
||||
@@ -216,7 +216,7 @@ void DefaultFont::constructGlyphs()
|
||||
(*data++)=((*ptr)&128)?value_on:value_off;
|
||||
(*data++)=((*ptr)&64)?value_on:value_off;
|
||||
(*data++)=((*ptr)&32)?value_on:value_off;
|
||||
(*data++)=((*ptr)&16)?value_on:value_off;
|
||||
(*data++)=((*ptr)&16)?value_on:value_off;
|
||||
(*data++)=((*ptr)&8)?value_on:value_off;
|
||||
(*data++)=((*ptr)&4)?value_on:value_off;
|
||||
(*data++)=((*ptr)&2)?value_on:value_off;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -25,12 +25,12 @@ struct FadeTextData : public osg::Referenced
|
||||
FadeTextData(FadeText* fadeText=0):
|
||||
_fadeText(fadeText),
|
||||
_visible(true) {}
|
||||
|
||||
|
||||
bool operator < (const FadeTextData& rhs) const
|
||||
{
|
||||
return _fadeText < rhs._fadeText;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
double getNearestZ() const
|
||||
{
|
||||
double nearestZ = _vertices[0].z();
|
||||
@@ -58,15 +58,15 @@ struct FadeTextPolytopeData : public FadeTextData, public osg::Polytope
|
||||
_referenceVertexList.push_back(_vertices[2]);
|
||||
_referenceVertexList.push_back(_vertices[3]);
|
||||
}
|
||||
|
||||
|
||||
void addEdgePlane(const osg::Vec3& corner, const osg::Vec3& edge)
|
||||
{
|
||||
osg::Vec3 normal( edge.y(), -edge.x(), 0.0f);
|
||||
normal.normalize();
|
||||
|
||||
|
||||
add(osg::Plane(normal, corner));
|
||||
}
|
||||
|
||||
|
||||
void buildPolytope()
|
||||
{
|
||||
osg::Vec3d edge01 = _vertices[1] - _vertices[0];
|
||||
@@ -82,7 +82,7 @@ struct FadeTextPolytopeData : public FadeTextData, public osg::Polytope
|
||||
add(osg::Plane( osg::Vec3d(0.0f,0.0f,0.0f), _vertices[1], _vertices[2]));
|
||||
add(osg::Plane( osg::Vec3d(0.0f,0.0f,0.0f), _vertices[2], _vertices[3]));
|
||||
add(osg::Plane( osg::Vec3d(0.0f,0.0f,0.0f), _vertices[3], _vertices[0]));
|
||||
|
||||
|
||||
#if 0
|
||||
OSG_NOTICE<<" normalFrontFace = "<<normalFrontFace<<std::endl;
|
||||
OSG_NOTICE<<" edge01 = "<<edge01<<std::endl;
|
||||
@@ -95,16 +95,16 @@ struct FadeTextPolytopeData : public FadeTextData, public osg::Polytope
|
||||
|
||||
if (needToFlip) flip();
|
||||
|
||||
#if 0
|
||||
#if 0
|
||||
OSG_NOTICE<<" plane 0 "<< _planeList[0]<<std::endl;
|
||||
OSG_NOTICE<<" plane 1 "<< _planeList[1]<<std::endl;
|
||||
OSG_NOTICE<<" plane 2 "<< _planeList[2]<<std::endl;
|
||||
OSG_NOTICE<<" plane 3 "<< _planeList[3]<<std::endl;
|
||||
OSG_NOTICE<<" plane 4 "<< _planeList[4]<<std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
inline bool contains(const std::vector<osg::Vec3>& vertices)
|
||||
{
|
||||
for(std::vector<osg::Vec3>::const_iterator itr = vertices.begin();
|
||||
@@ -118,7 +118,7 @@ struct FadeTextPolytopeData : public FadeTextData, public osg::Polytope
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
struct FadeTextUserData : public osg::Referenced
|
||||
@@ -144,11 +144,11 @@ struct GlobalFadeText : public osg::Referenced
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
FadeTextUserData* createNewFadeTextUserData(osg::View* view)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
|
||||
|
||||
FadeTextUserData* userData = new FadeTextUserData;
|
||||
|
||||
if (!userData)
|
||||
@@ -158,20 +158,20 @@ struct GlobalFadeText : public osg::Referenced
|
||||
}
|
||||
|
||||
_viewMap[view].insert(userData);
|
||||
|
||||
|
||||
return userData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void update(unsigned int frameNumber)
|
||||
{
|
||||
_frameNumber = frameNumber;
|
||||
|
||||
|
||||
for(GlobalFadeText::ViewUserDataMap::iterator vitr = _viewMap.begin();
|
||||
vitr != _viewMap.end();
|
||||
++vitr)
|
||||
{
|
||||
|
||||
|
||||
osg::View* view = vitr->first;
|
||||
|
||||
FadeTextSet& fadeTextSet = _viewFadeTextMap[view];
|
||||
@@ -184,7 +184,7 @@ struct GlobalFadeText : public osg::Referenced
|
||||
++uitr)
|
||||
{
|
||||
FadeTextUserData* userData = uitr->get();
|
||||
|
||||
|
||||
int frameDelta = frameNumber - userData->_frameNumber;
|
||||
if (frameDelta<=1)
|
||||
{
|
||||
@@ -194,7 +194,7 @@ struct GlobalFadeText : public osg::Referenced
|
||||
{
|
||||
FadeTextData& fadeTextData = *fitr;
|
||||
if (fadeTextSet.count(fadeTextData._fadeText)==0)
|
||||
{
|
||||
{
|
||||
fadeTextSet.insert(fadeTextData._fadeText);
|
||||
fadeTextPolytopeMap.insert(FadeTextPolytopeMap::value_type(
|
||||
-fadeTextData.getNearestZ(), new FadeTextPolytopeData(fadeTextData)));
|
||||
@@ -203,14 +203,14 @@ struct GlobalFadeText : public osg::Referenced
|
||||
}
|
||||
}
|
||||
|
||||
// for each FadeTexPoltopeData
|
||||
// for each FadeTexPoltopeData
|
||||
// create polytopes
|
||||
// test against all FTPD's later in the list
|
||||
// test all control points on FTPD against each plane of the current polytope
|
||||
// if all control points removed or outside then discard FTPD and make FT visible = false;
|
||||
|
||||
FadeTextPolytopeMap::iterator outer_itr = fadeTextPolytopeMap.begin();
|
||||
while (outer_itr != fadeTextPolytopeMap.end())
|
||||
|
||||
FadeTextPolytopeMap::iterator outer_itr = fadeTextPolytopeMap.begin();
|
||||
while (outer_itr != fadeTextPolytopeMap.end())
|
||||
{
|
||||
FadeTextPolytopeMap::iterator inner_itr = outer_itr;
|
||||
++inner_itr;
|
||||
@@ -225,7 +225,7 @@ struct GlobalFadeText : public osg::Referenced
|
||||
while(inner_itr != fadeTextPolytopeMap.end())
|
||||
{
|
||||
FadeTextPolytopeData& inner_ftpm = *(inner_itr->second);
|
||||
|
||||
|
||||
// OSG_NOTICE<<"Inner z "<<inner_ftpm.getNearestZ()<<std::endl;
|
||||
|
||||
if (outer_ftpm.contains(inner_ftpm.getReferenceVertexList()))
|
||||
@@ -233,12 +233,12 @@ struct GlobalFadeText : public osg::Referenced
|
||||
FadeTextPolytopeMap::iterator erase_itr = inner_itr;
|
||||
// move to next ftpm
|
||||
++inner_itr;
|
||||
|
||||
|
||||
fadeTextSet.erase(inner_ftpm._fadeText);
|
||||
|
||||
// need to remove inner_ftpm as its occluded.
|
||||
fadeTextPolytopeMap.erase(erase_itr);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -252,7 +252,7 @@ struct GlobalFadeText : public osg::Referenced
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void updateIfRequired(unsigned int frameNumber)
|
||||
{
|
||||
if (_frameNumber!=frameNumber) update(frameNumber);
|
||||
@@ -278,16 +278,16 @@ struct FadeText::FadeTextUpdateCallback : public osg::Drawable::UpdateCallback
|
||||
{
|
||||
osgText::FadeText* fadeText = dynamic_cast<osgText::FadeText*>(drawable);
|
||||
if (!fadeText) return;
|
||||
|
||||
|
||||
unsigned int frameNumber = nv->getFrameStamp()->getFrameNumber();
|
||||
|
||||
GlobalFadeText* gft = getGlobalFadeText();
|
||||
gft->updateIfRequired(frameNumber);
|
||||
|
||||
|
||||
osgText::FadeText::ViewBlendColourMap& vbcm = fadeText->getViewBlendColourMap();
|
||||
|
||||
_ftd._fadeText = fadeText;
|
||||
|
||||
|
||||
float fadeSpeed = fadeText->getFadeSpeed();
|
||||
|
||||
GlobalFadeText::ViewFadeTextMap& vftm = gft->_viewFadeTextMap;
|
||||
@@ -361,9 +361,9 @@ void FadeText::drawImplementation(osg::RenderInfo& renderInfo) const
|
||||
{
|
||||
Text::drawImplementation(*renderInfo.getState(), osg::Vec4(1.0f,1.0f,1.0f,1.0f) );
|
||||
}
|
||||
|
||||
|
||||
// now pass on new details
|
||||
|
||||
// now pass on new details
|
||||
|
||||
FadeTextUserData* userData = dynamic_cast<FadeTextUserData*>(renderInfo.getUserData());
|
||||
if (!userData)
|
||||
@@ -396,19 +396,19 @@ void FadeText::drawImplementation(osg::RenderInfo& renderInfo) const
|
||||
|
||||
|
||||
osgText::Text::AutoTransformCache& atc = _autoTransformCache[renderInfo.getContextID()];
|
||||
|
||||
|
||||
osg::Matrix lmv = atc._matrix;
|
||||
lmv.postMult(state.getModelViewMatrix());
|
||||
|
||||
|
||||
if (renderInfo.getView() && renderInfo.getView()->getCamera())
|
||||
{
|
||||
// move from camera into the view space.
|
||||
lmv.postMult(state.getInitialInverseViewMatrix());
|
||||
lmv.postMult(renderInfo.getView()->getCamera()->getViewMatrix());
|
||||
}
|
||||
|
||||
|
||||
FadeTextData ftd(const_cast<osgText::FadeText*>(this));
|
||||
|
||||
|
||||
ftd._vertices[0].set(osg::Vec3d(_textBB.xMin(),_textBB.yMin(),_textBB.zMin())*lmv);
|
||||
ftd._vertices[1].set(osg::Vec3d(_textBB.xMax(),_textBB.yMin(),_textBB.zMin())*lmv);
|
||||
ftd._vertices[2].set(osg::Vec3d(_textBB.xMax(),_textBB.yMax(),_textBB.zMin())*lmv);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -75,8 +75,8 @@ std::string osgText::findFontFile(const std::string& str)
|
||||
winFontPath += "\\fonts";
|
||||
s_FontFilePath.push_back(winFontPath);
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
osgDB::convertStringPathIntoFilePathList(
|
||||
#elif defined(__APPLE__)
|
||||
osgDB::convertStringPathIntoFilePathList(
|
||||
".:/usr/share/fonts/ttf:/usr/share/fonts/ttf/western:/usr/share/fonts/ttf/decoratives:/Library/Fonts:/System/Library/Fonts",
|
||||
s_FontFilePath);
|
||||
#else
|
||||
@@ -103,7 +103,7 @@ std::string osgText::findFontFile(const std::string& str)
|
||||
}
|
||||
|
||||
// Not found, return empty string
|
||||
OSG_INFO<<"Warning: font file \""<<str<<"\" not found."<<std::endl;
|
||||
OSG_INFO<<"Warning: font file \""<<str<<"\" not found."<<std::endl;
|
||||
return std::string();
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ osgText::Font* osgText::readFontFile(const std::string& filename, const osgDB::R
|
||||
std::string foundFile = findFontFile(filename);
|
||||
if (foundFile.empty())
|
||||
foundFile = filename;
|
||||
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(getFontFileMutex());
|
||||
|
||||
osg::ref_ptr<osgDB::ReaderWriter::Options> localOptions;
|
||||
@@ -156,7 +156,7 @@ osgText::Font* osgText::readFontStream(std::istream& stream, const osgDB::Reader
|
||||
return 0;
|
||||
}
|
||||
if (!rr.validObject()) return 0;
|
||||
|
||||
|
||||
osg::Object *object = rr.takeObject();
|
||||
|
||||
// if the object is a font then return it.
|
||||
@@ -175,7 +175,7 @@ osg::ref_ptr<Font> osgText::readRefFontFile(const std::string& filename, const o
|
||||
std::string foundFile = findFontFile(filename);
|
||||
if (foundFile.empty())
|
||||
foundFile = filename;
|
||||
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(getFontFileMutex());
|
||||
|
||||
osg::ref_ptr<osgDB::ReaderWriter::Options> localOptions;
|
||||
@@ -215,7 +215,7 @@ osg::ref_ptr<Font> osgText::readRefFontStream(std::istream& stream, const osgDB:
|
||||
return 0;
|
||||
}
|
||||
if (!rr.validObject()) return 0;
|
||||
|
||||
|
||||
// if the object is a font then return it.
|
||||
osgText::Font* font = dynamic_cast<osgText::Font*>(rr.getObject());
|
||||
if (font) return osg::ref_ptr<Font>(font);
|
||||
@@ -322,7 +322,7 @@ unsigned int Font::getTextureWidthHint() const
|
||||
unsigned int Font::getTextureHeightHint() const
|
||||
{
|
||||
return _textureHeightHint;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Font::setMinFilterHint(osg::Texture::FilterMode mode)
|
||||
@@ -354,7 +354,7 @@ Glyph* Font::getGlyph(const FontResolution& fontRes, unsigned int charcode)
|
||||
|
||||
FontResolution fontResUsed(0,0);
|
||||
if (_implementation->supportsMultipleFontResolutions()) fontResUsed = fontRes;
|
||||
|
||||
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_glyphMapMutex);
|
||||
FontSizeGlyphMap::iterator itr = _sizeGlyphMap.find(fontResUsed);
|
||||
@@ -396,7 +396,7 @@ Glyph3D* Font::getGlyph3D(unsigned int charcode)
|
||||
void Font::setThreadSafeRefUnref(bool threadSafe)
|
||||
{
|
||||
osg::Object::setThreadSafeRefUnref(threadSafe);
|
||||
|
||||
|
||||
if (_texenv.valid()) _texenv->setThreadSafeRefUnref(threadSafe);
|
||||
if (_stateset.valid()) _stateset->setThreadSafeRefUnref(threadSafe);
|
||||
|
||||
@@ -405,7 +405,7 @@ void Font::setThreadSafeRefUnref(bool threadSafe)
|
||||
++itr)
|
||||
{
|
||||
(*itr)->setThreadSafeRefUnref(threadSafe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Font::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
@@ -417,7 +417,7 @@ void Font::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
++itr)
|
||||
{
|
||||
(*itr)->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Font::releaseGLObjects(osg::State* state) const
|
||||
@@ -430,7 +430,7 @@ void Font::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
(*itr)->releaseGLObjects(state);
|
||||
}
|
||||
|
||||
|
||||
// const_cast<Font*>(this)->_glyphTextureList.clear();
|
||||
// const_cast<Font*>(this)->_sizeGlyphMap.clear();
|
||||
}
|
||||
@@ -454,9 +454,9 @@ void Font::addGlyph(const FontResolution& fontRes, unsigned int charcode, Glyph*
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_glyphMapMutex);
|
||||
|
||||
_sizeGlyphMap[fontRes][charcode]=glyph;
|
||||
|
||||
|
||||
int posX=0,posY=0;
|
||||
|
||||
|
||||
GlyphTexture* glyphTexture = 0;
|
||||
for(GlyphTextureList::iterator itr=_glyphTextureList.begin();
|
||||
itr!=_glyphTextureList.end() && !glyphTexture;
|
||||
@@ -464,17 +464,17 @@ void Font::addGlyph(const FontResolution& fontRes, unsigned int charcode, Glyph*
|
||||
{
|
||||
if ((*itr)->getSpaceForGlyph(glyph,posX,posY)) glyphTexture = itr->get();
|
||||
}
|
||||
|
||||
|
||||
if (glyphTexture)
|
||||
{
|
||||
//cout << " found space for texture "<<glyphTexture<<" posX="<<posX<<" posY="<<posY<<endl;
|
||||
}
|
||||
|
||||
|
||||
if (!glyphTexture)
|
||||
{
|
||||
|
||||
|
||||
glyphTexture = new GlyphTexture;
|
||||
|
||||
|
||||
static int numberOfTexturesAllocated = 0;
|
||||
++numberOfTexturesAllocated;
|
||||
|
||||
@@ -487,18 +487,18 @@ void Font::addGlyph(const FontResolution& fontRes, unsigned int charcode, Glyph*
|
||||
glyphTexture->setFilter(osg::Texture::MIN_FILTER,_minFilterHint);
|
||||
glyphTexture->setFilter(osg::Texture::MAG_FILTER,_magFilterHint);
|
||||
glyphTexture->setMaxAnisotropy(8);
|
||||
|
||||
|
||||
_glyphTextureList.push_back(glyphTexture);
|
||||
|
||||
|
||||
if (!glyphTexture->getSpaceForGlyph(glyph,posX,posY))
|
||||
{
|
||||
OSG_WARN<<"Warning: unable to allocate texture big enough for glyph"<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// add the glyph into the texture.
|
||||
glyphTexture->addGlyph(glyph,posX,posY);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,7 @@ GlyphTexture::GlyphTexture():
|
||||
setWrap(WRAP_T, CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
GlyphTexture::~GlyphTexture()
|
||||
GlyphTexture::~GlyphTexture()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ bool GlyphTexture::getSpaceForGlyph(Glyph* glyph, int& posX, int& posY)
|
||||
{
|
||||
int maxAxis = std::max(glyph->s(), glyph->t());
|
||||
int margin = _margin + (int)((float)maxAxis * _marginRatio);
|
||||
|
||||
|
||||
int width = glyph->s()+2*margin;
|
||||
int height = glyph->t()+2*margin;
|
||||
|
||||
@@ -68,7 +68,7 @@ bool GlyphTexture::getSpaceForGlyph(Glyph* glyph, int& posX, int& posY)
|
||||
|
||||
// record the position in which the texture will be stored.
|
||||
posX = _partUsedX+margin;
|
||||
posY = _usedY+margin;
|
||||
posY = _usedY+margin;
|
||||
|
||||
// move used markers on.
|
||||
_partUsedX += width;
|
||||
@@ -76,7 +76,7 @@ bool GlyphTexture::getSpaceForGlyph(Glyph* glyph, int& posX, int& posY)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// start an new row.
|
||||
if (width <= getTextureWidth() &&
|
||||
height <= (getTextureHeight()-_partUsedY))
|
||||
@@ -86,7 +86,7 @@ bool GlyphTexture::getSpaceForGlyph(Glyph* glyph, int& posX, int& posY)
|
||||
_usedY = _partUsedY;
|
||||
|
||||
posX = _partUsedX+margin;
|
||||
posY = _usedY+margin;
|
||||
posY = _usedY+margin;
|
||||
|
||||
// move used markers on.
|
||||
_partUsedX += width;
|
||||
@@ -121,7 +121,7 @@ void GlyphTexture::addGlyph(Glyph* glyph, int posX, int posY)
|
||||
|
||||
void GlyphTexture::apply(osg::State& state) const
|
||||
{
|
||||
// get the contextID (user defined ID of 0 upwards) for the
|
||||
// get the contextID (user defined ID of 0 upwards) for the
|
||||
// current OpenGL context.
|
||||
const unsigned int contextID = state.getContextID();
|
||||
|
||||
@@ -152,7 +152,7 @@ void GlyphTexture::apply(osg::State& state) const
|
||||
|
||||
// get the texture object for the current contextID.
|
||||
TextureObject* textureObject = getTextureObject(contextID);
|
||||
|
||||
|
||||
bool newTextureObject = (textureObject == 0);
|
||||
|
||||
#if defined(OSG_GLES2_AVAILABLE)
|
||||
@@ -183,7 +183,7 @@ void GlyphTexture::apply(osg::State& state) const
|
||||
OSG_WARN<<" Please set OSG_MAX_TEXTURE_SIZE lenvironment variable to "<<maxTextureSize<<" and re-run application."<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// being bound for the first time, need to allocate the texture
|
||||
|
||||
_textureObjectBuffer[contextID] = textureObject = osg::Texture::generateTextureObject(
|
||||
@@ -193,7 +193,7 @@ void GlyphTexture::apply(osg::State& state) const
|
||||
|
||||
|
||||
applyTexParameters(GL_TEXTURE_2D,state);
|
||||
|
||||
|
||||
// need to look at generate mip map extension if mip mapping required.
|
||||
switch(_min_filter)
|
||||
{
|
||||
@@ -213,14 +213,14 @@ void GlyphTexture::apply(osg::State& state) const
|
||||
// not mip mapping so no problems.
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
unsigned int imageDataSize = getTextureHeight()*getTextureWidth();
|
||||
unsigned char* imageData = new unsigned char[imageDataSize];
|
||||
for(unsigned int i=0; i<imageDataSize; ++i)
|
||||
{
|
||||
imageData[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// allocate the texture memory.
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA,
|
||||
@@ -228,15 +228,15 @@ void GlyphTexture::apply(osg::State& state) const
|
||||
GL_ALPHA,
|
||||
GL_UNSIGNED_BYTE,
|
||||
imageData );
|
||||
|
||||
|
||||
delete [] imageData;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// reuse texture by binding.
|
||||
textureObject->bind();
|
||||
|
||||
|
||||
if (getTextureParameterDirty(contextID))
|
||||
{
|
||||
applyTexParameters(GL_TEXTURE_2D,state);
|
||||
@@ -244,7 +244,7 @@ void GlyphTexture::apply(osg::State& state) const
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
static const GLubyte* s_renderer = 0;
|
||||
static bool s_subloadAllGlyphsTogether = false;
|
||||
if (!s_renderer)
|
||||
@@ -259,9 +259,9 @@ void GlyphTexture::apply(osg::State& state) const
|
||||
// subloading bugs by loading all at once.
|
||||
s_subloadAllGlyphsTogether = true;
|
||||
}
|
||||
|
||||
if (s_renderer &&
|
||||
((strstr((const char*)s_renderer,"Radeon")!=0) ||
|
||||
|
||||
if (s_renderer &&
|
||||
((strstr((const char*)s_renderer,"Radeon")!=0) ||
|
||||
(strstr((const char*)s_renderer,"RADEON")!=0) ||
|
||||
(strstr((const char*)s_renderer,"ALL-IN-WONDER")!=0)))
|
||||
{
|
||||
@@ -310,7 +310,7 @@ void GlyphTexture::apply(osg::State& state) const
|
||||
}
|
||||
}
|
||||
else // just subload the new entries.
|
||||
{
|
||||
{
|
||||
// default way of subloading as required.
|
||||
//std::cout<<"subloading"<<std::endl;
|
||||
for(GlyphPtrList::iterator itr=glyphsWereSubloading.begin();
|
||||
@@ -320,10 +320,10 @@ void GlyphTexture::apply(osg::State& state) const
|
||||
(*itr)->subload();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// clear the list since we have now subloaded them.
|
||||
glyphsWereSubloading.clear();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -352,7 +352,7 @@ void GlyphTexture::apply(osg::State& state) const
|
||||
for( int s = 0; s < (*itr)->s(); s++ )
|
||||
{
|
||||
int sindex = (t*(*itr)->s()+s);
|
||||
int dindex =
|
||||
int dindex =
|
||||
((((*itr)->getTexturePositionY()+t) * getTextureWidth()) +
|
||||
((*itr)->getTexturePositionX()+s));
|
||||
|
||||
@@ -368,7 +368,7 @@ void GlyphTexture::apply(osg::State& state) const
|
||||
glyphsWereSubloading.clear();
|
||||
|
||||
// Subload the image once
|
||||
glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0,
|
||||
glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0,
|
||||
getTextureWidth(),
|
||||
getTextureHeight(),
|
||||
GL_ALPHA, GL_UNSIGNED_BYTE, local_data );
|
||||
@@ -407,7 +407,7 @@ void GlyphTexture::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
|
||||
unsigned int initialSize = _glyphsToSubload.size();
|
||||
_glyphsToSubload.resize(maxSize);
|
||||
|
||||
|
||||
for(unsigned i=initialSize; i<_glyphsToSubload.size(); ++i)
|
||||
{
|
||||
for(GlyphRefList::iterator itr = _glyphs.begin();
|
||||
@@ -502,7 +502,7 @@ void Glyph::subload() const
|
||||
}
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT,getPacking());
|
||||
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH,getRowLength());
|
||||
#endif
|
||||
@@ -513,7 +513,7 @@ void Glyph::subload() const
|
||||
(GLenum)getPixelFormat(),
|
||||
(GLenum)getDataType(),
|
||||
data());
|
||||
|
||||
|
||||
errorNo = glGetError();
|
||||
if (errorNo!=GL_NO_ERROR)
|
||||
{
|
||||
@@ -529,7 +529,7 @@ void Glyph::subload() const
|
||||
"\t 0x"<<(GLenum)getPixelFormat()<<std::endl<<
|
||||
"\t 0x"<<(GLenum)getDataType()<<std::endl<<
|
||||
"\t 0x"<<(unsigned long)data()<<");"<<dec<<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Glyph3D::Glyph3D(Font* font, unsigned int glyphCode):
|
||||
|
||||
@@ -329,7 +329,7 @@ public:
|
||||
geometry->addPrimitiveSet(face.get());
|
||||
}
|
||||
|
||||
|
||||
|
||||
osg::DrawElementsUShort* bevel = new osg::DrawElementsUShort(GL_QUAD_STRIP);
|
||||
bevel->setName("bevel");
|
||||
bevel->reserve(count*2);
|
||||
@@ -476,7 +476,7 @@ OSGTEXT_EXPORT osg::Geometry* computeGlyphGeometry(const osgText::Glyph3D* glyph
|
||||
boundaryOuter.removeAllSegmentsAboveThickness(-shellThickness);
|
||||
boundaryOuter.newAddBoundaryToGeometry(new_geometry.get(), -shellThickness, "", "shell");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(new_geometry->getVertexArray());
|
||||
@@ -953,7 +953,7 @@ OSGTEXT_EXPORT osg::Geometry* computeShellGeometry(osg::Geometry* glyphGeometry,
|
||||
front_indices[pi] = vertices->size();
|
||||
vertices->push_back((*orig_vertices)[pi]+frontOffset);
|
||||
}
|
||||
pi = front_indices[pi];
|
||||
pi = front_indices[pi];
|
||||
}
|
||||
|
||||
for(unsigned int i=0; i<front_strip->size()-1;)
|
||||
|
||||
@@ -17,19 +17,19 @@ struct look_ahead_iterator
|
||||
_string(string),
|
||||
_index(0),
|
||||
_nullCharacter(0) {}
|
||||
|
||||
|
||||
bool valid() const { return _index<_string.length(); }
|
||||
|
||||
|
||||
look_ahead_iterator& operator ++ ()
|
||||
{
|
||||
if (_index<_string.length()) ++_index;
|
||||
if (_index<_string.length()) ++_index;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
look_ahead_iterator operator ++ (int)
|
||||
{
|
||||
look_ahead_iterator tmp(*this);
|
||||
if (_index<_string.length()) ++_index;
|
||||
look_ahead_iterator tmp(*this);
|
||||
if (_index<_string.length()) ++_index;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ struct look_ahead_iterator
|
||||
if (_index<_string.length()) _index = osg::minimum((unsigned int)(_index+offset),(unsigned int)_string.length());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
unsigned char operator * () const
|
||||
{
|
||||
if (_index<_string.length()) return _string[_index];
|
||||
@@ -51,12 +51,12 @@ struct look_ahead_iterator
|
||||
if (_index+offset<_string.length()) return _string[_index+offset];
|
||||
else return _nullCharacter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const std::string& _string;
|
||||
unsigned int _index;
|
||||
unsigned char _nullCharacter;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
look_ahead_iterator& operator = (const look_ahead_iterator&) { return *this; }
|
||||
@@ -124,7 +124,7 @@ String::Encoding findEncoding(look_ahead_iterator& charString,String::Encoding o
|
||||
|
||||
unsigned int getNextCharacter(look_ahead_iterator& charString,String::Encoding encoding)
|
||||
{
|
||||
// For more info on unicode encodings see:
|
||||
// For more info on unicode encodings see:
|
||||
// http://www-106.ibm.com/developerworks/unicode/library/u-encode.html
|
||||
switch(encoding)
|
||||
{
|
||||
@@ -168,7 +168,7 @@ unsigned int getNextCharacter(look_ahead_iterator& charString,String::Encoding e
|
||||
{
|
||||
int char2 = *charString++;
|
||||
int char3 = *charString++;
|
||||
int highSurrogate = (char0<<8) | char1;
|
||||
int highSurrogate = (char0<<8) | char1;
|
||||
int lowSurrogate = (char2<<8) | char3;
|
||||
if ((char2>=0xDC)&&(char2<=0xDF)) //only for the valid range of low surrogate
|
||||
{
|
||||
@@ -190,7 +190,7 @@ unsigned int getNextCharacter(look_ahead_iterator& charString,String::Encoding e
|
||||
{
|
||||
int char3 = *charString++;
|
||||
int char2 = *charString++;
|
||||
int highSurrogate = (char0<<8) | char1;
|
||||
int highSurrogate = (char0<<8) | char1;
|
||||
int lowSurrogate = (char2<<8) | char3;
|
||||
if ((char2>=0xDC)&&(char2<=0xDF)) //only for the valid range of low surrogate
|
||||
{
|
||||
@@ -205,9 +205,9 @@ unsigned int getNextCharacter(look_ahead_iterator& charString,String::Encoding e
|
||||
int character = ((((int)charString[0])<<24) | (((int)charString[1])<<16) |
|
||||
(((int)charString[2])<<8) | charString[3]);
|
||||
charString+=4;
|
||||
if (character<0x110000)
|
||||
{
|
||||
// Character is constrained to the range set by the unicode standard
|
||||
if (character<0x110000)
|
||||
{
|
||||
// Character is constrained to the range set by the unicode standard
|
||||
return character;
|
||||
}
|
||||
break;
|
||||
@@ -217,9 +217,9 @@ unsigned int getNextCharacter(look_ahead_iterator& charString,String::Encoding e
|
||||
int character = ((((int)charString[3])<<24) | (((int)charString[2])<<16) |
|
||||
(((int)charString[1])<<8) | charString[0]);
|
||||
charString+=4;
|
||||
if (character<0x110000)
|
||||
{
|
||||
// Character is constrained to the range set by the unicode standard
|
||||
if (character<0x110000)
|
||||
{
|
||||
// Character is constrained to the range set by the unicode standard
|
||||
return character;
|
||||
}
|
||||
break;
|
||||
@@ -249,10 +249,10 @@ String::String(const String& str):
|
||||
String& String::operator = (const String& str)
|
||||
{
|
||||
if (&str==this) return *this;
|
||||
|
||||
|
||||
clear();
|
||||
std::copy(str.begin(),str.end(),std::back_inserter(*this));
|
||||
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -281,13 +281,13 @@ void String::set(const std::string& text,Encoding encoding)
|
||||
|
||||
look_ahead_iterator itr(text);
|
||||
|
||||
if ((encoding == ENCODING_SIGNATURE) ||
|
||||
(encoding == ENCODING_UTF16) ||
|
||||
if ((encoding == ENCODING_SIGNATURE) ||
|
||||
(encoding == ENCODING_UTF16) ||
|
||||
(encoding == ENCODING_UTF32))
|
||||
{
|
||||
encoding = findEncoding(itr,encoding);
|
||||
}
|
||||
|
||||
|
||||
while(itr.valid())
|
||||
{
|
||||
unsigned int c = getNextCharacter(itr,encoding);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -106,7 +106,7 @@ String::iterator Text::computeLastCharacterOnLine(osg::Vec2& cursor, String::ite
|
||||
for(bool outOfSpace=false;lastChar!=last;++lastChar)
|
||||
{
|
||||
unsigned int charcode = *lastChar;
|
||||
|
||||
|
||||
if (charcode=='\n')
|
||||
{
|
||||
return lastChar;
|
||||
@@ -165,7 +165,7 @@ String::iterator Text::computeLastCharacterOnLine(osg::Vec2& cursor, String::ite
|
||||
if (_maximumHeight>0.0f && cursor.y()<-_maximumHeight) outOfSpace=true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// => word boundary detection & wrapping
|
||||
if (outOfSpace) break;
|
||||
|
||||
@@ -226,17 +226,17 @@ void Text::computeGlyphRepresentation()
|
||||
{
|
||||
Font* activefont = getActiveFont();
|
||||
if (!activefont) return;
|
||||
|
||||
|
||||
_textureGlyphQuadMap.clear();
|
||||
_lineCount = 0;
|
||||
|
||||
if (_text.empty())
|
||||
|
||||
if (_text.empty())
|
||||
{
|
||||
_textBB.set(0,0,0,0,0,0);//no size text
|
||||
TextBase::computePositions(); //to reset the origin
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//OpenThreads::ScopedLock<Font::FontMutex> lock(*(activefont->getSerializeFontCallsMutex()));
|
||||
|
||||
// initialize bounding box, it will be expanded during glyph position calculation
|
||||
@@ -245,12 +245,12 @@ void Text::computeGlyphRepresentation()
|
||||
osg::Vec2 startOfLine_coords(0.0f,0.0f);
|
||||
osg::Vec2 cursor(startOfLine_coords);
|
||||
osg::Vec2 local(0.0f,0.0f);
|
||||
|
||||
|
||||
unsigned int previous_charcode = 0;
|
||||
unsigned int linelength = 0;
|
||||
bool horizontal = _layout!=VERTICAL;
|
||||
bool kerning = true;
|
||||
|
||||
|
||||
unsigned int lineNumber = 0;
|
||||
|
||||
float hr = _characterHeight;
|
||||
@@ -485,8 +485,8 @@ void Text::computeGlyphRepresentation()
|
||||
{
|
||||
++itr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// move to new line.
|
||||
switch(_layout)
|
||||
{
|
||||
@@ -516,11 +516,11 @@ void Text::computeGlyphRepresentation()
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
++lineNumber;
|
||||
|
||||
}
|
||||
|
||||
|
||||
TextBase::computePositions();
|
||||
computeBackdropBoundingBox();
|
||||
computeBoundingBoxMargin();
|
||||
@@ -529,7 +529,7 @@ void Text::computeGlyphRepresentation()
|
||||
|
||||
// Returns false if there are no glyphs and the width/height values are invalid.
|
||||
// Also sets avg_width and avg_height to 0.0f if the value is invalid.
|
||||
// This method is used several times in a loop for the same object which will produce the same values.
|
||||
// This method is used several times in a loop for the same object which will produce the same values.
|
||||
// Further optimization may try saving these values instead of recomputing them.
|
||||
bool Text::computeAverageGlyphWidthAndHeight(float& avg_width, float& avg_height) const
|
||||
{
|
||||
@@ -543,10 +543,10 @@ bool Text::computeAverageGlyphWidthAndHeight(float& avg_width, float& avg_height
|
||||
unsigned int i;
|
||||
bool is_valid_size = true;
|
||||
// This section is going to try to compute the average width and height
|
||||
// for a character among the text. The reason I shift by an
|
||||
// average amount per-character instead of shifting each character
|
||||
// by its per-instance amount is because it may look strange to see
|
||||
// the individual backdrop text letters not space themselves the same
|
||||
// for a character among the text. The reason I shift by an
|
||||
// average amount per-character instead of shifting each character
|
||||
// by its per-instance amount is because it may look strange to see
|
||||
// the individual backdrop text letters not space themselves the same
|
||||
// way the foreground text does. Using one value gives uniformity.
|
||||
// Note: This loop is repeated for each context. I think it may produce
|
||||
// the same values regardless of context. This code be optimized by moving
|
||||
@@ -599,12 +599,12 @@ void Text::computePositions(unsigned int contextID) const
|
||||
case LEFT_BASE_LINE: _offset.set(0.0f,0.0f,0.0f); break;
|
||||
case CENTER_BASE_LINE: _offset.set((_textBB.xMax()+_textBB.xMin())*0.5f,0.0f,0.0f); break;
|
||||
case RIGHT_BASE_LINE: _offset.set(_textBB.xMax(),0.0f,0.0f); break;
|
||||
|
||||
|
||||
case LEFT_BOTTOM_BASE_LINE: _offset.set(0.0f,-_characterHeight*(1.0 + _lineSpacing)*(_lineCount-1),0.0f); break;
|
||||
case CENTER_BOTTOM_BASE_LINE: _offset.set((_textBB.xMax()+_textBB.xMin())*0.5f,-_characterHeight*(1.0 + _lineSpacing)*(_lineCount-1),0.0f); break;
|
||||
case RIGHT_BOTTOM_BASE_LINE: _offset.set(_textBB.xMax(),-_characterHeight*(1.0 + _lineSpacing)*(_lineCount-1),0.0f); break;
|
||||
}
|
||||
|
||||
|
||||
AutoTransformCache& atc = _autoTransformCache[contextID];
|
||||
osg::Matrix& matrix = atc._matrix;
|
||||
|
||||
@@ -613,8 +613,8 @@ void Text::computePositions(unsigned int contextID) const
|
||||
|
||||
matrix.makeTranslate(-_offset);
|
||||
|
||||
osg::Matrix rotate_matrix;
|
||||
if (_autoRotateToScreen)
|
||||
osg::Matrix rotate_matrix;
|
||||
if (_autoRotateToScreen)
|
||||
{
|
||||
osg::Vec3d trans(atc._modelview.getTrans());
|
||||
atc._modelview.setTrans(0.0f,0.0f,0.0f);
|
||||
@@ -633,9 +633,9 @@ void Text::computePositions(unsigned int contextID) const
|
||||
M.postMultTranslate(_position);
|
||||
M.postMult(atc._modelview);
|
||||
osg::Matrix& P = atc._projection;
|
||||
|
||||
|
||||
// compute the pixel size vector.
|
||||
|
||||
|
||||
// pre adjust P00,P20,P23,P33 by multiplying them by the viewport window matrix.
|
||||
// here we do it in short hand with the knowledge of how the window matrix is formed
|
||||
// note P23,P33 are multiplied by an implicit 1 which would come from the window matrix.
|
||||
@@ -686,7 +686,7 @@ void Text::computePositions(unsigned int contextID) const
|
||||
|
||||
}
|
||||
|
||||
if (_autoRotateToScreen)
|
||||
if (_autoRotateToScreen)
|
||||
{
|
||||
matrix.postMult(rotate_matrix);
|
||||
}
|
||||
@@ -712,13 +712,13 @@ void Text::computePositions(unsigned int contextID) const
|
||||
GlyphQuads& glyphquad = titr->second;
|
||||
GlyphQuads::Coords2& coords2 = glyphquad._coords;
|
||||
GlyphQuads::Coords3& transformedCoords = glyphquad._transformedCoords[contextID];
|
||||
|
||||
|
||||
unsigned int numCoords = coords2.size();
|
||||
if (numCoords!=transformedCoords.size())
|
||||
{
|
||||
transformedCoords.resize(numCoords);
|
||||
}
|
||||
|
||||
|
||||
for(unsigned int i=0;i<numCoords;++i)
|
||||
{
|
||||
transformedCoords[i] = osg::Vec3(coords2[i].x(),coords2[i].y(),0.0f)*matrix;
|
||||
@@ -730,7 +730,7 @@ void Text::computePositions(unsigned int contextID) const
|
||||
_normal = osg::Matrix::transform3x3(osg::Vec3(0.0f,0.0f,1.0f),matrix);
|
||||
_normal.normalize();
|
||||
|
||||
const_cast<Text*>(this)->dirtyBound();
|
||||
const_cast<Text*>(this)->dirtyBound();
|
||||
}
|
||||
|
||||
// Presumes the atc matrix is already up-to-date
|
||||
@@ -745,7 +745,7 @@ void Text::computeBackdropPositions(unsigned int contextID) const
|
||||
float avg_height = 0.0f;
|
||||
unsigned int i;
|
||||
bool is_valid_size;
|
||||
|
||||
|
||||
AutoTransformCache& atc = _autoTransformCache[contextID];
|
||||
osg::Matrix& matrix = atc._matrix;
|
||||
|
||||
@@ -755,7 +755,7 @@ void Text::computeBackdropPositions(unsigned int contextID) const
|
||||
is_valid_size = computeAverageGlyphWidthAndHeight(avg_width, avg_height);
|
||||
|
||||
if (!is_valid_size) return;
|
||||
|
||||
|
||||
// now apply matrix to the glyphs.
|
||||
for(TextureGlyphQuadMap::iterator titr=_textureGlyphQuadMap.begin();
|
||||
titr!=_textureGlyphQuadMap.end();
|
||||
@@ -831,7 +831,7 @@ void Text::computeBackdropPositions(unsigned int contextID) const
|
||||
horizontal_shift_direction = 0.0f;
|
||||
vertical_shift_direction = 1.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case DROP_SHADOW_BOTTOM_LEFT:
|
||||
{
|
||||
horizontal_shift_direction = -1.0f;
|
||||
@@ -862,7 +862,7 @@ void Text::computeBackdropPositions(unsigned int contextID) const
|
||||
}
|
||||
}
|
||||
|
||||
// This method adjusts the bounding box to account for the expanded area caused by the backdrop.
|
||||
// This method adjusts the bounding box to account for the expanded area caused by the backdrop.
|
||||
// This assumes that the bounding box has already been computed for the text without the backdrop.
|
||||
void Text::computeBackdropBoundingBox() const
|
||||
{
|
||||
@@ -874,7 +874,7 @@ void Text::computeBackdropBoundingBox() const
|
||||
float avg_width = 0.0f;
|
||||
float avg_height = 0.0f;
|
||||
bool is_valid_size;
|
||||
|
||||
|
||||
// FIXME: OPTIMIZE: It is possible that this value has already been computed before
|
||||
// from previous calls to this function. This might be worth optimizing.
|
||||
is_valid_size = computeAverageGlyphWidthAndHeight(avg_width, avg_height);
|
||||
@@ -886,7 +886,7 @@ void Text::computeBackdropBoundingBox() const
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Finally, we have one more issue to deal with.
|
||||
// Now that the text takes more space, we need
|
||||
// to adjust the size of the bounding box.
|
||||
@@ -951,7 +951,7 @@ void Text::computeBackdropBoundingBox() const
|
||||
_textBB.zMax()
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case DROP_SHADOW_BOTTOM_LEFT:
|
||||
{
|
||||
_textBB.set(
|
||||
@@ -1006,7 +1006,7 @@ void Text::computeBackdropBoundingBox() const
|
||||
}
|
||||
}
|
||||
|
||||
// This method expands the bounding box to a settable margin when a bounding box drawing mode is active.
|
||||
// This method expands the bounding box to a settable margin when a bounding box drawing mode is active.
|
||||
void Text::computeBoundingBoxMargin() const
|
||||
{
|
||||
if(_drawMode & (BOUNDINGBOX | FILLEDBOUNDINGBOX)){
|
||||
@@ -1057,7 +1057,7 @@ void Text::computeColorGradientsOverall() const
|
||||
const GlyphQuads::Coords2& coords2 = glyphquad._coords;
|
||||
|
||||
for(i=0;i<coords2.size();++i)
|
||||
{
|
||||
{
|
||||
// Min and Max are needed for color gradients
|
||||
if(coords2[i].x() > max_x)
|
||||
{
|
||||
@@ -1074,7 +1074,7 @@ void Text::computeColorGradientsOverall() const
|
||||
if(coords2[i].y() < min_y)
|
||||
{
|
||||
min_y = coords2[i].y();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1133,7 +1133,7 @@ void Text::computeColorGradientsOverall() const
|
||||
_colorGradientBottomRight[2],
|
||||
_colorGradientTopRight[2]
|
||||
);
|
||||
// Alpha does not convert to HSV
|
||||
// Alpha does not convert to HSV
|
||||
float alpha = bilinearInterpolate(
|
||||
min_x,
|
||||
max_x,
|
||||
@@ -1145,7 +1145,7 @@ void Text::computeColorGradientsOverall() const
|
||||
_colorGradientTopLeft[3],
|
||||
_colorGradientBottomRight[3],
|
||||
_colorGradientTopRight[3]
|
||||
);
|
||||
);
|
||||
|
||||
colorCoords[i] = osg::Vec4(red,green,blue,alpha);
|
||||
}
|
||||
@@ -1250,23 +1250,23 @@ void Text::drawImplementation(osg::State& state, const osg::Vec4& colorMultiplie
|
||||
doUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
atc._traversalNumber = frameNumber;
|
||||
atc._width = width;
|
||||
atc._height = height;
|
||||
|
||||
|
||||
if (doUpdate)
|
||||
{
|
||||
{
|
||||
atc._transformedPosition = newTransformedPosition;
|
||||
atc._projection = projection;
|
||||
atc._modelview = modelview;
|
||||
|
||||
computePositions(contextID);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Ensure that the glyph coordinates have been transformed for
|
||||
// this context id.
|
||||
|
||||
@@ -1344,7 +1344,7 @@ void Text::drawImplementation(osg::State& state, const osg::Vec4& colorMultiplie
|
||||
OSG_NOTICE<<"Warning: Text::drawImplementation() fillMode FILLEDBOUNDINGBOX not supported"<<std::endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OSG_GL_FIXED_FUNCTION_AVAILABLE)
|
||||
state.applyTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::ON);
|
||||
@@ -1401,7 +1401,7 @@ void Text::drawImplementation(osg::State& state, const osg::Vec4& colorMultiplie
|
||||
osg::Vec3 c11(osg::Vec3(_textBB.xMax(),_textBB.yMax(),_textBB.zMin())*matrix);
|
||||
osg::Vec3 c01(osg::Vec3(_textBB.xMin(),_textBB.yMax(),_textBB.zMin())*matrix);
|
||||
|
||||
|
||||
|
||||
gl.Color4f(colorMultiplier.r()*_textBBColor.r(),colorMultiplier.g()*_textBBColor.g(),colorMultiplier.b()*_textBBColor.b(),colorMultiplier.a()*_textBBColor.a());
|
||||
gl.Begin(GL_LINE_LOOP);
|
||||
gl.Vertex3fv(c00.ptr());
|
||||
@@ -1426,15 +1426,15 @@ void Text::drawImplementation(osg::State& state, const osg::Vec4& colorMultiplie
|
||||
osg::Vec3 vb(osg::Vec3(_offset.x(),_offset.y()+cursorsize,_offset.z())*matrix);
|
||||
|
||||
state.applyTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::OFF);
|
||||
|
||||
|
||||
gl.Begin(GL_LINES);
|
||||
gl.Vertex3fv(hl.ptr());
|
||||
gl.Vertex3fv(hr.ptr());
|
||||
gl.Vertex3fv(vt.ptr());
|
||||
gl.Vertex3fv(vb.ptr());
|
||||
gl.End();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Text::accept(osg::Drawable::ConstAttributeFunctor& af) const
|
||||
@@ -1459,9 +1459,9 @@ void Text::accept(osg::PrimitiveFunctor& pf) const
|
||||
|
||||
pf.setVertexArray(glyphquad._transformedCoords[0].size(),&(glyphquad._transformedCoords[0].front()));
|
||||
pf.drawArrays(GL_QUADS,0,glyphquad._transformedCoords[0].size());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1475,7 +1475,7 @@ void Text::setThreadSafeRefUnref(bool threadSafe)
|
||||
void Text::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
TextBase::resizeGLObjectBuffers(maxSize);
|
||||
|
||||
|
||||
getActiveFont()->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
|
||||
@@ -1556,7 +1556,7 @@ void Text::drawForegroundText(osg::State& state, const GlyphQuads& glyphquad, co
|
||||
unsigned int contextID = state.getContextID();
|
||||
|
||||
const GlyphQuads::Coords3& transformedCoords = glyphquad._transformedCoords[contextID];
|
||||
if (!transformedCoords.empty())
|
||||
if (!transformedCoords.empty())
|
||||
{
|
||||
state.setVertexPointer( 3, GL_FLOAT, 0, &(transformedCoords.front()));
|
||||
state.setTexCoordPointer( 0, 2, GL_FLOAT, 0, &(glyphquad._texcoords.front()));
|
||||
@@ -1654,7 +1654,7 @@ void Text::drawTextWithBackdrop(osg::State& state, const osg::Vec4& colorMultipl
|
||||
for( ; backdrop_index < max_backdrop_index; backdrop_index++)
|
||||
{
|
||||
const GlyphQuads::Coords3& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index][contextID];
|
||||
if (!transformedBackdropCoords.empty())
|
||||
if (!transformedBackdropCoords.empty())
|
||||
{
|
||||
state.setVertexPointer( 3, GL_FLOAT, 0, &(transformedBackdropCoords.front()));
|
||||
state.drawQuads(0,transformedBackdropCoords.size());
|
||||
@@ -1710,7 +1710,7 @@ void Text::renderWithPolygonOffset(osg::State& state, const osg::Vec4& colorMult
|
||||
for( ; backdrop_index < max_backdrop_index; backdrop_index++)
|
||||
{
|
||||
const GlyphQuads::Coords3& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index][contextID];
|
||||
if (!transformedBackdropCoords.empty())
|
||||
if (!transformedBackdropCoords.empty())
|
||||
{
|
||||
state.setVertexPointer( 3, GL_FLOAT, 0, &(transformedBackdropCoords.front()));
|
||||
glPolygonOffset(0.1f * osg::PolygonOffset::getFactorMultiplier(),
|
||||
@@ -1730,7 +1730,7 @@ void Text::renderWithPolygonOffset(osg::State& state, const osg::Vec4& colorMult
|
||||
OSG_NOTICE<<"Warning: Text::renderWithPolygonOffset(..) not implemented."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Text::renderWithNoDepthBuffer(osg::State& state, const osg::Vec4& colorMultiplier) const
|
||||
{
|
||||
@@ -1769,7 +1769,7 @@ void Text::renderWithNoDepthBuffer(osg::State& state, const osg::Vec4& colorMult
|
||||
for( ; backdrop_index < max_backdrop_index; backdrop_index++)
|
||||
{
|
||||
const GlyphQuads::Coords3& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index][contextID];
|
||||
if (!transformedBackdropCoords.empty())
|
||||
if (!transformedBackdropCoords.empty())
|
||||
{
|
||||
state.setVertexPointer( 3, GL_FLOAT, 0, &(transformedBackdropCoords.front()));
|
||||
state.drawQuads(0,transformedBackdropCoords.size());
|
||||
@@ -1825,7 +1825,7 @@ void Text::renderWithDepthRange(osg::State& state, const osg::Vec4& colorMultipl
|
||||
for( ; backdrop_index < max_backdrop_index; backdrop_index++)
|
||||
{
|
||||
const GlyphQuads::Coords3& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index][contextID];
|
||||
if (!transformedBackdropCoords.empty())
|
||||
if (!transformedBackdropCoords.empty())
|
||||
{
|
||||
state.setVertexPointer( 3, GL_FLOAT, 0, &(transformedBackdropCoords.front()));
|
||||
double offset = double(max_backdrop_index-backdrop_index)*0.0001;
|
||||
@@ -1864,7 +1864,7 @@ void Text::renderWithStencilBuffer(osg::State& state, const osg::Vec4& colorMult
|
||||
*/
|
||||
unsigned int contextID = state.getContextID();
|
||||
TextureGlyphQuadMap::iterator titr; // Moved up here for VC6
|
||||
|
||||
|
||||
glPushAttrib(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_STENCIL_TEST);
|
||||
|
||||
// It seems I can get away without calling this here
|
||||
@@ -1879,7 +1879,7 @@ void Text::renderWithStencilBuffer(osg::State& state, const osg::Vec4& colorMult
|
||||
// write only to the stencil buffer if we pass the depth test
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
|
||||
// Disable writing to the color buffer so we only write to the stencil
|
||||
// Disable writing to the color buffer so we only write to the stencil
|
||||
// buffer and the depth buffer
|
||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
|
||||
@@ -1890,11 +1890,11 @@ void Text::renderWithStencilBuffer(osg::State& state, const osg::Vec4& colorMult
|
||||
|
||||
// Arrrgh! Why does the code only seem to work correctly if I call this?
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
|
||||
|
||||
// Draw all the text to the stencil buffer to mark out the region
|
||||
// that we can write too.
|
||||
|
||||
|
||||
for(titr=_textureGlyphQuadMap.begin();
|
||||
titr!=_textureGlyphQuadMap.end();
|
||||
++titr)
|
||||
@@ -1923,7 +1923,7 @@ void Text::renderWithStencilBuffer(osg::State& state, const osg::Vec4& colorMult
|
||||
for( ; backdrop_index < max_backdrop_index; backdrop_index++)
|
||||
{
|
||||
const GlyphQuads::Coords3& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index][contextID];
|
||||
if (!transformedBackdropCoords.empty())
|
||||
if (!transformedBackdropCoords.empty())
|
||||
{
|
||||
state.setVertexPointer( 3, GL_FLOAT, 0, &(transformedBackdropCoords.front()));
|
||||
state.drawQuads(0,transformedBackdropCoords.size());
|
||||
@@ -1932,7 +1932,7 @@ void Text::renderWithStencilBuffer(osg::State& state, const osg::Vec4& colorMult
|
||||
|
||||
// Draw the foreground text
|
||||
const GlyphQuads::Coords3& transformedCoords = glyphquad._transformedCoords[contextID];
|
||||
if (!transformedCoords.empty())
|
||||
if (!transformedCoords.empty())
|
||||
{
|
||||
state.setVertexPointer( 3, GL_FLOAT, 0, &(transformedCoords.front()));
|
||||
state.setTexCoordPointer( 0, 2, GL_FLOAT, 0, &(glyphquad._texcoords.front()));
|
||||
@@ -1991,7 +1991,7 @@ void Text::renderWithStencilBuffer(osg::State& state, const osg::Vec4& colorMult
|
||||
for( ; backdrop_index < max_backdrop_index; backdrop_index++)
|
||||
{
|
||||
const GlyphQuads::Coords3& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index][contextID];
|
||||
if (!transformedBackdropCoords.empty())
|
||||
if (!transformedBackdropCoords.empty())
|
||||
{
|
||||
state.setVertexPointer( 3, GL_FLOAT, 0, &(transformedBackdropCoords.front()));
|
||||
state.drawQuads(0,transformedBackdropCoords.size());
|
||||
|
||||
@@ -72,7 +72,7 @@ void Text3D::accept(osg::PrimitiveFunctor& pf) const
|
||||
|
||||
if (!vertices || vertices->empty())
|
||||
continue; //skip over spaces
|
||||
|
||||
|
||||
//pf.setVertexArray(it->_glyph->getVertexArray()->size(),&(it->_glyph->getVertexArray()->front()));
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// now apply matrix to the glyphs.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -141,12 +141,12 @@ void TextBase::setLineSpacing(float lineSpacing)
|
||||
_lineSpacing = lineSpacing;
|
||||
computeGlyphRepresentation();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TextBase::setText(const String& text)
|
||||
{
|
||||
if (_text==text) return;
|
||||
|
||||
|
||||
_text = text;
|
||||
computeGlyphRepresentation();
|
||||
}
|
||||
@@ -160,7 +160,7 @@ void TextBase::setText(const std::string& text,String::Encoding encoding)
|
||||
{
|
||||
setText(String(text,encoding));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TextBase::setText(const wchar_t* text)
|
||||
{
|
||||
@@ -178,7 +178,7 @@ void TextBase::setPosition(const osg::Vec3& pos)
|
||||
void TextBase::setAlignment(AlignmentType alignment)
|
||||
{
|
||||
if (_alignment==alignment) return;
|
||||
|
||||
|
||||
_alignment = alignment;
|
||||
computeGlyphRepresentation();
|
||||
}
|
||||
@@ -191,19 +191,19 @@ void TextBase::setAxisAlignment(AxisAlignment axis)
|
||||
{
|
||||
case XZ_PLANE:
|
||||
setAutoRotateToScreen(false);
|
||||
setRotation(osg::Quat(osg::inDegrees(90.0f),osg::Vec3(1.0f,0.0f,0.0f)));
|
||||
setRotation(osg::Quat(osg::inDegrees(90.0f),osg::Vec3(1.0f,0.0f,0.0f)));
|
||||
break;
|
||||
case REVERSED_XZ_PLANE:
|
||||
setAutoRotateToScreen(false);
|
||||
setRotation(osg::Quat(osg::inDegrees(180.0f),osg::Vec3(0.0f,1.0f,0.0f))*
|
||||
osg::Quat(osg::inDegrees(90.0f),osg::Vec3(1.0f,0.0f,0.0f)));
|
||||
osg::Quat(osg::inDegrees(90.0f),osg::Vec3(1.0f,0.0f,0.0f)));
|
||||
break;
|
||||
case YZ_PLANE:
|
||||
case YZ_PLANE:
|
||||
setAutoRotateToScreen(false);
|
||||
setRotation(osg::Quat(osg::inDegrees(90.0f),osg::Vec3(1.0f,0.0f,0.0f))*
|
||||
osg::Quat(osg::inDegrees(90.0f),osg::Vec3(0.0f,0.0f,1.0f)));
|
||||
break;
|
||||
case REVERSED_YZ_PLANE:
|
||||
case REVERSED_YZ_PLANE:
|
||||
setAutoRotateToScreen(false);
|
||||
setRotation(osg::Quat(osg::inDegrees(180.0f),osg::Vec3(0.0f,1.0f,0.0f))*
|
||||
osg::Quat(osg::inDegrees(90.0f),osg::Vec3(1.0f,0.0f,0.0f))*
|
||||
@@ -235,7 +235,7 @@ void TextBase::setRotation(const osg::Quat& quat)
|
||||
void TextBase::setAutoRotateToScreen(bool autoRotateToScreen)
|
||||
{
|
||||
if (_autoRotateToScreen==autoRotateToScreen) return;
|
||||
|
||||
|
||||
_autoRotateToScreen = autoRotateToScreen;
|
||||
computePositions();
|
||||
}
|
||||
@@ -250,8 +250,8 @@ void TextBase::setLayout(Layout layout)
|
||||
}
|
||||
|
||||
|
||||
void TextBase::setDrawMode(unsigned int mode)
|
||||
{
|
||||
void TextBase::setDrawMode(unsigned int mode)
|
||||
{
|
||||
if (_drawMode==mode) return;
|
||||
|
||||
_drawMode=mode;
|
||||
@@ -317,14 +317,14 @@ osg::BoundingBox TextBase::computeBound() const
|
||||
void TextBase::computePositions()
|
||||
{
|
||||
unsigned int size = osg::maximum(osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts(),_autoTransformCache.size());
|
||||
|
||||
|
||||
// FIXME: OPTIMIZE: This would be one of the ideal locations to
|
||||
// call computeAverageGlyphWidthAndHeight(). It is out of the contextID loop
|
||||
// so the value would be computed fewer times. But the code will need changes
|
||||
// to get the value down to the locations it is needed. (Either pass through parameters
|
||||
// or member variables, but we would need a system to know if the values are stale.)
|
||||
|
||||
|
||||
|
||||
for(unsigned int i=0;i<size;++i)
|
||||
{
|
||||
computePositions(i);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user