Improved indentation.

This commit is contained in:
Robert Osfield
2011-06-16 10:05:49 +00:00
parent d0ccbf8219
commit 375c1456f6
14 changed files with 1423 additions and 1424 deletions

View File

@@ -670,16 +670,16 @@ public:
{
for (unsigned int i = 0; i < group.getNumChildren(); i++)
{
osg::Node* child = group.getChild(i);
osg::Node* seam = seamReplacement(child);
if (child != seam)
{
group.replaceChild(child,seam);
}
else
{
child->accept(*this);
}
osg::Node* child = group.getChild(i);
osg::Node* seam = seamReplacement(child);
if (child != seam)
{
group.replaceChild(child,seam);
}
else
{
child->accept(*this);
}
}
}
@@ -720,10 +720,10 @@ osg::Node* SeamFinder::seamReplacement(osg::Node* node)
bool nonSeamChild = true;
// looks like the problem is in here - likely due to seamLOD info
// not being adjusted properly in tiled databases
// seam center is outside the bounding box of the tile
osg::Vec3 lodCenter = lod->getCenter();
// looks like the problem is in here - likely due to seamLOD info
// not being adjusted properly in tiled databases
// seam center is outside the bounding box of the tile
osg::Vec3 lodCenter = lod->getCenter();
if(tileType == trpgHeader::TileLocal)
{
@@ -739,7 +739,7 @@ osg::Node* SeamFinder::seamReplacement(osg::Node* node)
tileExtents.y /= divider;
offset[0] = _x*tileExtents.x;// + tileExtents.x*0.5;
offset[1] = _y*tileExtents.y;// + tileExtents.y*0.5;
lodCenter += offset;
lodCenter += offset;
}
if (!_info.bbox.contains(lodCenter))
@@ -764,7 +764,6 @@ osg::Node* SeamFinder::seamReplacement(osg::Node* node)
// low res seam has min/max ranges of lod+1 range/lod 0 range
if (equalDoubles(lod_plus_oneSwitchInDistance,rangeList.at(0).first) && equalDoubles(lod0SwitchInDistance,rangeList.at(0).second))
{
if (loRes==0)
{
loRes = lod;
@@ -793,7 +792,7 @@ osg::Node* SeamFinder::seamReplacement(osg::Node* node)
int dx = 0;
int dy = 0;
int lod = _lod;
osg::Vec3 lodCenter = loRes->getCenter();
osg::Vec3 lodCenter = loRes->getCenter();
if(tileType == trpgHeader::TileLocal)
{
@@ -809,7 +808,7 @@ osg::Node* SeamFinder::seamReplacement(osg::Node* node)
tileExtents.y /= divider;
offset[0] = _x*tileExtents.x;// + tileExtents.x*0.5;
offset[1] = _y*tileExtents.y;// + tileExtents.y*0.5;
lodCenter += offset;
lodCenter += offset;
}
osg::Vec3 delta = lodCenter-_info.center;
@@ -829,7 +828,7 @@ osg::Node* SeamFinder::seamReplacement(osg::Node* node)
}
TXPSeamLOD* seam = new TXPSeamLOD(_x, _y, lod, dx, dy);
seam->setCenter(loRes->getCenter());
seam->setCenter(loRes->getCenter());
seam->addChild(loRes->getChild(0)); // low res
if (hiRes)
{

View File

@@ -55,231 +55,231 @@ namespace txp
// this one handles different placement of light direction in osg and terrapage
struct DeferredLightAttribute
{
// light point at (0,0,0) looking in (0,0,0) direction
osg::ref_ptr<osgSim::LightPointNode> lightPoint;
osg::ref_ptr<osg::StateSet> fallback;
osg::Vec3 attitude;
// light point at (0,0,0) looking in (0,0,0) direction
osg::ref_ptr<osgSim::LightPointNode> lightPoint;
osg::ref_ptr<osg::StateSet> fallback;
osg::Vec3 attitude;
};
class TXPParser;
class TXPArchive : public trpgr_Archive, public osg::Referenced
{
public:
// Constructor
TXPArchive();
// Opens the archive file and reads the header
bool openFile(const std::string& archiveName);
// Load the materials from the archve
bool loadMaterials();
bool loadMaterial(int ix);
bool loadTexture(int i);
// Load the models from the archive
bool loadModels();
bool loadModel(int ix);
// Load the light attribs from the archive
bool loadLightAttributes();
// Constructor
TXPArchive();
// Load the text styles from the archive
bool loadTextStyles();
inline std::map<int, osg::ref_ptr<osgText::Font> >& getStyles()
{
return _fonts;
}
inline std::map<int, osg::Vec4 >& getTextColors()
{
return _fcolors;
}
// Add light attrib
void addLightAttribute(osgSim::LightPointNode* lpn, osg::StateSet* fallback , const osg::Vec3& attitude,int handle);
int getNumLightAttributes()
{
return _lights.size();
}
// Opens the archive file and reads the header
bool openFile(const std::string& archiveName);
// Load the materials from the archve
bool loadMaterials();
bool loadMaterial(int ix);
bool loadTexture(int i);
// Get light attrib
inline DeferredLightAttribute& getLightAttribute(unsigned int i)
{
return _lights[i];
};
// Gets some informations for a given tile
struct TileInfo
{
osg::Vec3 center;
double minRange;
double maxRange;
double lod0Range;
float radius;
osg::Vec3 size;
osg::BoundingBox bbox;
};
struct TileLocationInfo
{
TileLocationInfo() : x( -1 ), y( -1 ), lod( -1 )
{}
TileLocationInfo(int gx, int gy, int glod, const trpgwAppAddress& gaddr, float gzmin = 0.0f, float gzmax = 0.0f):
x( gx ), y( gy ), lod( glod ), addr( gaddr ), zmin( gzmin ), zmax( gzmax )
{}
int x, y, lod;
trpgwAppAddress addr;
float zmin, zmax;
};
// Load the models from the archive
bool loadModels();
bool loadModel(int ix);
bool getTileInfo(int x, int y, int lod, TileInfo& info);
bool getTileInfo(const TileLocationInfo& loc, TileInfo& info);
// Set/Get the archive id
inline void setId(int id)
{
_id = id;
}
inline const int& getId() const
{
return _id;
}
// Returns the number of LODs for this archive
inline const int& getNumLODs() const
{
return _numLODs;
}
// Returns the extents of the archive
// Load the light attribs from the archive
bool loadLightAttributes();
// Load the text styles from the archive
bool loadTextStyles();
inline std::map<int, osg::ref_ptr<osgText::Font> >& getStyles()
{
return _fonts;
}
inline std::map<int, osg::Vec4 >& getTextColors()
{
return _fcolors;
}
// Add light attrib
void addLightAttribute(osgSim::LightPointNode* lpn, osg::StateSet* fallback , const osg::Vec3& attitude,int handle);
int getNumLightAttributes()
{
return _lights.size();
}
// Get light attrib
inline DeferredLightAttribute& getLightAttribute(unsigned int i)
{
return _lights[i];
};
// Gets some informations for a given tile
struct TileInfo
{
osg::Vec3 center;
double minRange;
double maxRange;
double lod0Range;
float radius;
osg::Vec3 size;
osg::BoundingBox bbox;
};
struct TileLocationInfo
{
TileLocationInfo() : x( -1 ), y( -1 ), lod( -1 )
{}
TileLocationInfo(int gx, int gy, int glod, const trpgwAppAddress& gaddr, float gzmin = 0.0f, float gzmax = 0.0f):
x( gx ), y( gy ), lod( glod ), addr( gaddr ), zmin( gzmin ), zmax( gzmax )
{}
int x, y, lod;
trpgwAppAddress addr;
float zmin, zmax;
};
bool getTileInfo(int x, int y, int lod, TileInfo& info);
bool getTileInfo(const TileLocationInfo& loc, TileInfo& info);
// Set/Get the archive id
inline void setId(int id)
{
_id = id;
}
inline const int& getId() const
{
return _id;
}
// Returns the number of LODs for this archive
inline const int& getNumLODs() const
{
return _numLODs;
}
// Returns the extents of the archive
// FIXME - Needs to change for databases that aren't flat-earth
void getExtents(osg::BoundingBox& extents);
// {
// extents.set(_swExtents.x,_swExtents.y,0.0f,_neExtents.x,_neExtents.y,0.0f);
// }
// Returns the origin of the archive
inline void getOrigin(double& x, double& y)
{
x=_swExtents.x;
y=_swExtents.y;
}
// Returns global texture
inline osg::Texture2D* getGlobalTexture(int id)
{
return GetTexMapEntry(id).get();
}
// Returns scenegraph representing the Tile.
// For version 2.1 and over this function can only be call
// with lod = 0, since the archive tile table will contain
// only tiles with lod = 0
osg::Group* getTileContent(
int x,
int y,
int lod,
double realMinRange,
double realMaxRange,
double usedMaxRange,
osg::Vec3& tileCenter,
std::vector<TileLocationInfo>& childInfoList);
// {
// extents.set(_swExtents.x,_swExtents.y,0.0f,_neExtents.x,_neExtents.y,0.0f);
// }
// To be used for Version 2.1 with lod > 0
osg::Group* getTileContent(
const TileLocationInfo& loc,
double realMinRange,
double realMaxRange,
double usedMaxRange,
osg::Vec3& tileCenter,
std::vector<TileLocationInfo>& childInfoList);
// Returns the origin of the archive
inline void getOrigin(double& x, double& y)
{
x=_swExtents.x;
y=_swExtents.y;
}
// Get the number of tiles for given LOD
bool getLODSize(int lod, int& x, int& y);
// Returns global texture
inline osg::Texture2D* getGlobalTexture(int id)
{
return GetTexMapEntry(id).get();
}
void GetVersion(int& majorVer, int& minorVer) const
{
majorVer = _majorVersion;
minorVer = _minorVersion;
}
//////////////////////////////////////////////////////////////////
// This section brought to you by A. Danklefsen and the team @
// Alion Science And Technology 2/12/07
//
// This will allow you to have smc / fid / swc / stp values and
// places them on the userdata of the state set. this way your own
// terrain loader / parser can know these values
void SetUserDataToMaterialAttributes(osg::StateSet& osg_state_set, const trpgMaterial& mat)
{
if(!_loadMaterialsToStateSet)
return;
// Returns scenegraph representing the Tile.
// For version 2.1 and over this function can only be call
// with lod = 0, since the archive tile table will contain
// only tiles with lod = 0
osg::Group* getTileContent(
int x,
int y,
int lod,
double realMinRange,
double realMaxRange,
double usedMaxRange,
osg::Vec3& tileCenter,
std::vector<TileLocationInfo>& childInfoList);
int attr_values = 0;
osg::ref_ptr<osg::IntArray> ourValueArray = new osg::IntArray();
for(int attrIter = 0 ; attrIter < 4; ++attrIter)
{
mat.GetAttr(attrIter, attr_values);
ourValueArray->push_back(attr_values);
}
osg_state_set.setUserData(ourValueArray.get());
}
// To be used for Version 2.1 with lod > 0
osg::Group* getTileContent(
const TileLocationInfo& loc,
double realMinRange,
double realMaxRange,
double usedMaxRange,
osg::Vec3& tileCenter,
std::vector<TileLocationInfo>& childInfoList);
void SetMaterialAttributesToStateSetVar(bool value) {_loadMaterialsToStateSet = value;}
// Get the number of tiles for given LOD
bool getLODSize(int lod, int& x, int& y);
void GetVersion(int& majorVer, int& minorVer) const
{
majorVer = _majorVersion;
minorVer = _minorVersion;
}
//////////////////////////////////////////////////////////////////
// This section brought to you by A. Danklefsen and the team @
// Alion Science And Technology 2/12/07
//
// This will allow you to have smc / fid / swc / stp values and
// places them on the userdata of the state set. this way your own
// terrain loader / parser can know these values
void SetUserDataToMaterialAttributes(osg::StateSet& osg_state_set, const trpgMaterial& mat)
{
if(!_loadMaterialsToStateSet)
return;
int attr_values = 0;
osg::ref_ptr<osg::IntArray> ourValueArray = new osg::IntArray();
for(int attrIter = 0 ; attrIter < 4; ++attrIter)
{
mat.GetAttr(attrIter, attr_values);
ourValueArray->push_back(attr_values);
}
osg_state_set.setUserData(ourValueArray.get());
}
void SetMaterialAttributesToStateSetVar(bool value) {_loadMaterialsToStateSet = value;}
protected:
// Destructor
virtual ~TXPArchive();
// Id of the archive
int _id;
// Number of the LODs
int _numLODs;
// Archive extents
trpg2dPoint _swExtents;
trpg2dPoint _neExtents;
// Terra Page Parser
osg::ref_ptr<TXPParser> _parser;
// Textures
typedef std::map<int,osg::ref_ptr<osg::Texture2D> > OSGTexMapType;
OSGTexMapType _texmap;
// Destructor
virtual ~TXPArchive();
void SetTexMap(int key,osg::ref_ptr<osg::Texture2D> ref);
osg::ref_ptr<osg::Texture2D> GetTexMapEntry(int key);
// Id of the archive
int _id;
// States
typedef std::map<int,osg::ref_ptr<osg::StateSet> > OSGStatesMapType;
OSGStatesMapType _statesMap;
// Number of the LODs
int _numLODs;
void SetStatesMap(int key,osg::ref_ptr<osg::StateSet> ref);
osg::ref_ptr<osg::StateSet> GetStatesMapEntry(int key);
// Models
typedef std::map<int,osg::ref_ptr<osg::Node> > OSGModelsMapType;
OSGModelsMapType _models;
// Light attributes vector
std::map<int, DeferredLightAttribute> _lights;
// Archive extents
trpg2dPoint _swExtents;
trpg2dPoint _neExtents;
// Text styles / Fonts
std::map<int, osg::ref_ptr<osgText::Font> > _fonts;
// Terra Page Parser
osg::ref_ptr<TXPParser> _parser;
// Text colors
std::map<int, osg::Vec4 > _fcolors;
// Textures
typedef std::map<int,osg::ref_ptr<osg::Texture2D> > OSGTexMapType;
OSGTexMapType _texmap;
//
OpenThreads::Mutex _mutex;
void SetTexMap(int key,osg::ref_ptr<osg::Texture2D> ref);
osg::ref_ptr<osg::Texture2D> GetTexMapEntry(int key);
// Cache those: TerraPage version
int _majorVersion, _minorVersion;
bool _isMaster;
bool _loadMaterialsToStateSet;
// States
typedef std::map<int,osg::ref_ptr<osg::StateSet> > OSGStatesMapType;
OSGStatesMapType _statesMap;
void SetStatesMap(int key,osg::ref_ptr<osg::StateSet> ref);
osg::ref_ptr<osg::StateSet> GetStatesMapEntry(int key);
// Models
typedef std::map<int,osg::ref_ptr<osg::Node> > OSGModelsMapType;
OSGModelsMapType _models;
// Light attributes vector
std::map<int, DeferredLightAttribute> _lights;
// Text styles / Fonts
std::map<int, osg::ref_ptr<osgText::Font> > _fonts;
// Text colors
std::map<int, osg::Vec4 > _fcolors;
//
OpenThreads::Mutex _mutex;
// Cache those: TerraPage version
int _majorVersion, _minorVersion;
bool _isMaster;
bool _loadMaterialsToStateSet;
};

View File

@@ -330,10 +330,10 @@ osg::Node* TXPNode::addPagedLODTile(int x, int y)
}
else
{
_nodesToAdd.push_back(pagedLOD);
return pagedLOD;
}
_nodesToAdd.push_back(pagedLOD);
return pagedLOD;
}
}
void TXPNode::updateSceneGraph()

