Ejemplo n.º 1
0
//-----------------------------------------------------------------
//  Import elevation file
//  Elevation are processed QGT per QGT
//  The array Spot is used to store for each detail tile the
//  spot elevation:
//  Type 0:   This is a unic elevation shared between sevral tiles
//  Type 1:   This is the unic center elevation for the detail tile
//  Type 2:   Elevation is an array of integers of dimension dim 
//-----------------------------------------------------------------
//  1) The elevations found in the database are loaded
//  2) The elevations from the BT file for this QGT are loaded
//     by => GetRegionElevation
//  3) New elevation overwrite those from the database =>Overwrite
//  4) Rectabgular region of same type are computed => CreateAreas
//-----------------------------------------------------------------
void CImport::ImportElevations(char *fn)
{ REGION_REC reg;
  reg.qgt = 0;
  CBtParser btp(fn);
  Dim = btp.Resolution();
  TRACE("=====BUILDING REGIONS ==========================");
  while (  btp.GetQgtKey(reg.qtx,reg.qtz))
  { reg.key = QGTKEY(reg.qtx,reg.qtz);
    TRACE("---QGT key=%010d",reg.key);
   //--- Load existing elevations from database ----
    globals->sqm->GetQgtElevation(reg,ELVtoSlots);
    btp.GetRegionElevation(reg);
    Overwrite(reg);
    //--- Create areas ----------------------------
    CreateAreas();
    area.qgt = 0;
    area.qtx = reg.qtx;
    area.qtz = reg.qtz;
    globals->sqm->DeleteElevation(reg.key);
    WriteRegions(1);
    //----Reset all resources ---------------------
    Reset();
    delete [] reg.data;
    reg.data = 0;
    btp.NextQgtKey();
  }
  return;
}
Ejemplo n.º 2
0
//-----------------------------------------------------------------------
//  Patch texture
//	Compute a flag at position corresponding to the actual detail tile
//						in the supertile  in [0-15];  The  SW detail tile
//						has index 0 into the supertile.
//-----------------------------------------------------------------------
void CFuiTBROS::PatchTexture()
{	GroundSpot *spot	= globals->tcm->GetSpot();
	U_INT				ind   = spot->GetTextureInSUP();
	U_INT				key		= QGTKEY(spot->qx,spot->qz);
	U_INT				sno   = spot->sup->GetNumber();
	U_INT       pat   = globals->sqm->ReadPatchDetail(key,sno);
	pat  |= (1 << ind);				// Position of patch 
	globals->sqm->PatchDetailTRN(key,sno,pat);
	//--- Update Texture Descriptor ----------------
	CTextureDef *txd = globals->tcm->GetTexDescriptor();
	txd->TypTX			 = 0;
	//--- Refresh display --------------------------
	globals->tcm->GetSpotQGT()->PutOutside();
  return;
}