コード例 #1
0
Eegeo::v3 ComputeHeadingVector(Eegeo::dv3 interestPosition, float heading)
{
	Eegeo::v3 m_heading(0,1,0);
	Eegeo::dv3 interestEcefUp = interestPosition.Norm();
	Eegeo::v3 m_interestUp = interestEcefUp.ToSingle();

	Eegeo::v3 m_interestRight = Eegeo::v3::Cross(m_interestUp, m_heading);
	m_interestRight = m_interestRight.Norm();

	m_heading = Eegeo::v3::Cross(m_interestRight, m_interestUp);
	m_heading = m_heading.Norm();

	Eegeo::Quaternion headingRot;
	headingRot.Set(m_interestUp, heading);
	m_heading = headingRot.RotatePoint(m_heading);

	return m_heading;
}
コード例 #2
0
            Eegeo::v3 ComputeHeadingVector(Eegeo::dv3 interestPosition, float heading)
            {
                Eegeo::v3 interestForward(0,1,0);
                Eegeo::dv3 interestEcefUp = interestPosition.Norm();
                Eegeo::v3 interestUp = interestEcefUp.ToSingle();

                Eegeo::v3 interestRight = Eegeo::v3::Cross(interestUp, interestForward);
                interestRight = interestRight.Norm();

                interestForward = Eegeo::v3::Cross(interestRight, interestUp);
                interestForward = interestForward.Norm();

                Eegeo::Quaternion rotation;
                rotation.Set(interestUp, heading);
                interestForward = rotation.RotatePoint(interestForward);

                return interestForward;
            }
コード例 #3
0
            void SplashScreen::Show()
            {
                
                Eegeo::Space::EcefTangentBasis basis;
                Eegeo::dv3 p = Eegeo::Space::LatLongAltitude::FromDegrees(56.456160, -2.966101, 241.5f).ToECEF();
                Eegeo::Camera::CameraHelpers::EcefTangentBasisFromPointAndHeading(p, -60.53f, basis);
                
                Eegeo::dv3 top(p.ToSingle().Norm());
                Eegeo::dv3 forward(basis.GetForward().Norm());
                Eegeo::dv3 right(Eegeo::dv3::Cross(top, forward));

                m_pStateButtonBuilding->SetEcefPosition((forward*310.f) + (right*4.f) + p);
                m_pStateButtonPOI->SetEcefPosition((forward*310.f) + (right*-28.f) + p);
                m_pStateButtonLocation->SetEcefPosition((forward*310.f) + (right*37.f) + p);
                m_pPlayButton->SetEcefPosition((forward*270.f) + (right*5.f) + (top*-35.f) + p);
                
                m_pStateButtonLocation->Show();
                m_pStateButtonBuilding->Show();
                m_pStateButtonPOI->Show();
                m_pPlayButton->SetItemShouldRender(true);
                m_pSplashScreenModel->SetShouldDisplay(true);
            }
コード例 #4
0
 void WorldMenuController::PositionItems()
 {
     
     if(!m_menuItemsShouldRender)
         return;
     
     Eegeo::m33 headTrackedOrientation;
     Eegeo::m33::Mul(headTrackedOrientation, m_uiCameraProvider.GetBaseOrientation(), m_cachedHeadTracker);
     
     float halfCount = m_viewsByModel.size()/2;
     if(m_viewsByModel.size()%2==0)
         halfCount-=0.5f;
     
     Eegeo::dv3 center = m_uiCameraProvider.GetRenderCameraForUI().GetEcefLocation();
     Eegeo::v3 forward(headTrackedOrientation.GetRow(2));
     Eegeo::v3 top(center.ToSingle().Norm());
     Eegeo::v3 right(Eegeo::v3::Cross(top, forward));
     
     Eegeo::v3 vA = center.ToSingle();
     Eegeo::v3 vB = m_uiCameraProvider.GetOrientation().GetRow(2);
     float angle = Eegeo::Math::Rad2Deg(Eegeo::Math::ACos(Eegeo::v3::Dot(vA, vB)/(vA.Length()*vB.Length())));
     
     
     const float MarginAngle = 85;
     const int PositionMultiplier = 600;
     
     bool shouldUpdatePosition = false;
     
     if(!m_isMenuShown && angle<=MarginAngle)
     {
         m_isMenuShown = true;
         shouldUpdatePosition = true;
         m_cachedHeadTracker = m_uiCameraProvider.GetHeadTrackerOrientation();
         m_cachedCenter = center;
     }
     else if(m_isMenuShown && angle>MarginAngle)
     {
         m_isMenuShown = false;
         shouldUpdatePosition = true;
     }
     
     if ((m_cachedCenter - center).LengthSq() > 1) {
         m_cachedCenter = center;
         shouldUpdatePosition = true;
     }
     
     if(shouldUpdatePosition || m_isMenuShown)
     {
         
         std::vector<WorldMenuItemView*> items;
         for(TViewsByModel::iterator it = m_viewsByModel.begin(); it != m_viewsByModel.end(); ++it)
         {
             std::vector<WorldMenuItemView*>::iterator itItems = items.begin();
             for(; itItems != items.end(); ++itItems)
             {
                 if((*itItems)->GetWorldMenuItem().GetId() < it->second->GetWorldMenuItem().GetId())
                 {
                     break;
                 }
             }
             items.insert(itItems, it->second);
         }
         
         float margin = 0.f;
         
         for(std::vector<WorldMenuItemView*>::iterator it = items.begin(); it != items.end(); ++it)
         {
             WorldMenuItemView* pView = *it;
             if(!m_isMenuShown)
             {
                 pView->SetItemShouldRender(false);
                 m_pSelectedArrow->SetItemShouldRender(false);
                 continue;
             }
             margin += pView->GetWorldMenuItem().GetMarginRight();
             
             Eegeo::dv3 position(center + (forward*PositionMultiplier) + (top*45) + ((right*55*halfCount)-(right*margin)));
             pView->SetEcefPosition(position);
             pView->SetItemShouldRender(true);
             m_pSelectedArrow->SetItemShouldRender(true);
             if(m_menuItemId==pView->GetWorldMenuItem().GetId())
             {
                 m_pSelectedArrow->SetEcefPosition(center + (forward*PositionMultiplier) + (top*92) + (right*55*halfCount)-(right*margin));
             }
             halfCount-=1;
             
             margin += pView->GetWorldMenuItem().GetMarginLeft();
             pView->SetItemShouldRender(m_menuItemsShouldRender);
         }
         
         items.clear();
         m_lastCameraPosition = center;
     }
 }