View File

@@ -56,49 +56,50 @@ bool trpgMatTable1_0::Read(trpgReadBuffer &buf)
std::vector<trpgMaterial> baseMats;
try {
buf.Get(numTable);
buf.Get(numMat);
if (numTable <= 0 || numMat < 0) throw 1;
buf.Get(numTable);
buf.Get(numMat);
if (numTable <= 0 || numMat < 0) throw 1;
// Short material tables are always full size
shortTable.resize(numTable*numMat);
// Short material tables are always full size
shortTable.resize(numTable*numMat);
// Look for short material table
buf.GetToken(matTok,len);
if (matTok == TRPGSHORTMATTABLE) {
int32 numTex,texId;
buf.PushLimit(len);
for (i=0;i<(unsigned int)numTable;i++)
// Look for short material table
buf.GetToken(matTok,len);
if (matTok == TRPGSHORTMATTABLE) {
int32 numTex,texId;
buf.PushLimit(len);
for (i=0;i<(unsigned int)numTable;i++) {
for (j=0;j<(unsigned int)numMat;j++) {
trpgShortMaterial &smat = shortTable[i*numMat+j];
buf.Get(smat.baseMat);
buf.Get(numTex);
trpgShortMaterial &smat = shortTable[i*numMat+j];
buf.Get(smat.baseMat);
buf.Get(numTex);
for (k=0;k<(unsigned int)numTex;k++) {
buf.Get(texId);
smat.texids.push_back(texId);
buf.Get(texId);
smat.texids.push_back(texId);
}
}
}
buf.PopLimit();
// Now read the base materials
int32 numBaseMat;
buf.Get(numBaseMat);
if (numBaseMat < 0) throw 1;
baseMats.resize(numBaseMat);
for (i=0;i<(unsigned int)numBaseMat;i++) {
buf.GetToken(matTok,len);
if (matTok != TRPGMATERIAL) throw 1;
buf.PushLimit(len);
mat.Reset();
status = mat.Read(buf);
buf.PopLimit();
if (!status) throw 1;
baseMats[i] = mat;
}
}
buf.PopLimit();
// Now read the base materials
int32 numBaseMat;
buf.Get(numBaseMat);
if (numBaseMat < 0) throw 1;
baseMats.resize(numBaseMat);
for (i=0;i<(unsigned int)numBaseMat;i++) {
buf.GetToken(matTok,len);
if (matTok != TRPGMATERIAL) throw 1;
buf.PushLimit(len);
mat.Reset();
status = mat.Read(buf);
buf.PopLimit();
if (!status) throw 1;
baseMats[i] = mat;
}
}
}
catch (...) {
return false;
return false;
}
// Now convert to the new style material table
@@ -124,7 +125,7 @@ bool trpgMatTable1_0::Read(trpgReadBuffer &buf)
bool trpgMatTable1_0::Write(trpgWriteBuffer &buf)
{
if (!isValid())
return false;
return false;
// Create one short material for every material
std::vector<trpgShortMaterial> shortMats;
@@ -134,21 +135,21 @@ bool trpgMatTable1_0::Write(trpgWriteBuffer &buf)
MaterialMapType::iterator itr = materialMap.begin();
for ( ; itr != materialMap.end( ); itr++) {
//for (i=0;i<numTable*numMat;i++) {
trpgMaterial &mat = itr->second; //matTables[i];
// Fill in the short material
trpgShortMaterial &sMat = shortMats[i];
sMat.baseMat = 0;
int numTex;
mat.GetNumTexture(numTex);
for (int j=0;j<numTex;j++) {
int texId;
trpgTextureEnv texEnv;
mat.GetTexture(j,texId,texEnv);
sMat.texids.push_back(texId);
sMat.baseMat = i;
}
i++;
//for (i=0;i<numTable*numMat;i++) {
trpgMaterial &mat = itr->second; //matTables[i];
// Fill in the short material
trpgShortMaterial &sMat = shortMats[i];
sMat.baseMat = 0;
int numTex;
mat.GetNumTexture(numTex);
for (int j=0;j<numTex;j++) {
int texId;
trpgTextureEnv texEnv;
mat.GetTexture(j,texId,texEnv);
sMat.texids.push_back(texId);
sMat.baseMat = i;
}
i++;
}
// Write the 1.0 material table
@@ -159,12 +160,12 @@ bool trpgMatTable1_0::Write(trpgWriteBuffer &buf)
// Write the short materials
buf.Begin(TRPGSHORTMATTABLE);
for (i=0;i<static_cast<int>(shortMats.size());i++) {
trpgShortMaterial &sMat = shortMats[i];
buf.Add(sMat.baseMat);
buf.Add((int)(sMat.texids.size()));
unsigned int j;
for (j=0;j<sMat.texids.size();j++)
buf.Add(sMat.texids[j]);
trpgShortMaterial &sMat = shortMats[i];
buf.Add(sMat.baseMat);
buf.Add((int)(sMat.texids.size()));
unsigned int j;
for (j=0;j<sMat.texids.size();j++)
buf.Add(sMat.texids[j]);
}
buf.End();
@@ -174,11 +175,11 @@ bool trpgMatTable1_0::Write(trpgWriteBuffer &buf)
itr = materialMap.begin();
for ( ; itr != materialMap.end( ); itr++) {
trpgMaterial &mat = itr->second; //matTables[i];
trpgMaterial &mat = itr->second; //matTables[i];
// This will be bigger than the old 1.0 material, but it doesn't matter since
// the new stuff is on the end.
mat.Write(buf);
// This will be bigger than the old 1.0 material, but it doesn't matter since
// the new stuff is on the end.
mat.Write(buf);
}
// Close Mat Table
@@ -199,13 +200,13 @@ bool trpgTexture1_0::Read(trpgReadBuffer &buf)
mode = External;
try {
char texName[1024];
buf.Get(texName,1023);
SetName(texName);
buf.Get(useCount);
char texName[1024];
buf.Get(texName,1023);
SetName(texName);
buf.Get(useCount);
}
catch (...) {
return false;
return false;
}
return true;
@@ -215,7 +216,7 @@ bool trpgTexture1_0::Write(trpgWriteBuffer &buf)
{
// Can only deal with external textures in 1.0
if (mode != External)
return false;
return false;
// Write the name and use count
buf.Add(name);
@@ -256,7 +257,7 @@ bool trpgTexTable1_0::Write(trpgWriteBuffer &buf)
int32 numTex;
if (!isValid())
return false;
return false;
buf.Begin(TRPGTEXTABLE);
@@ -264,10 +265,10 @@ bool trpgTexTable1_0::Write(trpgWriteBuffer &buf)
buf.Add(numTex);
TextureMapType::const_iterator itr = textureMap.begin();
for ( ; itr != textureMap.end( ); itr++) {
trpgTexture1_0 tex1_0;
tex1_0 = itr->second;
if (!tex1_0.Write(buf))
return false;
trpgTexture1_0 tex1_0;
tex1_0 = itr->second;
if (!tex1_0.Write(buf))
return false;
}
buf.End();
@@ -283,12 +284,12 @@ trpgTileTable1_0::trpgTileTable1_0(const trpgTileTable& /*inTable*/)
bool trpgTileTable1_0::Write(trpgWriteBuffer &buf)
{
try {
buf.Begin(TRPGTILETABLE);
buf.Add("");
buf.End();
buf.Begin(TRPGTILETABLE);
buf.Add("");
buf.End();
}
catch (...) {
return false;
return false;
}
return true;

View File

@@ -47,7 +47,7 @@ class trpgMatTable;
*/
TX_EXDECL class TX_CLDECL trpgHeader : public trpgReadWriteable
{
public:
public:
trpgHeader(void);
~trpgHeader(void);
@@ -181,43 +181,43 @@ TX_EXDECL class TX_CLDECL trpgHeader : public trpgReadWriteable
void SetMaster(bool isMaster)
{
if((verMajor >= TRPG_NOMERGE_VERSION_MAJOR) && (verMinor >=TRPG_NOMERGE_VERSION_MINOR))
{
if(isMaster)
flags |= ISMASTER;//set the master flag
else
flags &= ~ISMASTER;//clear the master flag
}
if((verMajor >= TRPG_NOMERGE_VERSION_MAJOR) && (verMinor >=TRPG_NOMERGE_VERSION_MINOR))
{
if(isMaster)
flags |= ISMASTER;//set the master flag
else
flags &= ~ISMASTER;//clear the master flag
}
}
bool GetIsMaster() const
{
return ((flags & ISMASTER)==ISMASTER);
return ((flags & ISMASTER)==ISMASTER);
}
void SetLocal(bool isLocal)
{
if((verMajor >= TRPG_NOMERGE_VERSION_MAJOR) && (verMinor >=TRPG_NOMERGE_VERSION_MINOR))
{
if(isLocal)
flags |= ISLOCAL;//set the local flag
else
flags &= ~ISLOCAL;//clear the local flag
}
if((verMajor >= TRPG_NOMERGE_VERSION_MAJOR) && (verMinor >=TRPG_NOMERGE_VERSION_MINOR))
{
if(isLocal)
flags |= ISLOCAL;//set the local flag
else
flags &= ~ISLOCAL;//clear the local flag
}
}
bool GetIsLocal() const
{
return ((flags & ISLOCAL)==ISLOCAL);
return ((flags & ISLOCAL)==ISLOCAL);
}
void SetBlocks(int rows,int cols)
{
this->rows = rows;
this->cols = cols;
this->rows = rows;
this->cols = cols;
}
void GetBlocks(int &rows,int &cols)
{
rows = this->rows;
cols = this->cols;
rows = this->rows;
cols = this->cols;
}
protected:
protected:
int verMinor,verMajor;
int dbVerMinor,dbVerMajor;
int maxGroupID;
@@ -249,7 +249,7 @@ TX_EXDECL class TX_CLDECL trpgHeader : public trpgReadWriteable
TX_EXDECL class TX_CLDECL trpgTextureEnv : public trpgReadWriteable
{
friend class trpgMatTable;
public:
public:
trpgTextureEnv(void);
~trpgTextureEnv(void);
@@ -308,7 +308,7 @@ TX_EXDECL class TX_CLDECL trpgTextureEnv : public trpgReadWriteable
// Prints this class to a print buffer
bool Print(trpgPrintBuffer &) const;
protected:
protected:
int envMode;
int minFilter;
int magFilter;
@@ -345,7 +345,7 @@ TX_EXDECL class TX_CLDECL trpgTextureEnv : public trpgReadWriteable
TX_EXDECL class TX_CLDECL trpgMaterial : public trpgReadWriteable
{
friend class trpgMatTable;
public:
public:
trpgMaterial(void);
~trpgMaterial(void);
// Set base material color
@@ -494,7 +494,7 @@ TX_EXDECL class TX_CLDECL trpgMaterial : public trpgReadWriteable
// Note: Need to do equality operator
protected:
protected:
bool isBump;
trpgColor color;
trpgColor ambient;
@@ -531,7 +531,7 @@ TX_EXDECL class TX_CLDECL trpgMaterial : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgLightAttr : public trpgReadWriteable
{
public:
public:
// Default constructor
trpgLightAttr(void);
// Copy constructor
@@ -542,89 +542,89 @@ TX_EXDECL class TX_CLDECL trpgLightAttr : public trpgReadWriteable
// Light Flags
enum
{
// Light flags
trpg_Day = 0x0001,
trpg_Dusk = 0x0002,
trpg_Night = 0x0004,
trpg_Directional = 0x0008,
trpg_BackColor = 0x0010,
trpg_Reflective = 0x0020,
// Light flags
trpg_Day = 0x0001,
trpg_Dusk = 0x0002,
trpg_Night = 0x0004,
trpg_Directional = 0x0008,
trpg_BackColor = 0x0010,
trpg_Reflective = 0x0020,
// Animation flags
trpg_Flashing = 0x0100,
trpg_Rotating = 0x0200,
trpg_ClockWise = 0x0400,
trpg_AnimationMask = 0x0f00,
// Animation flags
trpg_Flashing = 0x0100,
trpg_Rotating = 0x0200,
trpg_ClockWise = 0x0400,
trpg_AnimationMask = 0x0f00,
// Performer light flags
trpg_Perspective = 0x1000,
trpg_Fade = 0x2000,
trpg_ZBuffer = 0x4000,
trpg_FogPunch = 0x8000,
trpg_PerformerMask = 0xf000
// Performer light flags
trpg_Perspective = 0x1000,
trpg_Fade = 0x2000,
trpg_ZBuffer = 0x4000,
trpg_FogPunch = 0x8000,
trpg_PerformerMask = 0xf000
} LightFlags;
// Light Type
typedef enum
{
trpg_Raster,
trpg_Calligraphic,
trpg_RASCAL
trpg_Raster,
trpg_Calligraphic,
trpg_RASCAL
} LightType;
// Light Directionality
typedef enum
{
trpg_Omnidirectional,
trpg_Bidirectional,
trpg_Unidirectional
trpg_Omnidirectional,
trpg_Bidirectional,
trpg_Unidirectional
} LightDirectionality;
// Light Quality
typedef enum
{
trpg_Off,
trpg_Low,
trpg_Medium,
trpg_High,
trpg_Undefined
trpg_Off,
trpg_Low,
trpg_Medium,
trpg_High,
trpg_Undefined
} LightQuality;
// Struct for Performer Lights
struct PerformerAttr
{
PerformerAttr() : flags(0),minPixelSize(0),maxPixelSize(0),actualSize(0),
transparentPixelSize(0),transparentFallofExp(0),transparentScale(0),
transparentClamp(0),fogScale(0) {};
int32 flags;
float64 minPixelSize;
float64 maxPixelSize;
float64 actualSize;
float64 transparentPixelSize;
float64 transparentFallofExp;
float64 transparentScale;
float64 transparentClamp;
float64 fogScale;
PerformerAttr() : flags(0),minPixelSize(0),maxPixelSize(0),actualSize(0),
transparentPixelSize(0),transparentFallofExp(0),transparentScale(0),
transparentClamp(0),fogScale(0) {};
int32 flags;
float64 minPixelSize;
float64 maxPixelSize;
float64 actualSize;
float64 transparentPixelSize;
float64 transparentFallofExp;
float64 transparentScale;
float64 transparentClamp;
float64 fogScale;
};
// Struct for Animated Lights
struct AnimationAttr
{
AnimationAttr() : period(0),phaseDelay(0),timeOn(0),vector(trpg3dPoint(0,0,0)),flags(0) {};
float64 period;
float64 phaseDelay;
float64 timeOn;
trpg3dPoint vector;
int32 flags;
AnimationAttr() : period(0),phaseDelay(0),timeOn(0),vector(trpg3dPoint(0,0,0)),flags(0) {};
float64 period;
float64 phaseDelay;
float64 timeOn;
trpg3dPoint vector;
int32 flags;
};
// Struct for Calligraphic Lights
struct CalligraphicAttr
{
CalligraphicAttr() : drawOrder(0),minDefocus(0),maxDefocus(0) {} ;
int32 drawOrder;
float64 minDefocus;
float64 maxDefocus;
CalligraphicAttr() : drawOrder(0),minDefocus(0),maxDefocus(0) {} ;
int32 drawOrder;
float64 minDefocus;
float64 maxDefocus;
};
// Setters
@@ -808,31 +808,31 @@ TX_EXDECL class TX_CLDECL trpgLightAttr : public trpgReadWriteable
void Reset(void);
protected:
protected:
struct DataSet
{
LightType type;
LightDirectionality directionality;
trpgColor frontColor;
float64 frontIntensity;
trpgColor backColor;
float64 backIntensity;
trpg3dPoint normal;
int32 smc;
int32 fid;
int32 flags;
float64 horizontalLobeAngle;
float64 verticalLobeAngle;
float64 lobeRollAngle;
float64 lobeFalloff;
float64 ambientIntensity;
LightQuality quality;
LightQuality randomIntensity;
float64 rascalSignificance;
CalligraphicAttr calligraphicAttr;
PerformerAttr performerAttr;
AnimationAttr animationAttr;
char *commentStr;
LightType type;
LightDirectionality directionality;
trpgColor frontColor;
float64 frontIntensity;
trpgColor backColor;
float64 backIntensity;
trpg3dPoint normal;
int32 smc;
int32 fid;
int32 flags;
float64 horizontalLobeAngle;
float64 verticalLobeAngle;
float64 lobeRollAngle;
float64 lobeFalloff;
float64 ambientIntensity;
LightQuality quality;
LightQuality randomIntensity;
float64 rascalSignificance;
CalligraphicAttr calligraphicAttr;
PerformerAttr performerAttr;
AnimationAttr animationAttr;
char *commentStr;
} data;
};
@@ -843,7 +843,7 @@ TX_EXDECL class TX_CLDECL trpgLightAttr : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgLight : public trpgReadWriteable
{
public:
public:
// Default constructor
trpgLight(void);
// Copy constructor
@@ -890,7 +890,7 @@ TX_EXDECL class TX_CLDECL trpgLight : public trpgReadWriteable
// operator
trpgLight& operator = (const trpgLight &);
protected:
protected:
// Here we store the light locations
std::vector<trpg3dPoint> lightPoints;
int index;
@@ -902,7 +902,7 @@ TX_EXDECL class TX_CLDECL trpgLight : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgLightTable : public trpgReadWriteable
{
public:
public:
// Default constructor
trpgLightTable(void);
@@ -947,7 +947,7 @@ TX_EXDECL class TX_CLDECL trpgLightTable : public trpgReadWriteable
typedef std::map<int,trpgLightAttr> LightMapType;
LightMapType *getLightMap() { return &lightMap; }
protected:
protected:
// Here we store the light attributes
//std::vector<trpgLightAttr> lightList;
LightMapType lightMap;
@@ -962,7 +962,7 @@ TX_EXDECL class TX_CLDECL trpgLightTable : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgRange : public trpgReadWriteable
{
public:
public:
trpgRange(void);
~trpgRange(void);
@@ -1013,7 +1013,7 @@ TX_EXDECL class TX_CLDECL trpgRange : public trpgReadWriteable
// Assignment operator
trpgRange & operator = (const trpgRange &);
protected:
protected:
double inLod,outLod;
char *category;
char *subCategory;
@@ -1054,7 +1054,7 @@ TX_EXDECL class TX_CLDECL trpgRange : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgRangeTable : public trpgReadWriteable
{
public:
public:
trpgRangeTable(void);
~trpgRangeTable(void);
@@ -1087,7 +1087,7 @@ TX_EXDECL class TX_CLDECL trpgRangeTable : public trpgReadWriteable
// Assignment operator
trpgRangeTable & operator = (const trpgRangeTable &);
protected:
protected:
typedef std::map<int,trpgRange> RangeMapType;
RangeMapType rangeMap;
//std::vector<trpgRange> rangeList;
@@ -1118,7 +1118,7 @@ TX_EXDECL class TX_CLDECL trpgRangeTable : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgMatTable : public trpgReadWriteable
{
public:
public:
trpgMatTable(void);
~trpgMatTable(void);
/* If you intend to have more than one material sub-table you'll
@@ -1189,7 +1189,7 @@ TX_EXDECL class TX_CLDECL trpgMatTable : public trpgReadWriteable
bool Print(trpgPrintBuffer &) const;
protected:
protected:
int numTable;
int numMat;
typedef std::map<int,trpgMaterial> MaterialMapType;
@@ -1225,7 +1225,7 @@ TX_EXDECL class TX_CLDECL trpgMatTable : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgTexture : public trpgReadWriteable
{
public:
public:
trpgTexture(void);
trpgTexture(const trpgTexture &);
~trpgTexture(void);
@@ -1251,26 +1251,26 @@ TX_EXDECL class TX_CLDECL trpgTexture : public trpgReadWriteable
*/
typedef enum
{
trpg_RGB8,
trpg_RGBA8,
trpg_INT8,
trpg_INTA8,
trpg_FXT1,
trpg_Filler, // This is not a texture format. It's here to keep the numbering consistent
trpg_RGBX, // MCM no longer
trpg_Unknown,
trpg_DDS,
trpg_DXT1,
trpg_DXT3,
trpg_DXT5,
// This is a bit ugly, but we can't change the size of the texture record without
// breaking existing readers. So there will be multiple MCM types to indicate the number
// of bands and the nature of the extra channels, if any
trpg_MCM5,
trpg_MCM6R,
trpg_MCM6A,
trpg_MCM7RA,
trpg_MCM7AR
trpg_RGB8,
trpg_RGBA8,
trpg_INT8,
trpg_INTA8,
trpg_FXT1,
trpg_Filler, // This is not a texture format. It's here to keep the numbering consistent
trpg_RGBX, // MCM no longer
trpg_Unknown,
trpg_DDS,
trpg_DXT1,
trpg_DXT3,
trpg_DXT5,
// This is a bit ugly, but we can't change the size of the texture record without
// breaking existing readers. So there will be multiple MCM types to indicate the number
// of bands and the nature of the extra channels, if any
trpg_MCM5,
trpg_MCM6R,
trpg_MCM6A,
trpg_MCM7RA,
trpg_MCM7AR
} ImageType;
// Set the texture name.
@@ -1374,7 +1374,7 @@ TX_EXDECL class TX_CLDECL trpgTexture : public trpgReadWriteable
trpgTexture & operator = (const trpgTexture &);
int operator == (const trpgTexture &) const;
protected:
protected:
// Mode for this texture. See ImageMode for details
ImageMode mode;
@@ -1437,7 +1437,7 @@ TX_EXDECL class TX_CLDECL trpgTexture : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgTexTable : public trpgReadWriteable
{
public:
public:
trpgTexTable(void);
trpgTexTable(const trpgTexTable &);
~trpgTexTable(void);
@@ -1489,17 +1489,17 @@ TX_EXDECL class TX_CLDECL trpgTexTable : public trpgReadWriteable
const trpgTexture *FindByName(const char *name, int &texid) const;
void SetCurrentBlock(int row, int col)
{
currentRow = row;
currentCol = col;
currentRow = row;
currentCol = col;
}
//bool dumpGeoTypicalTextures(trpgwImageHelper *ihelper);
typedef std::map<int,trpgTexture> TextureMapType;
TextureMapType *getTextureMap()
{
return &textureMap;
return &textureMap;
}
protected:
protected:
TextureMapType textureMap;
//These are used to initialize the row/col values for
@@ -1537,7 +1537,7 @@ TX_EXDECL class TX_CLDECL trpgTexTable : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgModel : public trpgReadWriteable
{
public:
public:
trpgModel(void);
trpgModel(const trpgModel &);
~trpgModel(void);
@@ -1591,7 +1591,7 @@ TX_EXDECL class TX_CLDECL trpgModel : public trpgReadWriteable
int operator == (const trpgModel &) const;
protected:
protected:
int type;
char *name;
trpgDiskRef diskRef;
@@ -1615,7 +1615,7 @@ TX_EXDECL class TX_CLDECL trpgModel : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgModelTable : public trpgReadWriteable
{
public:
public:
trpgModelTable(void);
~trpgModelTable(void);
@@ -1661,9 +1661,9 @@ TX_EXDECL class TX_CLDECL trpgModelTable : public trpgReadWriteable
typedef std::map<int,trpgModel> ModelMapType;
ModelMapType *GetModelMap()
{
return &modelsMap;
return &modelsMap;
}
protected:
protected:
ModelMapType modelsMap;
};
@@ -1679,7 +1679,7 @@ TX_EXDECL class TX_CLDECL trpgModelTable : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgTileTable : public trpgReadWriteable
{
public:
public:
// Tiles can be stored individually (External and ExternalSaved) or in grouped files (Local).
// ExternalSaved still have an entry in the table. In this case the addess data is not valid.
@@ -1722,23 +1722,23 @@ TX_EXDECL class TX_CLDECL trpgTileTable : public trpgReadWriteable
**/
void SetCurrentBlock(int row, int col, bool local)
{
currentRow = row;
currentCol = col;
localBlock = local;
currentRow = row;
currentCol = col;
localBlock = local;
}
protected:
protected:
TileMode mode;
class LodInfo
{
public:
int numX,numY;
// Tile addresses into external Appendable files
std::vector<trpgwAppAddress> addr;
// Elevation of the midpoint of each tile
// This is used for calculating bounding boxes
std::vector<float> elev_min;
std::vector<float> elev_max;
public:
int numX,numY;
// Tile addresses into external Appendable files
std::vector<trpgwAppAddress> addr;
// Elevation of the midpoint of each tile
// This is used for calculating bounding boxes
std::vector<float> elev_min;
std::vector<float> elev_max;
};
std::vector <LodInfo> lodInfo;
//These are used to initialize the row/col values for
@@ -1762,7 +1762,7 @@ TX_EXDECL class TX_CLDECL trpgTileTable : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgLocalMaterial : public trpgReadWriteable
{
public:
public:
trpgLocalMaterial(void);
~trpgLocalMaterial(void);
@@ -1787,9 +1787,9 @@ TX_EXDECL class TX_CLDECL trpgLocalMaterial : public trpgReadWriteable
class SubImageInfo
{
public:
int32 sx,sy; // Source (sx,sy) in pixels
int32 ex,ey; // Source (ex,ey) in pixels
int32 destWidth,destHeight; // Size of destination image (in pixels)
int32 sx,sy; // Source (sx,sy) in pixels
int32 ex,ey; // Source (ex,ey) in pixels
int32 destWidth,destHeight; // Size of destination image (in pixels)
};
// Set the sub image info (only for writers)
@@ -1838,7 +1838,7 @@ TX_EXDECL class TX_CLDECL trpgLocalMaterial : public trpgReadWriteable
// Prints this class to a print buffer
bool Print(trpgPrintBuffer &) const;
protected:
protected:
int32 baseMatTable,baseMat;
// These are valid for Global images
int32 sx,sy,ex,ey,destWidth,destHeight;
@@ -1897,7 +1897,7 @@ TX_EXDECL class TX_CLDECL trpgLocalMaterial : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgTileHeader : public trpgReadWriteable
{
public:
public:
trpgTileHeader(void);
~trpgTileHeader(void);
/* Add the given material reference to this tile if it's not already there.
@@ -1962,15 +1962,15 @@ TX_EXDECL class TX_CLDECL trpgTileHeader : public trpgReadWriteable
bool Print(trpgPrintBuffer &) const;
void SetBlockNo(int row, int col)
{
this->row = row;
this->col = col;
this->row = row;
this->col = col;
}
void GetBlockNo(int &row, int &col)
{
row = this->row;
col = this->col;
row = this->row;
col = this->col;
}
protected:
protected:
std::vector<int> matList;
std::vector<int> modelList;
std::vector<trpgLocalMaterial> locMats;
@@ -1989,7 +1989,7 @@ TX_EXDECL class TX_CLDECL trpgTileHeader : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgColorInfo
{
public:
public:
trpgColorInfo(void);
~trpgColorInfo(void);
@@ -2023,7 +2023,7 @@ TX_EXDECL class TX_CLDECL trpgColorInfo
*/
TX_EXDECL class TX_CLDECL trpgTexData
{
public:
public:
trpgTexData(void);
~trpgTexData(void);
// This should always be set to PerVertex
@@ -2075,7 +2075,7 @@ TX_EXDECL class TX_CLDECL trpgTexData
*/
TX_EXDECL class TX_CLDECL trpgGeometry : public trpgReadWriteable
{
public:
public:
trpgGeometry(void);
~trpgGeometry(void);
typedef enum {Points,LineStrips,LineLoops,Lines,Polygons,TriStrips,
@@ -2295,7 +2295,7 @@ TX_EXDECL class TX_CLDECL trpgGeometry : public trpgReadWriteable
// Prints this class to a print buffer
bool Print(trpgPrintBuffer &) const;
protected:
protected:
int primType;
int numPrim;
std::vector<int> primLength;
@@ -2339,7 +2339,7 @@ TX_EXDECL class TX_CLDECL trpgGeometry : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgGroup : public trpgReadWriteable
{
public:
public:
trpgGroup(void);
virtual ~trpgGroup(void);
// Resets the contents back to empty
@@ -2372,7 +2372,7 @@ TX_EXDECL class TX_CLDECL trpgGroup : public trpgReadWriteable
// Prints this class to a print buffer
bool Print(trpgPrintBuffer &) const;
protected:
protected:
int id;
int numChild;
char* name;
@@ -2440,7 +2440,7 @@ TX_EXDECL class TX_CLDECL trpgGroup : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgAttach : public trpgGroup
{
public:
public:
trpgAttach(void);
~trpgAttach(void);
// Resets the contents back to empty
@@ -2469,13 +2469,13 @@ TX_EXDECL class TX_CLDECL trpgAttach : public trpgGroup
// Prints this class to a print buffer
bool Print(trpgPrintBuffer &) const;
protected:
protected:
int parentID,childPos;
};
TX_EXDECL class TX_CLDECL trpgChildRef : public trpgReadWriteable
{
public:
public:
trpgChildRef();
~trpgChildRef();
// Resets the contents back to empty
@@ -2505,7 +2505,7 @@ TX_EXDECL class TX_CLDECL trpgChildRef : public trpgReadWriteable
// Prints this class to a print buffer
bool Print(trpgPrintBuffer &) const;
protected:
protected:
// Grid Location
int x,y,lod;
// File Location
@@ -2532,7 +2532,7 @@ TX_EXDECL class TX_CLDECL trpgChildRef : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgBillboard : public trpgGroup
{
public:
public:
trpgBillboard(void);
~trpgBillboard(void);
enum {Individual,Group};
@@ -2578,7 +2578,7 @@ TX_EXDECL class TX_CLDECL trpgBillboard : public trpgGroup
bool Read(trpgReadBuffer &);
// Prints this class to a print buffer
bool Print(trpgPrintBuffer &) const;
protected:
protected:
int type;
int mode;
trpg3dPoint center;
@@ -2625,7 +2625,7 @@ TX_EXDECL class TX_CLDECL trpgBillboard : public trpgGroup
*/
TX_EXDECL class TX_CLDECL trpgLod : public trpgReadWriteable
{
public:
public:
trpgLod(void);
~trpgLod(void);
// Set the calculated center
@@ -2669,7 +2669,7 @@ TX_EXDECL class TX_CLDECL trpgLod : public trpgReadWriteable
// Prints this class to a print buffer
bool Print(trpgPrintBuffer &) const;
protected:
protected:
int numRange;
double switchIn,switchOut,width;
trpg3dPoint center;
@@ -2699,7 +2699,7 @@ TX_EXDECL class TX_CLDECL trpgLod : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgLayer : public trpgGroup
{
public:
public:
trpgLayer(void);
~trpgLayer(void);
// Writes this class to a write buffer
@@ -2711,7 +2711,7 @@ TX_EXDECL class TX_CLDECL trpgLayer : public trpgGroup
// Resets the contents back to empty
void Reset(void);
protected:
protected:
};
/* This is pretty much a standard 4x4 static transform. It has a matrix
@@ -2721,7 +2721,7 @@ TX_EXDECL class TX_CLDECL trpgLayer : public trpgGroup
*/
TX_EXDECL class TX_CLDECL trpgTransform : public trpgGroup
{
public:
public:
trpgTransform(void);
~trpgTransform(void);
@@ -2740,7 +2740,7 @@ TX_EXDECL class TX_CLDECL trpgTransform : public trpgGroup
// Resets the contents back to empty
void Reset(void);
protected:
protected:
float64 m[4][4];
};
@@ -2765,7 +2765,7 @@ TX_EXDECL class TX_CLDECL trpgTransform : public trpgGroup
*/
TX_EXDECL class TX_CLDECL trpgModelRef : public trpgReadWriteable
{
public:
public:
trpgModelRef(void);
~trpgModelRef(void);
// Set the model ID. Must come from a trpgModelTable
@@ -2787,7 +2787,7 @@ TX_EXDECL class TX_CLDECL trpgModelRef : public trpgReadWriteable
// Resets the contents back to empty
void Reset(void);
protected:
protected:
int modelRef;
float64 m[4][4];
};
@@ -2800,7 +2800,7 @@ TX_EXDECL class TX_CLDECL trpgModelRef : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgTextStyle : public trpgReadWriteable
{
public:
public:
trpgTextStyle(void);
~trpgTextStyle(void);
@@ -2848,7 +2848,7 @@ TX_EXDECL class TX_CLDECL trpgTextStyle : public trpgReadWriteable
// Return object validity
bool isValid(void) const;
protected:
protected:
std::string font;
bool bold,italic,underline;
float32 characterSize;
@@ -2861,7 +2861,7 @@ TX_EXDECL class TX_CLDECL trpgTextStyle : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgTextStyleTable : public trpgReadWriteable
{
public:
public:
trpgTextStyleTable(void);
~trpgTextStyleTable(void);
@@ -2889,7 +2889,7 @@ TX_EXDECL class TX_CLDECL trpgTextStyleTable : public trpgReadWriteable
bool Print(trpgPrintBuffer &) const;
typedef std::map<int,trpgTextStyle> StyleMapType;
const StyleMapType *getStyleMap()const { return &styleMap; }
protected:
protected:
//std::vector<trpgTextStyle> styles;
StyleMapType styleMap;
@@ -2903,7 +2903,7 @@ TX_EXDECL class TX_CLDECL trpgTextStyleTable : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgSupportStyle : public trpgReadWriteable
{
public:
public:
trpgSupportStyle(void);
~trpgSupportStyle(void);
@@ -2939,7 +2939,7 @@ TX_EXDECL class TX_CLDECL trpgSupportStyle : public trpgReadWriteable
// Return object validity
bool isValid(void) const;
protected:
protected:
SupportType type;
int matId;
};
@@ -2950,7 +2950,7 @@ TX_EXDECL class TX_CLDECL trpgSupportStyle : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgSupportStyleTable : public trpgReadWriteable
{
public:
public:
trpgSupportStyleTable(void);
~trpgSupportStyleTable(void);
@@ -2977,7 +2977,7 @@ TX_EXDECL class TX_CLDECL trpgSupportStyleTable : public trpgReadWriteable
// Print this class to a print buffer
bool Print(trpgPrintBuffer &) const;
protected:
protected:
//std::vector<trpgSupportStyle> styles;
typedef std::map<int,trpgSupportStyle> SupportStyleMapType;
SupportStyleMapType supportStyleMap;
@@ -2991,7 +2991,7 @@ TX_EXDECL class TX_CLDECL trpgSupportStyleTable : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgLabelProperty : public trpgReadWriteable
{
public:
public:
trpgLabelProperty(void);
~trpgLabelProperty(void);
@@ -3032,7 +3032,7 @@ TX_EXDECL class TX_CLDECL trpgLabelProperty : public trpgReadWriteable
// Return object validity
bool isValid(void) const;
protected:
protected:
int fontId;
int supportId;
LabelType type;
@@ -3044,7 +3044,7 @@ TX_EXDECL class TX_CLDECL trpgLabelProperty : public trpgReadWriteable
*/
TX_EXDECL class TX_CLDECL trpgLabelPropertyTable : public trpgReadWriteable
{
public:
public:
trpgLabelPropertyTable(void);
~trpgLabelPropertyTable(void);
@@ -3072,7 +3072,7 @@ TX_EXDECL class TX_CLDECL trpgLabelPropertyTable : public trpgReadWriteable
// Print this class to a print buffer
bool Print(trpgPrintBuffer &) const;
protected:
protected:
//std::vector<trpgLabelProperty> properties;
typedef std::map<int,trpgLabelProperty> LabelPropertyMapType;
LabelPropertyMapType labelPropertyMap;
@@ -3085,7 +3085,7 @@ TX_EXDECL class TX_CLDECL trpgLabelPropertyTable : public trpgReadWriteable
over a specific building in a visual database.
*/
TX_EXDECL class TX_CLDECL trpgLabel : public trpgReadWriteable {
public:
public:
trpgLabel(void);
~trpgLabel(void);
@@ -3176,7 +3176,7 @@ TX_EXDECL class TX_CLDECL trpgLabel : public trpgReadWriteable {
// Resets the contents back to empty
void Reset(void);
protected:
protected:
int propertyId;
std::string text; // Actual label text. May contain formatting
AlignmentType alignment;

File diff suppressed because it is too large Load Diff

View File

@@ -43,7 +43,7 @@ struct TileLocationInfo
TX_EXDECL class TX_CLDECL trpgManagedTile
{
friend class trpgPageManager;
public:
public:
trpgManagedTile(void);
// Called to clear any info out of this tile
@@ -136,7 +136,7 @@ TX_EXDECL class TX_CLDECL trpgManagedTile
// Children info, will throw exception if child index is out of bound
unsigned int GetNbChildren() const
{
return (unsigned int)childLocationInfo.size();
return (unsigned int)childLocationInfo.size();
}
bool SetChildLocationInfo(int childIdx, int x, int y, const trpgwAppAddress& addr);
bool SetChildLocationInfo(int childIdx, const TileLocationInfo& info);
@@ -145,7 +145,7 @@ TX_EXDECL class TX_CLDECL trpgManagedTile
const trpgwAppAddress& GetChildTileAddress(int childIdx) const;
protected:
protected:
// Set if a tile is currently loaded
bool isLoaded;
// Tile location info
@@ -178,7 +178,7 @@ TX_EXDECL class TX_CLDECL trpgManagedTile
*/
TX_EXDECL class TX_CLDECL trpgPageManager
{
public:
public:
trpgPageManager(void);
virtual ~trpgPageManager(void);
@@ -272,156 +272,156 @@ TX_EXDECL class TX_CLDECL trpgPageManager
detail as related to paging.
*/
TX_EXDECL class TX_CLDECL LodPageInfo {
friend class trpgPageManager;
friend class trpgPageManager;
public:
LodPageInfo(void);
virtual ~LodPageInfo(void);
LodPageInfo(void);
virtual ~LodPageInfo(void);
/* Initializes the class with its current LOD.
It figures out all the rest.
*/
virtual bool Init(trpgr_Archive *, int myLod, double scale, int freeListDivider = 1);
/* Initializes the class with its current LOD.
It figures out all the rest.
*/
virtual bool Init(trpgr_Archive *, int myLod, double scale, int freeListDivider = 1);
/* Reset the location. This forces a recalculation
of what to load and unload if the cell has changed
or if this is the first SetLocation.
The location passed in must be relative to the southwest
corner of the TerraPage archive.
*/
virtual bool SetLocation(trpg2dPoint &);
/* Reset the location. This forces a recalculation
of what to load and unload if the cell has changed
or if this is the first SetLocation.
The location passed in must be relative to the southwest
corner of the TerraPage archive.
*/
virtual bool SetLocation(trpg2dPoint &);
// Return the next tile to load for this terrain lod
virtual trpgManagedTile *GetNextLoad(void);
// Acknowledge the load. Move the active tile to the
// loaded list.
virtual void AckLoad();
// Return the next tile to load for this terrain lod
virtual trpgManagedTile *GetNextLoad(void);
// Acknowledge the load. Move the active tile to the
// loaded list.
virtual void AckLoad();
// Get the lsit of
//bool GetLoadedTile
// Get the lsit of
//bool GetLoadedTile
// Return the next tile to unload for this terrain lod
virtual trpgManagedTile *GetNextUnload(void);
// Acknowledge the unload. Move the active tile to the
// free list.
virtual void AckUnload(void);
// Called to stop paging. Everything active is dumped on
// the unload list.
virtual bool Stop(void);
// Print current status and content information
virtual void Print(trpgPrintBuffer &);
// Return the next tile to unload for this terrain lod
virtual trpgManagedTile *GetNextUnload(void);
// Acknowledge the unload. Move the active tile to the
// free list.
virtual void AckUnload(void);
// Called to stop paging. Everything active is dumped on
// the unload list.
virtual bool Stop(void);
// Print current status and content information
virtual void Print(trpgPrintBuffer &);
const trpg2iPoint& GetLodSize() const
{
return lodSize;
}
const trpg2iPoint& GetLodSize() const
{
return lodSize;
}
int GetLod() const
{
return lod;
}
int GetLod() const
{
return lod;
}
double GetPageDistance() const
{
return pageDist;
}
double GetPageDistance() const
{
return pageDist;
}
const trpg2dPoint& GetCellSize() const
{
return cellSize;
}
const trpg2dPoint& GetCellSize() const
{
return cellSize;
}
// The unit are cellSize
const trpg2iPoint& GetAreaOfInterest() const
{
return aoiSize;
}
// The unit are cellSize
const trpg2iPoint& GetAreaOfInterest() const
{
return aoiSize;
}
// The middle of this cell correspond to our paging
// location
const trpg2iPoint& GetCellPagingLocation() const
{
return cell;
}
// The middle of this cell correspond to our paging
// location
const trpg2iPoint& GetCellPagingLocation() const
{
return cell;
}
protected:
virtual void Clean(void);
virtual void Update(void);
virtual void Clean(void);
virtual void Update(void);
// Add to the load list the given tile if it is within the proper
// bound
bool AddToLoadList(int x, int y, const trpgwAppAddress& addr);
// Add to the load list the given tile if it is within the proper
// bound
bool AddToLoadList(int x, int y, const trpgwAppAddress& addr);
// Add the children of the given parent list
// to the load list if it it not already loaded
// or if it is not already in the list
void AddChildrenToLoadList(std::vector<trpgManagedTile*>& parentList);
// Add the children of the given parent list
// to the load list if it it not already loaded
// or if it is not already in the list
void AddChildrenToLoadList(std::vector<trpgManagedTile*>& parentList);
// Check if the given tile is within the area we care about
bool isWithin(trpgManagedTile *,trpg2iPoint &sw,trpg2iPoint &ne);
// Check if the given tile is within the area we care about
bool isWithin(trpgManagedTile *,trpg2iPoint &sw,trpg2iPoint &ne);
// Get the list of currently loaded tiles that fall within
// the region calculated from the given paging distance.
void GetLoadedTileWithin(double pagingDistance, std::vector<trpgManagedTile*>& tileList);
// Get the list of currently loaded tiles that fall within
// the region calculated from the given paging distance.
void GetLoadedTileWithin(double pagingDistance, std::vector<trpgManagedTile*>& tileList);
bool valid;
bool valid;
// Terrain LOD we're responsible for
int lod;
// Terrain LOD we're responsible for
int lod;
/* Adjusted (e.g. paranoid) distance outward from
which to page this terrain LOD. This takes into
account the distance in the header as well as
any factor the user may have added.
*/
double pageDist;
/* Adjusted (e.g. paranoid) distance outward from
which to page this terrain LOD. This takes into
account the distance in the header as well as
any factor the user may have added.
*/
double pageDist;
/* Max tiles we could have loaded in at any given time.
This is just a guess because it's up to the user
to load (and, more importantly) unload.
*/
int maxNumTiles;
/* Max tiles we could have loaded in at any given time.
This is just a guess because it's up to the user
to load (and, more importantly) unload.
*/
int maxNumTiles;
// Size of a single cell. Copied from the archive.
trpg2dPoint cellSize;
// Size of a single cell. Copied from the archive.
trpg2dPoint cellSize;
// Number of tiles (cells) in each direction
trpg2iPoint lodSize;
// Number of tiles (cells) in each direction
trpg2iPoint lodSize;
/* Area of interest size in cells
This is a linear distance "ahead" of the center cell.
*/
trpg2iPoint aoiSize;
/* Area of interest size in cells
This is a linear distance "ahead" of the center cell.
*/
trpg2iPoint aoiSize;
/* Our effective paging location sits at the middle
of this cell. We don't recalculate unless the
cell changes. */
trpg2iPoint cell;
/* Our effective paging location sits at the middle
of this cell. We don't recalculate unless the
cell changes. */
trpg2iPoint cell;
// List of tiles to load
std::deque<trpgManagedTile *> load;
// List of tiles to unload
std::deque<trpgManagedTile *> unload;
// List of currently loaded tiles
std::deque<trpgManagedTile *> current;
// List of tiles to load
std::deque<trpgManagedTile *> load;
// List of tiles to unload
std::deque<trpgManagedTile *> unload;
// List of currently loaded tiles
std::deque<trpgManagedTile *> current;
// Used by Update. Here because we want to avoid memory allocs, if possible.
std::vector<bool> tmpCurrent;
// Used by Update. Here because we want to avoid memory allocs, if possible.
std::vector<bool> tmpCurrent;
// Set if a load is in progress
// Load w/o ACK
bool activeLoad;
// Set if an unload is in progress
// Unload w/o ACK
bool activeUnload;
// Set if a load is in progress
// Load w/o ACK
bool activeLoad;
// Set if an unload is in progress
// Unload w/o ACK
bool activeUnload;
// List of tile pointers we can reuse
std::deque<trpgManagedTile *> freeList;
// List of tile pointers we can reuse
std::deque<trpgManagedTile *> freeList;
// TerraPage version
int majorVersion, minorVersion;
// TerraPage version
int majorVersion, minorVersion;
const trpgTileTable *tileTable;
const trpgTileTable *tileTable;
};
// Per terrain lod paging information

File diff suppressed because it is too large Load Diff

View File

@@ -248,18 +248,19 @@ bool trpgModel::Read(trpgReadBuffer &buf, bool hasHandle)
// TerraPage 2.2 will store the unique handle after the type
// we use a different token, so this is backwards compatible.
if(hasHandle) {
int32 tempHandle;
if(buf.Get(tempHandle))
{
handle = tempHandle;
}
else
{
int32 tempHandle;
if(buf.Get(tempHandle))
{
handle = tempHandle;
}
else
{
handle = -1;
}
}
}
else
handle = -1;
if (type == Local) {
// two possibilities:
// name, diskRef, useCount
@@ -304,6 +305,7 @@ bool trpgModel::Read(trpgReadBuffer &buf, bool hasHandle)
trpgModelTable::trpgModelTable()
{
}
trpgModelTable::~trpgModelTable()
{
}

View File

@@ -59,7 +59,7 @@ void trpgr_Token::init(int in_tok,trpgr_Callback *in_cb,bool in_dest)
void trpgr_Token::Destruct()
{
if (cb && destroy)
delete cb;
delete cb;
cb = NULL;
destroy = true;
}
@@ -119,17 +119,17 @@ const trpgr_Callback *trpgr_Parser::GetCallback(trpgToken tok) const
{
tok_map::const_iterator iter = tokenMap.find(tok);
if(iter != tokenMap.end())
return iter->second.cb;
return iter->second.cb;
else
return 0;
return 0;
}
trpgr_Callback *trpgr_Parser::GetCallback(trpgToken tok)
{
tok_map::iterator iter = tokenMap.find(tok);
if(iter != tokenMap.end())
return iter->second.cb;
return iter->second.cb;
else
return 0;
return 0;
}
@@ -154,7 +154,7 @@ void trpgr_Parser::SetDefaultCallback(trpgr_Callback *cb,bool in_dest)
bool trpgr_Parser::TokenIsValid(trpgToken tok)
{
if (tok < 0)
return false;
return false;
return true;
}
@@ -170,61 +170,61 @@ bool trpgr_Parser::Parse(trpgReadBuffer &buf)
try
{
while (!buf.isEmpty())
{
/* We're expecting the following
Token (int32)
Length (int32)
Data (variable)
*/
trpgToken tok;
int32 len;
if (!buf.Get(tok)) throw 1;
// Push and Pop are special - no data
if (tok != TRPG_PUSH && tok != TRPG_POP)
while (!buf.isEmpty())
{
if (!buf.Get(len)) throw 1;
if (!TokenIsValid(tok)) throw 1;
if (len < 0) throw 1;
// Limit what we're reading to the length of this
buf.PushLimit(len);
}
/* We're expecting the following
Token (int32)
Length (int32)
Data (variable)
*/
trpgToken tok;
int32 len;
if (!buf.Get(tok)) throw 1;
// Push and Pop are special - no data
if (tok != TRPG_PUSH && tok != TRPG_POP)
{
if (!buf.Get(len)) throw 1;
if (!TokenIsValid(tok)) throw 1;
if (len < 0) throw 1;
// Limit what we're reading to the length of this
buf.PushLimit(len);
}
// Call our token handler for this one
try
{
const trpgr_Token *tcb = NULL;
tok_map::const_iterator p = tokenMap.find(tok);
if (p != tokenMap.end())
tcb = &(*p).second;
if (!tcb)
// No such token, call the default
tcb = &defCb;
// Call our token handler for this one
try
{
const trpgr_Token *tcb = NULL;
tok_map::const_iterator p = tokenMap.find(tok);
if (p != tokenMap.end())
tcb = &(*p).second;
if (!tcb)
// No such token, call the default
tcb = &defCb;
// Run the callback
if (tcb->cb)
{
void *ret = tcb->cb->Parse(tok,buf);
// Note: Do something with the return value
lastObject = ret;
// Run the callback
if (tcb->cb)
{
void *ret = tcb->cb->Parse(tok,buf);
// Note: Do something with the return value
lastObject = ret;
}
}
catch (...)
{
// Don't want to screw up the limit stack
}
// No limit to worry about with push and pop
if (tok != TRPG_PUSH && tok != TRPG_POP)
{
buf.SkipToLimit();
buf.PopLimit();
}
}
}
catch (...)
{
// Don't want to screw up the limit stack
}
// No limit to worry about with push and pop
if (tok != TRPG_PUSH && tok != TRPG_POP)
{
buf.SkipToLimit();
buf.PopLimit();
}
}
}
catch (...)
{
// Failed to parse.
ret = false;
// Failed to parse.
ret = false;
}
return ret;
@@ -243,10 +243,10 @@ public:
void *Parse(trpgToken /*tok*/,trpgReadBuffer& /*buf*/)
{
// Call the start children callback
parse->StartChildren(parse->lastObject);
parse->parents.push_back(parse->lastObject);
return (void *)1;
// Call the start children callback
parse->StartChildren(parse->lastObject);
parse->parents.push_back(parse->lastObject);
return (void *)1;
}
protected:
trpgSceneParser *parse;
@@ -260,15 +260,15 @@ public:
{ parse = in_parse; };
void *Parse(trpgToken /*tok*/,trpgReadBuffer& /*buf*/)
{
// Make sure we don't have an extra pop
if (parse->parents.size() == 0)
// Note: let someone know about the extra pop
return NULL;
// Call the end children callback
int len = parse->parents.size();
parse->EndChildren(parse->parents[len-1]);
parse->parents.resize(len-1);
return (void *)1;
// Make sure we don't have an extra pop
if (parse->parents.size() == 0)
// Note: let someone know about the extra pop
return NULL;
// Call the end children callback
int len = parse->parents.size();
parse->EndChildren(parse->parents[len-1]);
parse->parents.resize(len-1);
return (void *)1;
}
protected:
trpgSceneParser *parse;
@@ -283,8 +283,8 @@ public:
trpgSceneHelperDefault(trpgSceneParser *in_parse) { parse = in_parse; }
void *Parse(trpgToken /*tok*/,trpgReadBuffer& /*buf*/)
{
// Absorb it quietly
return (void *)1;
// Absorb it quietly
return (void *)1;
}
protected:
trpgSceneParser *parse;

View File

@@ -41,7 +41,7 @@ public:
virtual void IncreaseIndent(int amount=1);
// Decreases the current indentation by the amount given (defaults to one)
virtual void DecreaseIndent(int amount=1);
protected:
protected:
void updateIndent(void);
int curIndent;
char indentStr[200];
@@ -51,7 +51,7 @@ public:
debugging output to a file.
*/
TX_EXDECL class TX_CLDECL trpgFilePrintBuffer : public trpgPrintBuffer {
public:
public:
// This class can be constructed with either a FILE pointer or a file name
trpgFilePrintBuffer(FILE *);
trpgFilePrintBuffer(char *);
@@ -62,7 +62,7 @@ TX_EXDECL class TX_CLDECL trpgFilePrintBuffer : public trpgPrintBuffer {
// For a file printer buffer, this writes a string out to a file
bool prnLine(const char *str = NULL);
protected:
protected:
bool valid;
bool isMine;
FILE *fp;
@@ -75,7 +75,7 @@ TX_EXDECL class TX_CLDECL trpgFilePrintBuffer : public trpgPrintBuffer {
*/
TX_EXDECL class TX_CLDECL trpgPrintGraphParser : public trpgSceneParser
{
public:
public:
trpgPrintGraphParser(trpgr_Archive *,trpgrImageHelper *,trpgPrintBuffer *);
virtual ~trpgPrintGraphParser(void) { };
@@ -96,15 +96,15 @@ TX_EXDECL class TX_CLDECL trpgPrintGraphParser : public trpgSceneParser
class ReadHelper : public trpgr_Callback
{
public:
// typedef std::vector<const trpgChildRef> ChildRefList;
// The const in the template parameter was removed because it causes GCC to
// freak out. I am of the opinion that const doesn't make sense in a template
// parameter for std::vector anyway... const prevents you from changing the
// value, so what exactly is the point? How does one add entries to the vector
// without giving them a value? -ADS
typedef std::vector<trpgChildRef> ChildRefList;
// typedef std::vector<const trpgChildRef> ChildRefList;
// The const in the template parameter was removed because it causes GCC to
// freak out. I am of the opinion that const doesn't make sense in a template
// parameter for std::vector anyway... const prevents you from changing the
// value, so what exactly is the point? How does one add entries to the vector
// without giving them a value? -ADS
typedef std::vector<trpgChildRef> ChildRefList;
ReadHelper(trpgPrintGraphParser *inPG,trpgPrintBuffer *inBuf): pBuf(inBuf), parse(inPG) {}
ReadHelper(trpgPrintGraphParser *inPG,trpgPrintBuffer *inBuf): pBuf(inBuf), parse(inPG) {}
~ReadHelper() { Reset();}
void *Parse(trpgToken,trpgReadBuffer &buf);
@@ -121,15 +121,13 @@ TX_EXDECL class TX_CLDECL trpgPrintGraphParser : public trpgSceneParser
private:
ChildRefList childRefList;
};
// Fetch the archive associated with this print
trpgr_Archive *GetArchive() {return archive; };
trpgrImageHelper *GetImageHelp() {return imageHelp; };
protected:
protected:
bool StartChildren(void *);
bool EndChildren(void *);

View File

@@ -140,7 +140,7 @@ bool trpgRange::operator == (const trpgRange &in) const
return false;
} else {
if ((category && !in.category) ||
(!category && in.category) )
(!category && in.category) )
return false;
}
@@ -192,13 +192,13 @@ bool trpgRange::Read(trpgReadBuffer &buf)
// Read the handle if we can..
try {
int32 tempHandle;
int32 tempHandle;
if(buf.Get(tempHandle))
{
handle = tempHandle;
}
else
{
{
handle = tempHandle;
}
else
{
handle = -1;
}
}
@@ -245,7 +245,7 @@ bool trpgRangeTable::GetRange(int id,trpgRange &ret) const
return false;
RangeMapType::const_iterator itr = rangeMap.find(id);
if(itr == rangeMap.end()) {
if(itr == rangeMap.end()) {
return false;
}
ret = itr->second;

View File

@@ -1057,17 +1057,17 @@ void trpgwGeomHelper::EndPolygon()
break;
}
ResetPolygon();
ResetPolygon();
}
// Clean out the polygon arrays
void trpgwGeomHelper::ResetPolygon()
{
tmpTex.resize(0);
matPoly.resize(0);
polyTex.resize(0);
polyNorm.resize(0);
polyVert.resize(0);
tmpTex.resize(0);
matPoly.resize(0);
polyTex.resize(0);
polyNorm.resize(0);
polyVert.resize(0);
}
// Set the current color
@@ -1081,28 +1081,28 @@ void trpgwGeomHelper::SetColor(trpgColor& /*col*/)
// Note: Required
void trpgwGeomHelper::SetTexCoord(trpg2dPoint &pt)
{
tmpTex.resize(0);
tmpTex.push_back(pt);
tmpTex.resize(0);
tmpTex.push_back(pt);
}
void trpgwGeomHelper::AddTexCoord(trpg2dPoint &pt)
{
tmpTex.push_back(pt);
tmpTex.push_back(pt);
}
// Set the current normal
// Note: required
void trpgwGeomHelper::SetNormal(trpg3dPoint &pt)
{
tmpNorm = pt;
tmpNorm = pt;
}
// Set the current material
// Note: required
void trpgwGeomHelper::SetMaterial(int32 imat)
{
matPoly.resize(0);
matPoly.push_back(imat);
matPoly.resize(0);
matPoly.push_back(imat);
}
void trpgwGeomHelper::AddMaterial(int32 imat)
@@ -1135,7 +1135,7 @@ void trpgwGeomHelper::AddVertex(trpg3dPoint &pt)
}
else
#endif
polyVert.push_back(pt);
polyVert.push_back(pt);
// Update min/max
zmin = MIN(pt.z,zmin);

View File

@@ -342,7 +342,7 @@ protected:
std::vector<TileFile> tileFiles;
std::vector<TileFileEntry> externalTiles;
std::vector<TileFileEntry> externalTiles;
int maxTileFileLen;