Added a bunch of files synched with 0.8.42

This commit is contained in:
Don BURNS
2001-09-19 21:08:56 +00:00
parent fed86f3f03
commit e8f256a59d
446 changed files with 58397 additions and 10552 deletions

View File

@@ -1,39 +1,35 @@
// FltFile.cpp
#include <osg/OSG>
#include <osg/Node>
#include <osg/NodeVisitor>
#include <osg/Notify>
#include "FltFile.h"
#include "Registry.h"
#include "Record.h"
#include "RecordVisitor.h"
#include "ExternalRecord.h"
#include "flt2osg.h" // ConvertFromFLT
#include "flt2osg.h" // ConvertFromFLT
#include "Input.h"
using namespace flt;
FltFile::FltFile(
ColorPool* pColorPool,
TexturePool* pTexturePool,
MaterialPool* pMaterialPool)
ColorPool* pColorPool,
TexturePool* pTexturePool,
MaterialPool* pMaterialPool)
{
if (pColorPool)
_pColorPool = pColorPool;
else
_pColorPool = &_colorPool;
_pColorPool = pColorPool;
if (pTexturePool)
_pTexturePool = pTexturePool;
else
if (pTexturePool)
_pTexturePool = pTexturePool;
else
_pTexturePool = &_texturePool;
if (pMaterialPool)
_pMaterialPool = pMaterialPool;
else
if (pMaterialPool)
_pMaterialPool = pMaterialPool;
else
_pMaterialPool = &_materialPool;
_pHeaderRecord = NULL;
@@ -61,8 +57,8 @@ osg::Node* FltFile::readNode(const std::string& fileName)
// Convert record tree to osg scene graph
node = convert();
pRootRec->unref(); // delete record tree
pRootRec->unref(); // delete record tree
return node;
}
@@ -102,12 +98,11 @@ Record* FltFile::readFile(const std::string& fileName)
return NULL;
}
if (pRec->isPrimaryNode()) // Header
pRec->readLocalData(fin); // Read rest of file
if (pRec->isPrimaryNode()) // Header
pRec->readLocalData(fin);// Read rest of file
fin.close();
return pRec;
}
@@ -121,29 +116,47 @@ public:
setTraverseMode(RecordVisitor::TRAVERSE_ALL_CHILDREN);
}
#define REGISTER_FLT 1
virtual void apply(ExternalRecord& rec)
{
SExternalReference* pSExternal = (SExternalReference*)rec.getData();
osg::notify(osg::INFO) << "External=" << pSExternal->szPath << endl;
ColorPool* pColorPool = NULL;
TexturePool* pTexturePool = NULL;
MaterialPool* pMaterialPool = NULL;
if (pSExternal->diFlags & BIT0)
pColorPool = _fltFile->getColorPool();
if (pSExternal->diFlags & BIT2)
pTexturePool = _fltFile->getTexturePool();
if (pSExternal->diFlags & BIT1)
pMaterialPool = _fltFile->getMaterialPool();
FltFile* flt = new FltFile(pColorPool, pTexturePool, pMaterialPool);
if (flt)
if (pSExternal)
{
flt->readModel(pSExternal->szPath);
FltFile* flt = NULL;
ColorPool* pColorPool = NULL;
TexturePool* pTexturePool = NULL;
MaterialPool* pMaterialPool = NULL;
std::string filename(pSExternal->szPath);
osg::notify(osg::INFO) << "External=" << filename << endl;
if (_fltFile && _fltFile->getFlightVersion() > 13)
{
if (pSExternal->diFlags & BIT0)
pColorPool = _fltFile->getColorPool();
if (pSExternal->diFlags & BIT2)
pTexturePool = _fltFile->getTexturePool();
if (pSExternal->diFlags & BIT1)
pMaterialPool = _fltFile->getMaterialPool();
}
#if REGISTER_FLT
flt = Registry::instance()->getFltFile(filename);
if (flt == NULL)
{
flt = new FltFile(pColorPool, pTexturePool, pMaterialPool);
flt->readModel(filename);
}
Registry::instance()->addFltFile(filename, flt);
#else
flt = new FltFile(pColorPool, pTexturePool, pMaterialPool);
flt->readModel(filename);
#endif
rec.setExternal(flt);
}
}
@@ -152,6 +165,7 @@ public:
FltFile* _fltFile;
};
void FltFile::readExternals(Record* pRec)
{
@@ -163,4 +177,13 @@ void FltFile::readExternals(Record* pRec)
}
int FltFile::getFlightVersion()
{
if (_pHeaderRecord)
{
SHeader* pSHeader = (SHeader*)_pHeaderRecord->getData();
if (pSHeader)
return pSHeader->diFormatRevLev;
}
return 0;
}