/*****************************************************************************
 * $LastChangedDate: 2011-04-09 21:58:06 -0400 (Sat, 09 Apr 2011) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   Observer of a view of the scene defined as a matrix.
 *//*
 * LEGAL:   COPYRIGHT (C) 2009 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#ifndef VIEW_OBSERVER_MATRIX_HH
#define VIEW_OBSERVER_MATRIX_HH 1

#include "math/module.hh"
#include "math/matrix.hh"
using namespace math;
#include "view/observer.hh"

namespace view {

////////////////////////////////////////////////////////////////////////////////
/// @brief Observer of a view of the scene defined as a matrix.
///
/// This is the generalized Observer class defined by a matrix.
///
/// The Observer is the source of the Viewpoint (View Matrix).
/// Pass Observer object to OtwViewpoint ctor so it will provide the Observer Matrix.
///
class ObserverMatrix : public Observer
{
PREVENT_COPYING(ObserverMatrix)
public:
    ObserverMatrix( void )
    :   mMatrix()
    {
        SET_TYPESIG(this,TYPESIG_OBSERVER_MATRIX);
    }

    virtual ~ObserverMatrix()
    {
        INVALIDATE_TYPESIG(this,TYPESIG_OBSERVER_MATRIX);
    }

    virtual Matrix GetObserverMatrix( void )
    {
    CHECK_TYPESIG(this,TYPESIG_OBSERVER_MATRIX);

        return mMatrix;
    }

    void SetObserverMatrix( const Matrix& matrix )
    {
    CHECK_TYPESIG(this,TYPESIG_OBSERVER_MATRIX);

        mMatrix = matrix;
    }

private:
    Matrix  mMatrix;
public:
    DECLARE_TYPESIG(TYPESIG_OBSERVER_MATRIX)
};

} // namespace view

#endif // VIEW_OBSERVER_MATRIX_HH
