Esempio n. 1
0
void trpgPageManager::Print(trpgPrintBuffer &buf)
{
    char line[1024];
    sprintf(line,"Paging pos = (%f,%f),  scale = %f",pagePt.x,pagePt.y,scale);  buf.prnLine(line);
    buf.prnLine("Terrain LODs:");

    for (unsigned int i=0;i<pageInfo.size();i++) {
        sprintf(line,"----Terrain lod %d---",i);  buf.prnLine(line);
            buf.IncreaseIndent();
        pageInfo[i].Print(buf);
        buf.DecreaseIndent();
    }
}
Esempio n. 2
0
void trpgPageManager::LodPageInfo::Print(trpgPrintBuffer &buf)
{
    char line[1024];
    unsigned int i;

    sprintf(line,"lod = %d,  valid = %s",lod,(valid ? "yes" : "no")); buf.prnLine(line);
    sprintf(line,"pageDist = %f,  maxNumTiles = %d",pageDist,maxNumTiles);  buf.prnLine(line);
    sprintf(line,"cellSize = (%f,%f)",cellSize.x,cellSize.y);  buf.prnLine(line);
    sprintf(line,"cell = (%d,%d),  aoiSize = (%d,%d),  lodSize = (%d,%d)",cell.x,cell.y,aoiSize.x,aoiSize.y,lodSize.x,lodSize.y);  buf.prnLine(line);

    sprintf(line,"Loads:  (activeLoad = %s)",(activeLoad ? "yes" : "no"));  buf.prnLine(line);
    buf.IncreaseIndent();
    for (i=0;i<load.size();i++)
        if (load[i])
            load[i]->Print(buf);
    buf.DecreaseIndent();

    sprintf(line,"Unloads:  (activeUnload = %s)",(activeUnload ? "yes" : "no"));  buf.prnLine(line);
    buf.IncreaseIndent();
    for (i=0;i<unload.size();i++)
        if (unload[i])
            unload[i]->Print(buf);
    buf.DecreaseIndent();

    buf.prnLine("Currently loaded:");
    buf.IncreaseIndent();
    for (i=0;i<current.size();i++)
        if (current[i])
            current[i]->Print(buf);
    buf.DecreaseIndent();

    sprintf(line,"Free list size = %d", (int)freeList.size());  buf.prnLine(line);
}
Esempio n. 3
0
bool trpgPrintArchive(trpgr_Archive *archive,trpgPrintBuffer &pBuf,int flags)
{
    char ls[1024];

    if (!archive->isValid())  return false;

    pBuf.prnLine("====Header Structures====");

    // Print out the header portion
    archive->GetHeader()->Print(pBuf);
    archive->GetMaterialTable()->Print(pBuf);
    archive->GetTexTable()->Print(pBuf);
    archive->GetModelTable()->Print(pBuf);
    archive->GetTileTable()->Print(pBuf);
    archive->GetLightTable()->Print(pBuf);
    archive->GetRangeTable()->Print(pBuf);
    archive->GetTextStyleTable()->Print(pBuf);
    archive->GetSupportStyleTable()->Print(pBuf);
    archive->GetLabelPropertyTable()->Print(pBuf);
    pBuf.prnLine();

    // Read the local images and do the math for the templates

    // Now do the tiles
    if (!archive->isValid())  return false;

   int majorVersion, minorVersion;
   archive->GetHeader()->GetVersion(majorVersion, minorVersion);

    // Parser that prints out a tile scene graph
    trpgrImageHelper* imageHelp=archive->GetNewRImageHelper(archive->GetEndian(),archive->getDir(),
            *archive->GetMaterialTable(),*archive->GetTexTable());

    trpgPrintGraphParser parser(archive,imageHelp,&pBuf);

    pBuf.prnLine("====Tile Data====");
    int nl,x,y;
    trpgMemReadBuffer buf(archive->GetEndian());
    // Iterate over the terrain lods
    int numLod;
    archive->GetHeader()->GetNumLods(numLod);
    trpg2iPoint tileSize;
   if(majorVersion == 2 && minorVersion >= 1)
   {
      // Version 2.1
      // Because of variable lod support in version 2.1 and over, we can
      // no longer suppose that all lod level are all populated with tiles
      // in all of the gaming area. We have to parse the parent to know that.
      // Also the tile table only contains lod 0 tiles so we can no longer access
      // the tile directly from its grid location. So we have to traverse.
      trpg2iPoint blockTileSize;
      if(archive->GetHeader()->GetLodSize(0,blockTileSize)) {
        for(x = 0; x < blockTileSize.x; x++)
            for( y = 0; y < blockTileSize.y; y++)
                if (archive->ReadTile(x,y,0,buf))
                printBuf(0, x, y, archive, parser, buf, pBuf);

      }

   }
   else
   {
       for (nl=0;nl<numLod;nl++) {
           archive->GetHeader()->GetLodSize(nl,tileSize);
           // Iterate over the tiles
           for (x=tileSize.x-1;x>=0;x--)
               for (y=0;y<tileSize.y;y++) {
                   sprintf(ls,"Tile (lod) (x,y) = (%d) (%d,%d)",nl,x,y);
                   pBuf.prnLine(ls);
                   if (archive->ReadTile(x,y,nl,buf)) {
                       if (flags & TRPGPRN_BODY) {
                          pBuf.IncreaseIndent();
                          // Parse it (also prints it
                          if (!parser.Parse(buf))
                          {
                              char errString[80];
                              sprintf(errString, "**** Warning: tile anomaly detected: (%d) (%d,%d) ****",nl,x,y);
                              // send it both ways so it's easier to spot
                              pBuf.prnLine(errString);
                              fprintf(stderr,"%s\n",errString);
                          }
                          pBuf.DecreaseIndent();
                       }
                   } else
                       pBuf.prnLine("  Couldn't read tile.");
               }
       }
   }

    return true;
}
Esempio n. 4
0
void trpgManagedTile::Print(trpgPrintBuffer &buf)
{
    char line[1024];
    sprintf(line,"x = %d, y = %d, lod = %d",location.x, location.y, location.lod);  buf.prnLine(line);
    // Note: Should print the rest too, probably.
}