34 #ifndef __TXPARCHIVE_H_
35 #define __TXPARCHIVE_H_
41 #include <osg/Referenced>
42 #include <osg/BoundingBox>
43 #include <osg/Texture2D>
44 #include <osg/StateSet>
46 #include <osg/PagedLOD>
48 #include <osgSim/LightPointNode>
49 #include <osgText/Font>
51 #include <OpenThreads/Mutex>
72 bool openFile(
const std::string& archiveName);
75 bool loadMaterial(
int ix);
76 bool loadTexture(
int i);
80 bool loadModel(
int ix);
83 bool loadLightAttributes();
86 bool loadTextStyles();
87 inline std::map<int, osg::ref_ptr<osgText::Font> >& getStyles()
91 inline std::map<int, osg::Vec4 >& getTextColors()
97 void addLightAttribute(osgSim::LightPointNode* lpn, osg::StateSet* fallback ,
const osg::Vec3& attitude,
int handle);
99 int getNumLightAttributes()
101 return _lights.size();
126 x( gx ), y( gy ), lod( glod ), addr( gaddr ), zmin( gzmin ), zmax( gzmax )
133 bool getTileInfo(
int x,
int y,
int lod,
TileInfo& info);
137 inline void setId(
int id)
141 inline const int& getId()
const
147 inline const int& getNumLODs()
const
154 void getExtents(osg::BoundingBox& extents);
160 inline void getOrigin(
double& x,
double& y)
167 inline osg::Texture2D* getGlobalTexture(
int id)
169 return GetTexMapEntry(
id).get();
176 osg::Group* getTileContent(
183 osg::Vec3& tileCenter,
184 std::vector<TileLocationInfo>& childInfoList);
187 osg::Group* getTileContent(
192 osg::Vec3& tileCenter,
193 std::vector<TileLocationInfo>& childInfoList);
196 bool getLODSize(
int lod,
int& x,
int& y);
200 majorVer = _majorVersion;
201 minorVer = _minorVersion;
211 void SetUserDataToMaterialAttributes(osg::StateSet& osg_state_set,
const trpgMaterial& mat)
213 if(!_loadMaterialsToStateSet)
217 osg::ref_ptr<osg::IntArray> ourValueArray =
new osg::IntArray();
218 for(
int attrIter = 0 ; attrIter < 4; ++attrIter)
220 mat.
GetAttr(attrIter, attr_values);
221 ourValueArray->push_back(attr_values);
223 osg_state_set.setUserData(ourValueArray.get());
229 static void setShouldLoadDisplayData(
bool);
230 static bool shouldLoadDisplayData();
231 static void setExternalLoadOptions(osg::ref_ptr<osgDB::ReaderWriter::Options> opts);
232 static osg::ref_ptr<osgDB::ReaderWriter::Options> externalLoadOptions();
237 static void setShouldLoadLocalMaterials(
bool);
238 static bool shouldLoadLocalMaterials();
262 void SetTexMap(
int key,osg::ref_ptr<osg::Texture2D> ref);
263 osg::ref_ptr<osg::Texture2D> GetTexMapEntry(
int key);
270 void SetStatesMap(
int key,osg::ref_ptr<osg::StateSet> ref);
271 osg::ref_ptr<osg::StateSet> GetStatesMapEntry(
int key);
278 std::map<int, DeferredLightAttribute>
_lights;
281 std::map<int, osg::ref_ptr<osgText::Font> >
_fonts;