From Don Tidrow, "I added some code to assign the archive pointer in TXPnode

with the archive that ReaderWriterTXP actually loads.  I also added a
function in TXPArchive to help in manipulating the lightpoints."
This commit is contained in:
Robert Osfield 2005-05-11 19:34:03 +00:00
parent 679c44f4ae
commit bdc7e8b4a9
3 changed files with 11 additions and 7 deletions

View File

@ -44,7 +44,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterTXP::local_readNode(const std::strin
{
int id = _archiveId++;
archive->setId(id);
getArchive(id,osgDB::getFilePath(fileName));
txpNode->setArchive(getArchive(id,osgDB::getFilePath(fileName)));
}
return txpNode.get();
}
@ -217,11 +217,11 @@ TXPArchive *ReaderWriterTXP::getArchive(int id, const std::string& dir)
return NULL;
}
if (archive->loadTextStyles() == false)
{
ReaderWriterTXPERROR("getArchive()") << "failed to load text styles from archive: \"" << archiveName << "\"" << std::endl;
return NULL;
}
if (archive->loadTextStyles() == false)
{
ReaderWriterTXPERROR("getArchive()") << "failed to load text styles from archive: \"" << archiveName << "\"" << std::endl;
return NULL;
}
archive->setId(id);

View File

@ -89,6 +89,8 @@ public:
// Add light attrib
void addLightAttribute(osgSim::LightPointNode* lpn, osg::StateSet* fallback , const osg::Vec3& attitude);
int getNumLightAttributes() { return _lights.size(); }
// Get light attrib
inline DeferredLightAttribute& getLightAttribute(unsigned int i)
{

View File

@ -66,6 +66,8 @@ public:
bool loadArchive();
TXPArchive* getArchive();
void setArchive(TXPArchive* archive) { _archive = archive; }
protected:
@ -78,7 +80,7 @@ protected:
osg::Node* addPagedLODTile(int x, int y, int lod);
std::string _archiveName;
std::string _archiveName;
std::string _options;
osg::ref_ptr<TXPArchive> _archive;