Exemple #1
0
/// @copydoc Entity::Attach()
void Camera::Attach()
{
    Base::Attach();

    // Update the scene view associated with this camera.
    if( IsValid( m_sceneViewId ) )
    {
        World* pWorld = GetWorld();
        HELIUM_ASSERT( pWorld );
        GraphicsScene* pScene = pWorld->GetGraphicsScene();
        if( pScene )
        {
            GraphicsSceneView* pSceneView = pScene->GetSceneView( m_sceneViewId );
            if( pSceneView )
            {
                Simd::Matrix44 rotationMatrix( Simd::Matrix44::INIT_ROTATION, GetRotation() );
                pSceneView->SetView(
                    GetPosition(),
                    Vector4ToVector3( rotationMatrix.GetRow( 2 ) ),
                    Vector4ToVector3( rotationMatrix.GetRow( 1 ) ) );
                pSceneView->SetHorizontalFov( m_fov );
            }
        }
    }
}