Exemplo n.º 1
0
/*
 * Split selected sectors in a brush in this world with one brush in other world.
 * (other brush must have only one sector)
 */
void CWorld::SplitSectors(CEntity &enThis, CBrushSectorSelection &selbscSectorsToSplit,
  CWorld &woOther, CEntity &enOther, const CPlacement3D &plOther)
{
  _pfWorldEditingProfile.StartTimer(CWorldEditingProfile::PTI_CSGTOTAL);
  _pfWorldEditingProfile.IncrementAveragingCounter();
  // assure that floating point precision is 53 bits
  AssureFPT_53();

  // get relevant brush mip in this brush
  CBrushMip &bmThis = *GetBrushMip(enThis);
  if (&bmThis==NULL) {
    _pfWorldEditingProfile.StopTimer(CWorldEditingProfile::PTI_CSGTOTAL);
    return;
  }

  // get relevant brush mip in other brush
  CBrushMip &bmOther = *GetBrushMip(enOther);
  if (&bmOther==NULL) {
    _pfWorldEditingProfile.StopTimer(CWorldEditingProfile::PTI_CSGTOTAL);
    return;
  }

  /* Assure that the other brush has only one sector. */

  // if other brush has more than one sector
  if (bmOther.bm_abscSectors.Count()>1) {
    // join all sectors of the other brush together
    CBrushSectorSelection selbscOtherAll;
    bmOther.SelectAllSectors(selbscOtherAll);
    woOther.JoinSectors(selbscOtherAll);
  }

  /* Split selected sectors with the one sector in the other brush. */

  // get the sector of the other brush to object
  CBrushSectorSelectionForCSG selbscOther;
  bmOther.SelectAllSectors(selbscOther);
  CObject3D obOther;
  DOUBLEaabbox3D boxOther;
  woOther.CopySourceBrushSectorsToObject(enOther, selbscOther, plOther,
    obOther, enThis.en_plPlacement, boxOther);

  // if the selection is empty
  if (selbscSectorsToSplit.Count()==0) {
    // select all sectors near the splitting tool
    bmThis.SelectSectorsInRange(selbscSectorsToSplit, DOUBLEtoFLOAT(boxOther));
  }
  // for all sectors in the selection
  FOREACHINDYNAMICCONTAINER(selbscSectorsToSplit, CBrushSector, itbsc) {
    // split the sector using the copy of other object
    CObject3D obj(obOther);
    SplitOneSector(*itbsc, obj);
  }
Exemplo n.º 2
0
/*
 * Move sectors of a target brush that are affected, to a 3D object.
 */
void CWorld::MoveTargetBrushPartToObject(
  CEntity &enBrush,
  DOUBLEaabbox3D &boxAffected,
  CObject3D &obObject
  )
{
  ASSERT(GetFPUPrecision()==FPT_53BIT);
  // get the brush mip from the entity
  CBrushMip &bmBrushMip = *GetBrushMip(enBrush);

  // copy those sectors of brush touching given bbox to 3D object
  CBrushSectorSelectionForCSG bscselSectors;
  bmBrushMip.SelectSectorsInRange(bscselSectors, DOUBLEtoFLOAT(boxAffected));
  bmBrushMip.ToObject3D(obObject, bscselSectors);
  bmBrushMip.DeleteSelectedSectors(bscselSectors);
  // if no sectors are moved this way
  if (obObject.ob_aoscSectors.Count()==0) {
    // move the open sector to object
    CBrushSectorSelectionForCSG bscselOpen;
    bmBrushMip.SelectOpenSector(bscselOpen);
    bmBrushMip.ToObject3D(obObject, bscselOpen);
    bmBrushMip.DeleteSelectedSectors(bscselOpen);
  }
}
Exemplo n.º 3
0
void CMappingVectors::FromPlane_DOUBLE(const DOUBLEplane3D &plPlane)
{
  FromPlane(DOUBLEtoFLOAT(plPlane));
}