///\brief
 ///Evaluates the bounding box of the capsule
 inline void GetBoundingBox(hkvAlignedBBox &dest)
 {
   dest.m_vMin = m_vStartPosition;
   dest.m_vMax = m_vStartPosition;
   dest.expandToInclude(m_vStartPosition+m_vDirection*GetLength());
   dest.addBoundary (hkvVec3 (GetRadius()));
 }
void VTerrainVisibilityInfo::Helper_GetShadowBox(hkvAlignedBBox &result, const hkvAlignedBBox &sourceBox) const
{
  result = sourceBox;
  hkvVec3 vShadowOfs = m_vShadowExtrusion * sourceBox.getSizeZ();
  result.translate(vShadowOfs);
  result.expandToInclude(sourceBox);
}
void VShadowMapGenSpotDir::GetBoundingBoxVS(hkvAlignedBBox &boundingBox) const
{
  VASSERT(m_eProjectionType==SHADOW_PROJECTION_ORTHOGRAPHIC && m_iNumParts>0);

  if (!boundingBox.isValid())
    return;

  // transform shadow-caster bounding box with view-matrix of first cascade, since actual cascade is indifferent here 
  boundingBox.transformFromOrigin(m_pParts[0].GetCamera()->GetWorldToCameraTransformation());
}
    /// \brief
    ///  Calculates the absolute bounding box for this instance
    ///
    /// \param destBBox
    ///  Destination box
    ///
    inline void GetBoundingBox(hkvAlignedBBox &destBBox) const
    {
        m_spModel->EnsureLoaded();
        VASSERT(m_spModel->m_LocalBBox.isValid());
        destBBox.setInvalid();

        //destBBox.Inflate(m_spModel->m_LocalBBox,m_Orientation,m_vPosition);
        {
            hkvAlignedBBox temp = m_spModel->m_LocalBBox;
            hkvMat4 mTransform (m_Orientation, m_vPosition);
            temp.transformFromOrigin (mTransform);
            destBBox.expandToInclude (temp);
        }

    }
    inline void GetRenderBoundingBox(hkvAlignedBBox &destBBox, const hkvVec3& vOffset) const
    {
        VASSERT(m_spModel->m_LocalBBox.isValid());
        destBBox.setInvalid();

        //destBBox.Inflate(m_spModel->m_LocalBBox,m_Orientation,m_vPosition);
        {
            hkvAlignedBBox temp = m_spModel->m_LocalBBox;
            hkvMat4 mTransform (m_Orientation, m_vPosition);
            temp.transformFromOrigin (mTransform);
            destBBox.expandToInclude (temp);
        }

        destBBox.m_vMin += vOffset;
        destBBox.m_vMax += vOffset;
    }
void VParticleWallmark::InflateBoundingBox(hkvAlignedBBox &bbox)
{
  hkvVec3 vDist(distortion[0],distortion[1],distortion[2]);
  float fRadius = vDist.getLength();
  fRadius = hkvMath::Max(fRadius,size);
  hkvAlignedBBox thisBox(hkvVec3 (pos[0]-fRadius,pos[1]-fRadius,pos[2]-fRadius), hkvVec3 (pos[0]+fRadius,pos[1]+fRadius,pos[2]+fRadius));
  bbox.expandToInclude(thisBox);
}
Esempio n. 7
0
  static void LookAtBox(const hkvAlignedBBox &bbox)
  {
    if (!bbox.isValid())
      return;

    VisBaseEntity_cl* pCenterEntity = Vision::Game.CreateEntity("VisBaseEntity_cl", bbox.getCenter());

    const float fBBRadius = bbox.getBoundingSphere().m_fRadius;

    float fFovX, fFovY;
    Vision::Contexts.GetMainRenderContext()->GetFinalFOV(fFovX, fFovY);
    
    const float fDist = fBBRadius / hkvMath::tanDeg(hkvMath::Min(fFovX, fFovY) * 0.5f);

    VOrbitCamera* pOrbitCamera = new VOrbitCamera();
    pOrbitCamera->MinimalDistance = fDist * 0.01f;
    pOrbitCamera->MaximalDistance = fDist * 100.0f;
    pOrbitCamera->CameraDistance = fDist;

    pCenterEntity->AddComponent(pOrbitCamera);
  }