From 7de12650597dcc4ed72a3b8b0cb4ab82a81d5dd0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 1 May 2005 10:34:48 +0000 Subject: [PATCH] From Don Tidrow, spelling fixes --- src/osgPlugins/txp/TXPArchive.cpp | 126 +++++++++++++++--------------- src/osgPlugins/txp/TXPArchive.h | 26 +++--- src/osgPlugins/txp/TXPParser.cpp | 8 +- src/osgPlugins/txp/TXPParser.h | 12 +-- 4 files changed, 86 insertions(+), 86 deletions(-) diff --git a/src/osgPlugins/txp/TXPArchive.cpp b/src/osgPlugins/txp/TXPArchive.cpp index 74a3076d3..0e88df8bf 100644 --- a/src/osgPlugins/txp/TXPArchive.cpp +++ b/src/osgPlugins/txp/TXPArchive.cpp @@ -522,91 +522,91 @@ bool TXPArchive::loadLightAttributes() void trim(std::string& str) { - while (!str.empty() && isspace(str[str.length()-1])) - str.erase(str.length()-1); - while (!str.empty() && isspace(str[0])) + while (!str.empty() && isspace(str[str.length()-1])) + str.erase(str.length()-1); + while (!str.empty() && isspace(str[0])) str.erase(0,1); } bool TXPArchive::loadTextStyles() { - const trpgTextStyleTable *textStyleTable = GetTextStyleTable(); - if (!textStyleTable) return false; - if (textStyleTable->GetNumStyle() < 1) return true; + const trpgTextStyleTable *textStyleTable = GetTextStyleTable(); + if (!textStyleTable) return false; + if (textStyleTable->GetNumStyle() < 1) return true; - // try fontmap.txt - std::map< std::string, std::string > fontmap; + // try fontmap.txt + std::map< std::string, std::string > fontmap; - std::string fmapfname = std::string(getDir())+"\\fontmap.txt"; - std::ifstream fmapfile; - fmapfile.open(fmapfname.c_str(),std::ios::in); + std::string fmapfname = std::string(getDir())+"\\fontmap.txt"; + std::ifstream fmapfile; + fmapfile.open(fmapfname.c_str(),std::ios::in); - if (fmapfile.is_open()) - { - osg::notify(osg::NOTICE) << "txp:: Font map file found: " << fmapfname << std::endl; - std::string line; - while (std::getline(fmapfile,line)) - { - unsigned int ix = line.find_first_of('='); - if (ix != std::string::npos) - { - std::string fontname = line.substr(0,ix); - std::string fontfilename = line.substr(ix+1,line.length()-ix+1); + if (fmapfile.is_open()) + { + osg::notify(osg::NOTICE) << "txp:: Font map file found: " << fmapfname << std::endl; + std::string line; + while (std::getline(fmapfile,line)) + { + unsigned int ix = line.find_first_of('='); + if (ix != std::string::npos) + { + std::string fontname = line.substr(0,ix); + std::string fontfilename = line.substr(ix+1,line.length()-ix+1); - trim(fontname); - trim(fontfilename); + trim(fontname); + trim(fontfilename); - fontmap[fontname] = fontfilename; + fontmap[fontname] = fontfilename; - } - } - fmapfile.close(); - } - else - { - osg::notify(osg::NOTICE) << "txp:: No font map file found: " << fmapfname << std::endl; - osg::notify(osg::NOTICE) << "txp:: All fonts defaulted to arial.ttf" << std::endl; - } + } + } + fmapfile.close(); + } + else + { + osg::notify(osg::NOTICE) << "txp:: No font map file found: " << fmapfname << std::endl; + osg::notify(osg::NOTICE) << "txp:: All fonts defaulted to arial.ttf" << std::endl; + } - _fonts.resize(textStyleTable->GetNumStyle()); - _fcolors.resize(textStyleTable->GetNumStyle()); - for (int i = 0; i < textStyleTable->GetNumStyle(); i++) - { - const trpgTextStyle *textStyle = textStyleTable->GetStyleRef(i); - if (!textStyle) continue; + _fonts.resize(textStyleTable->GetNumStyle()); + _fcolors.resize(textStyleTable->GetNumStyle()); + for (int i = 0; i < textStyleTable->GetNumStyle(); i++) + { + const trpgTextStyle *textStyle = textStyleTable->GetStyleRef(i); + if (!textStyle) continue; - const std::string *fontName = textStyle->GetFont(); - if (!fontName) continue; + const std::string *fontName = textStyle->GetFont(); + if (!fontName) continue; - std::string fontfilename = fontmap[*fontName]; - if (!fontfilename.length()) fontfilename = "arial.ttf"; - osg::ref_ptr< osgText::Font > font = osgText::readFontFile(fontfilename); + std::string fontfilename = fontmap[*fontName]; + if (!fontfilename.length()) fontfilename = "arial.ttf"; + osg::ref_ptr< osgText::Font > font = osgText::readFontFile(fontfilename); - _fonts[i] = font; + _fonts[i] = font; - const trpgMatTable* matTable = GetMaterialTable(); - if (matTable) - { - int matId = textStyle->GetMaterial(); - const trpgMaterial* mat = matTable->GetMaterialRef(0,matId); - if (mat) - { - trpgColor faceColor; - mat->GetColor(faceColor); + const trpgMatTable* matTable = GetMaterialTable(); + if (matTable) + { + int matId = textStyle->GetMaterial(); + const trpgMaterial* mat = matTable->GetMaterialRef(0,matId); + if (mat) + { + trpgColor faceColor; + mat->GetColor(faceColor); - float64 alpha; - mat->GetAlpha(alpha); + float64 alpha; + mat->GetAlpha(alpha); - _fcolors[i] = osg::Vec4(faceColor.red, faceColor.green, faceColor.blue, alpha ); - } - } - } + _fcolors[i] = osg::Vec4(faceColor.red, faceColor.green, faceColor.blue, alpha ); + } + } + } - return true; + return true; } void TXPArchive::addLightAttribute(osgSim::LightPointNode* lpn, osg::StateSet* fallback, const osg::Vec3& att) { - DefferedLightAttribute la; + DeferredLightAttribute la; la.lightPoint = lpn; la.fallback = fallback; la.attitude = att; diff --git a/src/osgPlugins/txp/TXPArchive.h b/src/osgPlugins/txp/TXPArchive.h index 1c0643916..83e0a3bf8 100644 --- a/src/osgPlugins/txp/TXPArchive.h +++ b/src/osgPlugins/txp/TXPArchive.h @@ -51,7 +51,7 @@ namespace txp { // this one handles different placement of light direction in osg and terrapage -struct DefferedLightAttribute +struct DeferredLightAttribute { // light point at (0,0,0) looking in (0,0,0) direction osg::ref_ptr lightPoint; @@ -72,7 +72,7 @@ public: // Load the materials from the archve bool loadMaterials(); bool loadMaterial(int ix); - bool loadTexture(int i); + bool loadTexture(int i); // Load the models from the archive bool loadModels(); @@ -81,16 +81,16 @@ public: // Load the light attribs from the archive bool loadLightAttributes(); - // Load the text styles from the archive - bool loadTextStyles(); - inline std::vector< osg::ref_ptr >& getStyles() { return _fonts; } - inline std::vector< osg::Vec4 >& getTextColors() { return _fcolors; } + // Load the text styles from the archive + bool loadTextStyles(); + inline std::vector< osg::ref_ptr >& getStyles() { return _fonts; } + inline std::vector< osg::Vec4 >& getTextColors() { return _fcolors; } // Add light attrib void addLightAttribute(osgSim::LightPointNode* lpn, osg::StateSet* fallback , const osg::Vec3& attitude); // Get light attrib - inline DefferedLightAttribute& getLightAttribute(unsigned int i) + inline DeferredLightAttribute& getLightAttribute(unsigned int i) { return _lights[i]; }; @@ -175,7 +175,7 @@ protected: osg::ref_ptr _parser; // Textures - std::vector< osg::ref_ptr > _textures; + std::vector< osg::ref_ptr > _textures; // States std::vector< osg::ref_ptr > _gstates; @@ -184,13 +184,13 @@ protected: std::vector< osg::ref_ptr > _models; // Light attributes vector - std::vector _lights; + std::vector _lights; - // Text styles / Fonts - std::vector< osg::ref_ptr > _fonts; + // Text styles / Fonts + std::vector< osg::ref_ptr > _fonts; - // Text colors - std::vector< osg::Vec4 > _fcolors; + // Text colors + std::vector< osg::Vec4 > _fcolors; // OpenThreads::Mutex _mutex; diff --git a/src/osgPlugins/txp/TXPParser.cpp b/src/osgPlugins/txp/TXPParser.cpp index 31c6463c4..d81fcc1b9 100644 --- a/src/osgPlugins/txp/TXPParser.cpp +++ b/src/osgPlugins/txp/TXPParser.cpp @@ -189,7 +189,7 @@ bool TXPParser::EndChildren(void *) return true; } -DefferedLightAttribute& TXPParser::getLightAttribute(int ix) +DeferredLightAttribute& TXPParser::getLightAttribute(int ix) { return _archive->getLightAttribute(ix); } @@ -664,13 +664,13 @@ void* lightRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) int attr_index; light.GetAttrIndex(attr_index); - DefferedLightAttribute& dla = _parse->getLightAttribute(attr_index); + DeferredLightAttribute& dla = _parse->getLightAttribute(attr_index); osgSim::LightPointNode* node = dla.lightPoint.get(); uint32 nvert; light.GetNumVertices(nvert); - if( node->getLightPoint(0)._sector.valid() ) // osgSim::LigthPoint is a must + if( node->getLightPoint(0)._sector.valid() ) // osgSim::LightPoint is a must { for(unsigned int i = 0; i < nvert; i++) { @@ -1149,7 +1149,7 @@ void* geomRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf) normals = new osg::Vec3Array(numVert); geom.GetNormals((float*)&(normals->front())); } - + // Set up the primitive type switch (primType) { diff --git a/src/osgPlugins/txp/TXPParser.h b/src/osgPlugins/txp/TXPParser.h index a799620e3..d29e579b0 100644 --- a/src/osgPlugins/txp/TXPParser.h +++ b/src/osgPlugins/txp/TXPParser.h @@ -103,7 +103,7 @@ protected: class TXPArchive; -struct DefferedLightAttribute; +struct DeferredLightAttribute; class TXPParser : public trpgSceneParser, public osg::Referenced { @@ -116,8 +116,8 @@ public: _archive = archive; } - // Gets the archive - inline TXPArchive* getArchive() { return _archive; } + // Gets the archive + inline TXPArchive* getArchive() { return _archive; } // Scene parser osg::Group *parseScene( @@ -144,8 +144,8 @@ public: return _materials; } - // Ensure material is loaded - inline void loadMaterial(int ix) { _archive->loadMaterial(ix); } + // Ensure material is loaded + inline void loadMaterial(int ix) { _archive->loadMaterial(ix); } // New to TerraPage 2.0 - local materials std::vector >* getLocalMaterials() @@ -206,7 +206,7 @@ public: } // Gets light attrib - DefferedLightAttribute& getLightAttribute(int ix); + DeferredLightAttribute& getLightAttribute(int ix); // Returns if we are under layer subgraph inline const bool underLayerSubgraph() const