/*****************************************************************************
 * $LastChangedDate: 2011-04-09 21:58:06 -0400 (Sat, 09 Apr 2011) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   Viewpoint class.
 *//*
 * LEGAL:   COPYRIGHT (C) 2008 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#ifndef VIEW_VIEWPOINT_HH
#define VIEW_VIEWPOINT_HH 1

namespace view {

class View;

////////////////////////////////////////////////////////////////////////////////
/// @brief Functor that computes view matrix every frame.
///
/// Logical views are composed with a View and a Viewpoint object.
/// Viewpoint is a functor containing an algorithm to compute the view matrix
/// which is called before rendering a new frame.
/// This composition can be changed dynamically using View::SetViewpoint()
/// to allow switching to different view modes (first-person, chase-plane, etc).
/// Despite the view appearing to change, View keeps the same underlying osg::Camera object.
///
/// Viewpoint is capable of controlling first-person and chase-plane views
/// by converting the player's matrix into an eye matrix.
/// View/Viewpoint supercedes EyeCraft and ChasePlane of old versions.
///
class Viewpoint : public Shared
{
PREVENT_COPYING(Viewpoint)
friend class View;
public:
                    Viewpoint( void ) { SET_TYPESIG(this,TYPESIG_VIEWPOINT); }
    virtual         ~Viewpoint()      { INVALIDATE_TYPESIG(this,TYPESIG_VIEWPOINT); }
protected:
    virtual Matrix  ComputeViewMatrix( shptr<View> view ) = 0;

public:
    DECLARE_TYPESIG(TYPESIG_VIEWPOINT);
};

} // namespace view

#endif // VIEW_VIEWPOINT_HH
