// transform mapping from one placement to another
void CMappingDefinition::Transform(const FLOATplane3D &plSourcePlane,
    const CPlacement3D &plSource, const CPlacement3D &plTarget)
{
  CSimpleProjection3D_DOUBLE prProjection;
  prProjection.ObjectPlacementL() = plSource;
  prProjection.ViewerPlacementL() = plTarget;
  prProjection.Prepare();
  CMappingDefinition mdTarget;
  prProjection.ProjectMapping(*this, FLOATtoDOUBLE(plSourcePlane), mdTarget);
  *this = mdTarget;
}
Beispiel #2
0
/*
 * Copy selected sectors of a source brush to a 3D object.
 */
void CWorld::CopySourceBrushSectorsToObject(
  CEntity &enBrush,
  CBrushSectorSelectionForCSG &bscselSectors,
  const CPlacement3D &plSourcePlacement,
  CObject3D &obObject,
  const CPlacement3D &plTargetPlacement,
  DOUBLEaabbox3D &boxSourceAbsolute
  )
{
  ASSERT(GetFPUPrecision()==FPT_53BIT);
  // get the brush mip from the entity
  CBrushMip &bmBrushMip = *GetBrushMip(enBrush);

  // calculate placement of the brush in absolute space (taking relative
  // world placement and entity placement in account)
  CPlacement3D plBrush = enBrush.en_plPlacement;
  plBrush.RelativeToAbsolute(plSourcePlacement);

  // copy selected sectors of brush to object3d object
  bmBrushMip.ToObject3D(obObject, bscselSectors);

  // make a copy of the object and find its box in absolute space
  CObject3D obAbsolute;
  obAbsolute = obObject;
  CSimpleProjection3D_DOUBLE prToAbsolute;
  prToAbsolute.ObjectPlacementL() = plBrush;
  prToAbsolute.ViewerPlacementL() = CPlacement3D(FLOAT3D(0,0,0), ANGLE3D(0,0,0));
  prToAbsolute.Prepare();
  obAbsolute.Project(prToAbsolute);
  obAbsolute.GetBoundingBox(boxSourceAbsolute);

  // project the brush into target space
  CSimpleProjection3D_DOUBLE prSimple;
  prSimple.ObjectPlacementL() = plBrush;
  prSimple.ViewerPlacementL() = plTargetPlacement;
  prSimple.Prepare();
  obObject.Project(prSimple);
}